danaugrs преди 7 години
родител
ревизия
6d8ef0f9ff
променени са 5 файла, в които са добавени 11 реда и са изтрити 13 реда
  1. 0 1
      material/material.go
  2. 4 5
      material/physical.go
  3. 3 1
      renderer/shaders/physical_fragment.glsl
  4. 3 1
      renderer/shaders/sources.go
  5. 1 5
      renderer/shaman.go

+ 0 - 1
material/material.go

@@ -330,7 +330,6 @@ func (mat *Material) RenderSetup(gs *gls.GLS) {
 	for slotIdx, tex := range mat.textures {
 		samplerName, _ := tex.GetUniformNames()
 		uniIdx, _ := samplerCounts[samplerName]
-		log.Error("slotIdx: %v, uniIdx: %v, sampleName: %v", slotIdx, uniIdx, samplerName)
 		tex.RenderSetup(gs, slotIdx, uniIdx)
 		samplerCounts[samplerName] = uniIdx+1
 	}

+ 4 - 5
material/physical.go

@@ -42,7 +42,7 @@ func NewPhysical() *Physical {
 	// Creates uniform and set default values
 	m.uni.Init("Material")
 	m.udata.baseColorFactor = math32.Color4{1, 1, 1, 1}
-	m.udata.emissiveFactor = math32.Color4{1, 1, 1, 1}
+	m.udata.emissiveFactor = math32.Color4{0, 0, 0, 1}
 	m.udata.metallicFactor = 1
 	m.udata.roughnessFactor = 1
 	return m
@@ -58,7 +58,7 @@ func (m *Physical) SetBaseColorFactor(c *math32.Color4) *Physical {
 }
 
 // SetMetallicFactor sets this material metallic factor.
-// Its default value is 1.0
+// Its default value is 1.
 // Returns pointer to this updated material.
 func (m *Physical) SetMetallicFactor(v float32) *Physical {
 
@@ -67,7 +67,7 @@ func (m *Physical) SetMetallicFactor(v float32) *Physical {
 }
 
 // SetRoughnessFactor sets this material roughness factor.
-// Its default value is 1.0
+// Its default value is 1.
 // Returns pointer to this updated material.
 func (m *Physical) SetRoughnessFactor(v float32) *Physical {
 
@@ -76,7 +76,7 @@ func (m *Physical) SetRoughnessFactor(v float32) *Physical {
 }
 
 // SetEmissiveFactor sets the emissive color of the material.
-// Its default is {0, 0, 0}.
+// Its default is {1, 1, 1}.
 // Returns pointer to this updated material.
 func (m *Physical) SetEmissiveFactor(c *math32.Color) *Physical {
 
@@ -172,6 +172,5 @@ func (m *Physical) RenderSetup(gl *gls.GLS) {
 
 	m.Material.RenderSetup(gl)
 	location := m.uni.Location(gl)
-	log.Error("Physical RenderSetup location:%v udata:%+v", location, m.udata)
 	gl.Uniform4fvUP(location, physicalVec4Count, unsafe.Pointer(&m.udata))
 }

+ 3 - 1
renderer/shaders/physical_fragment.glsl

@@ -413,8 +413,10 @@ void main() {
 
 #ifdef HAS_EMISSIVEMAP
     vec3 emissive = SRGBtoLINEAR(texture2D(uEmissiveSampler, FragTexcoord)).rgb * vec3(uEmissiveColor);
-    color += emissive;
+#else
+    vec3 emissive = vec3(uEmissiveColor);
 #endif
+    color += emissive;
 
     // Base Color
 //    FragColor = baseColor;

+ 3 - 1
renderer/shaders/sources.go

@@ -923,8 +923,10 @@ void main() {
 
 #ifdef HAS_EMISSIVEMAP
     vec3 emissive = SRGBtoLINEAR(texture2D(uEmissiveSampler, FragTexcoord)).rgb * vec3(uEmissiveColor);
-    color += emissive;
+#else
+    vec3 emissive = vec3(uEmissiveColor);
 #endif
+    color += emissive;
 
     // Base Color
 //    FragColor = baseColor;

+ 1 - 5
renderer/shaman.go

@@ -188,7 +188,6 @@ func (sm *Shaman) GenProgram(specs *ShaderSpecs) (*gls.Program, error) {
 		defines[name] = value
 	}
 
-	log.Error("shaman1")
 	// Get vertex shader source
 	vertexSource, ok := sm.shadersm[progInfo.Vertex]
 	if !ok {
@@ -201,7 +200,6 @@ func (sm *Shaman) GenProgram(specs *ShaderSpecs) (*gls.Program, error) {
 	}
 	//fmt.Printf("vertexSource:%s\n", vertexSource)
 
-	log.Error("shaman2")
 	// Get fragment shader source
 	fragSource, ok := sm.shadersm[progInfo.Fragment]
 	if err != nil {
@@ -214,7 +212,6 @@ func (sm *Shaman) GenProgram(specs *ShaderSpecs) (*gls.Program, error) {
 	}
 	//fmt.Printf("fragSource:%s\n", fragSource)
 
-	log.Error("shaman3")
 	// Checks for optional geometry shader compiled template
 	var geomSource = ""
 	if progInfo.Geometry != "" {
@@ -237,12 +234,11 @@ func (sm *Shaman) GenProgram(specs *ShaderSpecs) (*gls.Program, error) {
 	if progInfo.Geometry != "" {
 		prog.AddShader(gls.GEOMETRY_SHADER, geomSource, nil)
 	}
-	log.Error("shaman4")
 	err = prog.Build()
 	if err != nil {
 		return nil, err
 	}
-	log.Error("shaman5")
+
 	return prog, nil
 }