Пример #1
0
 public static PrimitiveType MapFrom(PrimType primType)
 {
     switch (primType)
      {
          case PrimType.PointList:
              return PrimitiveType.PointList;
          case PrimType.LineList:
              return PrimitiveType.LineList;
          case PrimType.LineStrip:
              return PrimitiveType.LineStrip;
          case PrimType.TriangleList:
              return PrimitiveType.TriangleList;
          case PrimType.TriangleStrip:
              return PrimitiveType.TriangleStrip;
          case PrimType.TriangleFan:
              return PrimitiveType.TriangleFan;
          default:
              throw new ArgumentOutOfRangeException("primType");
      }
 }
Пример #2
0
        private static void HasCutHollowDimpleProfileCut(PrimType primType, Primitive prim, out bool hasCut, out bool hasHollow,
            out bool hasDimple, out bool hasProfileCut)
        {
            if (primType == PrimType.Box || primType == PrimType.Cylinder || primType == PrimType.Prism)
                hasCut = (prim.PrimData.ProfileBegin > 0f) || (prim.PrimData.ProfileEnd < 1f);
            else
                hasCut = (prim.PrimData.PathBegin > 0f) || (prim.PrimData.PathEnd < 1f);

            hasHollow = prim.PrimData.ProfileHollow > 0f;
            hasDimple = (prim.PrimData.ProfileBegin > 0f) || (prim.PrimData.ProfileEnd < 1f); // taken from llSetPrimitiveParms
            hasProfileCut = hasDimple; // Is it the same thing?
        }
Пример #3
0
        public MRMPrim(MRMPrimFactory factory, string name, Vector3 position, Color colour = default(Color), Vector3 scale = default(Vector3), PrimType shape = PrimType.Unknown, Quaternion rotation = default(Quaternion))
        {
            _exists = true;
            _editable = true;
            _factory = factory;
            _name = name;
            _obj = factory.RegisterPrim(this, name, position);
            _id = _obj.GlobalID;
            _child = !ID.Equals(_obj.Root.GlobalID);

            Glow = 0d;
            Name = _name;
            Colour = !colour.Equals(default(Color)) ? colour : Color.White;
            Shape = !shape.Equals(PrimType.Unknown) ? shape : PrimType.Box;
            Rotation = !rotation.Equals(default(Quaternion)) ? rotation : Quaternion.Identity;
            Scale = !scale.Equals(default(Vector3)) ? scale : new Vector3(.5f, .5f, .5f);

            _updateListener = Update;
            factory.Update += _updateListener;
        }
Пример #4
0
        private void SetUpExistingObj(IObject obj, MRMPrimFactory factory)
        {
            _obj = obj;
            _exists = true;
            _editable = true;
            _name = _obj.Name;
            _pos =  _obj.WorldPosition;
            _child = !ID.Equals(obj.Root.GlobalID);
            bool attachment = _obj.IsAttachment;

            Vector3 shift = new Vector3();
            if (attachment && !_child) {
                //ATTACH_HUD_CENTER_2	    31	 HUD Center 2
                //ATTACH_HUD_TOP_RIGHT	    32	 HUD Top Right
                //ATTACH_HUD_TOP_CENTER	    33	 HUD Top
                //ATTACH_HUD_TOP_LEFT	    34	 HUD Top Left
                //ATTACH_HUD_CENTER_1	    35	 HUD Center
                //ATTACH_HUD_BOTTOM_LEFT	36	 HUD Bottom Left
                //ATTACH_HUD_BOTTOM	        37	 HUD Bottom
                //ATTACH_HUD_BOTTOM_RIGHT	38	 HUD Bottom Right
                switch (factory.World.Avatars.First(avatar => _obj.OwnerId.Equals(avatar.GlobalID)).Attachments.First(attach => attach.Asset.GlobalID.Equals(_obj.GlobalID)).Location) {
                    case 31: shift = new Vector3(0f, .5f, .5f); break;
                    case 32: shift = new Vector3(0f, 0f, 1f); break;
                    case 33: shift = new Vector3(0f, .5f, 1f); break;
                    case 34: shift = new Vector3(0f, 1f, 1f); break;
                    case 35: shift = new Vector3(0f, .5f, .5f); break;
                    case 36: shift = new Vector3(0f, 1f, 0f); break;
                    case 37: shift = new Vector3(0f, .5f, 0f); break;
                    //case 38: shift = new Vector3(0f, 0f, 0f); break;
                }
            }
            _factory.Update += () => {
                if (InWorld) {
                    if (!_editable) {
                        _name = Name;
                        _pos = Pos;
                        _scale = Scale;
                        _shape = Shape;
                        _colour = Colour;
                    }
                    if (attachment && !_child) {
                        Vector3 scale = _obj.Scale;
                        if (scale.Y < 1 && scale.Z < 1) {
                            Vector3 local = _obj.OffsetPosition + shift;
                            Vector3 newLocal = local;

                            float y = scale.Y / 2;
                            float z = scale.Z / 2;

                            //TODO Look into using texture stretch data to figure out screen ratio
                            //if (local.Y + y > .5f)
                            //    newLocal.Y = .5f - y;
                            //else
                            if (local.Y - y < 0f)
                                newLocal.Y = y;

                            if (local.Z + z > 1f)
                                newLocal.Z = 1 - z;
                            else if (local.Z - z < 0f)
                                newLocal.Z = z;

                            //TODO Look into using texture stretch data to figure out screen ratio
                            if (local != newLocal)
                                _obj.WorldPosition = newLocal - shift;
                        }
                    }
                }
            };

            _updateListener = Update;
            factory.Update += _updateListener;
        }
