Technique technique = new Technique(); technique.addAttributes("a_position", "position"); technique.addParameters("modelViewMatrix", createDefaultTechniqueParameters( "MODELVIEW", GltfConstants.GL_FLOAT_MAT4, null)); technique.addParameters("projectionMatrix", createDefaultTechniqueParameters( "PROJECTION", GltfConstants.GL_FLOAT_MAT4, null)); technique.addParameters("emission", createDefaultTechniqueParameters( null, GltfConstants.GL_FLOAT_VEC4, Arrays.asList(0.5f, 0.5f, 0.5f, 1.0f))); technique.addParameters("position", createDefaultTechniqueParameters( "POSITION", GltfConstants.GL_FLOAT_VEC3, null)); technique.setStates(createDefaultTechniqueStates()); technique.setProgram(programId); technique.addUniforms("u_modelViewMatrix", "modelViewMatrix"); technique.addUniforms("u_projectionMatrix", "projectionMatrix"); technique.addUniforms("u_emission", "emission");
/** * 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); } }
/** * 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); } }
Technique technique = new Technique(); technique.setProgram(programId); technique.setAttributes(techniqueAttributes); technique.setParameters(techniqueParameters); technique.setUniforms(techniqueUniforms); technique.setStates(states);
DefaultTechniqueModel techniqueModel = get("techniques", techniqueId, techniqueModels); techniqueModel.setName(technique.getName()); String programId = technique.getProgram(); DefaultProgramModel programModel = get("programs", programId, programModels);
.ofNullable(technique.getAttributes()) .orElse(Collections.emptyMap()); for (String attributeName : attributes.keySet()) technique.getParameters(); TechniqueParameters techniqueParameters = parameters.get(techniqueParameterId);
String programId = technique.getProgram(); Program program = gltf.getPrograms().get(programId); String vertexShaderId = program.getVertexShader();
Optionals.of(technique.getParameters()); for (Entry<String, TechniqueParameters> entry : parameters.entrySet())
String programId = technique.getProgram(); validatorResult.add(validateMapEntry( getGltf().getPrograms(), programId, context));
Optionals.of(technique.getParameters()); for (Entry<String, TechniqueParameters> entry : parameters.entrySet())
/** * 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); } }
/** * 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); } }
technique.getParameters(), techniqueParametersId, context)); if (validatorResult.hasErrors()) technique.getParameters().get(techniqueParametersId);
.ofNullable(technique.getAttributes()) .orElse(Collections.emptyMap()); for (String attributeName : attributes.keySet())
.ofNullable(technique.getUniforms()) .orElse(Collections.emptyMap()); for (String uniformName : uniforms.keySet())