smooth + mixmat bug fix
This commit is contained in:
parent
60730edb7b
commit
e35cca1830
3 changed files with 20 additions and 16 deletions
18
material.go
18
material.go
|
|
@ -41,8 +41,8 @@ func DefaultMaterial(ambiantColor Color) Material {
|
|||
return Material{
|
||||
ambiantColor: ambiantColor,
|
||||
diffuseColor: Vector3{255, 255, 255},
|
||||
diffuseFac: 1.0,
|
||||
specularColor: Vector3{0, 255, 0},
|
||||
diffuseFac: 0.5,
|
||||
specularColor: Vector3{255, 255, 255},
|
||||
specularFac: 1.0,
|
||||
specularExp: 32.0,
|
||||
reflectanceFac: 0.0,
|
||||
|
|
@ -54,16 +54,16 @@ func DefaultMaterial(ambiantColor Color) Material {
|
|||
|
||||
func MixMat(mat1 Material, mat2 Material, t float64, p Vector3) Material {
|
||||
return Material{
|
||||
mat1.ambiantColor.GetColor(p).Scale(1 - t).Add((mat2.ambiantColor.GetColor(p)).Scale(t)),
|
||||
mat1.diffuseColor.GetColor(p).Scale(1 - t).Add((mat2.diffuseColor.GetColor(p)).Scale(t)),
|
||||
(mat1.diffuseFac*(1-t) + mat2.diffuseFac) * t,
|
||||
(mat1.ambiantColor.GetColor(p).Scale(1 - t)).Add((mat2.ambiantColor.GetColor(p)).Scale(t)),
|
||||
(mat1.diffuseColor.GetColor(p).Scale(1 - t)).Add((mat2.diffuseColor.GetColor(p)).Scale(t)),
|
||||
mat1.diffuseFac*(1-t) + mat2.diffuseFac*t,
|
||||
mat1.specularColor.GetColor(p).Scale(1 - t).Add((mat2.specularColor.GetColor(p)).Scale(t)),
|
||||
(mat1.specularFac*(1-t) + mat2.specularFac) * t,
|
||||
(mat1.specularExp*(1-t) + mat2.specularExp) * t,
|
||||
mat1.specularFac*(1-t) + mat2.specularFac*t,
|
||||
mat1.specularExp*(1-t) + mat2.specularExp*t,
|
||||
(mat1.reflectanceFac*(1-t) + mat2.reflectanceFac) * t,
|
||||
mat1.reflectanceTint.GetColor(p).Scale(1 - t).Add((mat2.reflectanceTint.GetColor(p)).Scale(t)),
|
||||
(mat1.refractFac*(1-t) + mat2.refractFac) * t,
|
||||
(mat1.refractIndice*(1-t) + mat2.refractIndice) * t,
|
||||
mat1.refractFac*(1-t) + mat2.refractFac*t,
|
||||
mat1.refractIndice*(1-t) + mat2.refractIndice*t,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue