/** * Returns the given list, or an unmodifiable empty list if the * given list is <code>null</code>. * * @param <T> The element type * * @param list The list * @return The result */ public static <T> List<T> of(List<T> list) { return of(list, Collections.emptyList()); }
/** * Returns the given map, or an unmodifiable empty map if the * given map is <code>null</code>. * * @param <K> The key type * @param <V> The value type * * @param map The map * @return The result */ public static <K, V> Map<K, V> of(Map<K, V> map) { return of (map, Collections.emptyMap()); }
/** * Create the {@link AnimationModel} instances */ private void createAnimationModels() { List<Animation> animations = Optionals.of(gltf.getAnimations()); for (int i = 0; i < animations.size(); i++) { animationModels.add(new DefaultAnimationModel()); } }
/** * Create the {@link AccessorModel} instances */ private void createAccessorModels() { Map<String, Accessor> accessors = Optionals.of(gltf.getAccessors()); for (Accessor accessor : accessors.values()) { DefaultAccessorModel accessorModel = createAccessorModel(accessor); accessorModels.add(accessorModel); } }
/** * Create the {@link MeshModel} instances */ private void createMeshModels() { List<Mesh> meshes = Optionals.of(gltf.getMeshes()); for (int i = 0; i < meshes.size(); i++) { meshModels.add(new DefaultMeshModel()); } }
/** * Create the {@link NodeModel} instances */ private void createNodeModels() { List<Node> nodes = Optionals.of(gltf.getNodes()); for (int i = 0; i < nodes.size(); i++) { nodeModels.add(new DefaultNodeModel()); } }
/** * Create the {@link SkinModel} instances */ private void createSkinModels() { List<Skin> skins = Optionals.of(gltf.getSkins()); for (int i = 0; i < skins.size(); i++) { skinModels.add(new DefaultSkinModel(null)); } }
/** * Create the {@link AnimationModel} instances */ private void createAnimationModels() { Map<String, Animation> animations = Optionals.of(gltf.getAnimations()); for (int i = 0; i < animations.size(); i++) { animationModels.add(new DefaultAnimationModel()); } }
/** * Create the {@link MaterialModel} instances */ private void createMaterialModels() { Map<String, Material> materials = Optionals.of(gltf.getMaterials()); for (int i = 0; i < materials.size(); i++) { materialModels.add(new DefaultMaterialModel()); } }
/** * Create the {@link MeshModel} instances */ private void createMeshModels() { Map<String, Mesh> meshes = Optionals.of(gltf.getMeshes()); for (int i = 0; i < meshes.size(); i++) { meshModels.add(new DefaultMeshModel()); } }
/** * Create the {@link SceneModel} instances */ private void createSceneModels() { Map<String, Scene> scenes = Optionals.of(gltf.getScenes()); for (int i = 0; i < scenes.size(); i++) { sceneModels.add(new DefaultSceneModel()); } }
/** * Create the {@link ProgramModel} instances */ private void createProgramModels() { Map<String, Program> programs = Optionals.of(gltf.getPrograms()); for (int i = 0; i < programs.size(); i++) { programModels.add(new DefaultProgramModel()); } }
/** * Create the {@link NodeModel} instances */ private void createNodeModels() { Map<String, Node> nodes = Optionals.of(gltf.getNodes()); for (int i = 0; i < nodes.size(); i++) { nodeModels.add(new DefaultNodeModel()); } }
/** * Create the {@link TechniqueModel} instances */ private void createTechniqueModels() { Map<String, Technique> techniques = Optionals.of(gltf.getTechniques()); for (int i = 0; i < techniques.size(); i++) { techniqueModels.add(new DefaultTechniqueModel()); } }
/** * Create the {@link SceneModel} instances */ private void createSceneModels() { List<Scene> scenes = Optionals.of(gltf.getScenes()); for (int i = 0; i < scenes.size(); i++) { sceneModels.add(new DefaultSceneModel()); } }
/** * Create the {@link BufferViewModel} instances */ private void createBufferViewModels() { List<BufferView> bufferViews = Optionals.of(gltf.getBufferViews()); for (int i = 0; i < bufferViews.size(); i++) { BufferView bufferView = bufferViews.get(i); DefaultBufferViewModel bufferViewModel = createBufferViewModel(bufferView); bufferViewModels.add(bufferViewModel); } }
/** * Create the {@link BufferViewModel} instances */ private void createBufferViewModels() { Map<String, BufferView> bufferViews = Optionals.of(gltf.getBufferViews()); for (BufferView bufferView : bufferViews.values()) { DefaultBufferViewModel bufferViewModel = createBufferViewModel(bufferView); bufferViewModels.add(bufferViewModel); } }
/** * Create the {@link SkinModel} instances */ private void createSkinModels() { Map<String, Skin> skins = Optionals.of(gltf.getSkins()); for (Entry<String, Skin> entry : skins.entrySet()) { Skin skin = entry.getValue(); float[] bindShapeMatrix = skin.getBindShapeMatrix(); skinModels.add(new DefaultSkinModel(bindShapeMatrix)); } }
/** * Add all uniform entries of the given {@link Technique} to the given * {@link TechniqueModel} * * @param technique The {@link Technique} * @param techniqueModel The {@link TechniqueModel} */ private static void addUniforms(Technique technique, DefaultTechniqueModel techniqueModel) { Map<String, String> uniforms = Optionals.of(technique.getUniforms()); for (Entry<String, String> entry : uniforms.entrySet()) { String uniformName = entry.getKey(); String parameterName = entry.getValue(); techniqueModel.addUniform(uniformName, parameterName); } }
/** * Add all attribute entries of the given {@link Technique} to the given * {@link TechniqueModel} * * @param technique The {@link Technique} * @param techniqueModel The {@link TechniqueModel} */ private static void addAttributes(Technique technique, DefaultTechniqueModel techniqueModel) { Map<String, String> attributes = Optionals.of(technique.getAttributes()); for (Entry<String, String> entry : attributes.entrySet()) { String attributeName = entry.getKey(); String parameterName = entry.getValue(); techniqueModel.addAttribute(attributeName, parameterName); } }