Пример #1
0
        public override void SpawnNode(GameWorld world)
        {
            if (!world.IsPresentationEnabled)
            {
                return;
            }

            light = new OmniLight();

            light.Intensity   = LightPresetColor.GetColor(LightPreset, Intensity);;
            light.Position    = WorldMatrix.TranslationVector;
            light.RadiusOuter = Radius;
            light.RadiusInner = 0;

            world.Game.RenderSystem.RenderWorld.LightSet.OmniLights.Add(light);
        }
Пример #2
0
        public override void DrawNode(GameWorld world, DebugRender dr, Color color, bool selected)
        {
            var transform = WorldMatrix;

            var lightColor = LightPresetColor.GetColor(LightPreset, Intensity);

            var max = Math.Max(Math.Max(lightColor.Red, lightColor.Green), Math.Max(lightColor.Blue, 1));

            var dispColor = new Color((byte)(lightColor.Red / max * 255), (byte)(lightColor.Green / max * 255), (byte)(lightColor.Blue / max * 255), (byte)255);

            dr.DrawPoint(transform.TranslationVector, 1, color, 1);

            if (selected)
            {
                dr.DrawSphere(transform.TranslationVector, Radius, dispColor);
            }
            else
            {
            }
        }
Пример #3
0
        public override void DrawNode(GameWorld world, DebugRender dr, Color color, bool selected)
        {
            var transform = WorldMatrix;

            var lightColor = LightPresetColor.GetColor(LightPreset, Intensity);;

            var max = Math.Max(Math.Max(lightColor.Red, lightColor.Green), Math.Max(lightColor.Blue, 1));

            var dispColor = new Color((byte)(lightColor.Red / max * 255), (byte)(lightColor.Green / max * 255), (byte)(lightColor.Blue / max * 255), (byte)255);

            dr.DrawPoint(transform.TranslationVector, 1, color, 2);

            if (selected)
            {
                var frustum = new BoundingFrustum(SpotView * SpotProjection);

                var points = frustum.GetCorners();

                dr.DrawLine(points[0], points[1], color);
                dr.DrawLine(points[1], points[2], color);
                dr.DrawLine(points[2], points[3], color);
                dr.DrawLine(points[3], points[0], color);

                dr.DrawLine(points[4], points[5], color);
                dr.DrawLine(points[5], points[6], color);
                dr.DrawLine(points[6], points[7], color);
                dr.DrawLine(points[7], points[4], color);

                dr.DrawLine(points[0], points[4], color);
                dr.DrawLine(points[1], points[5], color);
                dr.DrawLine(points[2], points[6], color);
                dr.DrawLine(points[3], points[7], color);
            }
            else
            {
            }
        }
Пример #4
0
        public override void SpawnNode(GameWorld world)
        {
            if (!world.IsPresentationEnabled)
            {
                return;
            }

            var lightSet = world.Game.RenderSystem.RenderWorld.LightSet;

            var index = lightSet.SpotAtlas.IndexOf(SpotMaskName);

            if (index < 0)
            {
                Log.Warning("Can not spawn spot light with spot mask : {0}", SpotMaskName);
                return;
            }

            light = new SpotLight();

            float n = NearPlane;
            float f = FarPlane;
            float w = (float)Math.Tan(MathUtil.DegreesToRadians(FovHorizontal / 2)) * Radius / 32.0f;
            float h = (float)Math.Tan(MathUtil.DegreesToRadians(FovVertical / 2)) * Radius / 32.0f;

            light.Intensity    = LightPresetColor.GetColor(LightPreset, Intensity);;
            light.SpotView     = SpotView;
            light.Projection   = SpotProjection;
            light.RadiusOuter  = Radius;
            light.RadiusInner  = 0;
            light.TextureIndex = index;

            light.DepthBias = DepthBias;
            light.SlopeBias = SlopeBias;

            world.Game.RenderSystem.RenderWorld.LightSet.SpotLights.Add(light);
        }