Exemplo n.º 1
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;
        }
Exemplo n.º 2
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;
        }
Exemplo n.º 3
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);
                }
            }
        }