示例#1
0
 public void Render(Camera camera)
 {
     MasterRenderer.DisableCulling();
     shader.Start();
     shader.LoadViewMatrix(camera.GetViewMatrix());
     shader.LoadTransformationMatrix(camera.gameObject.transform.TransformationMatrixTranslation());
     GL.BindVertexArray(cube.vaoID);
     GL.EnableVertexAttribArray(0);
     GL.ActiveTexture(TextureUnit.Texture0);
     GL.BindTexture(TextureTarget.TextureCubeMap, skyboxTextureID);
     GL.DrawArrays(PrimitiveType.Triangles, 0, cube.vertexCount);
     GL.DisableVertexAttribArray(0);
     GL.BindVertexArray(0);
     shader.Stop();
     MasterRenderer.EnableCulling();
 }
示例#2
0
        public void PrepareTexturedModel(TexturedModel texturedModel)
        {
            if (texturedModel.hasTransparency)
            {
                MasterRenderer.DisableCulling();
            }
            RawModel model = texturedModel.rawModel;

            GL.BindVertexArray(model.vaoID);
            GL.EnableVertexAttribArray(0);
            GL.EnableVertexAttribArray(1);
            GL.EnableVertexAttribArray(2);
            shader.LoadUseFakeLightingVariable(texturedModel.useFakeLighting);
            shader.LoadShineVariables(texturedModel.shineDamper, texturedModel.reflectivity, texturedModel.luminosity);
            shader.LoadEnviromentMap(1);
            GL.ActiveTexture(TextureUnit.Texture1);
            GL.BindTexture(TextureTarget.TextureCubeMap, SkyboxRenderer.skyboxTextureID);
            texturedModel.BindTexture(OpenTK.Graphics.OpenGL4.TextureUnit.Texture0);
        }