Ejemplo n.º 1
0
        public override void Init()
        {
            Content.ContentPath = "Data";
            Instance = this;

            scene = new Scene();
            scene.View = this;
            scene.Camera = new LookatCartesianCamera
            {
                Position = new Vector3(10, 10, 10),
                Lookat = Vector3.Zero,
                ZFar = 100
            };
            //heightmap = TextureUtil.ToHeightmap(Content.Peek<Texture>(new TextureFromFile("testheightmap.png")), 100);
            heightmap = new Graphics.Software.Texel.R32F[250, 250];
            texture = new Graphics.Software.Texture<Graphics.Software.Texel.R32F>(heightmap);

            scene.Add(ground = new TestGround
            {
                Size = new SizeF(100, 100),
                Heightmap = heightmap,
                NPieces = new Size(20, 20),
                Height = 1
            });
            ground.ConstructPieces();

            heightmapEditor = new Graphics.Editors.GroundTextureEditor
            {
                Camera = scene.Camera,
                Viewport = Viewport,
                SoftwareTexture = new[] {texture},
                Position = ground.Translation,
                Size = ground.Size,
                GroundIntersect = new WorldViewProbe(this, scene.Camera)
                {
                    WorldProbe = new GroundProbe()
                }
            };
            heightmapEditor.TextureValuesChanged += new Graphics.Editors.TextureValuesChangedEventHandler((o, e) =>
            {
                ground.UpdatePatches(e.ChangedRegion);
            });
            InputHandler = new WalkaroundCameraInputHandler
            {
                Camera = (LookatCartesianCamera) scene.Camera,
                InputHandler = heightmapEditor
            };

            renderer = new Graphics.Renderer.Renderer(Device9) { Scene = scene, StateManager = new Device9StateManager(Device9) };
            renderer.Initialize(this);

            sceneRendererConnector = new SortedTestSceneRendererConnector
            {
                Scene = scene,
                Renderer = renderer
            };
            sceneRendererConnector.Initialize();
        }
Ejemplo n.º 2
0
        public override void Init()
        {
            Content.ContentPath = "Data";
            Instance            = this;

            scene        = new Scene();
            scene.View   = this;
            scene.Camera = new LookatCartesianCamera()
            {
                Position    = new Vector3(10, 10, 10),
                Lookat      = Vector3.Zero,
                ZFar        = 100,
                AspectRatio = AspectRatio
            };
            sceneQuadtree = new Common.Quadtree <Entity>(0, 0, 100, 100, 10);
            sbau          = new SceneBVHAutoSyncer(scene, sceneQuadtree);
            //heightmap = TextureUtil.ToHeightmap(Content.Peek<Texture>(new TextureFromFile("testheightmap.png")), 100);
            heightmap = new Graphics.Software.Texel.R32F[250, 250];
            texture   = new Graphics.Software.Texture <Graphics.Software.Texel.R32F>(heightmap);

            renderer = new Graphics.Renderer.Renderer(Device9)
            {
                Scene = scene, StateManager = new Device9StateManager(Device9)
            };
            renderer.Settings.ShadowQuality = Settings.ShadowQualities.NoShadows;
            renderer.Initialize(this);

            sceneRendererConnector = new SortedTestSceneRendererConnector
            {
                Renderer = renderer,
                Scene    = scene
            };
            sceneRendererConnector.Initialize();

            scene.Add(ground = new TestGround
            {
                Size      = new SizeF(100, 100),
                Heightmap = heightmap,
                NPieces   = new Size(20, 20),
                Height    = 1
            });
            ground.ConstructPieces();

            InputHandler = new WalkaroundCameraInputHandler
            {
                Camera = (LookatCartesianCamera)scene.Camera
            };
        }
