Exemple #1
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);
            }
        }
Exemple #2
0
        void IRenderable.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);

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

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

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

                m_actorMesh.Render(view.ViewMatrix, view.ProjMatrix, trs);
            }
            else
            {
                m_objRender.Render(view.ViewMatrix, view.ProjMatrix, trs);
            }
        }
Exemple #3
0
        public override void Draw(WSceneView view)
        {
            if (HasBrazier() && m_brazierModel != null)
            {
                // Draw the brazier.
                Matrix4 trs = Matrix4.CreateFromQuaternion(Transform.Rotation) * Matrix4.CreateTranslation(Transform.Position);

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

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

                if (IsSelected)
                {
                    m_brazierModel.Tick(1 / (float)60);
                }

                m_brazierModel.Render(view.ViewMatrix, view.ProjMatrix, trs);
            }

            // Draw the region that is lit up.
            base.Draw(view);
        }
Exemple #4
0
        public override void SetTimeOfDay(float timeOfDay)
        {
            base.SetTimeOfDay(timeOfDay);

            List <J3DNode> m_roomModelNodes = GetChildrenOfType <J3DNode>();

            if (EnvironmentLighting != null)
            {
                var curLight = EnvironmentLighting.Lerp(EnvironmentLightingConditions.WeatherPreset.Default, true, timeOfDay);
                foreach (J3DNode node in m_roomModelNodes)
                {
                    J3D model = node.Model;
                    if (model.Name == "model")
                    {
                        model.SetTevColorOverride(0, curLight.RoomLightColor);
                        model.SetTevkColorOverride(0, curLight.RoomAmbientColor);
                    }
                    else if (model.Name == "model1")
                    {
                        model.SetTevColorOverride(0, curLight.WaveColor);
                        model.SetTevkColorOverride(0, curLight.OceanColor);
                    }
                    else if (model.Name == "model3")
                    {
                        model.SetTevColorOverride(0, curLight.DoorBackfill);
                    }
                }

                var childActors = GetChildrenOfType <VisibleDOMNode>();
                foreach (var child in childActors)
                {
                    child.ColorOverrides.SetTevColorOverride(0, curLight.ShadowColor);
                    child.ColorOverrides.SetTevkColorOverride(0, curLight.ActorAmbientColor);
                }
            }
        }
Exemple #5
0
        public override void Draw(WSceneView view)
        {
            base.Draw(view);

            if (m_liftControlMesh == null || Path == null)
            {
                return;
            }

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

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

            var points = Path.GetPoints();

            for (int pathPointIndex = 2; pathPointIndex < 4; pathPointIndex++)
            {
                if (pathPointIndex >= points.Count)
                {
                    break;
                }
                PathPoint_v2 point = points[pathPointIndex];

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

                m_liftControlMesh.Render(view.ViewMatrix, view.ProjMatrix, trs);
            }
        }
Exemple #6
0
 private void ApplyLightOverrides(WLinearColor tev_override, WLinearColor tev_k_override)
 {
     m_Model.SetTevColorOverride(0, tev_override);
     m_Model.SetTevkColorOverride(0, tev_k_override);
 }
Exemple #7
0
        public override void Draw(WSceneView view)
        {
            base.Draw(view); // Draw the default editor cube to represent the bridge entity itself so that can still be clicked.

            if (m_plankMesh == null || Path == null)
            {
                return;
            }
            var points = Path.GetPoints();

            if (points.Count < 2)
            {
                return;
            }

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

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

            if (IsSelected)
            {
                m_plankMesh.Tick(1 / (float)60);
            }

            Vector3 p1           = points[0].Transform.Position;
            Vector3 p2           = points[1].Transform.Position;
            Vector3 bridge_delta = p2 - p1;

            float spacing_multiplier = 47f;

            if (bridge_delta.Length > 1300.0)
            {
                spacing_multiplier += 3f;
            }
            int     num_planks  = (int)(bridge_delta.Length / (1.5 * spacing_multiplier));
            Vector3 plank_delta = bridge_delta / (num_planks - 1);

            float      y_rot          = (float)Math.Atan2(bridge_delta.X, bridge_delta.Z);
            Quaternion yRot           = Quaternion.FromAxisAngle(Vector3.UnitY, y_rot);
            Vector3    plank_delta_xz = Vector3.Transform(plank_delta, yRot.Inverted());
            float      x_rot          = (float)-Math.Atan2(plank_delta_xz.Y, plank_delta_xz.Z);
            Quaternion xRot           = Quaternion.FromAxisAngle(Vector3.UnitX, x_rot);
            Quaternion plankRotation  = yRot * xRot;

            Vector3 plankScale = new Vector3(1.0f, 1.0f, 1.5f);

            for (int plank_i = 0; plank_i < num_planks; plank_i++)
            {
                Vector3 plankPosition = p1 + (plank_delta * plank_i);

                Matrix4 trs = Matrix4.CreateScale(plankScale) * Matrix4.CreateFromQuaternion(plankRotation) * Matrix4.CreateTranslation(plankPosition);

                m_plankMesh.Render(view.ViewMatrix, view.ProjMatrix, trs);
            }
        }