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
85e7ba5b
Commit
85e7ba5b
authored
May 02, 2019
by
chili
Browse files
fix dat pyramid boi (needed a ps cbuf)
parent
e16cbfd1
Changes
1
Show whitespace changes
Inline
Side-by-side
hw3d/Pyramid.cpp
View file @
85e7ba5b
...
...
@@ -25,13 +25,17 @@ Pyramid::Pyramid( Graphics& gfx,std::mt19937& rng,
std
::
array
<
char
,
4
>
color
;
char
padding
;
};
auto
model
=
Cone
::
MakeTesselatedIndependentFaces
<
Vertex
>
(
tdist
(
rng
)
);
// set vertex colors for mesh
const
auto
tesselation
=
tdist
(
rng
);
auto
model
=
Cone
::
MakeTesselatedIndependentFaces
<
Vertex
>
(
tesselation
);
// set vertex colors for mesh (tip red blending to blue base)
for
(
auto
&
v
:
model
.
vertices
)
{
v
.
color
=
{
(
char
)
40
,(
char
)
40
,(
char
)
255
};
v
.
color
=
{
(
char
)
10
,(
char
)
10
,(
char
)
255
};
}
for
(
int
i
=
0
;
i
<
tesselation
;
i
++
)
{
model
.
vertices
[
i
*
3
].
color
=
{
(
char
)
255
,(
char
)
10
,(
char
)
10
};
}
model
.
vertices
.
front
().
color
=
{
(
char
)
255
,(
char
)
20
,(
char
)
20
};
// very first vertex is the cone tip
// squash mesh a bit in the z direction
model
.
Transform
(
dx
::
XMMatrixScaling
(
1.0
f
,
1.0
f
,
0.7
f
)
);
// add normals
...
...
@@ -56,6 +60,14 @@ Pyramid::Pyramid( Graphics& gfx,std::mt19937& rng,
AddStaticBind
(
std
::
make_unique
<
InputLayout
>
(
gfx
,
ied
,
pvsbc
)
);
AddStaticBind
(
std
::
make_unique
<
Topology
>
(
gfx
,
D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST
)
);
struct
PSMaterialConstant
{
float
specularIntensity
=
0.6
f
;
float
specularPower
=
30.0
f
;
float
padding
[
2
];
}
colorConst
;
AddStaticBind
(
std
::
make_unique
<
PixelConstantBuffer
<
PSMaterialConstant
>>
(
gfx
,
colorConst
,
1u
)
);
}
else
{
...
...
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