public static HalcyonPrimitiveBaseShape GetRootAsHalcyonPrimitiveBaseShape(ByteBuffer _bb, HalcyonPrimitiveBaseShape obj) { return(obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
/// <summary> /// Maps the given sceneobjectpart to a flatbuffer primitive /// </summary> /// <param name="sop">The scene object to be serialized</param> /// <param name="builder">A FlatBufferBuilder that has been reset</param> /// <param name="close">Whether to close the buffer or not</param> /// <returns>A flatbuffer primitive</returns> public static Offset <HalcyonPrimitive> MapPartToFlatbuffer(SceneObjectPart sop, FlatBufferBuilder builder, bool close = false) { var angularVelocity = Vector3.CreateVector3(builder, sop.PhysicalAngularVelocity.X, sop.PhysicalAngularVelocity.Y, sop.PhysicalAngularVelocity.Z); var angularVelocityTarget = Vector3.CreateVector3(builder, sop.AngularVelocity.X, sop.AngularVelocity.Y, sop.AngularVelocity.Z); var creatorId = HalcyonPrimitive.CreateCreatorIdVector(builder, sop.CreatorID.GetBytes()); var description = builder.CreateString(sop.Description); var groupPosition = Vector3.CreateVector3(builder, sop.GroupPosition.X, sop.GroupPosition.Y, sop.GroupPosition.Z); var id = HalcyonPrimitive.CreateIdVector(builder, sop.UUID.GetBytes()); var name = builder.CreateString(sop.Name); var offsetPosition = Vector3.CreateVector3(builder, sop.OffsetPosition.X, sop.OffsetPosition.Y, sop.OffsetPosition.Z); var rotationOffset = Quaternion.CreateQuaternion(builder, sop.RotationOffset.X, sop.RotationOffset.Y, sop.RotationOffset.Z, sop.RotationOffset.W); var scale = Vector3.CreateVector3(builder, sop.Scale.X, sop.Scale.Y, sop.Scale.Z); var extraParams = HalcyonPrimitiveBaseShape.CreateExtraParamsVector(builder, sop.Shape.ExtraParams); var lightColor = HalcyonPrimitiveBaseShape.CreateLightColorVector(builder, new [] { sop.Shape.LightColorA, sop.Shape.LightColorR, sop.Shape.LightColorG, sop.Shape.LightColorB }); var ss = sop.Shape; var projectionTextureId = HalcyonPrimitiveBaseShape.CreateProjectionTextureIdVector(builder, ss.ProjectionTextureUUID.GetBytes()); var shapeScale = Vector3.CreateVector3(builder, ss.Scale.X, ss.Scale.Y, ss.Scale.Z); var sculptTextureId = HalcyonPrimitiveBaseShape.CreateSculptTextureVector(builder, ss.SculptTexture.GetBytes()); var textureEntry = HalcyonPrimitiveBaseShape.CreateTextureEntryVector(builder, ss.TextureEntry); HalcyonPrimitiveBaseShape.StartHalcyonPrimitiveBaseShape(builder); HalcyonPrimitiveBaseShape.AddExtraParams(builder, extraParams); HalcyonPrimitiveBaseShape.AddFlexiDrag(builder, ss.FlexiDrag); HalcyonPrimitiveBaseShape.AddFlexiEntry(builder, ss.FlexiEntry); HalcyonPrimitiveBaseShape.AddFlexiForceX(builder, ss.FlexiForceX); HalcyonPrimitiveBaseShape.AddFlexiForceY(builder, ss.FlexiForceY); HalcyonPrimitiveBaseShape.AddFlexiForceZ(builder, ss.FlexiForceZ); HalcyonPrimitiveBaseShape.AddFlexiGravity(builder, ss.FlexiGravity); HalcyonPrimitiveBaseShape.AddFlexiSoftness(builder, ss.FlexiSoftness); HalcyonPrimitiveBaseShape.AddFlexiTension(builder, ss.FlexiTension); HalcyonPrimitiveBaseShape.AddFlexiWind(builder, ss.FlexiWind); HalcyonPrimitiveBaseShape.AddHighLodBytes(builder, ss.HighLODBytes); HalcyonPrimitiveBaseShape.AddHollowShape(builder, (HollowShape)ss.HollowShape); HalcyonPrimitiveBaseShape.AddLightColor(builder, lightColor); HalcyonPrimitiveBaseShape.AddLightCutoff(builder, ss.LightCutoff); HalcyonPrimitiveBaseShape.AddLightEntry(builder, ss.LightEntry); HalcyonPrimitiveBaseShape.AddLightIntensity(builder, ss.LightIntensity); HalcyonPrimitiveBaseShape.AddLightRadius(builder, ss.LightRadius); HalcyonPrimitiveBaseShape.AddLowLodBytes(builder, ss.LowLODBytes); HalcyonPrimitiveBaseShape.AddLowestLodBytes(builder, ss.LowestLODBytes); HalcyonPrimitiveBaseShape.AddMidLodBytes(builder, ss.MidLODBytes); HalcyonPrimitiveBaseShape.AddPathBegin(builder, ss.PathBegin); HalcyonPrimitiveBaseShape.AddPathCurve(builder, ss.PathCurve); HalcyonPrimitiveBaseShape.AddPathEnd(builder, ss.PathEnd); HalcyonPrimitiveBaseShape.AddPathRadiusOffset(builder, ss.PathRadiusOffset); HalcyonPrimitiveBaseShape.AddPathRevolutions(builder, ss.PathRevolutions); HalcyonPrimitiveBaseShape.AddPathScaleX(builder, ss.PathScaleX); HalcyonPrimitiveBaseShape.AddPathScaleY(builder, ss.PathScaleY); HalcyonPrimitiveBaseShape.AddPathShearX(builder, ss.PathShearX); HalcyonPrimitiveBaseShape.AddPathShearY(builder, ss.PathShearY); HalcyonPrimitiveBaseShape.AddPathTaperX(builder, ss.PathTaperX); HalcyonPrimitiveBaseShape.AddPathTaperY(builder, ss.PathTaperY); HalcyonPrimitiveBaseShape.AddPathTwist(builder, ss.PathTwist); HalcyonPrimitiveBaseShape.AddPathTwistBegin(builder, ss.PathTwistBegin); HalcyonPrimitiveBaseShape.AddPathSkew(builder, ss.PathSkew); HalcyonPrimitiveBaseShape.AddPcode(builder, ss.PCode); HalcyonPrimitiveBaseShape.AddProfileBegin(builder, ss.ProfileBegin); HalcyonPrimitiveBaseShape.AddProfileCurve(builder, ss.ProfileCurve); HalcyonPrimitiveBaseShape.AddProfileEnd(builder, ss.ProfileEnd); HalcyonPrimitiveBaseShape.AddProfileHollow(builder, ss.ProfileHollow); HalcyonPrimitiveBaseShape.AddProfileShape(builder, (ProfileShape)ss.ProfileShape); HalcyonPrimitiveBaseShape.AddProjectionAmbiance(builder, ss.ProjectionAmbiance); HalcyonPrimitiveBaseShape.AddProjectionEntry(builder, ss.ProjectionEntry); HalcyonPrimitiveBaseShape.AddProjectionFocus(builder, ss.ProjectionFocus); HalcyonPrimitiveBaseShape.AddProjectionFov(builder, ss.ProjectionFOV); HalcyonPrimitiveBaseShape.AddProjectionTextureId(builder, projectionTextureId); HalcyonPrimitiveBaseShape.AddScale(builder, shapeScale); HalcyonPrimitiveBaseShape.AddSculptEntry(builder, ss.SculptEntry); HalcyonPrimitiveBaseShape.AddSculptTexture(builder, sculptTextureId); HalcyonPrimitiveBaseShape.AddSculptType(builder, ss.SculptType); HalcyonPrimitiveBaseShape.AddState(builder, ss.State); HalcyonPrimitiveBaseShape.AddTextureEntry(builder, textureEntry); HalcyonPrimitiveBaseShape.AddVertexCount(builder, ss.VertexCount); var baseShapeOffset = HalcyonPrimitiveBaseShape.EndHalcyonPrimitiveBaseShape(builder); HalcyonPrimitive.StartHalcyonPrimitive(builder); HalcyonPrimitive.AddAngularVelocity(builder, angularVelocity); HalcyonPrimitive.AddAngularVelocityTarget(builder, angularVelocityTarget); HalcyonPrimitive.AddCreatorId(builder, creatorId); HalcyonPrimitive.AddDescription(builder, description); HalcyonPrimitive.AddGroupPosition(builder, groupPosition); HalcyonPrimitive.AddId(builder, id); HalcyonPrimitive.AddLinkNumber(builder, sop.LinkNum); HalcyonPrimitive.AddLocalId(builder, sop.LocalId); HalcyonPrimitive.AddName(builder, name); HalcyonPrimitive.AddObjectFlags(builder, sop.ObjectFlags); HalcyonPrimitive.AddOffsetPosition(builder, offsetPosition); HalcyonPrimitive.AddParentId(builder, sop.ParentID); HalcyonPrimitive.AddRotationOffset(builder, rotationOffset); HalcyonPrimitive.AddScale(builder, scale); HalcyonPrimitive.AddShape(builder, baseShapeOffset); var offset = HalcyonPrimitive.EndHalcyonPrimitive(builder); if (close) { HalcyonPrimitive.FinishHalcyonPrimitiveBuffer(builder, offset); } return(offset); }