Пример #1
0
 private static void TextureUniform(Shader shader, FMAT mat, bool hasTex, string name, MatTexture mattex)
 {
     // Bind the texture and create the uniform if the material has the right textures.
     if (hasTex)
     {
         GL.Uniform1(shader.GetUniformLocation(name), BindTexture(mattex, mat.GetResFileU() != null));
     }
 }
Пример #2
0
        private void textureRefListView_DoubleClick(object sender, EventArgs e)
        {
            if (textureRefListView.SelectedIndices.Count <= 0)
            {
                return;
            }

            int index            = textureRefListView.SelectedIndices[0];
            Texture_Selector tex = new Texture_Selector();

            tex.LoadTexture(textureRefListView.SelectedItems[0].Text, material.GetResFileU() != null);
            if (tex.ShowDialog() == DialogResult.OK)
            {
                material.TextureMaps[index].Name = tex.GetSelectedTexture();
                InitializeTextureListView(material);
                material.UpdateTextureMaps();
            }
        }
Пример #3
0
        private static bool TextureUniform(SHShaderProgram shader, FMAT mat, string name, MatTexture mattex)
        {
            if (mattex.textureState == STGenericMatTexture.TextureState.Binded)
            {
                return(true);
            }

            // Bind the texture and create the uniform if the material has the right textures.
            BindTexture(mattex, mat, shader, mat.GetResFileU() != null);

            return(true);
        }
Пример #4
0
        private static void TextureUniform(ShaderProgram shader, FMAT mat, bool hasTex, string name, MatTexture mattex)
        {
            if (mattex.textureState == STGenericMatTexture.TextureState.Binded)
            {
                return;
            }

            // Bind the texture and create the uniform if the material has the right textures.
            if (hasTex)
            {
                GL.Uniform1(shader[name], BindTexture(mattex, mat.GetResFileU() != null));
            }
        }
Пример #5
0
        public static void WriteTextureRefs(this FMAT m, Material mat)
        {
            mat.TextureRefs = new List <TextureRef>();
            mat.TextureRefs.Clear();

            foreach (var textu in m.textures)
            {
                TextureRef texref = new TextureRef();
                texref.Name = textu.Name;
                Texture texMapped = new Texture();
                m.GetResFileU().Textures.TryGetValue(textu.Name, out texMapped);
                texref.Texture = texMapped;
                mat.TextureRefs.Add(texref);
            }
        }
Пример #6
0
        private static bool TextureUniform(SF.Shader shader, FMAT mat, string name, MatTexture mattex)
        {
            if (mattex.textureState == STGenericMatTexture.TextureState.Binded)
            {
                return(true);
            }

            // Bind the texture and create the uniform if the material has the right textures.
            bool IsBound = BindTexture(mattex, mat, shader, mat.GetResFileU() != null);
            int  texId   = mattex.textureUnit + 1;

            if (IsBound)
            {
                GL.Uniform1(shader.GetUniformLocation(name), texId);
            }
            else
            {
                return(false);
            }

            return(true);
        }