Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Clark Lin
hw3d
Commits
9beaef9a
Commit
9beaef9a
authored
Jul 27, 2019
by
chili
Browse files
fixed spec on helmut
parent
51c06840
Changes
2
Hide whitespace changes
Inline
Side-by-side
hw3d/Mesh.cpp
View file @
9beaef9a
...
@@ -311,8 +311,8 @@ std::unique_ptr<Mesh> Model::ParseMesh( Graphics& gfx,const aiMesh& mesh,const a
...
@@ -311,8 +311,8 @@ std::unique_ptr<Mesh> Model::ParseMesh( Graphics& gfx,const aiMesh& mesh,const a
struct
PSMaterialConstant
struct
PSMaterialConstant
{
{
float
specularIntensity
=
1.6
f
;
float
specularIntensity
=
0.8
f
;
float
specularPower
=
5
0.0
f
;
float
specularPower
=
4
0.0
f
;
float
padding
[
2
];
float
padding
[
2
];
}
pmc
;
}
pmc
;
bindablePtrs
.
push_back
(
std
::
make_unique
<
Bind
::
PixelConstantBuffer
<
PSMaterialConstant
>>
(
gfx
,
pmc
,
1u
)
);
bindablePtrs
.
push_back
(
std
::
make_unique
<
Bind
::
PixelConstantBuffer
<
PSMaterialConstant
>>
(
gfx
,
pmc
,
1u
)
);
...
...
hw3d/PhongPS.hlsl
View file @
9beaef9a
...
@@ -37,5 +37,5 @@ float4 main(float3 worldPos : Position, float3 n : Normal, float2 tc : Texcoord)
...
@@ -37,5 +37,5 @@ float4 main(float3 worldPos : Position, float3 n : Normal, float2 tc : Texcoord)
// calculate specular intensity based on angle between viewing vector and reflection vector, narrow with power function
// calculate specular intensity based on angle between viewing vector and reflection vector, narrow with power function
const
float3
specular
=
att
*
(
diffuseColor
*
diffuseIntensity
)
*
specularIntensity
*
pow
(
max
(
0
.
0
f
,
dot
(
normalize
(
-
r
),
normalize
(
worldPos
))),
specularPower
);
const
float3
specular
=
att
*
(
diffuseColor
*
diffuseIntensity
)
*
specularIntensity
*
pow
(
max
(
0
.
0
f
,
dot
(
normalize
(
-
r
),
normalize
(
worldPos
))),
specularPower
);
// final color
// final color
return
float4
(
saturate
(
diffuse
+
ambient
+
specular
),
1
.
0
f
)
*
tex
.
Sample
(
splr
,
tc
);
return
float4
(
saturate
(
(
diffuse
+
ambient
)
*
tex
.
Sample
(
splr
,
tc
)
.
rgb
+
specular
),
1
.
0
f
)
;
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment