Esempio n. 1
0
        public static void Initialize()
        {
            mieRT      = RenderingFunctions.CreateRenderTarget(Format.R16G16B16A16_Float, 128, 64);
            rayleighRT = RenderingFunctions.CreateRenderTarget(Format.R16G16B16A16_Float, 128, 64);
            // SpriteDrawer.AddInstance(rayleighRT.srv, 0.0f, 0.0f);


            moonTex          = TextureLoader.LoadTexture("sky/moon.png");
            glowTex          = TextureLoader.LoadTexture("sky/moonglow.png");
            starsTex         = TextureLoader.LoadTexture("sky/starfield.png");
            skyClouds1       = TextureLoader.LoadTexture("sky/clouds1.png");
            skyClouds2       = TextureLoader.LoadTexture("sky/clouds2.png");
            skyBoxCloudsMesh = WorldData.GetObject("skyDomeClouds") as Model;

            GenerateDome();
            GenerateMoon();



            lensFlare = new LensFlare();
            lensFlare.Initialize();

            SetSettings(WorldData.GetObject("defaultWeather") as WeatherSetting);
            Rain.Initialize();
            Snow.Initialize();
            Wind.Initalize();
            Lightning.Initalize();
        }
Esempio n. 2
0
        public static void Draw()
        {
            // Vector3.Backward = fix for bad model pivot.
            Matrix world = Matrix.Translation(Position);


            RenderingFunctions.RenderMesh2(model[0], Vector3.Zero, "SimpleTexturedQuad.fx", "RenderDiffOnly", world);
        }
Esempio n. 3
0
        public override void RenderDebugLightVolume(GameObjectReference objRef, Cell c, Vector4 GridColor)
        {
            Matrix m = GetLightVolumeMatrix(c, objRef.Position, objRef.EndPoint, objRef.MaxRange);

            RenderingFunctions.DrawLightVolume(DeferredRenderer.lightVolume[(int)LightType.Area], m, GridColor);
            RenderingFunctions.DrawLightVolume(DeferredRenderer.lightVolume[(int)LightType.Area], Matrix.Scaling(2, 2, 2) * WorldSpace.GetRealWorldMatrix(objRef.Position, c), GridColor);
            RenderingFunctions.DrawLightVolume(DeferredRenderer.lightVolume[(int)LightType.Area], Matrix.Scaling(2, 2, 2) * WorldSpace.GetRealWorldMatrix(objRef.EndPoint, c), GridColor);
        }
Esempio n. 4
0
        public override void RenderDebugLightVolume(GameObjectReference objRef, Cell c, Vector4 GridColor)
        {
            Matrix scale, translate, sphereMatWVP;

            translate    = WorldSpace.GetRealWorldMatrix(objRef.Position, c);
            scale        = Matrix.Scaling(objRef.MaxRange, objRef.MaxRange, objRef.MaxRange);
            sphereMatWVP = scale * translate;

            RenderingFunctions.DrawLightVolume(DeferredRenderer.lightVolume[(int)LightType.Point], sphereMatWVP, GridColor);
            RenderingFunctions.DrawLightVolume(DeferredRenderer.lightVolume[(int)LightType.Point], translate, GridColor);
        }
Esempio n. 5
0
        public override void RenderDebugLightVolume(GameObjectReference objRef, Cell c, Vector4 GridColor)
        {
            Vector3 max = DeferredRenderer.lightVolume[(int)LightType.Box].Mesh3d.bb.Maximum;
            Vector3 min = DeferredRenderer.lightVolume[(int)LightType.Box].Mesh3d.bb.Minimum;

            Matrix m = GetLightVolumeMatrix(c, objRef);

            Vector3 pos = objRef.Position;

            pos.Y += objRef.BoxHeight;
            RenderingFunctions.DrawLightVolume(DeferredRenderer.lightVolume[(int)LightType.Box], Matrix.Translation(WorldSpace.GetRealWorldPos(pos, c)), GridColor);
            RenderingFunctions.DrawLightVolume(DeferredRenderer.lightVolume[(int)LightType.Box], m, GridColor);

            RenderingFunctions.DrawLightVolume(DeferredRenderer.lightVolume[(int)LightType.Box], Matrix.Scaling(2, 2, 2) * Matrix.Translation(WorldSpace.GetRealWorldPos(objRef.Target, c)), GridColor);
        }
Esempio n. 6
0
        public static void Draw(Matrix mWorld)
        {
            Matrix w = Matrix.Translation(Position) * mWorld;

            w = w + Matrix.Translation(-WorldSpace.cellSize, 0, -WorldSpace.cellSize);
            VertexBufferBinding vbb = new VertexBufferBinding(vertices, Marshal.SizeOf(typeof(Vector4)), 0);

            Shader e = WorldData.GetObject("grid.fx") as Shader;

            if (e == null)
            {
                return;
            }
            e.GetVar("color").AsVector().Set(Global.GlobalSettings.GridColor);
            RenderingFunctions.RenderVertices(vbb, NumVerts, w, MeshInputElements10.PositionOnly4, "grid.fx", "Render");
        }
Esempio n. 7
0
        public override void RenderDebugLightVolume(GameObjectReference objRef, Cell c, Vector4 GridColor)
        {
            //if (targetMesh == null)
            //  targetMesh = new GameObjectRef(@"system/box.mesh", "box.mesh", MeshInputElements10.PositionOnly4);


            Model targetMesh = WorldData.GetObject("light_target") as Model;

            Matrix scale, rotate, translate, matWVP;
            float  fRadius = (float)Math.Tan(objRef.OuterAngle * 0.5f) * objRef.MaxRange;

            scale  = Matrix.Scaling(fRadius, objRef.MaxRange, fRadius);
            rotate = RotateToFace(WorldSpace.GetRealWorldPos(objRef.Position, c), WorldSpace.GetRealWorldPos(objRef.Target, c), Vector3.UnitY);

            translate = WorldSpace.GetRealWorldMatrix(objRef.Position, c);
            matWVP    = scale * rotate * translate;

            RenderingFunctions.DrawLightVolume(DeferredRenderer.lightVolume[(int)LightType.Spot], matWVP, GridColor);
            RenderingFunctions.DrawLightVolume(targetMesh, Matrix.Scaling(1, 1, 1) * WorldSpace.GetRealWorldMatrix(objRef.Target, c), GridColor);
        }
Esempio n. 8
0
        public static void DrawOrigin(Matrix mWorld)
        {
            Matrix world = Matrix.Scaling(2, 2, 2) * mWorld;

            RenderingFunctions.RenderMesh2(model[0], Vector3.Zero, "SimpleTexturedQuad.fx", "RenderDiffOnly", world);
        }