コード例 #1
0
        public bool DrawToBrushTexture(ShaderController shader, int oldTextureId, int textureId)
        {
            GL.BindTexture(TextureTarget.Texture2D, oldTextureId);
            DrawQuad(1f, 1f, 1f, 1f);

            shader.Begin();

            GL.ActiveTexture(TextureUnit.Texture0);
            GL.BindTexture(TextureTarget.Texture2D, oldTextureId);
            shader.UpdateUniform("u_Texture", 0);
            shader.UpdateUniform("u_World", Matrix4.Identity);
            shader.UpdateUniform("u_BrushColor", brushTool.Color);
            shader.UpdateUniform("u_SphereCenter", brushTool.SphereCenter);
            shader.UpdateUniform("u_SphereRadius", brushTool.Radius);

            headMeshesController.RenderMesh.DrawToTexture(headMeshesController.RenderMesh.Parts.Where(p => p.Texture == textureId));

            shader.End();

            return true;
        }
コード例 #2
0
        private bool DrawToTexture(ShaderController shader, int oldTextureId, int textureId)
        {
            //GL.BindTexture(TextureTarget.Texture2D, oldTextureId);
            DrawQuad(ProgramCore.Project.FaceColor.X, ProgramCore.Project.FaceColor.Y, ProgramCore.Project.FaceColor.Z, 1f);
            GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);
            GL.Enable(EnableCap.Blend);

            shader.Begin();

            GL.ActiveTexture(TextureUnit.Texture0);
            GL.BindTexture(TextureTarget.Texture2D, HeadTextureId);
            shader.UpdateUniform("u_Texture", 0);
            shader.UpdateUniform("u_BlendStartDepth", -0.5f);
            shader.UpdateUniform("u_BlendDepth", 4f);

            headMeshesController.RenderMesh.DrawToTexture(headMeshesController.RenderMesh.Parts.Where(p => p.Texture == textureId));

            shader.End();
            GL.Disable(EnableCap.Blend);
            return true;
        }