Ejemplo n.º 1
0
		/// <summary>
		/// Validation test constructor
		/// </summary>
		/// <param name="valid_parent">The parent collada element type to run this test for. Set to "All" to run regardless of parent type</param>
		/// <param name="field">The field to run the test on</param>
		public ColladaEmptyString(Enums.ColladaElementType valid_parent, ColladaObject field)
			: base(valid_parent)
		{
			testField = field;
		}
 /// <summary>
 /// Validation test constructor
 /// </summary>
 /// <param name="valid_parent">The parent collada element type to run this test for. Set to "All" to run regardless of parent type</param>
 /// <param name="field">The field to run the test on</param>
 public ColladaEmptyString(Enums.ColladaElementType valid_parent, ColladaObject field)
     : base(valid_parent)
 {
     testField = field;
 }
Ejemplo n.º 3
0
		/// <summary>
		/// Validation test constructor
		/// </summary>
		/// <param name="valid_parent">The parent collada element type to run this test for. Set to "All" to run regardless of parent type</param>
		/// <param name="field">The field to run the test on</param>
		public ColladaIsNull(Enums.ColladaElementType valid_parent, ColladaObject field)
			: base(valid_parent)
		{
			testField = field;
		}
Ejemplo n.º 4
0
 public ColladaLibraryAnimation(ref XmlTextReader reader, ColladaObject parent, ColladaScene scene)
     : base(ref reader, parent, scene, "library_animations")
 {
 }
Ejemplo n.º 5
0
            public ColladaNode(ref XmlTextReader reader, ColladaObject parent, ColladaScene scene)
                : base(ref reader, parent, scene, "node")
            {
                scene.nodes.Add(this);

                TreeName = treeName;
            }
Ejemplo n.º 6
0
 public ColladaControler(ref XmlTextReader reader, ColladaObject parent, ColladaScene scene)
     : base(ref reader, parent, scene, "controller")
 {
 }
Ejemplo n.º 7
0
 public ColladaInput(ref XmlTextReader reader,  ColladaObject parent, ColladaScene scene)
     : base(ref reader, parent, scene)
 {
 }
Ejemplo n.º 8
0
            public ColladaVertWeights(ref XmlTextReader reader,  ColladaObject parent, ColladaScene scene)
                : base(ref reader, parent, scene, "vertex_weights")
            {
                int groupCount = 0;
                ColladaInput jointIn = getInput("JOINT");
                ColladaInput weightIn = getInput("WEIGHT");

                float[] weights = weightIn.FloatAry;

                int groupOffset = jointIn.offset;
                int weightOffset = weightIn.offset;

                int vertexCount = vCounts.Length;
                int attributeCount = CalculateAttributeCount();
                int readerPos = 0;

                string[] boneNames = jointIn.NameAry;
                scene.colladaAnimationDataGenerator.boneNames = boneNames;

                groupCount = boneNames.Length;
                if (groupCount > maxAffBones)
                    groupCount = maxAffBones;

                float[][] tmpBoneWeights = new float[groupCount][];
                int[][] tmpBoneIds = new int[groupCount][];

                for (int i = 0; i < groupCount; i++)
                {
                    tmpBoneWeights[i] = new float[vertexCount];
                    tmpBoneIds[i] = new int[vertexCount];
                }

                for (int i = 0; i < vertexCount; i++)
                {
                    int curGroups = vCounts[i];
                    List<WeightJointPair> weightList = new List<WeightJointPair> { };

                    for (int j = 0; j < curGroups; j++)
                    {
                        int id = weightIndices[readerPos + groupOffset];

                        int weightIndex = weightIndices[readerPos + weightOffset];
                        float weight = weights[weightIndex];

                        weightList.Add(new WeightJointPair(id, weight));

                        readerPos += attributeCount;
                    }

                    weightList.Sort(CompareByWeight);

                    float totalWeight = 0;
                    for (int j = 0; j < groupCount && j < curGroups; j++)
                    {
                        totalWeight += weightList[j].weight;
                    }
                    for (int j = 0; j < groupCount && j < curGroups; j++)
                    {

                            tmpBoneWeights[j][i] = weightList[j].weight / totalWeight;
                            tmpBoneIds[j][i] = weightList[j].joint + 1;
                    }
                }

                scene.boneWeights = tmpBoneWeights;
                scene.boneIds = tmpBoneIds;
            }