Пример #5
0
        private void UpdateNotEditable()
        {
            if (_obj == null)
            {
                return;
            }
            if (!_obj.Exists)
            {
                _obj = _factory.RenewObject(ID);
                if (_OnWorldTouch != null)
                {
                    _obj.OnTouch += TriggerTouched;
                }
            }

            try {
                string     name        = _obj.Name;
                string     description = _obj.Description;
                string     touchText   = _obj.TouchText;
                Color      colour      = _obj.Materials[0].Color;
                double     glow        = _obj.Materials[0].Bloom;
                Vector3    pos         = _obj.WorldPosition;
                Quaternion rotation    = _obj.WorldRotation;
                Vector3    scale       = _obj.Scale;
                PrimType   shape       = PrimType.Unknown;

                switch (_obj.Shape.PrimType)
                {
                case MRMPrimType.Box: shape = PrimType.Box; break;

                case MRMPrimType.Cylinder: shape = PrimType.Cylinder; break;

                case MRMPrimType.Prism: shape = PrimType.Prism; break;

                case MRMPrimType.Ring: shape = PrimType.Ring; break;

                case MRMPrimType.Sculpt: shape = PrimType.Sculpt; break;

                case MRMPrimType.Sphere: shape = PrimType.Sphere; break;

                case MRMPrimType.Torus: shape = PrimType.Torus; break;

                case MRMPrimType.Tube: shape = PrimType.Tube; break;
                }

                if (!name.Equals(_name))
                {
                    Name = _name;
                }
                if (!description.Equals(_description))
                {
                    Description = _description;
                }
                if (!touchText.Equals(_touchText))
                {
                    TouchText = _touchText;
                }
                if (!colour.ToArgb().Equals(_colour.ToArgb()))
                {
                    Colour = _colour;
                }
                if (!glow.Equals(_glow))
                {
                    Glow = _glow;
                }
                if (!pos.Equals(_pos))
                {
                    Pos = _pos;
                }
                if (!rotation.Equals(_rotation))
                {
                    Rotation = _rotation;
                }
                if (!shape.Equals(_shape))
                {
                    Shape = _shape;
                }
                if (!scale.Equals(_scale))
                {
                    Scale = _scale;
                }
            } catch (Exception e) {
                if (!InWorld)
                {
                    UpdateNotEditable();
                }
                else
                {
                    throw new Exception("Unable to update non-editable prim " + Name + ".", e);
                }
            }
        }
