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
dd684b5e
Commit
dd684b5e
authored
Jul 27, 2019
by
chili
Browse files
load glossiness from mtl absent of specmap
parent
a69de679
Changes
1
Hide whitespace changes
Inline
Side-by-side
hw3d/Mesh.cpp
View file @
dd684b5e
...
...
@@ -271,6 +271,7 @@ std::unique_ptr<Mesh> Model::ParseMesh( Graphics& gfx,const aiMesh& mesh,const a
std
::
vector
<
std
::
unique_ptr
<
Bind
::
Bindable
>>
bindablePtrs
;
bool
hasSpecularMap
=
false
;
float
shininess
=
35.0
f
;
if
(
mesh
.
mMaterialIndex
>=
0
)
{
auto
&
material
=
*
pMaterials
[
mesh
.
mMaterialIndex
];
...
...
@@ -287,6 +288,10 @@ std::unique_ptr<Mesh> Model::ParseMesh( Graphics& gfx,const aiMesh& mesh,const a
bindablePtrs
.
push_back
(
std
::
make_unique
<
Bind
::
Texture
>
(
gfx
,
Surface
::
FromFile
(
base
+
texFileName
.
C_Str
()
),
1
)
);
hasSpecularMap
=
true
;
}
else
{
material
.
Get
(
AI_MATKEY_SHININESS
,
shininess
);
}
bindablePtrs
.
push_back
(
std
::
make_unique
<
Bind
::
Sampler
>
(
gfx
)
);
}
...
...
@@ -312,9 +317,10 @@ std::unique_ptr<Mesh> Model::ParseMesh( Graphics& gfx,const aiMesh& mesh,const a
struct
PSMaterialConstant
{
float
specularIntensity
=
0.8
f
;
float
specularPower
=
40.0
f
;
float
specularPower
;
float
padding
[
2
];
}
pmc
;
pmc
.
specularPower
=
shininess
;
bindablePtrs
.
push_back
(
std
::
make_unique
<
Bind
::
PixelConstantBuffer
<
PSMaterialConstant
>>
(
gfx
,
pmc
,
1u
)
);
}
...
...
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