Пример #1
0
        public static void DrawNudMaterialSphere(Shader shader, NUD.Material material, BufferObject screenVbo, Dictionary <NUD.DummyTextures, Texture> dummyTextures)
        {
            if (!shader.ProgramCreatedSuccessfully)
            {
                return;
            }

            shader.UseProgram();


            // Use the same uniforms as the NUD shader.
            NUD.SetMaterialPropertyUniforms(shader, material);
            NUD.SetStageLightingUniforms(shader, 0);
            ModelContainer.SetRenderSettingsUniforms(shader);

            nudSphereCamera.UpdateMatrices();
            ModelContainer.SetLightingUniforms(shader, nudSphereCamera);
            ModelContainer.SetCameraMatrixUniforms(nudSphereCamera, shader);

            // Use default textures rather than textures from the NUT.
            NUD.SetTextureUniformsNudMatSphere(shader, material, dummyTextures);

            // These values aren't needed in the shader currently.
            shader.SetVector3("cameraPosition", 0, 0, 0);
            shader.SetFloat("zBufferOffset", 0);
            shader.SetFloat("bloomThreshold", Runtime.bloomThreshold);

            bool isTransparent = (material.srcFactor > 0) || (material.dstFactor > 0) || (material.alphaFunction > 0) || (material.alphaTest > 0);

            shader.SetBoolToInt("isTransparent", isTransparent);

            // Set texture uniforms for the mesh attributes.
            shader.SetTexture("normalTex", sphereNrmTex.Id, TextureTarget.Texture2D, 15);
            shader.SetTexture("uvTex", sphereUvTex.Id, TextureTarget.Texture2D, 16);
            shader.SetTexture("tanTex", sphereTanTex.Id, TextureTarget.Texture2D, 17);
            shader.SetTexture("bitanTex", sphereBitanTex.Id, TextureTarget.Texture2D, 18);

            // Draw full screen "quad" (big triangle)
            ScreenDrawing.DrawScreenTriangle(shader, screenVbo);
        }