Пример #6
0
        /// <summary>
        /// Determines which primitive to draw based on input from the keyboard
        /// or game pad.
        /// </summary>
        private void CheckKeyboardInput()
        {
            lastKeyboardState = currentKeyboardState;
            currentKeyboardState = Keyboard.GetState();

            if (currentKeyboardState.IsKeyDown(Keys.A) &&
                 lastKeyboardState.IsKeyUp(Keys.A))
            {
                typeToDraw++;

                if (typeToDraw > PrimType.TriangleStrip)
                    typeToDraw = 0;
            }
        }
Пример #7
0
        public Primitive AddTempPrim(SimRegion R, string name, PrimType primType, Vector3 scale, Vector3 loc)
        {
            Primitive.ConstructionData CD = ObjectManager.BuildBasicShape(primType);
            CD.Material = Material.Light;
            CD.ProfileHole = HoleType.Triangle;

            bool success = false;

            Simulator simulator = R.TheSimulator;
            Primitive newPrim = null;
            // Register a handler for the creation event
            AutoResetEvent creationEvent = new AutoResetEvent(false);
            Quaternion rot = Quaternion.Identity;
            EventHandler<PrimEventArgs> callback =
                (s,e)=>//delegate(Simulator simulator0, Primitive prim, ulong regionHandle, ushort timeDilation)
                {
                    var regionHandle = e.Simulator.Handle;
                    var prim = e.Prim;
                    if (regionHandle != R.RegionHandle) return;
                    if ((loc - prim.Position).Length() > 3)
                    {
                        Debug("Not the prim " + (loc - prim.Position).Length());
                        return;
                    }
                    if (prim.PrimData.ProfileHole != HoleType.Triangle)
                    {
                        Debug("Not the prim?  prim.PrimData.ProfileHole != HoleType.Triangle: {0}!={1}",
                              prim.PrimData.ProfileHole, HoleType.Triangle);
                        // return;       //
                    }
                    if (Material.Light != prim.PrimData.Material)
                    {
                        Debug("Not the prim? Material.Light != prim.PrimData.Material: {0}!={1}", Material.Light,
                              prim.PrimData.Material);
                        // return;
                    }
                    if ((prim.Flags & PrimFlags.CreateSelected) == 0)
                    {
                        Debug("Not the prim? (prim.Flags & PrimFlags.CreateSelected) == 0) was {0}", prim.Flags);
                        // return;
                    }
                    if (primType != prim.Type)
                    {
                        Debug("Not the prim? Material.Light != prim.PrimData.Material: {0}!={1}", Material.Light,
                              prim.PrimData.Material);
                        // return;
                    }
                    //if (prim.Scale != scale) return;
                    //     if (prim.Rotation != rot) return;

                    //  if (Material.Light != prim.PrimData.Material) return;
                    //if (CD != prim.PrimData) return;
                    newPrim = prim;
                    creationEvent.Set();
                };

            client.Objects.ObjectUpdate += callback;

            // Start the creation setting process (with baking enabled or disabled)
            client.Objects.AddPrim(simulator, CD, UUID.Zero, loc, scale, rot,
                                   PrimFlags.CreateSelected | PrimFlags.Phantom | PrimFlags.Temporary);

            // Wait for the process to complete or time out
            if (creationEvent.WaitOne(1000 * 120, false))
                success = true;

            // Unregister the handler
            client.Objects.ObjectUpdate -= callback;

            // Return success or failure message
            if (!success)
            {
                Debug("Timeout on new prim " + name);
                return null;
            }
            uint LocalID = newPrim.LocalID;
            client.Objects.SetName(simulator, LocalID, name);
            client.Objects.SetPosition(simulator, LocalID, loc);
            client.Objects.SetScale(simulator, LocalID, scale, true, true);
            client.Objects.SetRotation(simulator, LocalID, rot);
            client.Objects.SetFlags(simulator, LocalID, false, true, true, false);
            return newPrim;
        }
