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
PracticeDx
Commits
7402f027
Commit
7402f027
authored
Apr 10, 2023
by
Administrator
Browse files
resolved multiple images in same section
parent
c8ea3d98
Changes
7
Hide whitespace changes
Inline
Side-by-side
PracticeDx/Box.cpp
View file @
7402f027
...
...
@@ -125,7 +125,7 @@ Box::Box(Graphics& gfx, StructVertex vertices[], Logger& logger)
//{ "Position",0,DXGI_FORMAT_R32G32B32_FLOAT,0,0,D3D11_INPUT_PER_VERTEX_DATA,0 },
{
"Position"
,
0
,
DXGI_FORMAT_R32G32B32_FLOAT
,
0
,
0
,
D3D11_INPUT_PER_VERTEX_DATA
,
0
},
{
"TexCoord"
,
0
,
DXGI_FORMAT_R32G32_FLOAT
,
0
,
12
,
D3D11_INPUT_PER_VERTEX_DATA
,
0
},
{
"ImageSlot"
,
0
,
DXGI_FORMAT_R32_
UIN
T
,
0
,
20
,
D3D11_INPUT_PER_VERTEX_DATA
,
0
},
{
"ImageSlot"
,
0
,
DXGI_FORMAT_R32_
FLOA
T
,
0
,
20
,
D3D11_INPUT_PER_VERTEX_DATA
,
0
},
};
//AddBind(std::make_unique<InputLayout>(gfx, ied, pvsbc));
AddStaticBind
(
std
::
make_unique
<
InputLayout
>
(
gfx
,
ied
,
pvsbc
));
...
...
PracticeDx/Ground.cpp
View file @
7402f027
...
...
@@ -8,11 +8,15 @@ Ground::Ground(Graphics & gfx, Logger & logger) noexcept
// Init 2 surfaces
Surface
*
yueyueSurface
=
new
Surface
();
yueyueSurface
->
LoadImageFromFile
(
gfx
.
getDevice
(),
gfx
.
getContext
(),
"resource
\\
img
\\
yueyue.jpg"
);
UINT
yueyueSlot
=
yueyueSurface
->
GetCurrSlot
();
float
yueyueSlot
=
yueyueSurface
->
GetCurrSlot
();
Surface
*
ethanSurface
=
new
Surface
();
ethanSurface
->
LoadImageFromFile
(
gfx
.
getDevice
(),
gfx
.
getContext
(),
"resource
\\
img
\\
Ethan.png"
);
UINT
ethanSlot
=
ethanSurface
->
GetCurrSlot
();
float
ethanSlot
=
ethanSurface
->
GetCurrSlot
();
Surface
*
ethanAndYueyueSurface
=
new
Surface
();
ethanAndYueyueSurface
->
LoadImageFromFile
(
gfx
.
getDevice
(),
gfx
.
getContext
(),
"resource
\\
img
\\
Ethan_and_yueyue.png"
);
float
ethanAndYueyueSlot
=
ethanAndYueyueSurface
->
GetCurrSlot
();
for
(
int
i
=
0
;
i
<
2
;
i
+=
2
)
for
(
int
j
=
0
;
j
<
2
;
j
+=
2
)
...
...
@@ -52,13 +56,13 @@ Ground::Ground(Graphics & gfx, Logger & logger) noexcept
// top surface
// left top front
{
XMFLOAT3
(
-
1.0
f
+
i
,
1.0
f
,
1.0
f
+
j
),
XMFLOAT2
(
0.0
f
,
0.0
f
),
y
ueyueSlot
},
{
XMFLOAT3
(
-
1.0
f
+
i
,
1.0
f
,
1.0
f
+
j
),
XMFLOAT2
(
0.0
f
,
0.0
f
),
ethanAndY
ueyueSlot
},
// right top front
{
XMFLOAT3
(
1.0
f
+
i
,
1.0
f
,
1.0
f
+
j
),
XMFLOAT2
(
1.0
f
,
0.0
f
),
y
ueyueSlot
},
{
XMFLOAT3
(
1.0
f
+
i
,
1.0
f
,
1.0
f
+
j
),
XMFLOAT2
(
1.0
f
,
0.0
f
),
ethanAndY
ueyueSlot
},
// left top back
{
XMFLOAT3
(
-
1.0
f
+
i
,
1.0
f
,
-
1.0
f
+
j
),
XMFLOAT2
(
0.0
f
,
1.0
f
),
y
ueyueSlot
},
{
XMFLOAT3
(
-
1.0
f
+
i
,
1.0
f
,
-
1.0
f
+
j
),
XMFLOAT2
(
0.0
f
,
1.0
f
),
ethanAndY
ueyueSlot
},
// right top back
{
XMFLOAT3
(
1.0
f
+
i
,
1.0
f
,
-
1.0
f
+
j
),
XMFLOAT2
(
1.0
f
,
1.0
f
),
y
ueyueSlot
},
{
XMFLOAT3
(
1.0
f
+
i
,
1.0
f
,
-
1.0
f
+
j
),
XMFLOAT2
(
1.0
f
,
1.0
f
),
ethanAndY
ueyueSlot
},
// front surface
// right top front
...
...
@@ -72,13 +76,13 @@ Ground::Ground(Graphics & gfx, Logger & logger) noexcept
// bottom surface
// left bottom back
{
XMFLOAT3
(
-
1.0
f
+
i
,
-
1.0
f
,
-
1.0
f
+
j
),
XMFLOAT2
(
0.0
f
,
0.0
f
),
ethanSlot
},
{
XMFLOAT3
(
-
1.0
f
+
i
,
-
1.0
f
,
-
1.0
f
+
j
),
XMFLOAT2
(
0.0
f
,
0.0
f
),
ethan
AndYueyue
Slot
},
// right bottom back
{
XMFLOAT3
(
1.0
f
+
i
,
-
1.0
f
,
-
1.0
f
+
j
),
XMFLOAT2
(
1.0
f
,
0.0
f
),
ethanSlot
},
{
XMFLOAT3
(
1.0
f
+
i
,
-
1.0
f
,
-
1.0
f
+
j
),
XMFLOAT2
(
1.0
f
,
0.0
f
),
ethan
AndYueyue
Slot
},
// left bottom front
{
XMFLOAT3
(
-
1.0
f
+
i
,
-
1.0
f
,
1.0
f
+
j
),
XMFLOAT2
(
0.0
f
,
1.0
f
),
ethanSlot
},
{
XMFLOAT3
(
-
1.0
f
+
i
,
-
1.0
f
,
1.0
f
+
j
),
XMFLOAT2
(
0.0
f
,
1.0
f
),
ethan
AndYueyue
Slot
},
// right bottom front
{
XMFLOAT3
(
1.0
f
+
i
,
-
1.0
f
,
1.0
f
+
j
),
XMFLOAT2
(
1.0
f
,
1.0
f
),
ethanSlot
},
{
XMFLOAT3
(
1.0
f
+
i
,
-
1.0
f
,
1.0
f
+
j
),
XMFLOAT2
(
1.0
f
,
1.0
f
),
ethan
AndYueyue
Slot
},
};
shapes
.
push_back
(
std
::
make_unique
<
Box
>
(
gfx
,
vertices
,
logger
));
...
...
PracticeDx/PracticeDx.vcxproj.filters
View file @
7402f027
...
...
@@ -99,6 +99,15 @@
<ClCompile
Include=
"DrawableBase.cpp"
>
<Filter>
Source Files\Drawables
</Filter>
</ClCompile>
<ClCompile
Include=
"Sampler.cpp"
>
<Filter>
Source Files
</Filter>
</ClCompile>
<ClCompile
Include=
"Surface.cpp"
>
<Filter>
Source Files
</Filter>
</ClCompile>
<ClCompile
Include=
"Texture.cpp"
>
<Filter>
Source Files
</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<FxCompile
Include=
"PixelShader.hlsl"
>
...
...
@@ -107,6 +116,12 @@
<FxCompile
Include=
"VertexShader.hlsl"
>
<Filter>
Shaders
</Filter>
</FxCompile>
<FxCompile
Include=
"TexturePS.hlsl"
>
<Filter>
Shaders
</Filter>
</FxCompile>
<FxCompile
Include=
"TextureVS.hlsl"
>
<Filter>
Shaders
</Filter>
</FxCompile>
</ItemGroup>
<ItemGroup>
<ClInclude
Include=
"Timer.h"
>
...
...
@@ -163,5 +178,14 @@
<ClInclude
Include=
"DrawableBase.h"
>
<Filter>
Header Files\Drawables
</Filter>
</ClInclude>
<ClInclude
Include=
"Sampler.h"
>
<Filter>
Header Files
</Filter>
</ClInclude>
<ClInclude
Include=
"Surface.h"
>
<Filter>
Header Files
</Filter>
</ClInclude>
<ClInclude
Include=
"Texture.h"
>
<Filter>
Header Files
</Filter>
</ClInclude>
</ItemGroup>
</Project>
\ No newline at end of file
PracticeDx/Structs.h
View file @
7402f027
...
...
@@ -10,7 +10,7 @@ struct StructVertex
{
DirectX
::
XMFLOAT3
pos
;
DirectX
::
XMFLOAT2
texCoord
;
UINT
slot
;
float
slot
;
};
struct
StructPixelConstBuf
...
...
PracticeDx/TexturePS.hlsl
View file @
7402f027
Texture2D
tex0
:
register
(
t0
);
Texture2D
tex1
:
register
(
t1
);
Texture2D
tex2
:
register
(
t2
);
struct
PSInput
{
...
...
@@ -11,13 +12,15 @@ SamplerState splr;
float4
main
(
PSInput
input
)
:
SV_Target
{
//return tex.Sample(splr,tc);
if
(
input
.
slot
==
1
.
0
f
)
switch
(
input
.
slot
)
{
case
0
.
0
f
:
return
tex0
.
Sample
(
splr
,
input
.
tex
);
case
1
.
0
f
:
return
tex1
.
Sample
(
splr
,
input
.
tex
);
}
else
{
case
2
.
0
f
:
return
tex2
.
Sample
(
splr
,
input
.
tex
);
default:
return
tex0
.
Sample
(
splr
,
input
.
tex
);
}
}
\ No newline at end of file
PracticeDx/WinMain.cpp
View file @
7402f027
...
...
@@ -771,7 +771,7 @@ int WINAPI WinMain(HINSTANCE hInstance,
auto
cosValue
=
cos
(
seed
/
5000
);
// Set camera
DirectX
::
XMVECTOR
eyePosition
=
DirectX
::
XMVectorSet
(
5.0
f
*
sinValue
,
2
.0
f
,
-
5.0
f
*
cosValue
,
1.0
f
);
DirectX
::
XMVECTOR
eyePosition
=
DirectX
::
XMVectorSet
(
5.0
f
*
sinValue
,
3
.0
f
,
-
5.0
f
*
cosValue
,
1.0
f
);
DirectX
::
XMVECTOR
focusPosition
=
DirectX
::
XMVectorZero
();
DirectX
::
XMVECTOR
upDirection
=
DirectX
::
XMVectorSet
(
0.0
f
,
1.0
f
,
0.0
f
,
1.0
f
);
...
...
PracticeDx/resource/img/Ethan_and_yueyue.png
0 → 100644
View file @
7402f027
560 KB
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