public override void Init() { VSync = false; SetWindowSize(1280, 720); // Start the application in demo mode? demoMode = true; #region MeshImports _Geo = new Geometry(); _Geo.LoadAsset("Assets/Cube.obj.model"); //_Geo.LoadAsset("Assets/Cube_quads.obj.model"); //_Geo.LoadAsset("Assets/Sphere.obj.model"); //_Geo.LoadAsset("Assets/Sphere_quads.obj.model"); //_Geo.LoadAsset("Assets/SharedCorners.obj.model"); //_Geo.LoadAsset("Assets/Cylinder.obj.model"); //_Geo.LoadAsset("Assets/Cylinder_quads.obj.model"); //_Geo.LoadAsset("Assets/SharedCorners_pro.obj.model"); //_Geo.LoadAsset("Assets/Teapot.obj.model"); #endregion MeshImports // Set the smoothing angle for the edge based vertex normal calculation // Feel free to test around. _Geo._SmoothingAngle = 89.0; // The shader colors here are not supposed to be changed. They don't have an effect. If you want to change the shaders // then please change the values in the ShaderChanger() method. These ones are just for declaration. #region Shaders #region TextureShader _msDiffuse = Shaders.GetDiffuseTextureShader(RC); _vLightShaderParam = _msDiffuse.GetShaderParam("texture1"); //ImageData imgData = RC.LoadImage("Assets/Cube_Mat_uv.jpg"); ImageData imgData = RC.LoadImage("Assets/world_map.jpg"); //ImageData imgData = RC.LoadImage("Assets/Teapot_Texture.jpg"); // Due to copyright reasons, this file will not be delivered with the project. //ImageData imgData = RC.LoadImage("Assets/Hellknight.jpg"); _tex = RC.CreateTexture(imgData); #endregion TextureShader #region ColorShader _spColor = Shaders.GetDiffuseColorShader(RC); _colorParam = _spColor.GetShaderParam("color"); RC.SetShader(_spColor); RC.SetShaderParam(_colorParam, new float4(0f, 0f, 0f, 1f)); #endregion ColorShader #region LightPos RC.SetLightActive(0, 0f); RC.SetLightAmbient(0, new float4(0.0f, 0.0f, 0.0f, 1.0f)); RC.SetLightDiffuse(0, new float4(1.0f, 1.0f, 1.0f, 1.0f)); RC.SetLightDirection(0, new float3(0.0f, -1.0f, 0.0f)); RC.SetLightActive(1, 0f); RC.SetLightAmbient(1, new float4(0.0f, 0.0f, 0.0f, 1.0f)); RC.SetLightDiffuse(1, new float4(0.5f, 0.5f, 0.5f, 1.0f)); RC.SetLightDirection(1, new float3(1.0f, 0.0f, 0.0f)); #endregion LightPos #endregion // Convert the loaded lfg model to a fusee mesh the first time. _lfgmesh = _Geo.ToMesh(); RC.ClearColor = new float4(0.2f, 0.2f, 0.2f, 1f); // For Benchmarking only. _ShaderType = 1; runDemoAnimation = true; _Geo._DoCalcVertexNormals = true; }
public override void Init() { VSync = false; // Start the application in demo mode? demoMode = true; #region MeshImports _Geo = new Geometry(); //_Geo.LoadAsset("Assets/Cube.obj.model"); //_Geo.LoadAsset("Assets/Cube_quads.obj.model"); //_Geo.LoadAsset("Assets/Sphere.obj.model"); //_Geo.LoadAsset("Assets/Sphere_quads.obj.model"); //_Geo.LoadAsset("Assets/SharedCorners.obj.model"); //_Geo.LoadAsset("Assets/Cylinder.obj.model"); //_Geo.LoadAsset("Assets/Cylinder_quads.obj.model"); //_Geo.LoadAsset("Assets/SharedCorners_pro.obj.model"); _Geo.LoadAsset("Assets/Teapot.obj.model"); // Due to copyright reasons, this file will not be delivered with the project. //_Geo.LoadAsset("Assets/Hellknight.obj.model"); #endregion MeshImports // Set the smoothing angle for the edge based vertex normal calculation // Feel free to test around. _Geo._SmoothingAngle = 89.0; // The shader colors here are not supposed to be changed. They don't have an effect. If you want to change the shaders // then please change the values in the ShaderChanger() method. These ones are just for declaration. #region Shaders #region TextureShader _msDiffuse = MoreShaders.GetDiffuseTextureShader(RC); _vLightShaderParam = _msDiffuse.GetShaderParam("texture1"); //ImageData imgData = RC.LoadImage("Assets/Cube_Mat_uv.jpg"); ImageData imgData = RC.LoadImage("Assets/world_map.jpg"); //ImageData imgData = RC.LoadImage("Assets/Teapot_Texture.jpg"); // Due to copyright reasons, this file will not be delivered with the project. //ImageData imgData = RC.LoadImage("Assets/Hellknight.jpg"); _tex = RC.CreateTexture(imgData); #endregion TextureShader #region ColorShader _spColor = MoreShaders.GetDiffuseColorShader(RC); _colorParam = _spColor.GetShaderParam("color"); RC.SetShader(_spColor); RC.SetShaderParam(_colorParam, new float4(0f, 0f, 0f, 1)); #endregion ColorShader #region LightPos RC.SetLightActive(0, 0f); RC.SetLightAmbient(0, new float4(0.0f, 0.0f, 0.0f, 1.0f)); RC.SetLightDiffuse(0, new float4(1.0f, 1.0f, 1.0f, 1.0f)); RC.SetLightDirection(0, new float3(0.0f, -1.0f, 0.0f)); RC.SetLightActive(1, 0f); RC.SetLightAmbient(1, new float4(0.0f, 0.0f, 0.0f, 1.0f)); RC.SetLightDiffuse(1, new float4(0.5f, 0.5f, 0.5f, 1.0f)); RC.SetLightDirection(1, new float3(1.0f, 0.0f, 0.0f)); #endregion LightPos #endregion // Convert the loaded lfg model to a fusee mesh the first time. _lfgmesh = _Geo.ToMesh(); RC.ClearColor = new float4(0.2f, 0.2f, 0.2f, 1f); // TODO: For Benchmarking only. _ShaderType = 1; runDemoAnimation = true; _Geo._DoCalcVertexNormals = true; }