Skip to content

Commit bf0695c

Browse files
committed
Added add_model cmake macro
1 parent d29fbe9 commit bf0695c

File tree

7 files changed

+24
-13
lines changed

7 files changed

+24
-13
lines changed

igneous/src/gui/gui.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -244,11 +244,10 @@ namespace gui
244244
// backgrounds (@todo: complete with BG_MED, BG_LOW)
245245
#define BG(v) ImVec4(0.200f, 0.220f, 0.270f, v)
246246
// text
247-
#define TEXT(v) ImVec4(0.860f, 0.930f, 0.890f, v)
248247

249248
auto& style = ImGui::GetStyle();
250-
style.Colors[ImGuiCol_Text] = TEXT(0.78f);
251-
style.Colors[ImGuiCol_TextDisabled] = TEXT(0.28f);
249+
style.Colors[ImGuiCol_Text] = ImVec4(0.860f, 0.930f, 0.890f, 0.78f);
250+
style.Colors[ImGuiCol_TextDisabled] = ImVec4(0.860f, 0.930f, 0.890f, 0.28f);
252251
style.Colors[ImGuiCol_WindowBg] = ImVec4(0.13f, 0.14f, 0.17f, 1.00f);
253252
style.Colors[ImGuiCol_ChildWindowBg] = BG(0.58f);
254253
style.Colors[ImGuiCol_PopupBg] = BG(0.9f);
@@ -277,9 +276,9 @@ namespace gui
277276
style.Colors[ImGuiCol_ResizeGrip] = ImVec4(0.47f, 0.77f, 0.83f, 0.04f);
278277
style.Colors[ImGuiCol_ResizeGripHovered] = MED(0.78f);
279278
style.Colors[ImGuiCol_ResizeGripActive] = MED(1.00f);
280-
style.Colors[ImGuiCol_PlotLines] = TEXT(0.63f);
279+
style.Colors[ImGuiCol_PlotLines] = ImVec4(0.860f, 0.930f, 0.890f, 0.63f);
281280
style.Colors[ImGuiCol_PlotLinesHovered] = MED(1.00f);
282-
style.Colors[ImGuiCol_PlotHistogram] = TEXT(0.63f);
281+
style.Colors[ImGuiCol_PlotHistogram] = ImVec4(0.860f, 0.930f, 0.890f, 0.63f);
283282
style.Colors[ImGuiCol_PlotHistogramHovered] = MED(1.00f);
284283
style.Colors[ImGuiCol_TextSelectedBg] = MED(0.43f);
285284
// [...]

igneous/src/physics/debugRenderer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ namespace physics
6666
debugVertices.push_back(fromVertex);
6767
debugVertices.push_back(toVertex);
6868

69-
debugIndicies.push_back(debugIndicies.size());
70-
debugIndicies.push_back(debugIndicies.size());
69+
debugIndicies.push_back((uint16_t)debugIndicies.size());
70+
debugIndicies.push_back((uint16_t)debugIndicies.size());
7171
}
7272

7373
void DebugRenderer::render()

igneous/src/renderer/renderer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ namespace renderer
324324
int pos = file.tellg();
325325

326326
uint32_t modelSize = 0;
327-
for (int i = 0; i < numMeshes; i++)
327+
for (unsigned int i = 0; i < numMeshes; i++)
328328
{
329329
unsigned int numVerticies;
330330
unsigned int numIndicies;
@@ -340,7 +340,7 @@ namespace renderer
340340

341341
std::vector<Mesh> meshes;
342342
uint32_t amountRead = 0;
343-
for (int i = 0; i < numMeshes; i++)
343+
for (unsigned int i = 0; i < numMeshes; i++)
344344
{
345345
unsigned int numVerticies;
346346
unsigned int numIndicies;

samples/sandbox/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,7 @@ add_shaders(sandbox OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/shaders
2424
shaders/fs_poly.sc
2525
)
2626

27+
add_model(sandbox VERTEX res/vertex/color.vtx MODEL res/models/barn.dae OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/res/models/barn.bin)
28+
2729
set_target_properties(sandbox PROPERTIES FOLDER "igneous/samples")
2830
set_property(DIRECTORY ${CMAKE_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT sandbox)

samples/sandbox/res/models/barn.dae

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<asset>
44
<contributor>
55
<author>Blender User</author>
6-
<authoring_tool>Blender 2.80.75 commit date:2019-07-29, commit time:14:47, hash:f6cb5f54494e</authoring_tool>
6+
<authoring_tool></authoring_tool>
77
</contributor>
88
<created>2019-07-31T13:13:34</created>
99
<modified>2019-07-31T13:13:34</modified>
@@ -210,4 +210,4 @@
210210
<scene>
211211
<instance_visual_scene url="#Scene"/>
212212
</scene>
213-
</COLLADA>
213+
</COLLADA>

tools/modelc/CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,15 @@ target_include_directories(modelc PUBLIC
1414
)
1515

1616
set_target_properties(modelc PROPERTIES FOLDER "igneous/tools")
17+
18+
macro(add_model ARG_TARGET)
19+
cmake_parse_arguments(ARG "" "VERTEX;MODEL;OUTPUT" "" ${ARGN})
20+
target_sources(${ARG_TARGET} PRIVATE ${ARG_MODEL})
21+
add_custom_command(
22+
MAIN_DEPENDENCY ${ARG_MODEL}
23+
OUTPUT ${ARG_OUTPUT}
24+
COMMAND "$<TARGET_FILE:modelc>" -v "${ARG_VERTEX}" -m "${ARG_MODEL}" -o "${ARG_OUTPUT}"
25+
COMMENT "Compiling model ${ARG_MODEL}"
26+
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
27+
)
28+
endmacro()

tools/modelc/modelc.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ int ctoi(char c)
2222
return c - '0';
2323
}
2424

25-
// -v res/vertex/color.vtx -m res/models/BigBarn/BigBarn.obj -o ../../build/samples/sandbox/res/models/BigBarn.bin
26-
// ..\..\..\samples\sandbox
2725
int main(int argc, char** argv)
2826
{
2927
bx::CommandLine cmd(argc, argv);

0 commit comments

Comments
 (0)