Skip to content

Commit ecc6383

Browse files
committed
release: Release version 1.0.0
1 parent 8524c19 commit ecc6383

File tree

2,046 files changed

+880425
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,046 files changed

+880425
-0
lines changed

.clang-format

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
---
2+
Language: Cpp
3+
AccessModifierOffset: -4
4+
AlignAfterOpenBracket: Align
5+
AlignConsecutiveMacros: false
6+
AlignConsecutiveAssignments: true
7+
AlignConsecutiveDeclarations: false
8+
AlignEscapedNewlines: Right
9+
AlignOperands: true
10+
AlignTrailingComments: true
11+
AllowAllArgumentsOnNextLine: true
12+
AllowAllConstructorInitializersOnNextLine: true
13+
AllowAllParametersOfDeclarationOnNextLine: true
14+
AllowShortBlocksOnASingleLine: Never
15+
AllowShortCaseLabelsOnASingleLine: true
16+
AllowShortFunctionsOnASingleLine: false
17+
AllowShortLambdasOnASingleLine: All
18+
AllowShortIfStatementsOnASingleLine: false
19+
AllowShortLoopsOnASingleLine: true
20+
AlwaysBreakAfterDefinitionReturnType: None
21+
AlwaysBreakAfterReturnType: None
22+
AlwaysBreakBeforeMultilineStrings: false
23+
AlwaysBreakTemplateDeclarations: Yes
24+
BinPackArguments: true
25+
BinPackParameters: true
26+
BraceWrapping:
27+
AfterCaseLabel: false
28+
AfterClass: true
29+
AfterControlStatement: Never
30+
AfterEnum: true
31+
AfterFunction: true
32+
AfterNamespace: false
33+
AfterObjCDeclaration: false
34+
AfterStruct: true
35+
AfterUnion: true
36+
BeforeCatch: false
37+
BeforeElse: false
38+
BeforeLambdaBody: false
39+
BeforeWhile: false
40+
IndentBraces: false
41+
SplitEmptyFunction: true
42+
SplitEmptyRecord: true
43+
SplitEmptyNamespace: true
44+
BreakBeforeBinaryOperators: None
45+
BreakBeforeBraces: Custom
46+
BreakBeforeInheritanceComma: false
47+
BreakInheritanceList: BeforeColon
48+
BreakBeforeTernaryOperators: true
49+
BreakConstructorInitializersBeforeComma: false
50+
BreakConstructorInitializers: BeforeColon
51+
BreakAfterJavaFieldAnnotations: false
52+
BreakStringLiterals: true
53+
ColumnLimit: 100
54+
CommentPragmas: '^ IWYU pragma:'
55+
CompactNamespaces: false
56+
ConstructorInitializerAllOnOneLineOrOnePerLine: false
57+
ConstructorInitializerIndentWidth: 4
58+
ContinuationIndentWidth: 4
59+
Cpp11BracedListStyle: true
60+
DeriveLineEnding: true
61+
DerivePointerAlignment: false
62+
DisableFormat: false
63+
ExperimentalAutoDetectBinPacking: false
64+
FixNamespaceComments: true
65+
ForEachMacros:
66+
- foreach
67+
- Q_FOREACH
68+
- BOOST_FOREACH
69+
IncludeBlocks: Preserve
70+
IncludeCategories:
71+
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
72+
Priority: 2
73+
SortPriority: 0
74+
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
75+
Priority: 3
76+
SortPriority: 0
77+
- Regex: '.*'
78+
Priority: 1
79+
SortPriority: 0
80+
IncludeIsMainRegex: '(Test)?$'
81+
IncludeIsMainSourceRegex: ''
82+
IndentCaseLabels: false
83+
IndentGotoLabels: true
84+
IndentPPDirectives: None
85+
IndentWidth: 4
86+
IndentWrappedFunctionNames: false
87+
JavaScriptQuotes: Leave
88+
JavaScriptWrapImports: true
89+
KeepEmptyLinesAtTheStartOfBlocks: true
90+
MacroBlockBegin: ''
91+
MacroBlockEnd: ''
92+
MaxEmptyLinesToKeep: 1
93+
NamespaceIndentation: None
94+
ObjCBinPackProtocolList: Auto
95+
ObjCBlockIndentWidth: 4
96+
ObjCSpaceAfterProperty: false
97+
ObjCSpaceBeforeProtocolList: true
98+
PenaltyBreakAssignment: 2
99+
PenaltyBreakBeforeFirstCallParameter: 19
100+
PenaltyBreakComment: 300
101+
PenaltyBreakFirstLessLess: 120
102+
PenaltyBreakString: 1000
103+
PenaltyBreakTemplateDeclaration: 10
104+
PenaltyExcessCharacter: 1000000
105+
PenaltyReturnTypeOnItsOwnLine: 60
106+
PointerAlignment: Left
107+
ReflowComments: true
108+
SortIncludes: false
109+
SortUsingDeclarations: true
110+
SpaceAfterCStyleCast: false
111+
SpaceAfterLogicalNot: false
112+
SpaceAfterTemplateKeyword: false
113+
SpaceBeforeAssignmentOperators: true
114+
SpaceBeforeCaseColon: false
115+
SpaceBeforeCpp11BracedList: false
116+
SpaceBeforeCtorInitializerColon: true
117+
SpaceBeforeInheritanceColon: true
118+
SpaceBeforeParens: ControlStatementsExceptControlMacros
119+
SpaceBeforeRangeBasedForLoopColon: true
120+
SpaceBeforeSquareBrackets: false
121+
SpaceInEmptyBlock: false
122+
SpaceInEmptyParentheses: false
123+
SpacesBeforeTrailingComments: 1
124+
SpacesInAngles: false
125+
SpacesInConditionalStatement: false
126+
SpacesInContainerLiterals: true
127+
SpacesInCStyleCastParentheses: false
128+
SpacesInParentheses: false
129+
SpacesInSquareBrackets: false
130+
Standard: c++17
131+
StatementMacros:
132+
- Q_UNUSED
133+
- QT_REQUIRE_VERSION
134+
TabWidth: 4
135+
UseCRLF: false
136+
UseTab: Never
137+
...

