internal override bool ParseNodeBodyElement(string id, VRMLParser parser) { int line = parser.Line; if (id == "children") { List <X3DNode> nodes = parser.ParseSFNodeOrMFNodeValue(); foreach (X3DNode node in nodes) { X3DChildNode child = node as X3DChildNode; if (child == null) { parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line); } else { Children.Add(child); } } } else if (id == "bboxCenter") { BBoxCenter = parser.ParseSFVec3fValue(); } else if (id == "bboxSize") { BBoxSize = parser.ParseSFVec3fValue(); } else { return(false); } return(true); }
internal override bool ParseNodeBodyElement(string id, VRMLParser parser) { int line = parser.Line; if (id == "children") { List <X3DNode> nodes = parser.ParseSFNodeOrMFNodeValue(); foreach (X3DNode node in nodes) { X3DChildNode child = node as X3DChildNode; if (child == null) { parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line); } else { Children.Add(child); } } } else if (id == "isPickable") { IsPickable = parser.ParseBoolValue(); } else if (id == "layout") { X3DNode node = parser.ParseSFNodeValue(); if (node != null) { Layout = node as X3DLayoutNode; if (Layout == null) { parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line); } } } else if (id == "viewport") { X3DNode node = parser.ParseSFNodeValue(); if (node != null) { Viewport = node as X3DViewportNode; if (Viewport == null) { parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line); } } } else { return(false); } return(true); }
public static Scene Parse(StreamReader stream, Func <double, bool> progressInfo, VRMLParserErrorHandling errorHandling) { Scene ret = new Scene(); VRMLParser parser = new VRMLParser(stream, progressInfo, errorHandling); foreach (X3DNode node in parser.nodes) { X3DChildNode child = node as X3DChildNode; if (child == null) { continue; // TODO } ret.Nodes.Add(child); } return(ret); }
internal override bool ParseNodeBodyElement(string id, VRMLParser parser) { int line = parser.Line; if (id == "center") { Center = parser.ParseSFVec3fStringValue(); } else if (id == "child1Url") { Child1URL.AddRange(parser.ParseSFStringOrMFStringValue()); } else if (id == "child2Url") { Child2URL.AddRange(parser.ParseSFStringOrMFStringValue()); } else if (id == "child3Url") { Child3URL.AddRange(parser.ParseSFStringOrMFStringValue()); } else if (id == "child4Url") { Child4URL.AddRange(parser.ParseSFStringOrMFStringValue()); } else if (id == "geoOrigin") { X3DNode node = parser.ParseSFNodeValue(); if (node != null) { GeoOrigin = node as IX3DGeoOriginNode; if (GeoOrigin == null) { parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line); } } } else if (id == "geoSystem") { if (wasGeoSystem) { GeoSystem.AddRange(parser.ParseSFStringOrMFStringValue()); } else { GeoSystem = parser.ParseSFStringOrMFStringValue(); } wasGeoSystem = true; } else if (id == "range") { Range = parser.ParseDoubleValue(); } else if (id == "rootUrl") { RootURL.AddRange(parser.ParseSFStringOrMFStringValue()); } else if (id == "rootNode") { List <X3DNode> nodes = parser.ParseSFNodeOrMFNodeValue(); foreach (X3DNode node in nodes) { X3DChildNode rn = node as X3DChildNode; if (rn == null) { parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line); } else { RootNode.Add(rn); } } } else if (id == "bboxCenter") { BBoxCenter = parser.ParseSFVec3fValue(); } else if (id == "bboxSize") { BBoxSize = parser.ParseSFVec3fValue(); } else { return(false); } return(true); }
internal override bool ParseNodeBodyElement(string id, VRMLParser parser) { int line = parser.Line; if (id == "address") { Address = parser.ParseStringValue(); } else if (id == "applicationID") { ApplicationID = parser.ParseIntValue(); } else if (id == "articulationParameterCount") { ArticulationParameterCount = parser.ParseIntValue(); } else if (id == "articulationParameterDesignatorArray") { ArticulationParameterDesignatorArray.AddRange(parser.ParseSFInt32OrMFInt32Value()); } else if (id == "articulationParameterChangeIndicatorArray") { ArticulationParameterChangeIndicatorArray.AddRange(parser.ParseSFInt32OrMFInt32Value()); } else if (id == "articulationParameterIdPartAttachedToArray") { ArticulationParameterIdPartAttachedToArray.AddRange(parser.ParseSFInt32OrMFInt32Value()); } else if (id == "articulationParameterTypeArray") { ArticulationParameterTypeArray.AddRange(parser.ParseSFInt32OrMFInt32Value()); } else if (id == "articulationParameterArray") { ArticulationParameterArray.AddRange(parser.ParseSFFloatOrMFFloatValue()); } else if (id == "center") { Center = parser.ParseSFVec3fValue(); } else if (id == "children") { List <X3DNode> nodes = parser.ParseSFNodeOrMFNodeValue(); foreach (X3DNode node in nodes) { X3DChildNode child = node as X3DChildNode; if (child == null) { parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line); } else { Children.Add(child); } } } else if (id == "collisionType") { CollisionType = parser.ParseIntValue(); } else if (id == "deadReckoning") { DeadReckoning = parser.ParseIntValue(); } else if (id == "detonationLocation") { DetonationLocation = parser.ParseSFVec3fValue(); } else if (id == "detonationRelativeLocation") { DetonationRelativeLocation = parser.ParseSFVec3fValue(); } else if (id == "detonationResult") { DetonationResult = parser.ParseIntValue(); } else if (id == "enabled") { Enabled = parser.ParseBoolValue(); } else if (id == "entityCategory") { EntityCategory = parser.ParseIntValue(); } else if (id == "entityCountry") { EntityCountry = parser.ParseIntValue(); } else if (id == "entityDomain") { EntityDomain = parser.ParseIntValue(); } else if (id == "entityExtra") { EntityExtra = parser.ParseIntValue(); } else if (id == "entityID") { EntityID = parser.ParseIntValue(); } else if (id == "entityKind") { EntityKind = parser.ParseIntValue(); } else if (id == "entitySpecific") { EntitySpecific = parser.ParseIntValue(); } else if (id == "entitySubCategory") { EntitySubCategory = parser.ParseIntValue(); } else if (id == "eventApplicationID") { EventApplicationID = parser.ParseIntValue(); } else if (id == "eventEntityID") { EventEntityID = parser.ParseIntValue(); } else if (id == "eventNumber") { EventNumber = parser.ParseIntValue(); } else if (id == "eventSiteID") { EventSiteID = parser.ParseIntValue(); } else if (id == "fired1") { Fired1 = parser.ParseBoolValue(); } else if (id == "fired2") { Fired2 = parser.ParseBoolValue(); } else if (id == "fireMissionIndex") { FireMissionIndex = parser.ParseIntValue(); } else if (id == "firingRange") { FiringRange = parser.ParseDoubleValue(); } else if (id == "firingRate") { FiringRate = parser.ParseIntValue(); } else if (id == "forceID") { ForceID = parser.ParseIntValue(); } else if (id == "fuse") { Fuse = parser.ParseIntValue(); } else if (id == "linearVelocity") { LinearVelocity = parser.ParseSFVec3fValue(); } else if (id == "linearAcceleration") { LinearAcceleration = parser.ParseSFVec3fValue(); } else if (id == "marking") { Marking = parser.ParseStringValue(); } else if (id == "multicastRelayHost") { MulticastRelayHost = parser.ParseStringValue(); } else if (id == "multicastRelayPort") { MulticastRelayPort = parser.ParseIntValue(); } else if (id == "munitionApplicationID") { MunitionApplicationID = parser.ParseIntValue(); } else if (id == "munitionEndPoint") { MunitionEndPoint = parser.ParseSFVec3fValue(); } else if (id == "munitionEntityID") { MunitionEntityID = parser.ParseIntValue(); } else if (id == "munitionQuantity") { MunitionQuantity = parser.ParseIntValue(); } else if (id == "munitionSiteID") { MunitionSiteID = parser.ParseIntValue(); } else if (id == "munitionStartPoint") { MunitionStartPoint = parser.ParseSFVec3fValue(); } else if (id == "networkMode") { NetworkMode = parser.ParseStringValue(); } else if (id == "port") { Port = parser.ParseIntValue(); } else if (id == "readInterval") { ReadInterval = parser.ParseDoubleValue(); } else if (id == "rotation") { Rotation = parser.ParseSFRotationValue(); } else if (id == "scale") { Scale = parser.ParseSFVec3fValue(); } else if (id == "scaleOrientation") { ScaleOrientation = parser.ParseSFRotationValue(); } else if (id == "siteID") { SiteID = parser.ParseIntValue(); } else if (id == "translation") { Translation = parser.ParseSFVec3fValue(); } else if (id == "warhead") { Warhead = parser.ParseIntValue(); } else if (id == "writeInterval") { WriteInterval = parser.ParseDoubleValue(); } else if (id == "bboxCenter") { BBoxCenter = parser.ParseSFVec3fValue(); } else if (id == "bboxSize") { BBoxSize = parser.ParseSFVec3fValue(); } else if (id == "rtpHeaderExpected") { RtpHeaderExpected = parser.ParseBoolValue(); } else { return(false); } return(true); }
internal override bool ParseNodeBodyElement(string id, VRMLParser parser) { int line = parser.Line; if (id == "centerOfMass") { CenterOfMass = parser.ParseSFVec3fValue(); } else if (id == "children") { List <X3DNode> nodes = parser.ParseSFNodeOrMFNodeValue(); foreach (X3DNode node in nodes) { X3DChildNode child = node as X3DChildNode; if (child == null) { parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line); } else { Children.Add(child); } } } else if (id == "coord") { X3DNode node = parser.ParseSFNodeValue(); if (node != null) { Coord = node as X3DCoordinateNode; if (Coord == null) { parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line); } } } else if (id == "displacers") { List <X3DNode> nodes = parser.ParseSFNodeOrMFNodeValue(); foreach (X3DNode node in nodes) { IX3DHAnimDisplacerNode displacer = node as IX3DHAnimDisplacerNode; if (displacer == null) { parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line); } else { Displacers.Add(displacer); } } } else if (id == "mass") { Mass = parser.ParseDoubleValue(); } else if (id == "momentsOfInertia") { if (wasMomentsOfInertia) { MomentsOfInertia.AddRange(parser.ParseSFFloatOrMFFloatValue()); } else { MomentsOfInertia = parser.ParseSFFloatOrMFFloatValue(); } wasMomentsOfInertia = true; } else if (id == "name") { Name = parser.ParseStringValue(); } else if (id == "bboxCenter") { BBoxCenter = parser.ParseSFVec3fValue(); } else if (id == "bboxSize") { BBoxSize = parser.ParseSFVec3fValue(); } else { return(false); } return(true); }
internal override bool ParseNodeBodyElement(string id, VRMLParser parser) { int line = parser.Line; if (id == "center") { Center = parser.ParseSFVec3fValue(); } else if (id == "info") { Info.AddRange(parser.ParseSFStringOrMFStringValue()); } else if (id == "joints") { List <X3DNode> nodes = parser.ParseSFNodeOrMFNodeValue(); foreach (X3DNode node in nodes) { IX3DHAnimJointNode joint = node as IX3DHAnimJointNode; if (joint == null) { parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line); } else { Joints.Add(joint); } } } else if (id == "name") { Name = parser.ParseStringValue(); } else if (id == "rotation") { Rotation = parser.ParseSFRotationValue(); } else if (id == "scale") { Scale = parser.ParseSFVec3fValue(); } else if (id == "scaleOrientation") { ScaleOrientation = parser.ParseSFRotationValue(); } else if (id == "segments") { List <X3DNode> nodes = parser.ParseSFNodeOrMFNodeValue(); foreach (X3DNode node in nodes) { IX3DHAnimeSegmentNode segment = node as IX3DHAnimeSegmentNode; if (segment == null) { parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line); } else { Segments.Add(segment); } } } else if (id == "sites") { List <X3DNode> nodes = parser.ParseSFNodeOrMFNodeValue(); foreach (X3DNode node in nodes) { IX3DHAnimSiteNode site = node as IX3DHAnimSiteNode; if (site == null) { parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line); } else { Sites.Add(site); } } } else if (id == "skeleton") { List <X3DNode> nodes = parser.ParseSFNodeOrMFNodeValue(); foreach (X3DNode node in nodes) { IX3DHAnimHumanoidSkeleton skeleton = node as IX3DHAnimHumanoidSkeleton; if (skeleton == null) { parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line); } else { Skeleton.Add(skeleton); } } } else if (id == "skin") { List <X3DNode> nodes = parser.ParseSFNodeOrMFNodeValue(); foreach (X3DNode node in nodes) { X3DChildNode skin = node as X3DChildNode; if (skin == null) { parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line); } else { Skin.Add(skin); } } } else if (id == "skinCoord") { X3DNode node = parser.ParseSFNodeValue(); if (node != null) { SkinCoord = node as X3DCoordinateNode; if (SkinCoord == null) { parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line); } } } else if (id == "skinNormal") { X3DNode node = parser.ParseSFNodeValue(); if (node != null) { SkinNormal = node as X3DNormalNode; if (SkinNormal == null) { parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line); } } } else if (id == "translation") { Translation = parser.ParseSFVec3fValue(); } else if (id == "version") { Version = parser.ParseStringValue(); } else if (id == "viewpoints") { List <X3DNode> nodes = parser.ParseSFNodeOrMFNodeValue(); foreach (X3DNode node in nodes) { X3DViewpointNode vp = node as X3DViewpointNode; // x3d-Spec specs. x3dHAnimSite change to interface if neccessary if (vp == null) { parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line); } else { Viewpoints.Add(vp); } } } else if (id == "bboxCenter") { BBoxCenter = parser.ParseSFVec3fValue(); } else if (id == "bboxSize") { BBoxSize = parser.ParseSFVec3fValue(); } else { return(false); } return(true); }
internal override bool ParseNodeBodyElement(string id, VRMLParser parser) { int line = parser.Line; if (id == "children") { List <X3DNode> nodes = parser.ParseSFNodeOrMFNodeValue(); foreach (X3DNode node in nodes) { X3DChildNode child = node as X3DShapeNode; if (child == null) { parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line); } else { Children.Add(child); } } } else if (id == "controlPoint") { object token = parser.PeekNextToken(); if (token is VRMLTokenIdKeywordOrFieldType) { X3DNode node = parser.ParseSFNodeValue(); if (node != null) { ControlPoint = node as X3DCoordinateNode; if (ControlPoint == null) { parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line); } } } else { x3dCoordinate coords = new x3dCoordinate(); coords.Point = parser.ParseSFVec3fOrMFVec3fValue(); ControlPoint = coords; } } else if (id == "inputCoord") { List <X3DNode> nodes = parser.ParseSFNodeOrMFNodeValue(); foreach (X3DNode node in nodes) { X3DCoordinateNode coord = node as X3DCoordinateNode; if (coord == null) { parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line); } else { InputCoord.Add(coord); } } } else if (id == "inputTransform") { List <X3DNode> nodes = parser.ParseSFNodeOrMFNodeValue(); foreach (X3DNode node in nodes) { IX3DCoordinateDeformerInputTransform transf = node as IX3DCoordinateDeformerInputTransform; if (transf == null) { parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line); } else { InputTransform.Add(transf); } } } else if (id == "outputCoord") { List <X3DNode> nodes = parser.ParseSFNodeOrMFNodeValue(); foreach (X3DNode node in nodes) { X3DCoordinateNode coord = node as X3DCoordinateNode; if (coord == null) { parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line); } else { OutputCoord.Add(coord); } } } else if (id == "weight") { Weight.AddRange(parser.ParseSFFloatOrMFFloatValue()); } else if (id == "bboxCenter") { BBoxCenter = parser.ParseSFVec3fValue(); } else if (id == "bboxSize") { BBoxSize = parser.ParseSFVec3fValue(); } else if (id == "uDimension") { UDimension = parser.ParseIntValue(); } else if (id == "uKnot") { UKnot.AddRange(parser.ParseSFFloatOrMFFloatValue()); } else if (id == "uOrder") { UOrder = parser.ParseIntValue(); } else if (id == "vDimension") { VDimension = parser.ParseIntValue(); } else if (id == "vKnot") { VKnot.AddRange(parser.ParseSFFloatOrMFFloatValue()); } else if (id == "vOrder") { VOrder = parser.ParseIntValue(); } else if (id == "wDimension") { WDimension = parser.ParseIntValue(); } else if (id == "wKnot") { WKnot.AddRange(parser.ParseSFFloatOrMFFloatValue()); } else if (id == "wOrder") { WOrder = parser.ParseIntValue(); } else { return(false); } return(true); }
public void RemoveChildren(X3DChildNode child) { Children.Remove(child); }
public void AddChildren(X3DChildNode child) { Children.Add(child); }
internal override bool ParseNodeBodyElement(string id, VRMLParser parser) { int line = parser.Line; if (id == "center") { Center = parser.ParseSFVec3fValue(); } else if (id == "children") { List <X3DNode> nodes = parser.ParseSFNodeOrMFNodeValue(); foreach (X3DNode node in nodes) { X3DChildNode child = node as IX3DHAnimJointChildren; if (child == null) { parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line); } else { Children.Add(child); } } } else if (id == "displacers") { List <X3DNode> nodes = parser.ParseSFNodeOrMFNodeValue(); foreach (X3DNode node in nodes) { IX3DHAnimDisplacerNode displacer = node as IX3DHAnimDisplacerNode; if (displacer == null) { parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line); } else { Displacers.Add(displacer); } } } else if (id == "limitOrientation") { LimitOrientation = parser.ParseSFRotationValue(); } else if (id == "llimit") { Llimit.AddRange(parser.ParseSFFloatOrMFFloatValue()); } else if (id == "name") { Name = parser.ParseStringValue(); } else if (id == "rotation") { Rotation = parser.ParseSFRotationValue(); } else if (id == "scale") { Scale = parser.ParseSFVec3fValue(); } else if (id == "scaleOrientation") { ScaleOrientation = parser.ParseSFRotationValue(); } else if (id == "skinCoordIndex") { SkinCoordIndex.AddRange(parser.ParseSFInt32OrMFInt32Value()); } else if (id == "skinCoordWeight") { SkinCoordWeight.AddRange(parser.ParseSFFloatOrMFFloatValue()); } else if (id == "stiffness") { if (wasStiffness) { Stiffness.AddRange(parser.ParseSFFloatOrMFFloatValue()); } else { Stiffness = parser.ParseSFFloatOrMFFloatValue(); } wasStiffness = true; } else if (id == "translation") { Translation = parser.ParseSFVec3fValue(); } else if (id == "ulimit") { Ulimit.AddRange(parser.ParseSFFloatOrMFFloatValue()); } else if (id == "bboxCenter") { BBoxCenter = parser.ParseSFVec3fValue(); } else if (id == "bboxSize") { BBoxSize = parser.ParseSFVec3fValue(); } else { return(false); } return(true); }
internal override bool ParseNodeBodyElement(string id, VRMLParser parser) { int line = parser.Line; if (id == "children") { List <X3DNode> nodes = parser.ParseSFNodeOrMFNodeValue(); foreach (X3DNode node in nodes) { X3DChildNode child = node as X3DChildNode; if (child == null) { parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line); } else { Children.Add(child); } } } else if (id == "geoCenter") { GeoCenter = parser.ParseSFVec3fValue(); } else if (id == "rotation") { Rotation = parser.ParseSFRotationValue(); } else if (id == "scale") { Scale = parser.ParseSFVec3fValue(); } else if (id == "scaleOrientation") { ScaleOrientation = parser.ParseSFRotationValue(); } else if (id == "translation") { Translation = parser.ParseSFVec3fValue(); } else if (id == "bboxCenter") { BBoxCenter = parser.ParseSFVec3fValue(); } else if (id == "bboxSize") { BBoxSize = parser.ParseSFVec3fValue(); } else if (id == "geoOrigin") { X3DNode node = parser.ParseSFNodeValue(); if (node != null) { GeoOrigin = node as IX3DGeoOriginNode; if (GeoOrigin == null) { parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line); } } } else if (id == "geoSystem") { if (wasGeoSystem) { GeoSystem.AddRange(parser.ParseSFStringOrMFStringValue()); } else { GeoSystem = parser.ParseSFStringOrMFStringValue(); } wasGeoSystem = true; } else { return(false); } return(true); }