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
724fe1fa
Commit
724fe1fa
authored
May 05, 2019
by
chili
Browse files
closeable box windows
parent
6df339c9
Changes
3
Hide whitespace changes
Inline
Side-by-side
hw3d/App.cpp
View file @
724fe1fa
...
@@ -155,9 +155,16 @@ void App::SpawnBoxWindowManagerWindow() noexcept
...
@@ -155,9 +155,16 @@ void App::SpawnBoxWindowManagerWindow() noexcept
void
App
::
SpawnBoxWindows
()
noexcept
void
App
::
SpawnBoxWindows
()
noexcept
{
{
for
(
auto
i
d
:
boxControlIds
)
for
(
auto
i
=
boxControlIds
.
begin
();
i
!=
boxControlIds
.
end
();
)
{
{
boxes
[
id
]
->
SpawnControlWindow
(
id
,
wnd
.
Gfx
()
);
if
(
!
boxes
[
*
i
]
->
SpawnControlWindow
(
*
i
,
wnd
.
Gfx
()
)
)
{
i
=
boxControlIds
.
erase
(
i
);
}
else
{
i
++
;
}
}
}
}
}
...
...
hw3d/Box.cpp
View file @
724fe1fa
...
@@ -69,12 +69,13 @@ DirectX::XMMATRIX Box::GetTransformXM() const noexcept
...
@@ -69,12 +69,13 @@ DirectX::XMMATRIX Box::GetTransformXM() const noexcept
return
dx
::
XMLoadFloat3x3
(
&
mt
)
*
TestObject
::
GetTransformXM
();
return
dx
::
XMLoadFloat3x3
(
&
mt
)
*
TestObject
::
GetTransformXM
();
}
}
void
Box
::
SpawnControlWindow
(
int
id
,
Graphics
&
gfx
)
noexcept
bool
Box
::
SpawnControlWindow
(
int
id
,
Graphics
&
gfx
)
noexcept
{
{
using
namespace
std
::
string_literals
;
using
namespace
std
::
string_literals
;
bool
dirty
=
false
;
bool
dirty
=
false
;
if
(
ImGui
::
Begin
(
(
"Box "
s
+
std
::
to_string
(
id
)).
c_str
()
)
)
bool
open
=
true
;
if
(
ImGui
::
Begin
(
(
"Box "
s
+
std
::
to_string
(
id
)).
c_str
(),
&
open
)
)
{
{
const
auto
cd
=
ImGui
::
ColorEdit3
(
"Material Color"
,
&
materialConstants
.
color
.
x
);
const
auto
cd
=
ImGui
::
ColorEdit3
(
"Material Color"
,
&
materialConstants
.
color
.
x
);
const
auto
sid
=
ImGui
::
SliderFloat
(
"Specular Intensity"
,
&
materialConstants
.
specularIntensity
,
0.05
f
,
4.0
f
,
"%.2f"
,
2
);
const
auto
sid
=
ImGui
::
SliderFloat
(
"Specular Intensity"
,
&
materialConstants
.
specularIntensity
,
0.05
f
,
4.0
f
,
"%.2f"
,
2
);
...
@@ -87,6 +88,7 @@ void Box::SpawnControlWindow( int id,Graphics& gfx ) noexcept
...
@@ -87,6 +88,7 @@ void Box::SpawnControlWindow( int id,Graphics& gfx ) noexcept
{
{
SyncMaterial
(
gfx
);
SyncMaterial
(
gfx
);
}
}
return
open
;
}
}
void
Box
::
SyncMaterial
(
Graphics
&
gfx
)
noexcept
(
!
IS_DEBUG
)
void
Box
::
SyncMaterial
(
Graphics
&
gfx
)
noexcept
(
!
IS_DEBUG
)
...
...
hw3d/Box.h
View file @
724fe1fa
...
@@ -13,7 +13,8 @@ public:
...
@@ -13,7 +13,8 @@ public:
std
::
uniform_real_distribution
<
float
>&
bdist
,
std
::
uniform_real_distribution
<
float
>&
bdist
,
DirectX
::
XMFLOAT3
material
);
DirectX
::
XMFLOAT3
material
);
DirectX
::
XMMATRIX
GetTransformXM
()
const
noexcept
override
;
DirectX
::
XMMATRIX
GetTransformXM
()
const
noexcept
override
;
void
SpawnControlWindow
(
int
id
,
Graphics
&
gfx
)
noexcept
;
// returns false if window is closed
bool
SpawnControlWindow
(
int
id
,
Graphics
&
gfx
)
noexcept
;
private:
private:
void
SyncMaterial
(
Graphics
&
gfx
)
noexcept
(
!
IS_DEBUG
);
void
SyncMaterial
(
Graphics
&
gfx
)
noexcept
(
!
IS_DEBUG
);
private:
private:
...
...
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