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
dfb87d50
Commit
dfb87d50
authored
Feb 20, 2019
by
chili
Browse files
disable assorted scene genny
parent
eaec9510
Changes
1
Show whitespace changes
Inline
Side-by-side
hw3d/App.cpp
View file @
dfb87d50
...
@@ -11,53 +11,53 @@ App::App()
...
@@ -11,53 +11,53 @@ App::App()
:
:
wnd
(
800
,
600
,
"The Donkey Fart Box"
)
wnd
(
800
,
600
,
"The Donkey Fart Box"
)
{
{
class
Factory
//
class Factory
{
//
{
public:
//
public:
Factory
(
Graphics
&
gfx
)
//
Factory( Graphics& gfx )
:
//
:
gfx
(
gfx
)
//
gfx( gfx )
{}
//
{}
std
::
unique_ptr
<
Drawable
>
operator
()()
//
std::unique_ptr<Drawable> operator()()
{
//
{
switch
(
typedist
(
rng
)
)
//
switch( typedist( rng ) )
{
//
{
case
0
:
//
case 0:
return
std
::
make_unique
<
Pyramid
>
(
//
return std::make_unique<Pyramid>(
gfx
,
rng
,
adist
,
ddist
,
//
gfx,rng,adist,ddist,
odist
,
rdist
//
odist,rdist
);
//
);
case
1
:
//
case 1:
return
std
::
make_unique
<
Box
>
(
//
return std::make_unique<Box>(
gfx
,
rng
,
adist
,
ddist
,
//
gfx,rng,adist,ddist,
odist
,
rdist
,
bdist
//
odist,rdist,bdist
);
//
);
case
2
:
//
case 2:
return
std
::
make_unique
<
Melon
>
(
//
return std::make_unique<Melon>(
gfx
,
rng
,
adist
,
ddist
,
//
gfx,rng,adist,ddist,
odist
,
rdist
,
longdist
,
latdist
//
odist,rdist,longdist,latdist
);
//
);
default:
//
default:
assert
(
false
&&
"bad drawable type in factory"
);
//
assert( false && "bad drawable type in factory" );
return
{};
//
return {};
}
//
}
}
//
}
private:
//
private:
Graphics
&
gfx
;
//
Graphics& gfx;
std
::
mt19937
rng
{
std
::
random_device
{}()
};
//
std::mt19937 rng{ std::random_device{}() };
std
::
uniform_real_distribution
<
float
>
adist
{
0.0
f
,
PI
*
2.0
f
};
//
std::uniform_real_distribution<float> adist{ 0.0f,PI * 2.0f };
std
::
uniform_real_distribution
<
float
>
ddist
{
0.0
f
,
PI
*
0.5
f
};
//
std::uniform_real_distribution<float> ddist{ 0.0f,PI * 0.5f };
std
::
uniform_real_distribution
<
float
>
odist
{
0.0
f
,
PI
*
0.08
f
};
//
std::uniform_real_distribution<float> odist{ 0.0f,PI * 0.08f };
std
::
uniform_real_distribution
<
float
>
rdist
{
6.0
f
,
20.0
f
};
//
std::uniform_real_distribution<float> rdist{ 6.0f,20.0f };
std
::
uniform_real_distribution
<
float
>
bdist
{
0.4
f
,
3.0
f
};
//
std::uniform_real_distribution<float> bdist{ 0.4f,3.0f };
std
::
uniform_int_distribution
<
int
>
latdist
{
5
,
20
};
//
std::uniform_int_distribution<int> latdist{ 5,20 };
std
::
uniform_int_distribution
<
int
>
longdist
{
10
,
40
};
//
std::uniform_int_distribution<int> longdist{ 10,40 };
std
::
uniform_int_distribution
<
int
>
typedist
{
0
,
2
};
//
std::uniform_int_distribution<int> typedist{ 0,2 };
};
//
};
Factory
f
(
wnd
.
Gfx
()
);
//
Factory f( wnd.Gfx() );
drawables
.
reserve
(
nDrawables
);
//
drawables.reserve( nDrawables );
std
::
generate_n
(
std
::
back_inserter
(
drawables
),
nDrawables
,
f
);
//
std::generate_n( std::back_inserter( drawables ),nDrawables,f );
wnd
.
Gfx
().
SetProjection
(
DirectX
::
XMMatrixPerspectiveLH
(
1.0
f
,
3.0
f
/
4.0
f
,
0.5
f
,
40.0
f
)
);
wnd
.
Gfx
().
SetProjection
(
DirectX
::
XMMatrixPerspectiveLH
(
1.0
f
,
3.0
f
/
4.0
f
,
0.5
f
,
40.0
f
)
);
}
}
...
...
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