コード例 #1
0
        internal override bool ParseNodeBodyElement(string id, VRMLParser parser)
        {
            int line = parser.Line;

            if (id == "angularDampingFactor")
            {
                AngularDampingFactor = parser.ParseDoubleValue();
            }
            else if (id == "angularVelocity")
            {
                AngularVelocity = parser.ParseSFVec3fValue();
            }
            else if (id == "autoDamp")
            {
                AutoDamp = parser.ParseBoolValue();
            }
            else if (id == "autoDisable")
            {
                AutoDisable = parser.ParseBoolValue();
            }
            else if (id == "centerOfMass")
            {
                CenterOfMass = parser.ParseSFVec3fValue();
            }
            else if (id == "disableAngularSpeed")
            {
                DisableAngularSpeed = parser.ParseDoubleValue();
            }
            else if (id == "disableLinearSpeed")
            {
                DisableLinearSpeed = parser.ParseDoubleValue();
            }
            else if (id == "disableTime")
            {
                DisableTime = parser.ParseDoubleValue();
            }
            else if (id == "enabled")
            {
                Enabled = parser.ParseBoolValue();
            }
            else if (id == "finiteRotationAxis")
            {
                FiniteRotationAxis = parser.ParseSFVec3fValue();
            }
            else if (id == "fixed")
            {
                Fixed = parser.ParseBoolValue();
            }
            else if (id == "forces")
            {
                Forces.AddRange(parser.ParseSFVec3fOrMFVec3fValue());
            }
            else if (id == "geometry")
            {
                List <X3DNode> nodes = parser.ParseSFNodeOrMFNodeValue();
                foreach (X3DNode node in nodes)
                {
                    X3DNBodyCollidableNode nbcn = node as X3DNBodyCollidableNode;
                    if (nbcn == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                    else
                    {
                        Geometry.Add(nbcn);
                    }
                }
            }
            else if (id == "inertia")
            {
                Inertia = parser.ParseSFMatrix3fValue();
            }
            else if (id == "linearDampingFactor")
            {
                LinearDampingFactor = parser.ParseDoubleValue();
            }
            else if (id == "linearVelocity")
            {
                LinearVelocity = parser.ParseSFVec3fValue();
            }
            else if (id == "mass")
            {
                Mass = parser.ParseDoubleValue();
            }
            else if (id == "massDensityModel")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    MassDensityModel = node as X3DGeometryNode;
                    if (MassDensityModel == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else if (id == "orientation")
            {
                Orientation = parser.ParseSFRotationValue();
            }
            else if (id == "position")
            {
                Position = parser.ParseSFVec3fValue();
            }
            else if (id == "torques")
            {
                Torques.AddRange(parser.ParseSFVec3fOrMFVec3fValue());
            }
            else if (id == "useFiniteRotation")
            {
                UseFiniteRotation = parser.ParseBoolValue();
            }
            else if (id == "useGlobalGravity")
            {
                UseGlobalGravity = parser.ParseBoolValue();
            }
            else
            {
                return(false);
            }
            return(true);
        }
コード例 #2
0
		internal override bool ParseNodeBodyElement(string id, VRMLParser parser)
		{
			int line=parser.Line;

			if(id=="angularDampingFactor") AngularDampingFactor=parser.ParseDoubleValue();
			else if(id=="angularVelocity") AngularVelocity=parser.ParseSFVec3fValue();
			else if(id=="autoDamp") AutoDamp=parser.ParseBoolValue();
			else if(id=="autoDisable") AutoDisable=parser.ParseBoolValue();
			else if(id=="centerOfMass") CenterOfMass=parser.ParseSFVec3fValue();
			else if(id=="disableAngularSpeed") DisableAngularSpeed=parser.ParseDoubleValue();
			else if(id=="disableLinearSpeed") DisableLinearSpeed=parser.ParseDoubleValue();
			else if(id=="disableTime") DisableTime=parser.ParseDoubleValue();
			else if(id=="enabled") Enabled=parser.ParseBoolValue();
			else if(id=="finiteRotationAxis") FiniteRotationAxis=parser.ParseSFVec3fValue();
			else if(id=="fixed") Fixed=parser.ParseBoolValue();
			else if(id=="forces") Forces.AddRange(parser.ParseSFVec3fOrMFVec3fValue());
			else if(id=="geometry")
			{
				List<X3DNode> nodes=parser.ParseSFNodeOrMFNodeValue();
				foreach(X3DNode node in nodes)
				{
					X3DNBodyCollidableNode nbcn=node as X3DNBodyCollidableNode;
					if(nbcn==null) parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
					else Geometry.Add(nbcn);
				}
			}
			else if(id=="inertia") Inertia=parser.ParseSFMatrix3fValue();
			else if(id=="linearDampingFactor") LinearDampingFactor=parser.ParseDoubleValue();
			else if(id=="linearVelocity") LinearVelocity=parser.ParseSFVec3fValue();
			else if(id=="mass") Mass=parser.ParseDoubleValue();
			else if(id=="massDensityModel")
			{
				X3DNode node=parser.ParseSFNodeValue();
				if(node!=null)
				{
					MassDensityModel=node as X3DGeometryNode;
					if(MassDensityModel==null) parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
				}
			}
			else if(id=="orientation") Orientation=parser.ParseSFRotationValue();
			else if(id=="position") Position=parser.ParseSFVec3fValue();
			else if(id=="torques") Torques.AddRange(parser.ParseSFVec3fOrMFVec3fValue());
			else if(id=="useFiniteRotation") UseFiniteRotation=parser.ParseBoolValue();
			else if(id=="useGlobalGravity") UseGlobalGravity=parser.ParseBoolValue();
			else return false;
			return true;
		}