public Material_AlphaBlend(List <string> imageList) : base(imageList) { modelGroupName = ModelGroupName.Material_AlphaBlend; onlyBinaryProperties = false; noPrerequisite = false; Runtime.Image baseColorTexture = new Runtime.Image { Uri = imageList.Find(e => e.Contains("BaseColor_Plane")) }; usedTextures.Add(baseColorTexture); List <Vector4> vertexColors = new List <Vector4>() { new Vector4(0.3f, 0.3f, 0.3f, 0.4f), new Vector4(0.3f, 0.3f, 0.3f, 0.2f), new Vector4(0.3f, 0.3f, 0.3f, 0.8f), new Vector4(0.3f, 0.3f, 0.3f, 0.6f) }; requiredProperty = new List <Property> { new Property(Propertyname.AlphaMode_Blend, glTFLoader.Schema.Material.AlphaModeEnum.BLEND) }; properties = new List <Property> { new Property(Propertyname.VertexColor_Vector4_Float, vertexColors, group: 2), new Property(Propertyname.BaseColorTexture, baseColorTexture), new Property(Propertyname.BaseColorFactor, new Vector4(1.0f, 1.0f, 1.0f, 0.7f)), }; }
public Material_SpecularGlossiness(List <string> textures, List <string> figures) : base(textures, figures) { modelGroupName = ModelGroupName.Material_SpecularGlossiness; onlyBinaryProperties = false; var diffuseTexture = new Runtime.Image { Uri = textures.Find(e => e.Contains("Diffuse_Plane")) }; var specularGlossinessTexture = new Runtime.Image { Uri = textures.Find(e => e.Contains("SpecularGlossiness_Plane")) }; var baseColorTexture = new Runtime.Image { Uri = textures.Find(e => e.Contains("BaseColor_X")) }; usedTextures.Add(diffuseTexture); usedTextures.Add(specularGlossinessTexture); usedTextures.Add(baseColorTexture); var colorCoord = new List <Vector4>() { new Vector4(0.0f, 0.0f, 1.0f, 0.8f), new Vector4(1.0f, 0.0f, 0.0f, 0.8f), new Vector4(0.0f, 0.0f, 1.0f, 0.8f), new Vector4(1.0f, 0.0f, 0.0f, 0.8f) }; requiredProperty = new List <Property> { new Property(Propertyname.ExtensionUsed_SpecularGlossiness, "Specular Glossiness", group: 3), new Property(Propertyname.BaseColorTexture, baseColorTexture) }; properties = new List <Property> { new Property(Propertyname.VertexColor_Vector3_Float, colorCoord, group: 2), new Property(Propertyname.DiffuseTexture, diffuseTexture), new Property(Propertyname.DiffuseFactor, new Vector4(0.2f, 0.2f, 0.2f, 0.8f)), new Property(Propertyname.SpecularFactor, new Vector3(0.4f, 0.4f, 0.4f), group: 1), new Property(Propertyname.SpecularFactor_Override, new Vector3(0.0f, 0.0f, 0.0f), group: 1), new Property(Propertyname.GlossinessFactor, 0.3f), new Property(Propertyname.SpecularGlossinessTexture, specularGlossinessTexture), }; specialCombos.Add(ComboHelper.CustomComboCreation( properties.Find(e => e.name == Propertyname.DiffuseFactor), properties.Find(e => e.name == Propertyname.DiffuseTexture))); specialCombos.Add(ComboHelper.CustomComboCreation( properties.Find(e => e.name == Propertyname.SpecularGlossinessTexture), properties.Find(e => e.name == Propertyname.SpecularFactor))); specialCombos.Add(ComboHelper.CustomComboCreation( properties.Find(e => e.name == Propertyname.SpecularGlossinessTexture), properties.Find(e => e.name == Propertyname.GlossinessFactor))); removeCombos.Add(ComboHelper.CustomComboCreation( properties.Find(e => e.name == Propertyname.SpecularFactor_Override))); }
public Material(List <string> textures, List <string> figures) : base(textures, figures) { modelGroupName = ModelGroupName.Material; onlyBinaryProperties = false; noPrerequisite = false; Runtime.Image emissiveTexture = new Runtime.Image { Uri = textures.Find(e => e.Contains("Emissive_Plane")) }; Runtime.Image normalTexture = new Runtime.Image { Uri = textures.Find(e => e.Contains("Normal_Plane")) }; Runtime.Image occlusionTexture = new Runtime.Image { Uri = textures.Find(e => e.Contains("Occlusion_Plane")) }; usedTextures.Add(emissiveTexture); usedTextures.Add(normalTexture); usedTextures.Add(occlusionTexture); List <Vector3> planeNormals = new List <Vector3>() { new Vector3(0.0f, 0.0f, 1.0f), new Vector3(0.0f, 0.0f, 1.0f), new Vector3(0.0f, 0.0f, 1.0f), new Vector3(0.0f, 0.0f, 1.0f) }; requiredProperty = new List <Property> { new Property(Propertyname.MetallicFactor, 0.0f), new Property(Propertyname.BaseColorFactor, new Vector4(0.2f, 0.2f, 0.2f, 1.0f)), }; properties = new List <Property> { new Property(Propertyname.EmissiveFactor, new Vector3(1.0f, 1.0f, 1.0f)), new Property(Propertyname.EmissiveTexture, emissiveTexture), new Property(Propertyname.NormalTexture, normalTexture), new Property(Propertyname.Scale, 10.0f, Propertyname.NormalTexture), new Property(Propertyname.OcclusionTexture, occlusionTexture), new Property(Propertyname.Strength, 0.5f, Propertyname.OcclusionTexture) }; specialProperties = new List <Property> { new Property(Propertyname.VertexNormal, planeNormals), }; specialCombos.Add(ComboHelper.CustomComboCreation( properties.Find(e => e.name == Propertyname.EmissiveFactor), properties.Find(e => e.name == Propertyname.EmissiveTexture))); removeCombos.Add(ComboHelper.CustomComboCreation( properties.Find(e => e.name == Propertyname.EmissiveTexture))); }
public Node_Attribute(List <string> imageList) : base(imageList) { modelGroupName = ModelGroupName.Node_Attribute; onlyBinaryProperties = false; Runtime.Image baseColorTexture = new Runtime.Image { Uri = imageList.Find(e => e.Contains("BaseColor_Nodes")) }; usedTextures.Add(baseColorTexture); var matrixT = Matrix4x4.CreateTranslation(new Vector3(-2, 2, -2)); var matrixR = Matrix4x4.CreateFromAxisAngle(new Vector3(0f, 1f, 0f), (float)(Math.PI)); var matrixS = Matrix4x4.CreateScale(1.2f); var matrixTRS = Matrix4x4.Multiply(Matrix4x4.Multiply(matrixS, matrixR), matrixT); var rotation = Quaternion.CreateFromAxisAngle(new Vector3(0f, 1f, 0f), (float)Math.PI); rotation.W = (float)Math.Round(rotation.W); requiredProperty = new List <Property> { new Property(Propertyname.BaseColorTexture, baseColorTexture), }; properties = new List <Property> { new Property(Propertyname.Translation, new Vector3(-2, 2, -2), group: 1), new Property(Propertyname.Translation_X, new Vector3(-2, 0, 0), group: 1), new Property(Propertyname.Translation_Y, new Vector3(0, 2, 0), group: 1), new Property(Propertyname.Translation_Z, new Vector3(0, 0, -2), group: 1), new Property(Propertyname.Rotation, rotation), new Property(Propertyname.Scale, new Vector3(1.2f, 1.2f, 1.2f), group: 2), new Property(Propertyname.Matrix, matrixTRS), }; specialProperties = new List <Property> { new Property(Propertyname.Matrix, matrixTRS), new Property(Propertyname.Rotation, rotation), }; var matrix = properties.Find(e => e.name == Propertyname.Matrix); var translation = properties.Find(e => e.name == Propertyname.Translation); var rot = properties.Find(e => e.name == Propertyname.Rotation); var scale = properties.Find(e => e.name == Propertyname.Scale); specialCombos.Add(new List <Property>() { translation, rot, scale, }); }
public Material_MetallicRoughness(List <string> textures, List <string> figures) : base(textures, figures) { modelGroupName = ModelGroupName.Material_MetallicRoughness; onlyBinaryProperties = false; Runtime.Image baseColorTexture = new Runtime.Image { Uri = textures.Find(e => e.Contains("BaseColor_Plane")) }; Runtime.Image metallicRoughnessTexture = new Runtime.Image { Uri = textures.Find(e => e.Contains("MetallicRoughness_Plane")) }; usedTextures.Add(baseColorTexture); usedTextures.Add(metallicRoughnessTexture); List <Vector4> colorCoord = new List <Vector4>() { new Vector4(0.0f, 0.0f, 1.0f, 0.8f), new Vector4(1.0f, 0.0f, 0.0f, 0.8f), new Vector4(0.0f, 0.0f, 1.0f, 0.8f), new Vector4(1.0f, 0.0f, 0.0f, 0.8f) }; properties = new List <Property> { new Property(Propertyname.VertexColor_Vector3_Float, colorCoord, group: 2), new Property(Propertyname.BaseColorTexture, baseColorTexture), new Property(Propertyname.BaseColorFactor, new Vector4(0.2f, 0.2f, 0.2f, 0.8f)), new Property(Propertyname.MetallicFactor, 0.0f), new Property(Propertyname.RoughnessFactor, 0.0f), new Property(Propertyname.MetallicRoughnessTexture, metallicRoughnessTexture), }; // Not called explicitly, but values are required here to run ApplySpecialProperties specialProperties = new List <Property> { new Property(Propertyname.VertexColor_Vector3_Float, colorCoord, group: 2), }; specialCombos.Add(ComboHelper.CustomComboCreation( properties.Find(e => e.name == Propertyname.BaseColorFactor), properties.Find(e => e.name == Propertyname.BaseColorTexture))); specialCombos.Add(ComboHelper.CustomComboCreation( properties.Find(e => e.name == Propertyname.MetallicRoughnessTexture), properties.Find(e => e.name == Propertyname.MetallicFactor))); specialCombos.Add(ComboHelper.CustomComboCreation( properties.Find(e => e.name == Propertyname.MetallicRoughnessTexture), properties.Find(e => e.name == Propertyname.RoughnessFactor))); }
public Material_AlphaMask(List <string> imageList) : base(imageList) { modelGroupName = ModelGroupName.Material_AlphaMask; onlyBinaryProperties = false; noPrerequisite = false; Runtime.Image baseColorTexture = new Runtime.Image { Uri = imageList.Find(e => e.Contains("BaseColor_Plane")) }; usedTextures.Add(baseColorTexture); requiredProperty = new List <Property> { new Property(Propertyname.AlphaMode_Mask, glTFLoader.Schema.Material.AlphaModeEnum.MASK), new Property(Propertyname.BaseColorTexture, baseColorTexture), }; properties = new List <Property> { new Property(Propertyname.AlphaCutoff_Low, 0.4f, group: 3), new Property(Propertyname.AlphaCutoff_High, 0.7f, group: 3), new Property(Propertyname.AlphaCutoff_Multiplied, 0.6f, group: 3), new Property(Propertyname.AlphaCutoff_All, 1.1f, group: 3), new Property(Propertyname.AlphaCutoff_None, 0f, group: 3), new Property(Propertyname.BaseColorFactor, new Vector4(1.0f, 1.0f, 1.0f, 0.7f)), }; var cutoffLow = properties.Find(e => e.name == Propertyname.AlphaCutoff_Low); var cutoffHigh = properties.Find(e => e.name == Propertyname.AlphaCutoff_High); var cutoffMultiplied = properties.Find(e => e.name == Propertyname.AlphaCutoff_Multiplied); var cutoffAll = properties.Find(e => e.name == Propertyname.AlphaCutoff_All); var cutoffNone = properties.Find(e => e.name == Propertyname.AlphaCutoff_None); var baseColorFactor = properties.Find(e => e.name == Propertyname.BaseColorFactor); specialCombos.Add(new List <Property>() { cutoffMultiplied, baseColorFactor, }); removeCombos.Add(new List <Property>() { baseColorFactor }); removeCombos.Add(new List <Property>() { cutoffMultiplied }); }
public Texture_Sampler(List <string> imageList) : base(imageList) { // The base glTF spec does not support mipmapping, so the MagFilter and MinFilter // attributes will have no visible affect unless mipmapping is implemented by the client modelGroupName = ModelGroupName.Texture_Sampler; onlyBinaryProperties = false; noPrerequisite = false; Runtime.Image baseColorTexture = new Runtime.Image { Uri = imageList.Find(e => e.Contains("BaseColor_Plane")) }; usedTextures.Add(baseColorTexture); List <Vector2> textureCoords2 = new List <Vector2>() { new Vector2(1.3f, 1.3f), new Vector2(-0.3f, 1.3f), new Vector2(-0.3f, -0.3f), new Vector2(1.3f, -0.3f) }; requiredProperty = new List <Property> { new Property(Propertyname.BaseColorTexture, baseColorTexture), }; properties = new List <Property> { new Property(Propertyname.WrapT_ClampToEdge, glTFLoader.Schema.Sampler.WrapTEnum.CLAMP_TO_EDGE, group: 4), new Property(Propertyname.WrapT_MirroredRepeat, glTFLoader.Schema.Sampler.WrapTEnum.MIRRORED_REPEAT, group: 4), new Property(Propertyname.WrapS_ClampToEdge, glTFLoader.Schema.Sampler.WrapSEnum.CLAMP_TO_EDGE, group: 3), new Property(Propertyname.WrapS_MirroredRepeat, glTFLoader.Schema.Sampler.WrapSEnum.MIRRORED_REPEAT, group: 3), new Property(Propertyname.MagFilter_Nearest, glTFLoader.Schema.Sampler.MagFilterEnum.NEAREST, group: 1), new Property(Propertyname.MagFilter_Linear, glTFLoader.Schema.Sampler.MagFilterEnum.LINEAR, group: 1), new Property(Propertyname.MinFilter_Nearest, glTFLoader.Schema.Sampler.MinFilterEnum.NEAREST, group: 2), new Property(Propertyname.MinFilter_Linear, glTFLoader.Schema.Sampler.MinFilterEnum.LINEAR, group: 2), new Property(Propertyname.MinFilter_NearestMipmapNearest, glTFLoader.Schema.Sampler.MinFilterEnum.NEAREST_MIPMAP_NEAREST, group: 2), new Property(Propertyname.MinFilter_LinearMipmapNearest, glTFLoader.Schema.Sampler.MinFilterEnum.LINEAR_MIPMAP_NEAREST, group: 2), new Property(Propertyname.MinFilter_NearestMipmapLinear, glTFLoader.Schema.Sampler.MinFilterEnum.NEAREST_MIPMAP_LINEAR, group: 2), new Property(Propertyname.MinFilter_LinearMipmapLinear, glTFLoader.Schema.Sampler.MinFilterEnum.LINEAR_MIPMAP_LINEAR, group: 2), }; specialProperties = new List <Property> { new Property(Propertyname.TexCoord, textureCoords2) }; }
public Buffer_Interleaved(List <string> textures, List <string> figures) : base(textures, figures) { modelGroupName = ModelGroupName.Buffer_Interleaved; onlyBinaryProperties = false; noPrerequisite = false; Runtime.Image baseColorTexture = new Runtime.Image { Uri = textures.Find(e => e.Contains("BaseColor_Grey")) }; usedTextures.Add(baseColorTexture); List <Vector4> vertexColors = new List <Vector4>() { new Vector4(0.0f, 1.0f, 0.0f, 0.2f), new Vector4(1.0f, 0.0f, 0.0f, 0.2f), new Vector4(1.0f, 1.0f, 0.0f, 0.2f), new Vector4(0.0f, 0.0f, 1.0f, 0.2f) }; requiredProperty = new List <Property> { new Property(Propertyname.BaseColorTexture, baseColorTexture) }; properties = new List <Property> { new Property(Propertyname.VertexUV0_Float, Runtime.MeshPrimitive.TextureCoordsComponentTypeEnum.FLOAT, group: 1), new Property(Propertyname.VertexUV0_Byte, Runtime.MeshPrimitive.TextureCoordsComponentTypeEnum.NORMALIZED_UBYTE, group: 1), new Property(Propertyname.VertexUV0_Short, Runtime.MeshPrimitive.TextureCoordsComponentTypeEnum.NORMALIZED_USHORT, group: 1), new Property(Propertyname.VertexColor_Vector3_Float, group: 3, propertyValue: new VertexColor( Runtime.MeshPrimitive.ColorComponentTypeEnum.FLOAT, Runtime.MeshPrimitive.ColorTypeEnum.VEC3, vertexColors)), new Property(Propertyname.VertexColor_Vector3_Byte, group: 3, propertyValue: new VertexColor( Runtime.MeshPrimitive.ColorComponentTypeEnum.NORMALIZED_UBYTE, Runtime.MeshPrimitive.ColorTypeEnum.VEC3, vertexColors)), new Property(Propertyname.VertexColor_Vector3_Short, group: 3, propertyValue: new VertexColor( Runtime.MeshPrimitive.ColorComponentTypeEnum.NORMALIZED_USHORT, Runtime.MeshPrimitive.ColorTypeEnum.VEC3, vertexColors)), }; var UVF = properties.Find(e => e.name == Propertyname.VertexUV0_Float); var UVB = properties.Find(e => e.name == Propertyname.VertexUV0_Byte); var UVS = properties.Find(e => e.name == Propertyname.VertexUV0_Short); var colorF = properties.Find(e => e.name == Propertyname.VertexColor_Vector3_Float); var colorB = properties.Find(e => e.name == Propertyname.VertexColor_Vector3_Byte); var colorS = properties.Find(e => e.name == Propertyname.VertexColor_Vector3_Short); foreach (var property in properties) { removeCombos.Add(new List <Property>() { property }); } specialCombos.Add(new List <Property>() { UVS, colorF }); specialCombos.Add(new List <Property>() { UVB, colorF }); specialCombos.Add(new List <Property>() { UVF, colorS }); specialCombos.Add(new List <Property>() { UVF, colorB }); }
public Mesh_Primitives(List <string> textures, List <string> figures) : base(textures, figures) { modelGroupName = ModelGroupName.Mesh_Primitives; onlyBinaryProperties = false; noPrerequisite = false; Runtime.Image figureIndicesPrimitive0 = new Runtime.Image { Uri = figures.Find(e => e.Contains("Indices_Primitive0")) }; Runtime.Image figureIndicesPrimitive1 = new Runtime.Image { Uri = figures.Find(e => e.Contains("Indices_Primitive1")) }; Runtime.Image figureUVSpace2 = new Runtime.Image { Uri = figures.Find(e => e.Contains("UVSpace2")) }; Runtime.Image figureUVSpace3 = new Runtime.Image { Uri = figures.Find(e => e.Contains("UVSpace3")) }; Runtime.Image baseColorTexture = new Runtime.Image { Uri = textures.Find(e => e.Contains("BaseColor_Plane")) }; Runtime.Image normalTexture = new Runtime.Image { Uri = textures.Find(e => e.Contains("Normal_Plane")) }; usedTextures.Add(baseColorTexture); usedTextures.Add(normalTexture); usedFigures.Add(figureIndicesPrimitive0); usedFigures.Add(figureIndicesPrimitive1); usedFigures.Add(figureUVSpace2); usedFigures.Add(figureUVSpace3); List <Vector3> primitive0Positions = new List <Vector3>() { new Vector3(-0.5f, -0.5f, 0.0f), new Vector3(0.5f, 0.5f, 0.0f), new Vector3(-0.5f, 0.5f, 0.0f) }; List <Vector3> primitive1Positions = new List <Vector3>() { new Vector3(-0.5f, -0.5f, 0.0f), new Vector3(0.5f, -0.5f, 0.0f), new Vector3(0.5f, 0.5f, 0.0f) }; List <int> primitiveTriangleIndices = new List <int> { 0, 1, 2, }; Runtime.MeshPrimitive primitive0Mesh = new Runtime.MeshPrimitive { Positions = primitive0Positions, Indices = primitiveTriangleIndices, }; Runtime.MeshPrimitive primitive1Mesh = new Runtime.MeshPrimitive { Positions = primitive1Positions, Indices = primitiveTriangleIndices, }; List <Vector4> vertexColors = new List <Vector4>() { new Vector4(0.0f, 1.0f, 0.0f, 0.2f), new Vector4(1.0f, 0.0f, 0.0f, 0.2f), new Vector4(0.0f, 0.0f, 1.0f, 0.2f) }; List <Vector3> normals = new List <Vector3>() { new Vector3(0.0f, 0.0f, 1.0f), new Vector3(0.0f, 0.0f, 1.0f), new Vector3(0.0f, 0.0f, 1.0f) }; List <Vector4> tangents = new List <Vector4>() { new Vector4(1.0f, 0.0f, 0.0f, 1.0f), new Vector4(1.0f, 0.0f, 0.0f, 1.0f), new Vector4(1.0f, 0.0f, 0.0f, 1.0f) }; List <Vector2> textureCoords0Prim0 = new List <Vector2>() { new Vector2(0.0f, 1.0f), new Vector2(1.0f, 0.0f), new Vector2(0.0f, 0.0f) }; List <Vector2> textureCoords0Prim2 = new List <Vector2>() { new Vector2(0.0f, 1.0f), new Vector2(1.0f, 1.0f), new Vector2(1.0f, 0.0f) }; requiredProperty = new List <Property> { new Property(Propertyname.Primitive0VertexUV0, "UV 0 mapping"), new Property(Propertyname.Primitive1VertexUV0, "UV 0 mapping"), }; properties = new List <Property> { new Property(Propertyname.VertexNormal, normals), new Property(Propertyname.VertexTangent, tangents), new Property(Propertyname.VertexColor_Vector4_Float, vertexColors), new Property(Propertyname.NormalTexture, normalTexture), new Property(Propertyname.BaseColorTexture, baseColorTexture), }; specialProperties = new List <Property> { new Property(Propertyname.Primitives_Split1, primitive0Mesh, group: 1), new Property(Propertyname.Primitives_Split2, primitive1Mesh, group: 1), new Property(Propertyname.Primitive0VertexUV0, textureCoords0Prim0), new Property(Propertyname.Primitive1VertexUV0, textureCoords0Prim2), }; var normTex = properties.Find(e => e.name == Propertyname.NormalTexture); var normal = properties.Find(e => e.name == Propertyname.VertexNormal); var tangent = properties.Find(e => e.name == Propertyname.VertexTangent); var pbrTexture = properties.Find(e => e.name == Propertyname.BaseColorTexture); var color = properties.Find(e => e.name == Propertyname.VertexColor_Vector4_Float); specialCombos.Add(new List <Property>() { normal, tangent, normTex, pbrTexture }); specialCombos.Add(new List <Property>() { normal, pbrTexture }); removeCombos.Add(new List <Property>() { normal }); removeCombos.Add(new List <Property>() { tangent }); removeCombos.Add(new List <Property>() { normTex }); }
public Material_SpecularGlossiness(List <string> imageList) : base(imageList) { modelGroupName = ModelGroupName.Material_SpecularGlossiness; onlyBinaryProperties = false; var diffuseTexture = new Runtime.Image { Uri = imageList.Find(e => e.Contains("Diffuse_Plane")) }; var specularGlossinessTexture = new Runtime.Image { Uri = imageList.Find(e => e.Contains("SpecularGlossiness_Plane")) }; var baseColorTexture = new Runtime.Image { Uri = imageList.Find(e => e.Contains("BaseColor_X")) }; usedTextures.Add(diffuseTexture); usedTextures.Add(specularGlossinessTexture); usedTextures.Add(baseColorTexture); var colorCoord = new List <Vector4>() { new Vector4(0.0f, 0.0f, 1.0f, 0.8f), new Vector4(1.0f, 0.0f, 0.0f, 0.8f), new Vector4(0.0f, 0.0f, 1.0f, 0.8f), new Vector4(1.0f, 0.0f, 0.0f, 0.8f) }; requiredProperty = new List <Property> { new Property(Propertyname.ExtensionUsed_SpecularGlossiness, "Specular Glossiness", group: 3), new Property(Propertyname.BaseColorTexture, baseColorTexture) }; properties = new List <Property> { new Property(Propertyname.VertexColor_Vector3_Float, colorCoord, group: 2), new Property(Propertyname.DiffuseTexture, diffuseTexture), new Property(Propertyname.DiffuseFactor, new Vector4(0.2f, 0.2f, 0.2f, 0.8f)), new Property(Propertyname.SpecularGlossinessTexture, specularGlossinessTexture), new Property(Propertyname.SpecularFactor, new Vector3(0.4f, 0.4f, 0.4f), group: 1), new Property(Propertyname.SpecularFactor_Override, new Vector3(0.0f, 0.0f, 0.0f), group: 1), new Property(Propertyname.GlossinessFactor, 0.3f), }; var vertColor = properties.Find(e => e.name == Propertyname.VertexColor_Vector3_Float); var diffTex = properties.Find(e => e.name == Propertyname.DiffuseTexture); var diffFac = properties.Find(e => e.name == Propertyname.DiffuseFactor); var specGlossTex = properties.Find(e => e.name == Propertyname.SpecularGlossinessTexture); var specFac = properties.Find(e => e.name == Propertyname.SpecularFactor); var glossFac = properties.Find(e => e.name == Propertyname.GlossinessFactor); var specFacOverride = properties.Find(e => e.name == Propertyname.SpecularFactor_Override); specialCombos.Add(new List <Property>() { diffTex, diffFac, specFacOverride, }); specialCombos.Add(new List <Property>() { specGlossTex, specFac, }); specialCombos.Add(new List <Property>() { specGlossTex, glossFac }); specialCombos.Add(new List <Property>() { diffFac, specFacOverride, }); specialCombos.Add(new List <Property>() { vertColor, diffTex, specFacOverride, }); specialCombos.Add(new List <Property>() { diffTex, specFacOverride, }); specialCombos.Add(new List <Property>() { diffTex, glossFac, }); specialCombos.Add(new List <Property>() { diffTex, specFac, glossFac, }); specialCombos.Add(new List <Property>() { vertColor, specFacOverride, }); removeCombos.Add(new List <Property>() { vertColor, }); removeCombos.Add(new List <Property>() { diffTex, }); removeCombos.Add(new List <Property>() { diffFac, }); removeCombos.Add(new List <Property>() { specFacOverride, }); }
public Mesh_Indices(List <string> textures, List <string> figures) : base(textures, figures) { modelGroupName = ModelGroupName.Mesh_Indices; onlyBinaryProperties = false; noPrerequisite = false; Runtime.Image figureIndices = new Runtime.Image { Uri = figures.Find(e => e.Contains("Indices")) }; usedFigures.Add(figureIndices); List <Vector3> noIndicesPositionsTriangles = new List <Vector3>() { new Vector3(-0.5f, -0.5f, 0.0f), new Vector3(0.5f, -0.5f, 0.0f), new Vector3(0.5f, 0.5f, 0.0f), new Vector3(-0.5f, -0.5f, 0.0f), new Vector3(0.5f, 0.5f, 0.0f), new Vector3(-0.5f, 0.5f, 0.0f), }; List <Vector3> noIndicesPositionsLines = new List <Vector3>() { new Vector3(0.5f, -0.5f, 0.0f), new Vector3(0.5f, 0.5f, 0.0f), new Vector3(0.5f, 0.5f, 0.0f), new Vector3(-0.5f, 0.5f, 0.0f), new Vector3(-0.5f, 0.5f, 0.0f), new Vector3(-0.5f, -0.5f, 0.0f), new Vector3(-0.5f, -0.5f, 0.0f), new Vector3(0.5f, -0.5f, 0.0f), }; List <Vector3> noIndicesPositionsLineloopPointsFan = new List <Vector3>() { new Vector3(0.5f, -0.5f, 0.0f), new Vector3(0.5f, 0.5f, 0.0f), new Vector3(-0.5f, 0.5f, 0.0f), new Vector3(-0.5f, -0.5f, 0.0f), }; List <Vector3> noIndicesPositionsLineStrip = new List <Vector3>() { new Vector3(0.5f, -0.5f, 0.0f), new Vector3(0.5f, 0.5f, 0.0f), new Vector3(-0.5f, 0.5f, 0.0f), new Vector3(-0.5f, -0.5f, 0.0f), new Vector3(0.5f, -0.5f, 0.0f), }; List <Vector3> noIndicesPositionsTrianglestrip = new List <Vector3>() { new Vector3(0.5f, -0.5f, 0.0f), new Vector3(0.5f, 0.5f, 0.0f), new Vector3(-0.5f, -0.5f, 0.0f), new Vector3(-0.5f, 0.5f, 0.0f), }; Runtime.GLTF defaultModel = Common.SinglePlane(); // Only used to get the default indices List <int> defaultModelIndices = new List <int>(defaultModel.Scenes[0].Nodes[0].Mesh.MeshPrimitives[0].Indices); List <int> linesIndices = new List <int> { 0, 3, 3, 2, 2, 1, 1, 0, }; List <int> lineloopPointsFanIndices = new List <int> { 0, 3, 2, 1, }; List <int> linestripIndices = new List <int> { 0, 3, 2, 1, 0, }; List <int> trianglestripIndices = new List <int> { 0, 3, 1, 2, }; List <Vector4> vertexColors = new List <Vector4>() { new Vector4(0.0f, 1.0f, 0.0f, 0.2f), new Vector4(1.0f, 0.0f, 0.0f, 0.2f), new Vector4(0.0f, 0.0f, 1.0f, 0.2f) }; properties = new List <Property> { new Property(Propertyname.Mode_Points, Runtime.MeshPrimitive.ModeEnum.POINTS, group: 1), new Property(Propertyname.Mode_Lines, Runtime.MeshPrimitive.ModeEnum.LINES, group: 1), new Property(Propertyname.Mode_Line_Loop, Runtime.MeshPrimitive.ModeEnum.LINE_LOOP, group: 1), new Property(Propertyname.Mode_Line_Strip, Runtime.MeshPrimitive.ModeEnum.LINE_STRIP, group: 1), new Property(Propertyname.Mode_Triangle_Strip, Runtime.MeshPrimitive.ModeEnum.TRIANGLE_STRIP, group: 1), new Property(Propertyname.Mode_Triangle_Fan, Runtime.MeshPrimitive.ModeEnum.TRIANGLE_FAN, group: 1), new Property(Propertyname.Mode_Triangles, Runtime.MeshPrimitive.ModeEnum.TRIANGLES, group: 1), new Property(Propertyname.IndicesValues_Points, lineloopPointsFanIndices, Propertyname.Mode_Points, group: 2), new Property(Propertyname.IndicesValues_Lines, linesIndices, Propertyname.Mode_Lines, group: 2), new Property(Propertyname.IndicesValues_LineLoop, lineloopPointsFanIndices, Propertyname.Mode_Line_Loop, group: 2), new Property(Propertyname.IndicesValues_LineStrip, linestripIndices, Propertyname.Mode_Line_Strip, group: 2), new Property(Propertyname.IndicesValues_TriangleStrip, trianglestripIndices, Propertyname.Mode_Triangle_Strip, group: 2), new Property(Propertyname.IndicesValues_TriangleFan, lineloopPointsFanIndices, Propertyname.Mode_Triangle_Fan, group: 2), new Property(Propertyname.IndicesValues_Triangles, defaultModelIndices, Propertyname.Mode_Triangles, group: 2), new Property(Propertyname.IndicesValues_None, " ", group: 2), new Property(Propertyname.IndicesComponentType_Byte, Runtime.MeshPrimitive.IndexComponentTypeEnum.UNSIGNED_BYTE, group: 4), new Property(Propertyname.IndicesComponentType_Short, Runtime.MeshPrimitive.IndexComponentTypeEnum.UNSIGNED_SHORT, group: 4), new Property(Propertyname.IndicesComponentType_Int, Runtime.MeshPrimitive.IndexComponentTypeEnum.UNSIGNED_INT, group: 4), new Property(Propertyname.IndicesComponentType_None, " ", group: 4), }; specialProperties = new List <Property> { new Property(Propertyname.VertexColor_Vector4_Float, vertexColors), new Property(Propertyname.Mode_Points, noIndicesPositionsLineloopPointsFan, group: 1), new Property(Propertyname.Mode_Lines, noIndicesPositionsLines, group: 1), new Property(Propertyname.Mode_Line_Loop, noIndicesPositionsLineloopPointsFan, group: 1), new Property(Propertyname.Mode_Line_Strip, noIndicesPositionsLineStrip, group: 1), new Property(Propertyname.Mode_Triangle_Strip, noIndicesPositionsTrianglestrip, group: 1), new Property(Propertyname.Mode_Triangle_Fan, noIndicesPositionsLineloopPointsFan, group: 1), new Property(Propertyname.Mode_Triangles, noIndicesPositionsTriangles, group: 1), }; // Each mode with and without indices, and drop singles var defaultIndices = properties.Find(e => e.name == Propertyname.IndicesComponentType_Int); var noIndicesType = properties.Find(e => e.name == Propertyname.IndicesComponentType_None); var noIndicesValue = properties.Find(e => e.name == Propertyname.IndicesValues_None); foreach (var property in properties) { if (property.propertyGroup == 1) { var IndicesValues = properties.Find(e => e.prerequisite == property.name); specialCombos.Add(ComboHelper.CustomComboCreation( property, defaultIndices, IndicesValues)); specialCombos.Add(ComboHelper.CustomComboCreation( property, noIndicesValue, noIndicesType)); } removeCombos.Add(ComboHelper.CustomComboCreation( property)); } specialCombos.Add(ComboHelper.CustomComboCreation( properties.Find(e => e.name == Propertyname.IndicesValues_Triangles), properties.Find(e => e.name == Propertyname.IndicesComponentType_Byte), properties.Find(e => e.name == Propertyname.Mode_Triangles))); specialCombos.Add(ComboHelper.CustomComboCreation( properties.Find(e => e.name == Propertyname.IndicesValues_Triangles), properties.Find(e => e.name == Propertyname.IndicesComponentType_Short), properties.Find(e => e.name == Propertyname.Mode_Triangles))); }
public Mesh_PrimitiveAttribute(List <string> imageList) : base(imageList) { modelGroupName = ModelGroupName.Mesh_PrimitiveAttribute; onlyBinaryProperties = false; noPrerequisite = false; Runtime.Image baseColorTexture = new Runtime.Image { Uri = imageList.Find(e => e.Contains("BaseColor_Plane")) }; Runtime.Image normalTexture = new Runtime.Image { Uri = imageList.Find(e => e.Contains("Normal_Plane")) }; usedTextures.Add(normalTexture); usedTextures.Add(baseColorTexture); List <Vector3> planeNormals = new List <Vector3>() { new Vector3(0.0f, 0.0f, 1.0f), new Vector3(0.0f, 0.0f, 1.0f), new Vector3(0.0f, 0.0f, 1.0f), new Vector3(0.0f, 0.0f, 1.0f) }; List <Vector2> textureCoords1 = new List <Vector2>() { new Vector2(1.0f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.0f), new Vector2(1.0f, 0.0f) }; List <Vector4> vertexColors = new List <Vector4>() { new Vector4(0.0f, 1.0f, 0.0f, 0.2f), new Vector4(1.0f, 0.0f, 0.0f, 0.2f), new Vector4(1.0f, 1.0f, 0.0f, 0.2f), new Vector4(0.0f, 0.0f, 1.0f, 0.2f) }; List <Vector4> tangents = new List <Vector4>() { new Vector4(1.0f, 0.0f, 0.0f, 1.0f), new Vector4(1.0f, 0.0f, 0.0f, 1.0f), new Vector4(1.0f, 0.0f, 0.0f, 1.0f), new Vector4(1.0f, 0.0f, 0.0f, 1.0f) }; requiredProperty = new List <Property> { new Property(Propertyname.BaseColorTexture, baseColorTexture), }; properties = new List <Property> { new Property(Propertyname.VertexUV0_Float, Runtime.MeshPrimitive.TextureCoordsComponentTypeEnum.FLOAT, group: 1), new Property(Propertyname.VertexUV0_Byte, Runtime.MeshPrimitive.TextureCoordsComponentTypeEnum.NORMALIZED_UBYTE, group: 1), new Property(Propertyname.VertexUV0_Short, Runtime.MeshPrimitive.TextureCoordsComponentTypeEnum.NORMALIZED_USHORT, group: 1), new Property(Propertyname.VertexNormal, planeNormals), new Property(Propertyname.VertexTangent, tangents), new Property(Propertyname.NormalTexture, normalTexture), }; var uv0 = properties.Find(e => e.name == Propertyname.VertexUV0_Float); var normal = properties.Find(e => e.name == Propertyname.VertexNormal); var tangent = properties.Find(e => e.name == Propertyname.VertexTangent); var normalTex = properties.Find(e => e.name == Propertyname.NormalTexture); specialCombos.Add(new List <Property>() { normal, normalTex, }); removeCombos.Add(new List <Property>() { tangent, }); }
public Mesh_PrimitiveMode(List <string> imageList) : base(imageList) { modelGroupName = ModelGroupName.Mesh_PrimitiveMode; onlyBinaryProperties = false; noPrerequisite = false; Runtime.Image figureIndices = new Runtime.Image { Uri = imageList.Find(e => e.Contains("Indices")) }; Runtime.Image figurePointsIndices = new Runtime.Image { Uri = imageList.Find(e => e.Contains("Indices_Points")) }; //Runtime.Image normalTexture = new Runtime.Image //{ // Uri = textures.Find(e => e.Contains("Normal_Plane")) //}; //usedTextures.Add(normalTexture); usedFigures.Add(figureIndices); usedFigures.Add(figurePointsIndices); List <Vector3> noIndicesPositionsTriangles = new List <Vector3>() { new Vector3(-0.5f, -0.5f, 0.0f), new Vector3(0.5f, -0.5f, 0.0f), new Vector3(0.5f, 0.5f, 0.0f), new Vector3(-0.5f, -0.5f, 0.0f), new Vector3(0.5f, 0.5f, 0.0f), new Vector3(-0.5f, 0.5f, 0.0f), }; List <Vector3> noIndicesPositionsLines = new List <Vector3>() { new Vector3(0.5f, -0.5f, 0.0f), new Vector3(-0.5f, -0.5f, 0.0f), new Vector3(-0.5f, -0.5f, 0.0f), new Vector3(-0.5f, 0.5f, 0.0f), new Vector3(-0.5f, 0.5f, 0.0f), new Vector3(0.5f, 0.5f, 0.0f), new Vector3(0.5f, 0.5f, 0.0f), new Vector3(0.5f, -0.5f, 0.0f), }; List <Vector3> noIndicesPositionsLineloopFan = new List <Vector3>() { new Vector3(0.5f, -0.5f, 0.0f), new Vector3(0.5f, 0.5f, 0.0f), new Vector3(-0.5f, 0.5f, 0.0f), new Vector3(-0.5f, -0.5f, 0.0f), }; // Make a list of verticies for points with 1024 values List <Vector3> noIndicesPositionsPoints = new List <Vector3>(); List <Vector3> cornerPoints = new List <Vector3>() { new Vector3(0.5f, -0.5f, 0.0f), new Vector3(-0.5f, -0.5f, 0.0f), new Vector3(-0.5f, 0.5f, 0.0f), new Vector3(0.5f, 0.5f, 0.0f), new Vector3(0.5f, -0.5f, 0.0f) }; for (int corner = 0; corner < 4; corner++) { for (int x = 256; x > 0; x--) { Vector3 startPoint = cornerPoints[corner]; Vector3 endPoint = cornerPoints[corner + 1]; float fractionOfLine = (float)x / 256f; noIndicesPositionsPoints.Add(PointOnLine.FindPoint(startPoint, endPoint, fractionOfLine)); } } List <Vector3> noIndicesPositionsLineStrip = new List <Vector3>() { new Vector3(0.5f, -0.5f, 0.0f), new Vector3(0.5f, 0.5f, 0.0f), new Vector3(-0.5f, 0.5f, 0.0f), new Vector3(-0.5f, -0.5f, 0.0f), new Vector3(0.5f, -0.5f, 0.0f), }; List <Vector3> noIndicesPositionsTrianglestrip = new List <Vector3>() { new Vector3(0.5f, -0.5f, 0.0f), new Vector3(0.5f, 0.5f, 0.0f), new Vector3(-0.5f, -0.5f, 0.0f), new Vector3(-0.5f, 0.5f, 0.0f), }; Runtime.GLTF defaultModel = Common.SinglePlane(); // Only used to get the default indices List <int> defaultModelIndices = new List <int>(defaultModel.Scenes[0].Nodes[0].Mesh.MeshPrimitives[0].Indices); List <int> linesIndices = new List <int> { 0, 3, 3, 2, 2, 1, 1, 0, }; List <int> lineloopFanIndices = new List <int> { 0, 3, 2, 1, }; List <int> linestripIndices = new List <int> { 0, 3, 2, 1, 0, }; List <int> trianglestripIndices = new List <int> { 0, 3, 1, 2, }; List <int> pointsIndices = new List <int>(); for (int x = 0; x < noIndicesPositionsPoints.Count; x++) { pointsIndices.Add(x); } //List<Vector2> pointsTextureCoords = new List<Vector2>() //{ // new Vector2(1.0f, 1.0f), // new Vector2(0.75f, 1.0f), // new Vector2(0.5f, 1.0f), // new Vector2(0.25f, 1.0f), // new Vector2(0.0f, 1.0f), // new Vector2(0.0f, 0.75f), // new Vector2(0.0f, 0.5f), // new Vector2(0.0f, 0.25f), // new Vector2(0.0f, 0.0f), // new Vector2(0.25f, 0.0f), // new Vector2(0.5f, 0.0f), // new Vector2(0.75f, 0.0f), // new Vector2(1.0f, 0.0f), // new Vector2(1.0f, 0.25f), // new Vector2(1.0f, 0.5f), // new Vector2(1.0f, 0.75f), //}; //List<Vector2> linesTextureCoords = new List<Vector2>() //{ // new Vector2(1.0f, 1.0f), // new Vector2(0.0f, 1.0f), // new Vector2(0.0f, 1.0f), // new Vector2(0.0f, 0.0f), // new Vector2(0.0f, 0.0f), // new Vector2(1.0f, 0.0f), // new Vector2(1.0f, 0.0f), // new Vector2(1.0f, 1.0f), //}; //List<List<Vector2>> textureCoords = new List<List<Vector2>>() //{ // pointsTextureCoords, // linesTextureCoords //}; //List<Vector3> normalsPoints = new List<Vector3>(); //List<Vector4> tangentsPoints = new List<Vector4>(); //for (int x = 0; x < 16; x++) //{ // normalsPoints.Add(new Vector3(0.0f, 0.0f, 1.0f)); // tangentsPoints.Add(new Vector4(1.0f, 0.0f, 0.0f, 1.0f)); //} //List<Vector3> normalsLines = new List<Vector3>(); //List<Vector4> tangentsLines = new List<Vector4>(); //for (int x = 0; x < 8; x++) //{ // normalsLines.Add(new Vector3(0.0f, 0.0f, 1.0f)); // tangentsLines.Add(new Vector4(1.0f, 0.0f, 0.0f, 1.0f)); //} //List<List<Vector3>> normals = new List<List<Vector3>>() //{ // normalsPoints, // normalsLines //}; //List<List<Vector4>> tangents = new List<List<Vector4>>() //{ // tangentsPoints, // tangentsLines //}; properties = new List <Property> { new Property(Propertyname.Mode_Points, Runtime.MeshPrimitive.ModeEnum.POINTS, group: 1), new Property(Propertyname.Mode_Lines, Runtime.MeshPrimitive.ModeEnum.LINES, group: 1), new Property(Propertyname.Mode_Line_Loop, Runtime.MeshPrimitive.ModeEnum.LINE_LOOP, group: 1), new Property(Propertyname.Mode_Line_Strip, Runtime.MeshPrimitive.ModeEnum.LINE_STRIP, group: 1), new Property(Propertyname.Mode_Triangle_Strip, Runtime.MeshPrimitive.ModeEnum.TRIANGLE_STRIP, group: 1), new Property(Propertyname.Mode_Triangle_Fan, Runtime.MeshPrimitive.ModeEnum.TRIANGLE_FAN, group: 1), new Property(Propertyname.Mode_Triangles, Runtime.MeshPrimitive.ModeEnum.TRIANGLES, group: 1), new Property(Propertyname.IndicesValues_Points, "[0 - 1023]", Propertyname.Mode_Points, group: 2), new Property(Propertyname.IndicesValues_Lines, linesIndices, Propertyname.Mode_Lines, group: 2), new Property(Propertyname.IndicesValues_LineLoop, lineloopFanIndices, Propertyname.Mode_Line_Loop, group: 2), new Property(Propertyname.IndicesValues_LineStrip, linestripIndices, Propertyname.Mode_Line_Strip, group: 2), new Property(Propertyname.IndicesValues_TriangleStrip, trianglestripIndices, Propertyname.Mode_Triangle_Strip, group: 2), new Property(Propertyname.IndicesValues_TriangleFan, lineloopFanIndices, Propertyname.Mode_Triangle_Fan, group: 2), new Property(Propertyname.IndicesValues_Triangles, defaultModelIndices, Propertyname.Mode_Triangles, group: 2), new Property(Propertyname.IndicesValues_None, " ", group: 2), new Property(Propertyname.IndicesComponentType_Byte, Runtime.MeshPrimitive.IndexComponentTypeEnum.UNSIGNED_BYTE, group: 4), new Property(Propertyname.IndicesComponentType_Short, Runtime.MeshPrimitive.IndexComponentTypeEnum.UNSIGNED_SHORT, group: 4), new Property(Propertyname.IndicesComponentType_Int, Runtime.MeshPrimitive.IndexComponentTypeEnum.UNSIGNED_INT, group: 4), new Property(Propertyname.IndicesComponentType_None, " ", group: 4), //new Property(Propertyname.VertexUV0_Float, ":white_check_mark:", group:5), //new Property(Propertyname.VertexNormal, ":white_check_mark:"), //new Property(Propertyname.VertexTangent, ":white_check_mark:"), //new Property(Propertyname.NormalTexture, normalTexture), }; specialProperties = new List <Property> { //new Property(Propertyname.VertexUV0_Float, textureCoords, group:5), //new Property(Propertyname.VertexNormal, normals), //new Property(Propertyname.VertexTangent, tangents), new Property(Propertyname.Mode_Points, noIndicesPositionsPoints, group: 1), new Property(Propertyname.Mode_Lines, noIndicesPositionsLines, group: 1), new Property(Propertyname.Mode_Line_Loop, noIndicesPositionsLineloopFan, group: 1), new Property(Propertyname.Mode_Line_Strip, noIndicesPositionsLineStrip, group: 1), new Property(Propertyname.Mode_Triangle_Strip, noIndicesPositionsTrianglestrip, group: 1), new Property(Propertyname.Mode_Triangle_Fan, noIndicesPositionsLineloopFan, group: 1), new Property(Propertyname.Mode_Triangles, noIndicesPositionsTriangles, group: 1), new Property(Propertyname.IndicesValues_Points, pointsIndices, Propertyname.Mode_Points, group: 2), }; // Each mode with and without indices, and drop singles var defaultIndices = properties.Find(e => e.name == Propertyname.IndicesComponentType_Int); var noIndicesType = properties.Find(e => e.name == Propertyname.IndicesComponentType_None); var noIndicesValue = properties.Find(e => e.name == Propertyname.IndicesValues_None); foreach (var property in properties) { if (property.propertyGroup == 1) { var IndicesValues = properties.Find(e => e.prerequisite == property.name); specialCombos.Add(ComboHelper.CustomComboCreation( property, defaultIndices, IndicesValues)); specialCombos.Add(ComboHelper.CustomComboCreation( property, noIndicesValue, noIndicesType)); } removeCombos.Add(ComboHelper.CustomComboCreation( property)); } var valueTriangles = properties.Find(e => e.name == Propertyname.IndicesValues_Triangles); var modeTriangles = properties.Find(e => e.name == Propertyname.Mode_Triangles); var modePoints = properties.Find(e => e.name == Propertyname.Mode_Points); var modeLines = properties.Find(e => e.name == Propertyname.Mode_Lines); var typeByte = properties.Find(e => e.name == Propertyname.IndicesComponentType_Byte); var typeShort = properties.Find(e => e.name == Propertyname.IndicesComponentType_Short); var vertexUV = properties.Find(e => e.name == Propertyname.VertexUV0_Float); //var normal = properties.Find(e => e.name == Propertyname.VertexNormal); //var tangent = properties.Find(e => e.name == Propertyname.VertexTangent); //var normalTex = properties.Find(e => e.name == Propertyname.NormalTexture); specialCombos.Add(new List <Property>() { valueTriangles, typeByte, modeTriangles }); specialCombos.Add(new List <Property>() { valueTriangles, typeShort, modeTriangles }); //specialCombos.Add(new List<Property>() //{ // modePoints, // noIndicesValue, // noIndicesType, // vertexUV, // normal //}); //specialCombos.Add(new List<Property>() //{ // modeLines, // noIndicesValue, // noIndicesType, // vertexUV, // normal //}); //specialCombos.Add(new List<Property>() //{ // modeLines, // noIndicesValue, // noIndicesType, // vertexUV, // normal, // tangent, // normalTex //}); }
public Node_NegativeScale(List <string> textures, List <string> figures) : base(textures, figures) { modelGroupName = ModelGroupName.Node_NegativeScale; onlyBinaryProperties = false; Runtime.Image normalTexture = new Runtime.Image { Uri = textures.Find(e => e.Contains("Normal_Nodes")) }; Runtime.Image baseColorTexture = new Runtime.Image { Uri = textures.Find(e => e.Contains("BaseColor_Nodes")) }; Runtime.Image metallicRoughnessTexture = new Runtime.Image { Uri = textures.Find(e => e.Contains("MetallicRoughness_Nodes")) }; usedTextures.Add(normalTexture); usedTextures.Add(baseColorTexture); usedTextures.Add(metallicRoughnessTexture); Runtime.GLTF defaultModel = Common.MultiNode(); // Only used to get the default tangent and normal values List <Vector3> normals = new List <Vector3>(defaultModel.Scenes[0].Nodes[0].Mesh.MeshPrimitives[0].Normals); List <Vector4> tangents = new List <Vector4>(defaultModel.Scenes[0].Nodes[0].Mesh.MeshPrimitives[0].Tangents); var matrixNegScale = Matrix4x4.CreateScale(new Vector3(-2, 1, 1)); properties = new List <Property> { new Property(Propertyname.Scale, new Vector3(-2, 1, 1)), new Property(Propertyname.Matrix, matrixNegScale), new Property(Propertyname.VertexNormal, normals), new Property(Propertyname.VertexTangent, tangents), new Property(Propertyname.NormalTexture, normalTexture), new Property(Propertyname.BaseColorTexture, baseColorTexture), new Property(Propertyname.MetallicRoughnessTexture, metallicRoughnessTexture), }; specialProperties = new List <Property> { new Property(Propertyname.Matrix, matrixNegScale), }; var matrix = properties.Find(e => e.name == Propertyname.Matrix); var scale = properties.Find(e => e.name == Propertyname.Scale); var normal = properties.Find(e => e.name == Propertyname.VertexNormal); var tangent = properties.Find(e => e.name == Propertyname.VertexTangent); var normTex = properties.Find(e => e.name == Propertyname.NormalTexture); var colorTex = properties.Find(e => e.name == Propertyname.BaseColorTexture); var metallicRoughTex = properties.Find(e => e.name == Propertyname.MetallicRoughnessTexture); specialCombos.Add(new List <Property>() { normal, tangent, normTex, colorTex, metallicRoughTex }); specialCombos.Add(new List <Property>() { scale, normal, tangent, normTex, colorTex, metallicRoughTex }); specialCombos.Add(new List <Property>() { matrix, normal, tangent, normTex, colorTex, metallicRoughTex }); specialCombos.Add(new List <Property>() { normal, normTex, colorTex, metallicRoughTex }); specialCombos.Add(new List <Property>() { scale, normal, normTex, colorTex, metallicRoughTex }); specialCombos.Add(new List <Property>() { matrix, normal, normTex, colorTex, metallicRoughTex }); removeCombos.Add(new List <Property>() { normal }); removeCombos.Add(new List <Property>() { tangent }); removeCombos.Add(new List <Property>() { normTex }); removeCombos.Add(new List <Property>() { colorTex }); removeCombos.Add(new List <Property>() { metallicRoughTex }); removeCombos.Add(new List <Property>() { matrix, scale, normal, tangent, normTex, colorTex, metallicRoughTex }); }
public Material_Mixed(List <string> textures, List <string> figures) : base(textures, figures) { modelGroupName = ModelGroupName.Material_Mixed; onlyBinaryProperties = false; var baseColorTexture = new Runtime.Image { Uri = textures.Find(e => e.Contains("BaseColor_X")) }; Runtime.Image figureUVSpace2 = new Runtime.Image { Uri = figures.Find(e => e.Contains("UVSpace2")) }; Runtime.Image figureUVSpace3 = new Runtime.Image { Uri = figures.Find(e => e.Contains("UVSpace3")) }; usedTextures.Add(baseColorTexture); usedFigures.Add(figureUVSpace2); usedFigures.Add(figureUVSpace3); List <Vector3> primitive0Positions = new List <Vector3>() { new Vector3(-0.5f, -0.5f, 0.0f), new Vector3(0.5f, 0.5f, 0.0f), new Vector3(-0.5f, 0.5f, 0.0f) }; List <Vector3> primitive1Positions = new List <Vector3>() { new Vector3(-0.5f, -0.5f, 0.0f), new Vector3(0.5f, -0.5f, 0.0f), new Vector3(0.5f, 0.5f, 0.0f) }; List <int> primitiveTriangleIndices = new List <int> { 0, 1, 2, }; Runtime.MeshPrimitive primitive0Mesh = new Runtime.MeshPrimitive { Positions = primitive0Positions, Indices = primitiveTriangleIndices, }; Runtime.MeshPrimitive primitive1Mesh = new Runtime.MeshPrimitive { Positions = primitive1Positions, Indices = primitiveTriangleIndices, }; List <Vector2> textureCoords0Prim0 = new List <Vector2>() { new Vector2(0.0f, 1.0f), new Vector2(1.0f, 0.0f), new Vector2(0.0f, 0.0f) }; List <Vector2> textureCoords0Prim2 = new List <Vector2>() { new Vector2(0.0f, 1.0f), new Vector2(1.0f, 1.0f), new Vector2(1.0f, 0.0f) }; requiredProperty = new List <Property> { new Property(Propertyname.ExtensionUsed_SpecularGlossiness, "Specular Glossiness", group: 1), new Property(Propertyname.BaseColorTexture, baseColorTexture) }; properties = new List <Property> { new Property(Propertyname.SpecularGlossinessOnMaterial0_Yes, null, group: 2), new Property(Propertyname.SpecularGlossinessOnMaterial0_No, ":x:", group: 2), new Property(Propertyname.SpecularGlossinessOnMaterial1_Yes, null, group: 3), new Property(Propertyname.SpecularGlossinessOnMaterial1_No, ":x:", group: 3), }; specialProperties = new List <Property> { new Property(Propertyname.Primitives_Split1, primitive0Mesh, group: 4), new Property(Propertyname.Primitives_Split2, primitive1Mesh, group: 4), new Property(Propertyname.Primitive0VertexUV0, textureCoords0Prim0), new Property(Propertyname.Primitive1VertexUV0, textureCoords0Prim2), }; var mat0Yes = properties.Find(e => e.name == Propertyname.SpecularGlossinessOnMaterial0_Yes); var mat0No = properties.Find(e => e.name == Propertyname.SpecularGlossinessOnMaterial0_No); var mat1Yes = properties.Find(e => e.name == Propertyname.SpecularGlossinessOnMaterial1_Yes); var mat1No = properties.Find(e => e.name == Propertyname.SpecularGlossinessOnMaterial1_No); specialCombos.Add(new List <Property>() { mat0No, mat1No }); specialCombos.Add(new List <Property>() { mat0Yes, mat1No }); removeCombos.Add(new List <Property>() { mat0Yes }); removeCombos.Add(new List <Property>() { mat0No }); removeCombos.Add(new List <Property>() { mat1Yes }); removeCombos.Add(new List <Property>() { mat1No }); }
public Mesh_PrimitivesUV(List <string> textures, List <string> figures) : base(textures, figures) { modelGroupName = ModelGroupName.Mesh_PrimitivesUV; onlyBinaryProperties = false; noPrerequisite = false; Runtime.Image figureIndicesPrimitive0 = new Runtime.Image { Uri = figures.Find(e => e.Contains("Indices_Primitive0")) }; Runtime.Image figureIndicesPrimitive1 = new Runtime.Image { Uri = figures.Find(e => e.Contains("Indices_Primitive1")) }; Runtime.Image figureUVSpace2 = new Runtime.Image { Uri = figures.Find(e => e.Contains("UVSpace2")) }; Runtime.Image figureUVSpace3 = new Runtime.Image { Uri = figures.Find(e => e.Contains("UVSpace3")) }; Runtime.Image figureUVSpace4 = new Runtime.Image { Uri = figures.Find(e => e.Contains("UVSpace4")) }; Runtime.Image figureUVSpace5 = new Runtime.Image { Uri = figures.Find(e => e.Contains("UVSpace5")) }; Runtime.Image baseColorTexture = new Runtime.Image { Uri = textures.Find(e => e.Contains("BaseColor_Plane")) }; Runtime.Image normalTexture = new Runtime.Image { Uri = textures.Find(e => e.Contains("Normal_Plane")) }; usedTextures.Add(baseColorTexture); usedTextures.Add(normalTexture); usedFigures.Add(figureIndicesPrimitive0); usedFigures.Add(figureIndicesPrimitive1); usedFigures.Add(figureUVSpace2); usedFigures.Add(figureUVSpace3); usedFigures.Add(figureUVSpace4); usedFigures.Add(figureUVSpace5); List <Vector3> primitive0Positions = new List <Vector3>() { new Vector3(-0.5f, -0.5f, 0.0f), new Vector3(0.5f, 0.5f, 0.0f), new Vector3(-0.5f, 0.5f, 0.0f) }; List <Vector3> primitive1Positions = new List <Vector3>() { new Vector3(-0.5f, -0.5f, 0.0f), new Vector3(0.5f, -0.5f, 0.0f), new Vector3(0.5f, 0.5f, 0.0f) }; List <int> primitiveTriangleIndices = new List <int> { 0, 1, 2, }; Runtime.MeshPrimitive primitive0Mesh = new Runtime.MeshPrimitive { Positions = primitive0Positions, Indices = primitiveTriangleIndices, }; Runtime.MeshPrimitive primitive1Mesh = new Runtime.MeshPrimitive { Positions = primitive1Positions, Indices = primitiveTriangleIndices, }; List <Vector4> vertexColors = new List <Vector4>() { new Vector4(0.0f, 1.0f, 0.0f, 0.2f), new Vector4(1.0f, 0.0f, 0.0f, 0.2f), new Vector4(0.0f, 0.0f, 1.0f, 0.2f) }; List <Vector3> normals = new List <Vector3>() { new Vector3(0.0f, 0.0f, 1.0f), new Vector3(0.0f, 0.0f, 1.0f), new Vector3(0.0f, 0.0f, 1.0f) }; List <Vector4> tangents = new List <Vector4>() { new Vector4(1.0f, 0.0f, 0.0f, 1.0f), new Vector4(1.0f, 0.0f, 0.0f, 1.0f), new Vector4(1.0f, 0.0f, 0.0f, 1.0f) }; List <Vector2> textureCoords0Prim0 = new List <Vector2>() { new Vector2(0.0f, 1.0f), new Vector2(1.0f, 0.0f), new Vector2(0.0f, 0.0f) }; List <Vector2> textureCoords1Prim0 = new List <Vector2>() { new Vector2(0.5f, 0.5f), new Vector2(1.0f, 0.0f), new Vector2(0.5f, 0.0f) }; List <Vector2> textureCoords0Prim2 = new List <Vector2>() { new Vector2(0.0f, 1.0f), new Vector2(1.0f, 1.0f), new Vector2(1.0f, 0.0f) }; List <Vector2> textureCoords1Prim2 = new List <Vector2>() { new Vector2(0.5f, 0.5f), new Vector2(1.0f, 0.5f), new Vector2(1.0f, 0.0f) }; requiredProperty = new List <Property> { new Property(Propertyname.VertexNormal, normals), new Property(Propertyname.VertexTangent, tangents), new Property(Propertyname.VertexColor_Vector4_Float, vertexColors), new Property(Propertyname.NormalTexture, normalTexture), new Property(Propertyname.BaseColorTexture, baseColorTexture), }; properties = new List <Property> { new Property(Propertyname.Primitive0VertexUV0, ":white_check_mark:"), new Property(Propertyname.Primitive0VertexUV1, ":white_check_mark:"), new Property(Propertyname.Primitive1VertexUV0, ":white_check_mark:"), new Property(Propertyname.Primitive1VertexUV1, ":white_check_mark:"), }; specialProperties = new List <Property> { new Property(Propertyname.Primitives_Split4, "No attributes set", group: 1), new Property(Propertyname.Primitives_Split3, "Attributes set on both", group: 1), new Property(Propertyname.Primitives_Split1, "Primitive 0 attributes set", group: 1), new Property(Propertyname.Primitives_Split2, "Primitive 1 attributes set", group: 1), new Property(Propertyname.Primitive_0, primitive0Mesh), new Property(Propertyname.Primitive_1, primitive1Mesh), new Property(Propertyname.Primitive0VertexUV0, textureCoords0Prim0), new Property(Propertyname.Primitive0VertexUV1, textureCoords1Prim0), new Property(Propertyname.Primitive1VertexUV0, textureCoords0Prim2), new Property(Propertyname.Primitive1VertexUV1, textureCoords1Prim2), }; var normal = requiredProperty.Find(e => e.name == Propertyname.VertexNormal); var normTex = requiredProperty.Find(e => e.name == Propertyname.NormalTexture); var tangent = requiredProperty.Find(e => e.name == Propertyname.VertexTangent); var color = requiredProperty.Find(e => e.name == Propertyname.VertexColor_Vector4_Float); var uv0Prim0 = properties.Find(e => e.name == Propertyname.Primitive0VertexUV0); var uv1Prim0 = properties.Find(e => e.name == Propertyname.Primitive0VertexUV1); var uv0Prim1 = properties.Find(e => e.name == Propertyname.Primitive1VertexUV0); var uv1Prim1 = properties.Find(e => e.name == Propertyname.Primitive1VertexUV1); var pbrTexture = requiredProperty.Find(e => e.name == Propertyname.BaseColorTexture); specialCombos.Add(new List <Property>() { uv0Prim0, uv1Prim0, uv0Prim1, specialProperties[1], // Both attributes set normal, tangent, color, normTex, pbrTexture }); specialCombos.Add(new List <Property>() { uv0Prim0, uv0Prim1, uv1Prim1, specialProperties[1], // Both attributes set normal, tangent, color, normTex, pbrTexture }); foreach (var property in properties) { removeCombos.Add(new List <Property>() { property, }); } foreach (var property in specialProperties) { if (property.propertyGroup == 1 && property.name != Propertyname.Primitives_Split4) { specialCombos.Add(new List <Property>() { uv0Prim0, uv0Prim1, property, normal, tangent, color, normTex, pbrTexture }); specialCombos.Add(new List <Property>() { uv0Prim0, uv0Prim1, uv1Prim0, uv1Prim1, property, normal, tangent, color, normTex, pbrTexture }); // Look at the last two special combos and remove UV 0/1 as appropriate for (int x = specialCombos.Count - 2; x < specialCombos.Count; x++) { if (property.name == Propertyname.Primitives_Split1) { specialCombos[x].Remove(uv0Prim1); specialCombos[x].Remove(uv1Prim1); } else if (property.name == Propertyname.Primitives_Split2) { specialCombos[x].Remove(uv0Prim0); specialCombos[x].Remove(uv1Prim0); } } } } }
public Material_Doublesided(List <string> textures, List <string> figures) : base(textures, figures) { modelGroupName = ModelGroupName.Material_Doublesided; onlyBinaryProperties = false; noPrerequisite = false; Runtime.Image baseColorTexture = new Runtime.Image { Uri = textures.Find(e => e.Contains("BaseColor_Plane")) }; Runtime.Image normalTexture = new Runtime.Image { Uri = textures.Find(e => e.Contains("Normal_Plane")) }; usedTextures.Add(baseColorTexture); usedTextures.Add(normalTexture); List <Vector4> vertexColors = new List <Vector4>() { new Vector4(0.3f, 0.3f, 0.3f, 0.4f), new Vector4(0.3f, 0.3f, 0.3f, 0.2f), new Vector4(0.3f, 0.3f, 0.3f, 0.8f), new Vector4(0.3f, 0.3f, 0.3f, 0.6f) }; List <Vector3> planeNormals = new List <Vector3>() { new Vector3(0.0f, 0.0f, 1.0f), new Vector3(0.0f, 0.0f, 1.0f), new Vector3(0.0f, 0.0f, 1.0f), new Vector3(0.0f, 0.0f, 1.0f) }; List <Vector4> tangents = new List <Vector4>() { new Vector4(1.0f, 0.0f, 0.0f, 1.0f), new Vector4(1.0f, 0.0f, 0.0f, 1.0f), new Vector4(1.0f, 0.0f, 0.0f, 1.0f), new Vector4(1.0f, 0.0f, 0.0f, 1.0f) }; requiredProperty = new List <Property> { new Property(Propertyname.DoubleSided, true), }; properties = new List <Property> { new Property(Propertyname.VertexNormal, planeNormals), new Property(Propertyname.VertexTangent, tangents), new Property(Propertyname.NormalTexture, normalTexture), new Property(Propertyname.BaseColorTexture, baseColorTexture), }; var normal = properties.Find(e => e.name == Propertyname.VertexNormal); var tangent = properties.Find(e => e.name == Propertyname.VertexTangent); var normTex = properties.Find(e => e.name == Propertyname.NormalTexture); var colorTex = properties.Find(e => e.name == Propertyname.BaseColorTexture); specialCombos.Add(new List <Property>() { normal, normTex, colorTex }); specialCombos.Add(new List <Property>() { normal, colorTex }); removeCombos.Add(new List <Property>() { normal }); removeCombos.Add(new List <Property>() { tangent }); removeCombos.Add(new List <Property>() { normTex }); }
public Node_NegativeScale(List <string> imageList) : base(imageList) { modelGroupName = ModelGroupName.Node_NegativeScale; onlyBinaryProperties = false; Runtime.Image normalTexture = new Runtime.Image { Uri = imageList.Find(e => e.Contains("Normal_Nodes")) }; Runtime.Image baseColorTexture = new Runtime.Image { Uri = imageList.Find(e => e.Contains("BaseColor_Nodes")) }; Runtime.Image metallicRoughnessTexture = new Runtime.Image { Uri = imageList.Find(e => e.Contains("MetallicRoughness_Nodes")) }; usedTextures.Add(normalTexture); usedTextures.Add(baseColorTexture); usedTextures.Add(metallicRoughnessTexture); Runtime.GLTF defaultModel = Common.MultiNode(); // Only used to get the default tangent and normal values List <Vector3> normals = new List <Vector3>(defaultModel.Scenes[0].Nodes[0].Mesh.MeshPrimitives[0].Normals); List <Vector4> tangents = new List <Vector4>(defaultModel.Scenes[0].Nodes[0].Mesh.MeshPrimitives[0].Tangents); var matrixT = Matrix4x4.CreateTranslation(new Vector3(0, 2, 0)); var matrixNegScale_X = Matrix4x4.Multiply(Matrix4x4.CreateScale(new Vector3(-1, 1, 1)), matrixT); var matrixNegScale_XY = Matrix4x4.Multiply(Matrix4x4.CreateScale(new Vector3(-1, -1, 1)), matrixT); var matrixNegScale_XYZ = Matrix4x4.Multiply(Matrix4x4.CreateScale(new Vector3(-1, -1, -1)), matrixT); requiredProperty = new List <Property> { new Property(Propertyname.Translation_Y, new Vector3(0, 2, 0), group: 1), new Property(Propertyname.BaseColorTexture, baseColorTexture), new Property(Propertyname.NormalTexture, normalTexture), new Property(Propertyname.MetallicRoughnessTexture, metallicRoughnessTexture), }; properties = new List <Property> { new Property(Propertyname.Matrix_X, matrixNegScale_X, group: 1), new Property(Propertyname.Matrix_XY, matrixNegScale_XY, group: 1), new Property(Propertyname.Matrix_XYZ, matrixNegScale_XYZ, group: 1), new Property(Propertyname.Scale_X, new Vector3(-1, 1, 1), group: 2), new Property(Propertyname.Scale_XY, new Vector3(-1, -1, 1), group: 2), new Property(Propertyname.Scale_XYZ, new Vector3(-1, -1, -1), group: 2), new Property(Propertyname.VertexNormal, normals), new Property(Propertyname.VertexTangent, tangents), }; var scale_X = properties.Find(e => e.name == Propertyname.Scale_X); var scale_XY = properties.Find(e => e.name == Propertyname.Scale_XY); var scale_XYZ = properties.Find(e => e.name == Propertyname.Scale_XYZ); var normal = properties.Find(e => e.name == Propertyname.VertexNormal); var tangent = properties.Find(e => e.name == Propertyname.VertexTangent); // Makes combos with both normals, and normals with tangents for each of the following scale values var scaleSets = new List <Property>() { scale_X, scale_XY, scale_XYZ, }; foreach (var scale in scaleSets) { specialCombos.Add(new List <Property>() { scale, normal, }); specialCombos.Add(new List <Property>() { scale, normal, tangent, }); } removeCombos.Add(new List <Property>() { normal, }); removeCombos.Add(new List <Property>() { tangent, }); }
public Mesh_Primitives(List <string> imageList) : base(imageList) { modelGroupName = ModelGroupName.Mesh_Primitives; onlyBinaryProperties = false; noPrerequisite = false; Runtime.Image figureIndicesPrimitive0 = new Runtime.Image { Uri = imageList.Find(e => e.Contains("Indices_Primitive0")) }; Runtime.Image figureIndicesPrimitive1 = new Runtime.Image { Uri = imageList.Find(e => e.Contains("Indices_Primitive1")) }; usedFigures.Add(figureIndicesPrimitive0); usedFigures.Add(figureIndicesPrimitive1); List <Vector3> primitive0Positions = new List <Vector3>() { new Vector3(-0.5f, -0.5f, 0.0f), new Vector3(0.5f, 0.5f, 0.0f), new Vector3(-0.5f, 0.5f, 0.0f) }; List <Vector3> primitive1Positions = new List <Vector3>() { new Vector3(-0.5f, -0.5f, 0.0f), new Vector3(0.5f, -0.5f, 0.0f), new Vector3(0.5f, 0.5f, 0.0f) }; List <int> primitiveTriangleIndices = new List <int> { 0, 1, 2, }; Runtime.MeshPrimitive primitive0Mesh = new Runtime.MeshPrimitive { Positions = primitive0Positions, Indices = primitiveTriangleIndices, }; Runtime.MeshPrimitive primitive1Mesh = new Runtime.MeshPrimitive { Positions = primitive1Positions, Indices = primitiveTriangleIndices, }; Vector4 colors0 = new Vector4(0.0f, 1.0f, 0.0f, 1.0f); Vector4 colors1 = new Vector4(0.0f, 0.0f, 1.0f, 1.0f); requiredProperty = new List <Property> { new Property(Propertyname.Material0WithBaseColorFactor, colors0), new Property(Propertyname.Material1WithBaseColorFactor, colors1), }; properties = new List <Property> { new Property(Propertyname.Primitive0_Material0BaseColorFactor, "Material 0", group: 2), new Property(Propertyname.Primitive0_Material1BaseColorFactor, "Material 1", group: 2), new Property(Propertyname.Primitive1_Material0BaseColorFactor, "Material 0", group: 3), new Property(Propertyname.Primitive1_Material1BaseColorFactor, "Material 1", group: 3), }; specialProperties = new List <Property> { new Property(Propertyname.Primitives_Split1, primitive0Mesh, group: 1), new Property(Propertyname.Primitives_Split2, primitive1Mesh, group: 1), }; var pri0mat0 = properties.Find(e => e.name == Propertyname.Primitive0_Material0BaseColorFactor); var pri0mat1 = properties.Find(e => e.name == Propertyname.Primitive0_Material1BaseColorFactor); var pri1mat0 = properties.Find(e => e.name == Propertyname.Primitive1_Material0BaseColorFactor); var pri1mat1 = properties.Find(e => e.name == Propertyname.Primitive1_Material1BaseColorFactor); specialCombos.Add(new List <Property>() { pri0mat1, pri1mat0 }); specialCombos.Add(new List <Property>() { pri0mat0, pri1mat1 }); foreach (var property in properties) // Removes the automatic combos { removeCombos.Add(new List <Property>() { property }); } }