.gitattributes

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
* text=auto
2+
3+
*.c text
4+
*.cpp text
5+
*.h text
6+
*.hpp text
7+
*.inc text
8+
9+
*.png binary

.gitignore

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# For C++ language -------------------------------
2+
build/
3+
# Compiled Object files
4+
*.slo
5+
*.lo
6+
*.o
7+
*.obj
8+
# Precompiled Headers
9+
*.gch
10+
*.pch
11+
# Executables
12+
*.exe
13+
*.out
14+
*.app
15+
16+
# For IDEs / editors -----------------------------
17+
# Visual Studio
18+
*.rsuser
19+
*.suo
20+
*.user
21+
*.userosscache
22+
*.sln.docstates
23+
.vs/
24+
ipch/
25+
*.aps
26+
*.ncb
27+
*.opendb
28+
*.opensdf
29+
*.sdf
30+
*.cachefile
31+
*.VC.db
32+
*.VC.VC.opendb
33+
*.[Cc]ache
34+
# Visual Studio Code
35+
.vscode/
36+
# Vim
37+
.vim/
38+
*.swp
39+
40+
# For Doxygen ------------------------------------
41+
docs/build/

CMakeLists.txt

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
cmake_minimum_required(VERSION 3.5)
2+
project(dandelion VERSION 0.4)
3+
4+
set(CMAKE_CXX_STANDARD 17)
5+
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
6+
set(CMAKE_CONFIGURATION_TYPES "Debug;Release")
7+
if (CMAKE_BUILD_TYPE MATCHES "(Debug)|(Release)")
8+
message("Current build type: ${CMAKE_BUILD_TYPE}")
9+
else()
10+
message("Set default buile type to Debug.")
11+
set(CMAKE_BUILD_TYPE "Debug")
12+
endif()
13+
set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE)
14+
15+
add_subdirectory(deps/glfw)
16+
17+
set(ASSIMP_BUILD_ALL_IMPORTERS_BY_DEFAULT OFF CACHE BOOL "" FORCE)
18+
set(ASSIMP_BUILD_ALL_EXPORTERS_BY_DEFAULT OFF CACHE BOOL "" FORCE)
19+
set(ASSIMP_BUILD_TESTS OFF CACHE BOOL "" FORCE)
20+
set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
21+
set(ASSIMP_BUILD_COLLADA_IMPORTER TRUE)
22+
set(ASSIMP_BUILD_OBJ_IMPORTER TRUE)
23+
set(ASSIMP_BUILD_FBX_IMPORTER TRUE)
24+
add_subdirectory(deps/assimp)
25+
26+
set(GLAD_SOURCES
27+
deps/glad/src/glad.c
28+
)
29+
set(IMGUI_SOURCES
30+
deps/imgui/imgui.cpp
31+
deps/imgui/imgui_demo.cpp
32+
deps/imgui/imgui_draw.cpp
33+
deps/imgui/imgui_tables.cpp
34+
deps/imgui/imgui_widgets.cpp
35+
deps/imgui/imgui_impl_glfw.cpp
36+
deps/imgui/imgui_impl_opengl3.cpp
37+
)
38+
39+
set(DANDELION_PLATFORM_SOURCES
40+
src/platform/platform.cpp
41+
src/platform/gl.cpp
42+
src/platform/shader.cpp
43+
)
44+
set(DANDELION_UI_SOURCES
45+
src/ui/controller.cpp
46+
src/ui/menubar.cpp
47+
src/ui/toolbar.cpp
48+
)
49+
set(DANDELION_SCENE_SOURCES
50+
src/scene/scene.cpp
51+
src/scene/group.cpp
52+
src/scene/object.cpp
53+
src/scene/camera.cpp
54+
src/scene/light.cpp
55+
)
56+
set(DANDELION_UTILS_SOURCES
57+
src/utils/stb_image_wrapper.cpp
58+
# src/utils/ray.cpp
59+
# src/utils/aabb.cpp
60+
# src/utils/bvh.cpp
61+
src/utils/kinetic_state.cpp
62+
src/utils/logger.cpp
63+
)
64+
set(DANDELION_RENDER_SOURCES
65+
src/render/shader.cpp
66+
src/render/rasterizer.cpp
67+
src/render/rasterizer_mt.cpp
68+
src/render/rasterizer_renderer.cpp
69+
src/render/rasterizer_renderer_mt.cpp
70+
src/render/whitted_renderer.cpp
71+
src/render/render_engine.cpp
72+
src/render/triangle.cpp
73+
)
74+
set(DANDELION_GEOMETRY_SOURCES
75+
src/geometry/halfedge_mesh.cpp
76+
src/geometry/meshedit.cpp
77+
src/geometry/halfedge.cpp
78+
src/geometry/vertex.cpp
79+
src/geometry/edge.cpp
80+
src/geometry/face.cpp
81+
)
82+
set(DANDELION_SIMULATION_SOURCES
83+
src/simulation/solver.cpp
84+
)
85+
86+
set(SOURCES
87+
src/main.cpp
88+
${DANDELION_PLATFORM_SOURCES}
89+
${DANDELION_UI_SOURCES}
90+
${DANDELION_SCENE_SOURCES}
91+
${DANDELION_UTILS_SOURCES}
92+
${DANDELION_RENDER_SOURCES}
93+
${DANDELION_GEOMETRY_SOURCES}
94+
${DANDELION_SIMULATION_SOURCES}
95+
${GLAD_SOURCES}
96+
${IMGUI_SOURCES}
97+
)
98+
99+
add_executable(${PROJECT_NAME} ${SOURCES})
100+
target_include_directories(${PROJECT_NAME}
101+
PRIVATE deps
102+
PRIVATE deps/glad/include
103+
)
104+
target_link_directories(${PROJECT_NAME} PRIVATE deps)
105+
target_link_libraries(${PROJECT_NAME}
106+
glfw
107+
assimp
108+
debug dandelion-ray-debug
109+
optimized dandelion-ray
110+
debug dandelion-bvh-debug
111+
optimized dandelion-bvh
112+
)
113+
target_compile_definitions(${PROJECT_NAME}
114+
PRIVATE $<$<CONFIG:Debug>:DEBUG>
115+
PRIVATE SPDLOG_FMT_EXTERNAL
116+
PRIVATE FMT_HEADER_ONLY
117+
)
118+
# Apple macOS has platform-specific libraries (frameworks) which need to be linked
119+
if (APPLE)
120+
find_package(OpenGL REQUIRED)
121+
target_include_directories(${PROJECT_NAME} PRIVATE ${OPENGL_INCLUDE_DIR})
122+
target_link_libraries(${PROJECT_NAME}
123+
"-framework Cocoa"
124+
"-framework OpenGL"
125+
"-framework IOKit"
126+
${OPENGL_gl_LIBRARY}
127+
)
128+
endif()
129+
130+
# Disable the deprecated-non-prototype warning for zlib
131+
if (${CMAKE_C_COMPILER_ID} MATCHES "Clang")
132+
target_compile_options(zlibstatic
133+
PRIVATE $<$<COMPILE_LANGUAGE:C>:-Wno-deprecated-non-prototype>
134+
)
135+
endif()
136+
if (MSVC)
137+
# Disable C4127 for Eigen
138+
# Disable C4996 for std::fopen
139+
# Disable C4458 because we usually declare local variables with the same name
140+
# as member variables just as short for the members.
141+
target_compile_options(${PROJECT_NAME}
142+
PRIVATE /W4 /utf-8 /wd4127 /wd4996 /wd4458
143+
)
144+
target_compile_definitions(${PROJECT_NAME}
145+
PRIVATE NOMINMAX
146+
)
147+
else()
148+
target_compile_options(${PROJECT_NAME}
149+
PRIVATE -Wall -Wextra -Werror
150+
)
151+
endif()
152+
153+
file(COPY ${PROJECT_SOURCE_DIR}/resources DESTINATION ${PROJECT_BINARY_DIR})