Ejemplo n.º 3
0
        public override void Init()
        {
            Content.ContentPath = "Data";
            Instance            = this;

            scene        = new Scene();
            scene.View   = this;
            scene.Camera = new LookatCartesianCamera
            {
                Position = new Vector3(10, 10, 10),
                Lookat   = Vector3.Zero,
                ZFar     = 100
            };
            //heightmap = TextureUtil.ToHeightmap(Content.Peek<Texture>(new TextureFromFile("testheightmap.png")), 100);
            heightmap = new Graphics.Software.Texel.R32F[250, 250];
            texture   = new Graphics.Software.Texture <Graphics.Software.Texel.R32F>(heightmap);

            scene.Add(ground = new TestGround
            {
                Size      = new SizeF(100, 100),
                Heightmap = heightmap,
                NPieces   = new Size(20, 20),
                Height    = 1
            });
            ground.ConstructPieces();

            heightmapEditor = new Graphics.Editors.GroundTextureEditor
            {
                Camera          = scene.Camera,
                Viewport        = Viewport,
                SoftwareTexture = new[] { texture },
                Position        = ground.Translation,
                Size            = ground.Size,
                GroundIntersect = new WorldViewProbe(this, scene.Camera)
                {
                    WorldProbe = new GroundProbe()
                }
            };
            heightmapEditor.TextureValuesChanged += new Graphics.Editors.TextureValuesChangedEventHandler((o, e) =>
            {
                ground.UpdatePatches(e.ChangedRegion);
            });
            InputHandler = new WalkaroundCameraInputHandler
            {
                Camera       = (LookatCartesianCamera)scene.Camera,
                InputHandler = heightmapEditor
            };

            renderer = new Graphics.Renderer.Renderer(Device9)
            {
                Scene = scene, StateManager = new Device9StateManager(Device9)
            };
            renderer.Initialize(this);

            sceneRendererConnector = new SortedTestSceneRendererConnector
            {
                Scene    = scene,
                Renderer = renderer
            };
            sceneRendererConnector.Initialize();
        }
Ejemplo n.º 4
0
        public override void Init()
        {
            Content.ContentPath = "Data";
            Instance = this;

            scene = new Scene();
            scene.View = this;
            scene.Camera = new LookatCartesianCamera()
            {
                Position = new Vector3(10, 10, 10),
                Lookat = Vector3.Zero,
                ZFar = 100,
                AspectRatio = AspectRatio
            };
            //heightmap = TextureUtil.ToHeightmap(Content.Peek<Texture>(new TextureFromFile("testheightmap.png")), 100);
            texture = new Graphics.Software.Texture<Graphics.Software.Texel.A8R8G8B8>(new Graphics.Software.Texel.A8R8G8B8[250, 250]);

            scene.Add(ground = new TestGround
            {
                Size = new SizeF(100, 100),
                //Texture = new SingleColorTexture(Color.Orange),
                NPieces = new Size(20, 20),

            });
            ground.ConstructPieces();

            dxTexture = texture.ToTexture9(Device9);

            ground.Texture = new UnmanagedResource<SlimDX.Direct3D9.Texture, SlimDX.Direct3D10.Texture2D> { Resource9 = dxTexture };

            groundTextureEditor = new Graphics.Editors.GroundTextureEditor
            {
                Camera = scene.Camera,
                Viewport = Viewport,
                SoftwareTexture = new[] {texture},
                Texture9 = new[] {dxTexture},
                Position = ground.Translation,
                Size = ground.Size,
                GroundIntersect = new WorldViewProbe(this, scene.Camera)
                {
                    WorldProbe = new GroundProbe()
                },
                Pencil = new Graphics.Editors.GroundTexturePencil
                {
                    Color = new Vector4(0, 0, 1, 0),
                    Radius = 5,
                    Type = Graphics.Editors.GroundTexturePencilType.AddSaturate
                }
            };
            groundTextureEditor.TextureValuesChanged += new Graphics.Editors.TextureValuesChangedEventHandler((o, e) =>
            {
            });
            InputHandler = new WalkaroundCameraInputHandler
            {
                Camera = (LookatCartesianCamera)scene.Camera,
                InputHandler = groundTextureEditor,
            };

            renderer = new Graphics.Renderer.Renderer(Device9) { Scene = scene, StateManager = new Device9StateManager(Device9) };
            renderer.Initialize(this);

            sceneRendererConnector = new SortedTestSceneRendererConnector
            {
                Renderer = renderer,
                Scene = scene
            };
            sceneRendererConnector.Initialize();
        }
