public CameraFollow(int width, int height, SceneSphere sceneObject) { Data = new CameraData(); //this.projectionMatrixUniformIndex = projectionMatrixUniformIndex; //this.viewMatrixUniformIndex = viewMatrixUniformIndex; Data.ProjectionMatrix = Matrix4.CreatePerspectiveFieldOfView(MathHelper.PiOver2, width / (float)height, 0.01f, 100f); //lastMouseX = Mouse.GetState().X; this.sceneObject = sceneObject; }
protected override void OnLoad(EventArgs e) { GL.ClearColor(Color4.CadetBlue); GL.Enable(EnableCap.DepthTest); GL.Enable(EnableCap.Texture2D); VertexObjectGroupDefinition vertexGroupDefinition = new VertexObjectGroupDefinition(Properties.Resources.VertexShader, Properties.Resources.FragmentShader); vertexGroup = new VertexObjectGroup(vertexGroupDefinition); this.disposables.Add(vertexGroup); #region Models WavefrontModel model = new WavefrontModelLoader().Load(new FileInfo(@"C:\Users\pstepnowski\Documents\untitled.obj")); RenderableModel modelSphere = vertexGroup.Add(model); #endregion #region Scene Objects race = new Race(200); vertexGroup.Add(modelSphere, race.Spheres); playerSceneSphere = vertexGroup.Renderables.OfType <SceneSphere>().First(s => s.Sphere == race.PlayerSphere); #endregion Camera camera1 = new Camera(Width, Height); camera1.position = new Vector3(5, 2, 5); CameraFollow camera2 = new CameraFollow(Width, Height, playerSceneSphere); camera2.position = new Vector3(5, 2, 5); this.cameras.Add(camera2); TexturedObjectGroupDefinition texturedGroupDefinition = new TexturedObjectGroupDefinition(Properties.Resources.VertexShaderTextured, Properties.Resources.FragmentShaderTextured); texturedGroup = new TexturedObjectGroup(texturedGroupDefinition); this.disposables.Add(texturedGroup); FileInfo textureFile = new FileInfo(@"C:\Users\pstepnowski\Source\Repos\fdafadf\basics\Basics.Physics.Test.UI\Textures\concrete.png"); Texture texture = texturedGroup.LoadTexture(textureFile); TestModelLoader modelLoader = new TestModelLoader(); modelLoader.LoadTrack(texturedGroup, texture); //TexturedModel triangleModel = texturedGroup.Add(race.Ground); //texturedGroup.Add(triangleModel, texture.Handle, new Vector3()); }
public void Add(RenderableModel model, Sphere3d sphere) { SceneSphere sceneSphere = new SceneSphere(model, sphere); Renderables.Add(sceneSphere); }