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
d6e000ca
Commit
d6e000ca
authored
May 02, 2019
by
chili
Browse files
cylinder all fixed up
parent
59fa1103
Changes
4
Hide whitespace changes
Inline
Side-by-side
hw3d/Box.cpp
View file @
d6e000ca
...
@@ -55,10 +55,10 @@ Box::Box( Graphics& gfx,
...
@@ -55,10 +55,10 @@ Box::Box( Graphics& gfx,
struct
PSMaterialConstant
struct
PSMaterialConstant
{
{
alignas
(
16
)
dx
::
XMFLOAT3
color
;
dx
::
XMFLOAT3
color
;
float
specularIntensity
=
0.6
f
;
float
specularIntensity
=
0.6
f
;
float
specularPower
=
30.0
f
;
float
specularPower
=
30.0
f
;
float
padding
[
2
];
float
padding
[
3
];
}
colorConst
;
}
colorConst
;
colorConst
.
color
=
material
;
colorConst
.
color
=
material
;
AddBind
(
std
::
make_unique
<
PixelConstantBuffer
<
PSMaterialConstant
>>
(
gfx
,
colorConst
,
1u
)
);
AddBind
(
std
::
make_unique
<
PixelConstantBuffer
<
PSMaterialConstant
>>
(
gfx
,
colorConst
,
1u
)
);
...
...
hw3d/Cylinder.cpp
View file @
d6e000ca
...
@@ -44,7 +44,7 @@ Cylinder::Cylinder( Graphics& gfx,std::mt19937& rng,
...
@@ -44,7 +44,7 @@ Cylinder::Cylinder( Graphics& gfx,std::mt19937& rng,
struct
PSMaterialConstant
struct
PSMaterialConstant
{
{
alignas
(
16
)
dx
::
XMFLOAT3A
colors
[
6
]
=
{
dx
::
XMFLOAT3A
colors
[
6
]
=
{
{
1.0
f
,
0.0
f
,
0.0
f
},
{
1.0
f
,
0.0
f
,
0.0
f
},
{
0.0
f
,
1.0
f
,
0.0
f
},
{
0.0
f
,
1.0
f
,
0.0
f
},
{
0.0
f
,
0.0
f
,
1.0
f
},
{
0.0
f
,
0.0
f
,
1.0
f
},
...
...
hw3d/IndexedPhongPS.hlsl
View file @
d6e000ca
...
@@ -12,6 +12,7 @@ cbuffer LightCBuf
...
@@ -12,6 +12,7 @@ cbuffer LightCBuf
cbuffer
ObjectCBuf
cbuffer
ObjectCBuf
{
{
float3
materialColors
[
6
];
float3
materialColors
[
6
];
float
padding
;
float
specularIntensity
;
float
specularIntensity
;
float
specularPower
;
float
specularPower
;
};
};
...
@@ -33,5 +34,5 @@ float4 main( float3 worldPos : Position,float3 n : Normal,uint tid : SV_Primitiv
...
@@ -33,5 +34,5 @@ float4 main( float3 worldPos : Position,float3 n : Normal,uint tid : SV_Primitiv
// 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
)
*
materialColors
[
tid
%
6
]
),
1
.
0
f
);
return
float4
(
saturate
((
diffuse
+
ambient
+
specular
)
*
materialColors
[
(
tid
/
2
)
%
6
]),
1
.
0
f
);
}
}
\ No newline at end of file
hw3d/hw3d.vcxproj
View file @
d6e000ca
...
@@ -289,6 +289,12 @@
...
@@ -289,6 +289,12 @@
<ShaderModel
Condition=
"'$(Configuration)|$(Platform)'=='Debug|x64'"
>
4.0
</ShaderModel>
<ShaderModel
Condition=
"'$(Configuration)|$(Platform)'=='Debug|x64'"
>
4.0
</ShaderModel>
<ObjectFileOutput
Condition=
"'$(Configuration)|$(Platform)'=='Debug|Win32'"
>
$(ProjectDir)%(Filename).cso
</ObjectFileOutput>
<ObjectFileOutput
Condition=
"'$(Configuration)|$(Platform)'=='Debug|Win32'"
>
$(ProjectDir)%(Filename).cso
</ObjectFileOutput>
<ObjectFileOutput
Condition=
"'$(Configuration)|$(Platform)'=='Debug|x64'"
>
$(ProjectDir)%(Filename).cso
</ObjectFileOutput>
<ObjectFileOutput
Condition=
"'$(Configuration)|$(Platform)'=='Debug|x64'"
>
$(ProjectDir)%(Filename).cso
</ObjectFileOutput>
<ShaderType
Condition=
"'$(Configuration)|$(Platform)'=='Release|Win32'"
>
Pixel
</ShaderType>
<ShaderModel
Condition=
"'$(Configuration)|$(Platform)'=='Release|Win32'"
>
4.0
</ShaderModel>
<ShaderType
Condition=
"'$(Configuration)|$(Platform)'=='Release|x64'"
>
Pixel
</ShaderType>
<ShaderModel
Condition=
"'$(Configuration)|$(Platform)'=='Release|x64'"
>
4.0
</ShaderModel>
<ObjectFileOutput
Condition=
"'$(Configuration)|$(Platform)'=='Release|Win32'"
>
$(ProjectDir)%(Filename).cso
</ObjectFileOutput>
<ObjectFileOutput
Condition=
"'$(Configuration)|$(Platform)'=='Release|x64'"
>
$(ProjectDir)%(Filename).cso
</ObjectFileOutput>
</FxCompile>
</FxCompile>
<FxCompile
Include=
"SolidPS.hlsl"
>
<FxCompile
Include=
"SolidPS.hlsl"
>
<ShaderType
Condition=
"'$(Configuration)|$(Platform)'=='Debug|Win32'"
>
Pixel
</ShaderType>
<ShaderType
Condition=
"'$(Configuration)|$(Platform)'=='Debug|Win32'"
>
Pixel
</ShaderType>
...
...
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