Пример #8
0
        /// <summary>
        /// Tell us if this object has cut, hollow, dimple, and other factors affecting the number of faces 
        /// </summary>
        /// <param name="primType"></param>
        /// <param name="shape"></param>
        /// <param name="hasCut"></param>
        /// <param name="hasHollow"></param>
        /// <param name="hasDimple"></param>
        /// <param name="hasProfileCut"></param>
        protected static void HasCutHollowDimpleProfileCut(PrimType primType, PrimitiveBaseShape shape, out bool hasCut, out bool hasHollow,
            out bool hasDimple, out bool hasProfileCut)
        {
            if (primType == PrimType.BOX || primType == PrimType.CYLINDER || primType == PrimType.PRISM)
                hasCut = (shape.ProfileBegin > 0) || (shape.ProfileEnd > 0);
            else
                hasCut = (shape.PathBegin > 0) || (shape.PathEnd > 0);

            if (primType == PrimType.TORUS || primType == PrimType.RING || primType == PrimType.TUBE)
            {
                if ((shape.PathTaperX != 0) || (shape.PathTaperY != 0) || 
                         (shape.PathTwistBegin != shape.PathTwist) || (shape.PathSkew != 0) || 
                         (shape.PathRadiusOffset != 0) || (shape.PathRevolutions > 1))
                    hasCut = true;
            }

            hasHollow = shape.ProfileHollow > 0;
            hasDimple = (shape.ProfileBegin > 0) || (shape.ProfileEnd > 0); // taken from llSetPrimitiveParms
            hasProfileCut = hasDimple; // is it the same thing?
        }
Пример #9
0
 public static void TypesNotComparableError(PrimType type0, PrimType type1)
 {
     Console.WriteLine($"{type0} is not comparable with {type1}");
 }
Пример #10
0
 public Primitive(PrimType type)
 {
     Type    = type;
     Indices = new List <uint>();
     NodeIDs = new List <ushort>();
 }
Пример #11
0
 internal ZilHash(ZilAtom type, PrimType primtype, ZilObject primvalue)
     : base(type, primtype, primvalue)
 {
 }
Пример #12
0
        public MRMPrim(MRMPrimFactory factory, string name, Vector3 position, Color colour = default(Color), Vector3 scale = default(Vector3), PrimType shape = PrimType.Unknown, Quaternion rotation = default(Quaternion))
        {
            _exists   = true;
            _editable = true;
            _factory  = factory;
            _name     = name;
            _obj      = factory.RegisterPrim(this, name, position);
            _id       = _obj.GlobalID;
            _child    = !ID.Equals(_obj.Root.GlobalID);

            Glow     = 0d;
            Name     = _name;
            Colour   = !colour.Equals(default(Color)) ? colour : Color.White;
            Shape    = !shape.Equals(PrimType.Unknown) ? shape : PrimType.Box;
            Rotation = !rotation.Equals(default(Quaternion)) ? rotation : Quaternion.Identity;
            Scale    = !scale.Equals(default(Vector3)) ? scale : new Vector3(.5f, .5f, .5f);

            _updateListener = Update;
            factory.Update += _updateListener;
        }
