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(); }
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(); }