Ejemplo n.º 1
0
 private void SetRenderSettings(ShaderProgram shader)
 {
     shader.SetInt("renderType", (int)Runtime.DebugRendering);
     shader.SetBoolToInt("hasDiffuse", false);
     shader.SetInt("selectedBoneIndex", Runtime.SelectedBoneIndex);
     shader.SetBoolToInt("renderVertColor", DisplayVertexColors);
     shader.SetBoolToInt("renderVertAlpha", DisplayVertexColorAlpha);
     shader.SetColor("diffuseColor", STColor8.White.Color);
 }
Ejemplo n.º 2
0
 private void SetRenderSettings(ShaderProgram shader)
 {
     shader.SetInt("renderType", (int)Runtime.DebugRendering);
     shader.SetBoolToInt("hasDiffuse", false);
     shader.SetInt("selectedBoneIndex", Runtime.SelectedBoneIndex);
     shader.SetBoolToInt("renderVertColor", DisplayVertexColors);
     shader.SetBoolToInt("renderVertAlpha", DisplayVertexColorAlpha);
     shader.SetColor("diffuseColor", STColor8.White.Color);
     shader.SetBoolToInt("HasSkeleton", false);
     if (Scene.Models.Count > 0)
     {
         shader.SetBoolToInt("HasSkeleton", Scene.Models.Any(x => x.Skeleton.Bones.Count > 0));
     }
 }
Ejemplo n.º 3
0
        public virtual void RenderMaterials(ShaderProgram shader,
                                            STGenericMesh mesh, STPolygonGroup group, STGenericMaterial material, Vector4 highlight_color)
        {
            if (material == null && group.MaterialIndex != -1 && Model.Materials.Count > group.MaterialIndex)
            {
                material = Model.Materials[group.MaterialIndex];
            }

            shader.SetVector4("highlight_color", highlight_color);

            SetTextureUniforms(shader);
            SetMaterialUniforms(shader, material, mesh);
            if (material == null)
            {
                return;
            }

            int textureUintID = 1;

            foreach (var textureMap in material.TextureMaps)
            {
                var tex = textureMap.GetTexture();
                if (textureMap.Type == STTextureType.Diffuse)
                {
                    shader.SetBoolToInt("hasDiffuse", true);
                    BindTexture(shader, Model.Textures, textureMap, textureUintID);
                    shader.SetInt($"tex_Diffuse", textureUintID);
                }

                textureUintID++;
            }
        }