Ejemplo n.º 5
0
        public override void Init()
        {
            Content.ContentPath = "Data";
            Instance = this;

            scene = new Scene();
            scene.View = this;
            scene.Camera = new LookatCartesianCamera()
            {
                Position = new Vector3(10, 10, 10),
                Lookat = Vector3.Zero,
                ZFar = 100,
                AspectRatio = AspectRatio
            };
            sceneQuadtree = new Common.Quadtree<Entity>(0, 0, 100, 100, 10);
            sbau = new SceneBVHAutoSyncer(scene, sceneQuadtree);
            //heightmap = TextureUtil.ToHeightmap(Content.Peek<Texture>(new TextureFromFile("testheightmap.png")), 100);
            heightmap = new Graphics.Software.Texel.R32F[250, 250];
            texture = new Graphics.Software.Texture<Graphics.Software.Texel.R32F>(heightmap);

            renderer = new Graphics.Renderer.Renderer(Device9) { Scene = scene, StateManager = new Device9StateManager(Device9) };
            renderer.Settings.ShadowQuality = Settings.ShadowQualities.NoShadows;
            renderer.Initialize(this);

            sceneRendererConnector = new SortedTestSceneRendererConnector
            {
                Renderer = renderer,
                Scene = scene
            };
            sceneRendererConnector.Initialize();

            scene.Add(ground = new TestGround
            {
                Size = new SizeF(100, 100),
                Heightmap = heightmap,
                NPieces = new Size(20, 20),
                Height = 1
            });
            ground.ConstructPieces();

            InputHandler = new WalkaroundCameraInputHandler
            {
                Camera = (LookatCartesianCamera)scene.Camera
            };
        }
Ejemplo n.º 6
0
        public override void Init()
        {
            Content.ContentPath = "Data";
            Instance            = this;

            scene        = new Scene();
            scene.View   = this;
            scene.Camera = new LookatCartesianCamera()
            {
                Position    = new Vector3(10, 10, 10),
                Lookat      = Vector3.Zero,
                ZFar        = 100,
                AspectRatio = AspectRatio
            };
            //heightmap = TextureUtil.ToHeightmap(Content.Peek<Texture>(new TextureFromFile("testheightmap.png")), 100);
            texture = new Graphics.Software.Texture <Graphics.Software.Texel.A8R8G8B8>(new Graphics.Software.Texel.A8R8G8B8[250, 250]);

            scene.Add(ground = new TestGround
            {
                Size = new SizeF(100, 100),
                //Texture = new SingleColorTexture(Color.Orange),
                NPieces = new Size(20, 20),
            });
            ground.ConstructPieces();

            dxTexture = texture.ToTexture9(Device9);

            ground.Texture = new UnmanagedResource <SlimDX.Direct3D9.Texture, SlimDX.Direct3D10.Texture2D> {
                Resource9 = dxTexture
            };

            groundTextureEditor = new Graphics.Editors.GroundTextureEditor
            {
                Camera          = scene.Camera,
                Viewport        = Viewport,
                SoftwareTexture = new[] { texture },
                Texture9        = new[] { dxTexture },
                Position        = ground.Translation,
                Size            = ground.Size,
                GroundIntersect = new WorldViewProbe(this, scene.Camera)
                {
                    WorldProbe = new GroundProbe()
                },
                Pencil = new Graphics.Editors.GroundTexturePencil
                {
                    Color  = new Vector4(0, 0, 1, 0),
                    Radius = 5,
                    Type   = Graphics.Editors.GroundTexturePencilType.AddSaturate
                }
            };
            groundTextureEditor.TextureValuesChanged += new Graphics.Editors.TextureValuesChangedEventHandler((o, e) =>
            {
            });
            InputHandler = new WalkaroundCameraInputHandler
            {
                Camera       = (LookatCartesianCamera)scene.Camera,
                InputHandler = groundTextureEditor,
            };

            renderer = new Graphics.Renderer.Renderer(Device9)
            {
                Scene = scene, StateManager = new Device9StateManager(Device9)
            };
            renderer.Initialize(this);

            sceneRendererConnector = new SortedTestSceneRendererConnector
            {
                Renderer = renderer,
                Scene    = scene
            };
            sceneRendererConnector.Initialize();
        }