Ejemplo n.º 9
0
 public ColladaAnimation(ref XmlTextReader reader, ColladaObject parent, ColladaScene scene)
     : base(ref reader, parent, scene, "animation")
 {
     ColladaLibraryAnimation libPar = (ColladaLibraryAnimation)parent;
     libPar.animations.Add(this);
 }
Ejemplo n.º 10
0
 public ColladaSource(ref XmlTextReader reader, ColladaObject parent, ColladaScene scene)
     : base(ref reader, parent, scene, "source")
 {
 }
Ejemplo n.º 11
0
 public ColladaVerts(ref XmlTextReader reader, ColladaObject parent, ColladaScene scene)
     : base(ref reader, parent, scene, "vertices")
 {
 }
Ejemplo n.º 12
0
            public ColladaPolys(ref XmlTextReader reader, ColladaObject parent, ColladaScene scene)
                : base(ref reader,parent, scene, "polylist")
            {
                int position = 0;
                foreach (var vCount in vCounts)
                {
                    Polys.Add(new Face(vCount,position));
                    position += vCount;
                }

                int attributeCount = CalculateAttributeCount();

                ColladaInput vertIn = getInput("VERTEX");
                ColladaInput normalIn = getInput("NORMAL");
                ColladaInput texIn = getInput("TEXCOORD");

                scene.positionVboDataList = vertIn.Vector3Data;
                scene.normalVboDataList = normalIn.Vector3Data;
                scene.textureVboDataList = GenericMethods.FlipY(texIn.Vector2Data);

                int offset = vertIn.offset;
                int normaloffset = normalIn.offset;
                int texoffset = texIn.offset;

                foreach (var Poly in Polys)
                {
                    int basepos = Poly.position * attributeCount;
                    foreach (var vert in Poly.Vertice)
                    {
                        vert.Vi = rawIndices[basepos + offset];
                        vert.Ni = rawIndices[basepos + normaloffset];
                        vert.Ti = rawIndices[basepos + texoffset];
                        basepos += attributeCount;
                    }
                }

                scene.FaceList = Polys;
            }
Ejemplo n.º 13
0
            public ColladaObject(ref XmlTextReader reader, ColladaObject parent, ColladaScene scene)
            {
                this.parent = parent;
                parent.childs.Add(this);

                this.scene = scene;
                scene.colladaObjects.Add(this);

                while (reader.MoveToNextAttribute())
                {
                    specialHeaderAttributes(ref reader);
                    genericHeaderAttributes(ref reader);
                }
            }
Ejemplo n.º 14
0
            public ColladaObject(ref XmlTextReader reader,  ColladaObject parent, ColladaScene scene, string nodename)
            {
                this.parent = parent;
                if(parent != null)
                    parent.childs.Add(this);

                this.scene = scene;
                scene.colladaObjects.Add(this);

                this.nodename = nodename;

                while (reader.MoveToNextAttribute())
                {
                    specialHeaderAttributes(ref reader);
                    genericHeaderAttributes(ref reader);
                }
                while (reader.Read() && !(reader.Name == nodename && reader.NodeType == XmlNodeType.EndElement) )
                {
                    specialAttributes(ref reader);
                    genericAttributes(ref reader);
                }
            }
 /// <summary>
 /// Validation test constructor
 /// </summary>
 /// <param name="valid_parent">The parent collada element type to run this test for. Set to "All" to run regardless of parent type</param>
 /// <param name="field">The field to run the test on</param>
 /// <param name="valid_values">A list of values to check for</param>
 public ColladaHasValidValue(Enums.ColladaElementType valid_parent, ColladaObject field, List <T> valid_values)
     : base(valid_parent)
 {
     testField   = field;
     validValues = valid_values;
 }
Ejemplo n.º 16
0
 /// <summary>
 /// Validation test constructor
 /// </summary>
 /// <param name="valid_parent">The parent collada element type to run this test for. Set to "All" to run regardless of parent type</param>
 /// <param name="field">The field to run the test on</param>
 public ColladaIsNull(Enums.ColladaElementType valid_parent, ColladaObject field)
     : base(valid_parent)
 {
     testField = field;
 }