Пример #13
0
        private void SetUpExistingObj(IObject obj, MRMPrimFactory factory)
        {
            _obj      = obj;
            _exists   = true;
            _editable = true;
            _name     = _obj.Name;
            _pos      = _obj.WorldPosition;
            _child    = !ID.Equals(obj.Root.GlobalID);
            bool attachment = _obj.IsAttachment;

            Vector3 shift = new Vector3();

            if (attachment && !_child)
            {
                //ATTACH_HUD_CENTER_2	    31	 HUD Center 2
                //ATTACH_HUD_TOP_RIGHT	    32	 HUD Top Right
                //ATTACH_HUD_TOP_CENTER	    33	 HUD Top
                //ATTACH_HUD_TOP_LEFT	    34	 HUD Top Left
                //ATTACH_HUD_CENTER_1	    35	 HUD Center
                //ATTACH_HUD_BOTTOM_LEFT	36	 HUD Bottom Left
                //ATTACH_HUD_BOTTOM	        37	 HUD Bottom
                //ATTACH_HUD_BOTTOM_RIGHT	38	 HUD Bottom Right
                switch (factory.World.Avatars.First(avatar => _obj.OwnerId.Equals(avatar.GlobalID)).Attachments.First(attach => attach.Asset.GlobalID.Equals(_obj.GlobalID)).Location)
                {
                case 31: shift = new Vector3(0f, .5f, .5f); break;

                case 32: shift = new Vector3(0f, 0f, 1f); break;

                case 33: shift = new Vector3(0f, .5f, 1f); break;

                case 34: shift = new Vector3(0f, 1f, 1f); break;

                case 35: shift = new Vector3(0f, .5f, .5f); break;

                case 36: shift = new Vector3(0f, 1f, 0f); break;

                case 37: shift = new Vector3(0f, .5f, 0f); break;
                    //case 38: shift = new Vector3(0f, 0f, 0f); break;
                }
            }
            _factory.Update += () => {
                if (InWorld)
                {
                    if (!_editable)
                    {
                        _name   = Name;
                        _pos    = Pos;
                        _scale  = Scale;
                        _shape  = Shape;
                        _colour = Colour;
                    }
                    if (attachment && !_child)
                    {
                        Vector3 scale = _obj.Scale;
                        if (scale.Y < 1 && scale.Z < 1)
                        {
                            Vector3 local    = _obj.OffsetPosition + shift;
                            Vector3 newLocal = local;

                            float y = scale.Y / 2;
                            float z = scale.Z / 2;

                            //TODO Look into using texture stretch data to figure out screen ratio
                            //if (local.Y + y > .5f)
                            //    newLocal.Y = .5f - y;
                            //else
                            if (local.Y - y < 0f)
                            {
                                newLocal.Y = y;
                            }

                            if (local.Z + z > 1f)
                            {
                                newLocal.Z = 1 - z;
                            }
                            else if (local.Z - z < 0f)
                            {
                                newLocal.Z = z;
                            }

                            //TODO Look into using texture stretch data to figure out screen ratio
                            if (local != newLocal)
                            {
                                _obj.WorldPosition = newLocal - shift;
                            }
                        }
                    }
                }
            };

            _updateListener = Update;
            factory.Update += _updateListener;
        }
Пример #14
0
 public List<XNAPrimitiveShape> SetToGetData(OpenMetaverse.Rendering.FacetedMesh FM, PrimType PT)
 {
     List<XNAPrimitiveShape> XnaPrim = new List<XNAPrimitiveShape>();
         for (int i = 0; i < (int)PT; i++)
         {
             this.XnaPrimN.Center = FM.Faces[i].Center;
             this.XnaPrimN.Edge = FM.Faces[i].Edge;
             this.XnaPrimN.Indices = FM.Faces[i].Indices;
             this.XnaPrimN.TextureUUID = FM.Faces[i].TextureFace.TextureID;
             this.XnaPrimN.Vertices = FM.Faces[i].Vertices;
             XnaPrim.Add(this.XnaPrimN);
         }
         return XnaPrim;
 }
Пример #15
0
 public void VisitPrimTypeConstraint(PrimType primType)
 {
     result = new JObject {
         ["constraint"] = "primtype", ["primype"] = primType.ToString()
     };
 }
Пример #16
0
        private void BuildAndRez(PrimType primType)
        {
            float size, distance;
            if (!float.TryParse(tbox_Size.Text,  System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, out size))
            {
                instance.MainForm.TabConsole.DisplayNotificationInChat(pluginName + ": Invalid size", ChatBufferTextStyle.Error);
                return;
            }

            if (!float.TryParse(tbox_Distance.Text, System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, out distance))
            {
                instance.MainForm.TabConsole.DisplayNotificationInChat(pluginName + ": Invalid distance", ChatBufferTextStyle.Error);
                return;
            }

            Primitive.ConstructionData primData = ObjectManager.BuildBasicShape(primType);

            Vector3 rezpos = new Vector3(distance, 0, 0);
            rezpos = client.Self.SimPosition + rezpos * client.Self.Movement.BodyRotation;

            client.Objects.AddPrim(client.Network.CurrentSim, primData, UUID.Zero, rezpos, new Vector3(size), Quaternion.Identity);

            instance.MainForm.TabConsole.DisplayNotificationInChat(pluginName + ": Object built and rezzed", ChatBufferTextStyle.Normal);
        }
