// Adds a glTF attribute, as described by name, type, and semantic, to the given technique tech. private static void AddAttribute(string name, GlTF_Technique.Type type, GlTF_Technique.Semantic semantic, GlTF_Technique tech) { GlTF_Technique.Parameter tParam = new GlTF_Technique.Parameter(); tParam.name = name; tParam.type = type; tParam.semantic = semantic; tech.parameters.Add(tParam); GlTF_Technique.Attribute tAttr = new GlTF_Technique.Attribute(); tAttr.name = "a_" + name; tAttr.param = tParam.name; tech.attributes.Add(tAttr); }
public AttributeInfo(GlTF_Accessor.Type accessorType, GlTF_Accessor.ComponentType accessorComponentType) { this.accessorType = accessorType; this.accessorComponentType = accessorComponentType; switch (accessorType) { case GlTF_Accessor.Type.SCALAR: techniqueType = GlTF_Technique.Type.FLOAT; break; case GlTF_Accessor.Type.VEC2: techniqueType = GlTF_Technique.Type.FLOAT_VEC2; break; case GlTF_Accessor.Type.VEC3: techniqueType = GlTF_Technique.Type.FLOAT_VEC3; break; case GlTF_Accessor.Type.VEC4: techniqueType = GlTF_Technique.Type.FLOAT_VEC4; break; default: throw new ArgumentException("accessorType"); } }
// Adds a glTF uniform, as described by name, type, and semantic, to the given technique tech. If // node is non-null, that is also included (e.g. for lights). private void AddUniform( IExportableMaterial exportableMaterial, string name, GlTF_Technique.Type type, GlTF_Technique.Semantic semantic, GlTF_Node node = null) { //var techName = GlTF_Technique.GetNameFromObject(matObjName); var tech = GlTF_Writer.GetTechnique(G, exportableMaterial); GlTF_Technique.Parameter tParam = new GlTF_Technique.Parameter(); tParam.name = name; tParam.type = type; tParam.semantic = semantic; if (node != null) { tParam.node = node; } tech.parameters.Add(tParam); GlTF_Technique.Uniform tUniform = new GlTF_Technique.Uniform(); tUniform.name = "u_" + name; tUniform.param = tParam.name; tech.uniforms.Add(tUniform); }