Example #1
0
        public WDOMNode(WWorld world)
        {
            m_world = world;

            m_children = new List <WDOMNode>();
            Transform  = new WTransform();
        }
Example #2
0
        public override void Draw(WSceneView view)
        {
            var bbox = GetBoundingBox();

            m_world.DebugDrawBox(bbox.Center, (bbox.Max - bbox.Min) / 2, Transform.Rotation, (Flags & NodeFlags.Selected) == NodeFlags.Selected ? WLinearColor.White : WLinearColor.Black, 0, 0);

            int spawnPatternIndex = (int)SpawnPattern;
            int groupIndex        = kFoliageSpawnPatternGroupIndexes[spawnPatternIndex];
            int numModels         = kFoliageSpawnPatternNumModels[spawnPatternIndex];

            Vector3[] offsetsForGroup = kGrassSpawnOffsets[groupIndex];

            for (int i = 0; i < numModels; i++)
            {
                Vector3 modelOffset = offsetsForGroup[i];

                WTransform transform = new WTransform();

                if (Type == TypeEnum.Tree)
                {
                    // Only trees rotate, and they only rotate the positions of each tree model around the entity's center, not the individual trees themselves.
                    Quaternion rotation = Quaternion.Identity.FromEulerAngles(new Vector3(0, Transform.Rotation.ToEulerAngles().Y, 0));
                    modelOffset = Vector3.Transform(modelOffset, rotation);
                }

                transform.Position = Transform.Position + modelOffset;

                Matrix4 trs = Matrix4.CreateScale(transform.LocalScale) * Matrix4.CreateFromQuaternion(transform.Rotation) * Matrix4.CreateTranslation(transform.Position);

                m_objRender.Render(view.ViewMatrix, view.ProjMatrix, trs);
            }
        }
Example #3
0
        public override void Draw(WSceneView view)
        {
            base.Draw(view);
            if (m_stairMesh == null)
            {
                return;
            }

            for (int i = 0; i < 4; i++)
            {
                if (ColorOverrides.ColorsEnabled[i])
                {
                    m_stairMesh.SetTevColorOverride(i, ColorOverrides.Colors[i]);
                }

                if (ColorOverrides.ConstColorsEnabled[i])
                {
                    m_stairMesh.SetTevkColorOverride(i, ColorOverrides.ConstColors[i]);
                }
            }

            for (int i = 1; i < GetNumStairs() + 1; i++)
            {
                WTransform transform = new WTransform();
                float      yRot      = Transform.Rotation.ToEulerAngles().Y + 180;
                transform.Rotation = Quaterniond.FromAxisAngle(Vector3d.UnitY, yRot / 180f * Math.PI);
                Vector3 positionOffset = new Vector3(0, i * 25f, i * -50f);
                positionOffset     = Vector3.Transform(positionOffset, transform.Rotation.ToSinglePrecision());
                transform.Position = Transform.Position + positionOffset;

                Matrix4 trs = Matrix4.CreateScale(transform.LocalScale) * Matrix4.CreateFromQuaternion(transform.Rotation.ToSinglePrecision()) * Matrix4.CreateTranslation(transform.Position);

                m_stairMesh.Render(view.ViewMatrix, view.ProjMatrix, trs);
            }
        }
Example #4
0
        public WDOMNode(WWorld world)
        {
            m_world = world;

            m_children        = new ObservableCollection <WDOMNode>();
            Transform         = new WTransform();
            VisibleProperties = new List <PropertyDefinition>();

            IsVisible = true;
        }
Example #5
0
        //public IEnumerator GetEnumerator()
        //{
        //    foreach (WTransform trns in m_children)
        //    {
        //        yield return trns;
        //    }
        //}

        public override bool Equals(object o)
        {
            WTransform otherTrns = o as WTransform;

            if (otherTrns == null)
            {
                return(false);
            }

            return(Position == otherTrns.Position && Rotation == otherTrns.Rotation && LocalScale == otherTrns.LocalScale);
        }
Example #6
0
 public WCamera()
 {
     Transform      = new WTransform();
     bEnableUpdates = true;
 }
Example #7
0
 public WCamera()
 {
     Transform = new WTransform();
 }