Пример #17
0
        private void BuildAndRez(PrimType primType)
        {
            float size, distance;

            size = (float)tbox_Size.Value;
            distance = (float)tbox_Distance.Value;

            Primitive.ConstructionData primData = ObjectManager.BuildBasicShape(primType);

            Vector3 rezpos = new Vector3(distance, 0, 0);
            rezpos = client.Self.SimPosition + rezpos * client.Self.Movement.BodyRotation;

            ObjectName = txt_ObjectName.Text;
            client.Objects.ObjectUpdate += new EventHandler<PrimEventArgs>(Objects_OnNewPrim);
            client.Objects.AddPrim(client.Network.CurrentSim, primData, UUID.Zero, rezpos, new Vector3(size), Quaternion.Identity);
            if (!primDone.WaitOne(10000, false))
                throw new Exception("Rez failed, timed out while creating the prim.");

            txt_ObjectName.Text = ObjectName;
        }
Пример #18
0
 protected ZilHashBase(ZilAtom type, PrimType primType, TPrim primValue)
 {
     this.type      = type;
     this.primType  = primType;
     this.primValue = primValue;
 }
Пример #19
0
        /// <summary>
        /// Setup construction data for a basic primitive shape
        /// </summary>
        /// <param name="type">Primitive shape to construct</param>
        /// <returns>Construction data that can be plugged into a <seealso cref="Primitive"/></returns>
        public static Primitive.ConstructionData BuildBasicShape(PrimType type)
        {
            Primitive.ConstructionData prim = new Primitive.ConstructionData();
            prim.PCode = PCode.Prim;
            prim.Material = Material.Wood;

            switch (type)
            {
                case PrimType.Box:
                    prim.ProfileCurve = ProfileCurve.Square;
                    prim.PathCurve = PathCurve.Line;
                    prim.ProfileEnd = 1f;
                    prim.PathEnd = 1f;
                    prim.PathScaleX = 1f;
                    prim.PathScaleY = 1f;
                    prim.PathRevolutions = 1f;
                    break;
                case PrimType.Cylinder:
                    prim.ProfileCurve = ProfileCurve.Circle;
                    prim.PathCurve = PathCurve.Line;
                    prim.ProfileEnd = 1f;
                    prim.PathEnd = 1f;
                    prim.PathScaleX = 1f;
                    prim.PathScaleY = 1f;
                    prim.PathRevolutions = 1f;
                    break;
                case PrimType.Prism:
                    prim.ProfileCurve = ProfileCurve.Square;
                    prim.PathCurve = PathCurve.Line;
                    prim.ProfileEnd = 1f;
                    prim.PathEnd = 1f;
                    prim.PathScaleX = 0f;
                    prim.PathScaleY = 0f;
                    prim.PathRevolutions = 1f;
                    break;
                case PrimType.Ring:
                    prim.ProfileCurve = ProfileCurve.EqualTriangle;
                    prim.PathCurve = PathCurve.Circle;
                    prim.ProfileEnd = 1f;
                    prim.PathEnd = 1f;
                    prim.PathScaleX = 1f;
                    prim.PathScaleY = 0.25f;
                    prim.PathRevolutions = 1f;
                    break;
                case PrimType.Sphere:
                    prim.ProfileCurve = ProfileCurve.HalfCircle;
                    prim.PathCurve = PathCurve.Circle;
                    prim.ProfileEnd = 1f;
                    prim.PathEnd = 1f;
                    prim.PathScaleX = 1f;
                    prim.PathScaleY = 1f;
                    prim.PathRevolutions = 1f;
                    break;
                case PrimType.Torus:
                    prim.ProfileCurve = ProfileCurve.Circle;
                    prim.PathCurve = PathCurve.Circle;
                    prim.ProfileEnd = 1f;
                    prim.PathEnd = 1f;
                    prim.PathScaleX = 1f;
                    prim.PathScaleY = 0.25f;
                    prim.PathRevolutions = 1f;
                    break;
                case PrimType.Tube:
                    prim.ProfileCurve = ProfileCurve.Square;
                    prim.PathCurve = PathCurve.Circle;
                    prim.ProfileEnd = 1f;
                    prim.PathEnd = 1f;
                    prim.PathScaleX = 1f;
                    prim.PathScaleY = 0.25f;
                    prim.PathRevolutions = 1f;
                    break;
                default:
                    throw new NotSupportedException("Unsupported shape: " + type.ToString());
            }

            return prim;
        }
