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
e288866e
Commit
e288866e
authored
Jul 22, 2019
by
chili
Browse files
fun with pointers
parent
84403d53
Changes
3
Show whitespace changes
Inline
Side-by-side
hw3d/App.h
View file @
e288866e
...
...
@@ -25,5 +25,5 @@ private:
float
speed_factor
=
1.0
f
;
Camera
cam
;
PointLight
light
;
Model
nano
{
wnd
.
Gfx
(),
"Models
\\
nano_
hierarchy.gltf
"
};
Model
nano
{
wnd
.
Gfx
(),
"Models
\\
nano_
textured
\\
nanosuit.obj
"
};
};
\ No newline at end of file
hw3d/Mesh.cpp
View file @
e288866e
...
...
@@ -212,7 +212,7 @@ Model::Model( Graphics& gfx,const std::string fileName )
for
(
size_t
i
=
0
;
i
<
pScene
->
mNumMeshes
;
i
++
)
{
meshPtrs
.
push_back
(
ParseMesh
(
gfx
,
*
pScene
->
mMeshes
[
i
]
)
);
meshPtrs
.
push_back
(
ParseMesh
(
gfx
,
*
pScene
->
mMeshes
[
i
]
,
pScene
->
mMaterials
)
);
}
int
nextId
=
0
;
...
...
@@ -236,7 +236,7 @@ void Model::ShowWindow( const char* windowName ) noexcept
Model
::~
Model
()
noexcept
{}
std
::
unique_ptr
<
Mesh
>
Model
::
ParseMesh
(
Graphics
&
gfx
,
const
aiMesh
&
mesh
)
std
::
unique_ptr
<
Mesh
>
Model
::
ParseMesh
(
Graphics
&
gfx
,
const
aiMesh
&
mesh
,
const
aiMaterial
*
const
*
pMaterials
)
{
using
Dvtx
::
VertexLayout
;
...
...
@@ -246,6 +246,8 @@ std::unique_ptr<Mesh> Model::ParseMesh( Graphics& gfx,const aiMesh& mesh )
.
Append
(
VertexLayout
::
Normal
)
)
);
auto
&
material
=
*
pMaterials
[
mesh
.
mMaterialIndex
];
for
(
unsigned
int
i
=
0
;
i
<
mesh
.
mNumVertices
;
i
++
)
{
vbuf
.
EmplaceBack
(
...
...
hw3d/Mesh.h
View file @
e288866e
...
...
@@ -58,7 +58,7 @@ public:
void
ShowWindow
(
const
char
*
windowName
=
nullptr
)
noexcept
;
~
Model
()
noexcept
;
private:
static
std
::
unique_ptr
<
Mesh
>
ParseMesh
(
Graphics
&
gfx
,
const
aiMesh
&
mesh
);
static
std
::
unique_ptr
<
Mesh
>
ParseMesh
(
Graphics
&
gfx
,
const
aiMesh
&
mesh
,
const
aiMaterial
*
const
*
pMaterials
);
std
::
unique_ptr
<
Node
>
ParseNode
(
int
&
nextId
,
const
aiNode
&
node
)
noexcept
;
private:
std
::
unique_ptr
<
Node
>
pRoot
;
...
...
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