Пример #1
0
        public override void Render(Camera camera)
        {
            modelAnim.Update();
            modelAnim.SetupIdle(sro);

            sro.RenderColor = Classification.ColorVector4(Color);
            Matrix matrixRender = this.matrixSro * world;

            sro.Render(camera, ref matrixRender, null);
        }
Пример #2
0
        }   // end of RenderObj c'tor

        public override void Render(Camera camera)
        {
            if (!parent.Visible)
            {
                return;
            }

            Frustum.CullResult cull = camera.Frustum.CullTest(parent.BoundingSphere.Center + parent.Movement.Position, parent.BoundingSphere.Radius);
            if (cull != Frustum.CullResult.TotallyOutside)
            {
                sro.PreRender   = parent.PreRender;
                sro.Animators   = parent.Animators;
                sro.RenderColor = parent.Classification.ColorRGBA;
                GameActor parentActor = parent as GameActor;
                if (parentActor != null)
                {
                    sro.GlowEmissiveColor = parentActor.GlowEmissivity * parentActor.GlowColor;
                }

                Matrix local = Matrix.CreateScale(parent.ReScale) * parent.Movement.LocalMatrix;

                // Add in squashed transform if appropriate.
                if (parentActor.SquashScale != Vector3.One)
                {
                    if (parent.CurrentState == GameThing.State.Squashed && false)
                    {
                        // Translate down to the ground.
                        // TODO (****) should probably make this happen smoothly.
                        float terrainHeight = Boku.SimWorld.Terra.Terrain.GetHeight(parent.Movement.Position);
                        if (terrainHeight > 0)
                        {
                            Vector3 translation = local.Translation;
                            translation.Z            = terrainHeight;
                            local.Translation        = translation;
                            parent.Movement.Altitude = translation.Z;
                        }
                    }
                    local = Matrix.CreateScale(parentActor.SquashScale) * local;
                }

                sro.Render(camera, ref local, null);

                sro.PreRender = null;

                parent.DebugDisplay(camera);
            }
        }