CREDITS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Icon by Freepik from www.flaticon.com

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Dandelion 3D
2+
3+
Dandelion is a light-weight, cross-platform graphics framework for educational usage. It allow users to load and place objects in a 3D scene, render the scene using different offline renderers, edit mesh with the help of halfedge data structure, or perform simple simulation. We believe it will be a good choice for basic computer graphics courses.
4+
5+
We have Dandelion Development Documents published on both *GitHub Pages* and *Read the Docs*:
6+
7+
- https://xjtu-graphics.github.io/Dandelion-docs/index.html
8+
- https://dandelion-docs.readthedocs.io
9+
10+
The two websites are synchronized automatically, please visit any of them to get more information about Dandelion 3D. We hope the documents will be helpful for extending Dandelion to more graphics labs.
11+
12+
Dandelion 是一个轻量级的跨平台图形学实验框架,实现了场景布局、离线渲染、网格编辑、物理模拟等功能,可以用于计算机图形学入门课程的教学。
13+
14+
Dandelion 开发者文档同步托管于 GitHub Pages 和 Read the Docs 两个平台:
15+
16+
- https://xjtu-graphics.github.io/Dandelion-docs/index.html
17+
- https://dandelion-docs.readthedocs.io
18+
19+
请访问上述二者之一来获取详细的文档。相信在这些文档的帮助下,扩展 Dandelion 使之支持更多的图形学实验会更加容易。

0 commit comments

Comments
 (0)