Пример #20
0
 public Prim(PrimType type)
 {
     Type = type;
 }
Пример #21
0
        /// <summary>
        /// Determines which primitive to draw based on input from the keyboard
        /// or game pad.
        /// </summary>
        private void CheckGamePadInput()
        {
            lastGamePadState = currentGamePadState;
            currentGamePadState = GamePad.GetState(PlayerIndex.One);

            if (((currentGamePadState.Buttons.A == ButtonState.Pressed)) &&
                 (lastGamePadState.Buttons.A == ButtonState.Released))
            {
                typeToDraw++;

                if (typeToDraw > PrimType.TriangleStrip)
                    typeToDraw = 0;
            }
        }
Пример #22
0
 private void SetInWorldShape(PrimType shape)
 {
     switch (shape) {
         case PrimType.Box: _obj.Shape.PrimType = MRMPrimType.Box; break;
         case PrimType.Cylinder: _obj.Shape.PrimType = MRMPrimType.Cylinder; break;
         case PrimType.Prism: _obj.Shape.PrimType = MRMPrimType.Prism; break;
         case PrimType.Ring: _obj.Shape.PrimType = MRMPrimType.Ring; break;
         case PrimType.Sculpt: _obj.Shape.PrimType = MRMPrimType.Sculpt; break;
         case PrimType.Sphere: _obj.Shape.PrimType = MRMPrimType.Sphere; break;
         case PrimType.Torus: _obj.Shape.PrimType = MRMPrimType.Torus; break;
         case PrimType.Tube: _obj.Shape.PrimType = MRMPrimType.Tube; break;
     }
 }
Пример #23
0
        /// <summary>
        /// Tell us if this object has cut, hollow, dimple, and other factors affecting the number of faces 
        /// </summary>
        /// <param name="primType"></param>
        /// <param name="shape"></param>
        /// <param name="hasCut"></param>
        /// <param name="hasHollow"></param>
        /// <param name="hasDimple"></param>
        /// <param name="hasProfileCut"></param>
        protected static void HasCutHollowDimpleProfileCut(PrimType primType, PrimitiveBaseShape shape, out bool hasCut, out bool hasHollow,
            out bool hasDimple, out bool hasProfileCut)
        {
            if (primType == PrimType.BOX
                ||
                primType == PrimType.CYLINDER
                ||
                primType == PrimType.PRISM)

                hasCut = (shape.ProfileBegin > 0) || (shape.ProfileEnd > 0);
            else
                hasCut = (shape.PathBegin > 0) || (shape.PathEnd > 0);

            hasHollow = shape.ProfileHollow > 0;
            hasDimple = (shape.ProfileBegin > 0) || (shape.ProfileEnd > 0); // taken from llSetPrimitiveParms
            hasProfileCut = hasDimple; // is it the same thing?
        }
Пример #24
0
        /// <param name="primFactory">The factory that will be used to interact with the world.</param>
        public MRMPrimCached(IMRMPrimFactory primFactory, string name, Vector3 pos = default(Vector3), Color colour = default(Color), Vector3 scale = default(Vector3), PrimType shape = PrimType.Unknown, Quaternion rotation = default(Quaternion))
        {
            _exists        = true;
            _factory       = primFactory;
            _name          = name;
            _colour        = colour.Equals(default(Color)) ? Color.White : colour;
            _defaultColour = colour.Equals(default(Color)) ? Color.White : colour;
            _pos           = pos.Equals(default(Vector3)) ? new Vector3(125f, 125f, 25f) : pos;
            _scale         = scale.Equals(default(Vector3)) ? new Vector3(.5f, .5f, .5f) : scale;
            _shape         = shape == PrimType.Unknown ? PrimType.Box : shape;
            _rotation      = rotation == default(Quaternion) ? Quaternion.Identity : rotation;

            _description = "";
            _touchText   = "";
            _glow        = 0d;

            //Create the primitive in world
            _obj = primFactory.RegisterPrim(this, Update);
            _id  = _obj.GlobalID;

            Editable = true;

            //Set up the primitive with the given values
            if (!InWorld)
            {
                throw new Exception("Primitive was not created correctly in world.");
            }
            UpdateNotEditable();
        }