├── ork
├── render
│ ├── Types.h
│ ├── CPUBuffer.cpp
│ ├── Texture2DMultisampleArray.h
│ ├── CPUBuffer.h
│ ├── Texture2DMultisample.cpp
│ ├── Texture2DMultisampleArray.cpp
│ ├── Texture2DMultisample.h
│ ├── Query.cpp
│ ├── TextureBuffer.h
│ ├── Query.h
│ ├── TextureBuffer.cpp
│ └── AttributeBuffer.cpp
├── ork.pc.in
├── CMakeLists.txt
├── taskgraph
│ ├── TaskFactory.cpp
│ ├── Scheduler.cpp
│ ├── TaskFactory.h
│ └── Scheduler.h
├── resource
│ ├── ResourceLoader.cpp
│ ├── ResourceDescriptor.cpp
│ ├── ResourceFactory.cpp
│ ├── CompiledResourceLoader.cpp
│ ├── ResourceLoader.h
│ ├── ResourceCompiler.cpp
│ ├── ResourceDescriptor.h
│ ├── ResourceCompiler.h
│ └── ResourceFactory.h
├── ui
│ ├── DebugCallback.h
│ ├── EventHandler.cpp
│ ├── Window.cpp
│ └── DebugCallback.cpp
├── scenegraph
│ ├── Method.cpp
│ ├── AbstractTask.cpp
│ ├── Method.h
│ ├── SequenceTask.h
│ ├── ShowLogTask.h
│ ├── SequenceTask.cpp
│ ├── CallMethodTask.h
│ ├── AbstractTask.h
│ ├── CallMethodTask.cpp
│ ├── SetProgramTask.h
│ ├── LoopTask.h
│ └── DrawMeshTask.h
└── core
│ ├── GPUTimer.h
│ ├── GPUTimer.cpp
│ ├── Logger.cpp
│ └── Atomic.h
├── doc
└── figures
│ ├── textures.png
│ ├── resource-example.cpp
│ ├── scenegraph-example.cpp
│ └── example.cpp
├── HISTORY.TXT
├── examples
├── shaders
│ ├── flat.xml
│ ├── text.xml
│ ├── camera.xml
│ ├── plastic.xml
│ ├── skybox.xml
│ ├── texturedPlastic.xml
│ ├── skyboxArray.xml
│ ├── postprocess.xml
│ ├── spotlight.xml
│ ├── plasticVS.glsl
│ ├── spotlight.glsl
│ ├── plasticFS.glsl
│ ├── text.glsl
│ ├── flat.glsl
│ ├── skybox.glsl
│ ├── camera.glsl
│ ├── postprocess.glsl
│ └── texturedPlastic.glsl
├── textures
│ ├── checker.png
│ ├── cubemap.png
│ ├── cubemapArray.png
│ ├── lucidaConsole.png
│ ├── checker.xml
│ ├── cubemap.xml
│ ├── lucidaConsole.xml
│ ├── cubemapArray.xml
│ ├── defaultFont.xml
│ ├── offscreenColor.xml
│ └── offscreenDepth.xml
├── methods
│ ├── infoMethod.xml
│ ├── logMethod.xml
│ ├── lightMethod.xml
│ ├── skyboxMethod.xml
│ ├── objectMethod.xml
│ ├── meshMethod.xml
│ ├── cameraMethod.xml
│ └── cameraMethodPostprocess.xml
├── meshes
│ ├── quad.mesh
│ ├── plane.mesh
│ └── cube.mesh
├── CMakeLists.txt
├── scenes
│ ├── skyboxScene.xml
│ ├── exampleScene.xml
│ ├── postprocessScene.xml
│ └── cubesScene.xml
├── Main.h
└── Main.cpp
├── .gitignore
├── libraries
├── CMakeLists.txt
├── stbi
│ └── CMakeLists.txt
└── tinyxml
│ ├── CMakeLists.txt
│ └── tinyxmlerror.cpp
├── test
├── CMakeLists.txt
└── Test.h
├── README.md
├── LICENSE.TXT
├── CMakeLists.txt
└── INSTALL.TXT
/ork/render/Types.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LarsFlaeten/ork/HEAD/ork/render/Types.h
--------------------------------------------------------------------------------
/doc/figures/textures.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LarsFlaeten/ork/HEAD/doc/figures/textures.png
--------------------------------------------------------------------------------
/HISTORY.TXT:
--------------------------------------------------------------------------------
1 | Ork 3.1 (october 2010)
2 |
3 | Release of Ork as an Open Source project, with LGPL license.
4 |
--------------------------------------------------------------------------------
/examples/shaders/flat.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/examples/shaders/text.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/examples/textures/checker.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LarsFlaeten/ork/HEAD/examples/textures/checker.png
--------------------------------------------------------------------------------
/examples/textures/cubemap.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LarsFlaeten/ork/HEAD/examples/textures/cubemap.png
--------------------------------------------------------------------------------
/examples/shaders/camera.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/examples/textures/cubemapArray.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LarsFlaeten/ork/HEAD/examples/textures/cubemapArray.png
--------------------------------------------------------------------------------
/examples/textures/lucidaConsole.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LarsFlaeten/ork/HEAD/examples/textures/lucidaConsole.png
--------------------------------------------------------------------------------
/examples/methods/infoMethod.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/examples/methods/logMethod.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Ignore all builds
2 | /build/
3 | # Ignore bin outut directory
4 | /bin/
5 | # Ignore library output directory
6 | /lib/
7 |
8 |
--------------------------------------------------------------------------------
/examples/shaders/plastic.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/examples/meshes/quad.mesh:
--------------------------------------------------------------------------------
1 | -1 1 -1 1 0 0
2 | trianglestrip
3 | 1
4 | 0 2 float false
5 | 4
6 | -1 -1
7 | +1 -1
8 | -1 +1
9 | +1 +1
10 | 0
11 |
--------------------------------------------------------------------------------
/examples/methods/lightMethod.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/examples/textures/checker.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/examples/textures/cubemap.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/examples/shaders/skybox.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/examples/textures/lucidaConsole.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/examples/textures/cubemapArray.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/examples/textures/defaultFont.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/examples/shaders/texturedPlastic.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/examples/textures/offscreenColor.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/examples/textures/offscreenDepth.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/examples/shaders/skyboxArray.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/examples/shaders/postprocess.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/ork/ork.pc.in:
--------------------------------------------------------------------------------
1 | prefix=@CMAKE_INSTALL_PREFIX@
2 | libdir=${prefix}/@LIB_INSTALL_DIR@
3 | includedir=${prefix}/include
4 |
5 | Name: ork
6 | Description: OpenGL Rendering Kernel
7 | Version: @ORK_VERSION@
8 | Requires:
9 | Libs: -L${libdir} -lork
10 | Cflags: -I${includedir} @ORK_CFLAGS@
11 |
--------------------------------------------------------------------------------
/examples/shaders/spotlight.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/libraries/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | include_directories("${CMAKE_CURRENT_SOURCE_DIR}")
2 |
3 | add_subdirectory(stbi)
4 | add_subdirectory(tinyxml)
5 |
6 | INSTALL(FILES pmath.h DESTINATION include/ork/math)
7 | INSTALL(FILES tinyxml/tinyxml.h DESTINATION include/ork/resource/tinyxml)
8 | INSTALL(FILES stbi/stb_image.h DESTINATION include/ork/resource/stbi)
9 |
--------------------------------------------------------------------------------
/examples/methods/skyboxMethod.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/examples/shaders/plasticVS.glsl:
--------------------------------------------------------------------------------
1 | layout(location = 1) in vec3 normal;
2 | layout(location = 3) in vec4 color;
3 |
4 | out vec3 wpos;
5 | out vec3 wnormal;
6 | out vec4 fcolor;
7 |
8 | void projection(vec3 normal, out vec3 worldPos, out vec3 worldNormal);
9 |
10 | void main() {
11 | projection(normal, wpos, wnormal);
12 | fcolor = color;
13 | }
14 |
--------------------------------------------------------------------------------
/examples/meshes/plane.mesh:
--------------------------------------------------------------------------------
1 | -10 10 -10 10 0 0
2 | trianglestrip
3 | 4
4 | 0 3 float false
5 | 1 3 float false
6 | 2 2 float false
7 | 3 4 ubyte true
8 | 4
9 | -10 -10 0 0 0 +1 0 0 248 166 10 0
10 | +10 -10 0 0 0 +1 1 0 248 166 10 0
11 | -10 +10 0 0 0 +1 0 1 248 166 10 0
12 | +10 +10 0 0 0 +1 1 1 248 166 10 0
13 | 0
14 | // attributes: position - normal - uv - color
15 |
--------------------------------------------------------------------------------
/examples/methods/objectMethod.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/test/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 2.6)
2 |
3 | set(EXENAME ork-test)
4 |
5 | # Sources
6 | include_directories("${PROJECT_SOURCE_DIR}" "${PROJECT_SOURCE_DIR}/libraries" "${CMAKE_CURRENT_SOURCE_DIR}")
7 | file(GLOB SOURCE_FILES *.cpp)
8 |
9 | add_definitions("-DORK_API=")
10 |
11 | add_executable(${EXENAME} ${SOURCE_FILES})
12 | target_link_libraries(${EXENAME} ork)
13 |
14 |
--------------------------------------------------------------------------------
/examples/methods/meshMethod.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/libraries/stbi/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | set(LIBNAME "stb_image")
2 |
3 | # Sources
4 | include_directories("${CMAKE_CURRENT_SOURCE_DIR}")
5 | file(GLOB SOURCE_FILES *.cpp)
6 |
7 | # Create a static library
8 | add_library(${LIBNAME} STATIC ${SOURCE_FILES})
9 |
10 | link_directories(${CMAKE_CURRENT_BINARY_DIR})
11 |
12 | # Install library
13 | INSTALL(TARGETS ${LIBNAME} LIBRARY DESTINATION ${LIB_INSTALL_DIR} ARCHIVE DESTINATION ${LIB_INSTALL_DIR})
14 |
15 |
--------------------------------------------------------------------------------
/libraries/tinyxml/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | set(LIBNAME "tinyxml")
2 |
3 | # Sources
4 | include_directories("${CMAKE_CURRENT_SOURCE_DIR}")
5 | file(GLOB SOURCE_FILES *.cpp)
6 |
7 | add_definitions("-DORK_API=" "-DTIXML_USE_STL")
8 |
9 | # Create a static library
10 | add_library(${LIBNAME} STATIC ${SOURCE_FILES})
11 |
12 | link_directories(${CMAKE_CURRENT_BINARY_DIR})
13 |
14 | # Install library
15 | INSTALL(TARGETS ${LIBNAME} LIBRARY DESTINATION ${LIB_INSTALL_DIR} ARCHIVE DESTINATION ${LIB_INSTALL_DIR})
16 |
17 |
--------------------------------------------------------------------------------
/examples/shaders/spotlight.glsl:
--------------------------------------------------------------------------------
1 | uniform light {
2 | vec3 worldLightPos;
3 | vec3 worldLightDir;
4 | vec2 spotlightAngle;
5 | };
6 |
7 | float illuminance(vec3 worldP, vec3 worldN, out vec3 worldL) {
8 | worldL = normalize(worldLightPos - worldP);
9 | float falloff = 1.0 - smoothstep(spotlightAngle.x, spotlightAngle.y, acos(dot(worldLightDir, -worldL)));
10 | return max(dot(worldN, worldL), 0.0) * falloff;
11 | }
12 |
13 | #ifdef _VERTEX_
14 | #endif
15 |
16 | #ifdef _FRAGMENT_
17 | #endif
18 |
--------------------------------------------------------------------------------
/examples/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 2.6)
2 |
3 | set(EXENAME ork-examples)
4 |
5 | # Sources
6 | include_directories("${PROJECT_SOURCE_DIR}" "${PROJECT_SOURCE_DIR}/libraries" "${CMAKE_CURRENT_SOURCE_DIR}")
7 | file(GLOB SOURCE_FILES *.cpp)
8 |
9 | add_definitions("-DORK_API=")
10 |
11 | add_executable(${EXENAME} ${SOURCE_FILES})
12 |
13 | #Added whole archive due to the "plug-in usage"
14 | set(WHOLE_ORK_LIB -Wl,--whole-archive ork -Wl,--no-whole-archive)
15 | target_link_libraries(${EXENAME} ${WHOLE_ORK_LIB})
16 |
--------------------------------------------------------------------------------
/examples/shaders/plasticFS.glsl:
--------------------------------------------------------------------------------
1 | in vec3 wpos;
2 | in vec3 wnormal;
3 | in vec4 fcolor;
4 |
5 | layout(location = 0) out vec4 data;
6 |
7 | vec3 viewDir(vec3 worldP);
8 |
9 | float illuminance(vec3 worldP, vec3 worldN, out vec3 worldL);
10 |
11 | void main() {
12 | vec3 wl;
13 | vec3 wn = normalize(wnormal);
14 | float light = illuminance(wpos, wn, wl);
15 |
16 | float angle = dot(viewDir(wpos), reflect(wl, wn));
17 | float specular = light * pow(max(angle, 0.0), 5.0);
18 |
19 | data = fcolor * (light + 0.2) + vec4(specular);
20 | }
21 |
--------------------------------------------------------------------------------
/examples/methods/cameraMethod.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/examples/shaders/text.glsl:
--------------------------------------------------------------------------------
1 | #ifdef _VERTEX_
2 |
3 | layout(location = 0) in vec4 vertex;
4 | layout(location = 1) in vec4 color;
5 | out vec2 uv;
6 | flat out vec3 rgb;
7 |
8 | void main() {
9 | gl_Position = vec4(vertex.xy, 0.0, 1.0);
10 | uv = vertex.zw;
11 | rgb = color.rgb;
12 | }
13 |
14 | #endif
15 |
16 | #ifdef _FRAGMENT_
17 |
18 | uniform sampler2D font;
19 |
20 | in vec2 uv;
21 | flat in vec3 rgb;
22 | layout(location = 0) out vec4 color;
23 |
24 | void main() {
25 | float v = texture(font, uv).r;
26 | color.rgb = (1.0 - v) * rgb * 0.25 + v * rgb;
27 | color.a = 0.6 + 0.4 * v;
28 | }
29 |
30 | #endif
31 |
--------------------------------------------------------------------------------
/examples/scenes/skyboxScene.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/examples/shaders/flat.glsl:
--------------------------------------------------------------------------------
1 | #ifdef _VERTEX_
2 |
3 | layout(location = 1) in vec3 normal;
4 | layout(location = 3) in vec4 color;
5 |
6 | out vec3 wpos;
7 | out vec3 wnormal;
8 |
9 | void projection(vec3 normal, out vec3 worldPos, out vec3 worldNormal);
10 |
11 | void main() {
12 | projection(normal, wpos, wnormal);
13 | }
14 |
15 | #endif
16 |
17 | #ifdef _FRAGMENT_
18 |
19 | uniform vec4 color;
20 |
21 | in vec3 wpos;
22 | in vec3 wnormal;
23 |
24 | layout(location = 0) out vec4 data;
25 |
26 | vec3 viewDir(vec3 worldP);
27 |
28 | float illuminance(vec3 worldP, vec3 worldN, out vec3 worldL);
29 |
30 | void main() {
31 | vec3 wl;
32 | vec3 wn = normalize(wnormal);
33 | float light = illuminance(wpos, wn, wl);
34 | data = color * (0.5 + 0.5 * dot(wn, wl));
35 | }
36 |
37 | #endif
38 |
--------------------------------------------------------------------------------
/examples/shaders/skybox.glsl:
--------------------------------------------------------------------------------
1 | #ifdef _VERTEX_
2 |
3 | layout (location = 0) in vec3 vertex;
4 | out vec3 dir;
5 |
6 | uniform mat4 cameraToWorld;
7 | uniform mat4 screenToCamera;
8 |
9 | void main() {
10 | dir = (cameraToWorld * vec4((screenToCamera * vec4(vertex, 1.0)).xyz, 0.0)).xyz;
11 | gl_Position = vec4(vertex.xy, 0.9999999, 1.0);
12 | }
13 |
14 | #endif
15 |
16 | #ifdef _FRAGMENT_
17 |
18 | in vec3 dir;
19 | layout (location = 0) out vec4 data;
20 |
21 | #ifdef CUBEMAPARRAY
22 | #extension GL_ARB_texture_cube_map_array : enable
23 | uniform samplerCubeArray skymap;
24 | uniform float map;
25 | #else
26 | uniform samplerCube skymap;
27 | #endif
28 |
29 | void main() {
30 | #ifdef CUBEMAPARRAY
31 | data = texture(skymap, vec4(dir, map));
32 | #else
33 | data = texture(skymap, dir);
34 | #endif
35 | }
36 |
37 | #endif
38 |
--------------------------------------------------------------------------------
/examples/shaders/camera.glsl:
--------------------------------------------------------------------------------
1 | uniform camera {
2 | vec3 worldCameraPos;
3 | };
4 |
5 | uniform mat4 localToScreen;
6 | uniform mat4 localToWorld;
7 |
8 | #ifdef _VERTEX_
9 |
10 | layout(location = 0) in vec3 POS;
11 |
12 | void projection() {
13 | gl_Position = localToScreen * vec4(POS, 1.0);
14 | }
15 |
16 | void projection(out vec3 worldVertex) {
17 | gl_Position = localToScreen * vec4(POS, 1.0);
18 | worldVertex = (localToWorld * vec4(POS, 1.0)).xyz;
19 | }
20 |
21 | void projection(vec3 normal, out vec3 worldVertex, out vec3 worldNormal) {
22 | gl_Position = localToScreen * vec4(POS, 1.0);
23 | worldVertex = (localToWorld * vec4(POS, 1.0)).xyz;
24 | worldNormal = (localToWorld * vec4(normal, 0.0)).xyz;
25 | }
26 |
27 | #endif
28 |
29 | #ifdef _FRAGMENT_
30 |
31 | vec3 viewDir(vec3 worldP) {
32 | return normalize(worldP - worldCameraPos);
33 | }
34 |
35 | #endif
36 |
--------------------------------------------------------------------------------
/doc/figures/resource-example.cpp:
--------------------------------------------------------------------------------
1 | #include "ork/resource/XMLResourceLoader.h"
2 | #include "ork/resource/ResourceManager.h"
3 | #include "ork/render/FrameBuffer.h"
4 | #include "ork/ui/GlutWindow.h"
5 |
6 | using namespace ork;
7 |
8 | class SimpleExample : public GlutWindow
9 | {
10 | public:
11 | ptr resManager;
12 | ptr m;
13 | ptr p;
14 |
15 | SimpleExample() : GlutWindow(Window::Parameters())
16 | {
17 | ptr resLoader = new XMLResourceLoader();
18 | resLoader->addPath("resources/textures");
19 | resLoader->addPath("resources/shaders");
20 | resLoader->addPath("resources/meshes");
21 |
22 | resManager = new ResourceManager(resLoader);
23 | m = resManager->loadResource("quad.mesh").cast();
24 | p = resManager->loadResource("basic;").cast();
25 | }
26 |
27 | // rest of the code unchanged
28 | };
29 |
--------------------------------------------------------------------------------
/examples/shaders/postprocess.glsl:
--------------------------------------------------------------------------------
1 | #ifdef _VERTEX_
2 |
3 | layout (location = 0) in vec4 vertex;
4 | out vec2 uv;
5 |
6 | void main() {
7 | gl_Position = vertex;
8 | uv = vertex.xy * 0.5 + vec2(0.5);
9 | }
10 |
11 | #endif
12 |
13 | #ifdef _FRAGMENT_
14 |
15 | uniform sampler2D colorSampler;
16 | uniform sampler2D depthSampler;
17 |
18 | in vec2 uv;
19 | layout (location = 0) out vec4 data;
20 |
21 | void main() {
22 | data = textureLod(colorSampler, uv, 0.0);
23 | data += textureLod(colorSampler, uv, 1.0) * 0.25;
24 | data += textureLod(colorSampler, uv, 2.0) * 0.25;
25 | data += textureLod(colorSampler, uv, 3.0) * 0.25;
26 | data += textureLod(colorSampler, uv, 4.0) * 0.25;
27 | data += textureLod(colorSampler, uv, 5.0) * 0.25;
28 | data += textureLod(colorSampler, uv, 6.0) * 0.25;
29 | data += textureLod(colorSampler, uv, 7.0) * 0.25;
30 | data += textureLod(colorSampler, uv, 8.0) * 0.25;
31 | gl_FragDepth = texture(depthSampler, uv).x;
32 | }
33 |
34 | #endif
35 |
--------------------------------------------------------------------------------
/examples/methods/cameraMethodPostprocess.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/examples/shaders/texturedPlastic.glsl:
--------------------------------------------------------------------------------
1 | #ifdef _VERTEX_
2 |
3 | layout(location = 1) in vec3 normal;
4 | layout(location = 2) in vec2 uv;
5 |
6 | out vec3 wpos;
7 | out vec3 wnormal;
8 | out vec2 fuv;
9 |
10 | void projection(vec3 normal, out vec3 worldPos, out vec3 worldNormal);
11 |
12 | void main() {
13 | projection(normal, wpos, wnormal);
14 | fuv = uv;
15 | }
16 |
17 | #endif
18 |
19 | #ifdef _FRAGMENT_
20 |
21 | uniform sampler2D tex;
22 |
23 | in vec3 wpos;
24 | in vec3 wnormal;
25 | in vec2 fuv;
26 |
27 | layout(location = 0) out vec4 data;
28 |
29 | vec3 viewDir(vec3 worldP);
30 |
31 | float illuminance(vec3 worldP, vec3 worldN, out vec3 worldL);
32 |
33 | void main() {
34 | vec3 wl;
35 | vec3 wn = normalize(wnormal);
36 | float light = illuminance(wpos, wn, wl);
37 |
38 | float angle = dot(viewDir(wpos), reflect(wl, wn));
39 | float specular = light * pow(max(angle, 0.0), 5.0);
40 |
41 | vec4 fcolor = texture(tex, fuv);
42 |
43 | data = fcolor * (light + 0.2) + vec4(specular);
44 | }
45 |
46 | #endif
47 |
--------------------------------------------------------------------------------
/examples/scenes/exampleScene.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/examples/scenes/postprocessScene.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | #Ork
2 | [Ork home page](http://ork.gforge.inria.fr/)
3 |
4 | ##Introduction
5 | Ork, for OpenGL rendering kernel, provides a C++ API on top of OpenGL, which greatly simplifies the development of 3D applications.
6 |
7 | ##Example
8 | Suppose that you want to draw a mesh in an offscreen framebuffer, with a program that uses a texture. Assuming that these objects are already created, with the OpenGL API you need something like this:
9 | ```C++
10 | glUseProgram(myProgram);
11 | glActiveTexture(GL_TEXTURE0 + myUnit);
12 | glBindTexture(GL_TEXTURE_2D, myTexture);
13 | glUniform1i(glGetUniformLocation(myProgram, "mySampler"), myUnit);
14 | glBindBuffer(GL_ARRAY_BUFFER, myVBO);
15 | glVertexAttribPointer(0, 4, GL_FLOAT, false, 16, 0);
16 | glEnableVertexAttribArray(0);
17 | glBindFramebuffer(GL_FRAMEBUFFER, myFramebuffer);
18 | glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
19 | ```
20 | With the Ork API you simply need two steps (and the first one does not need to be repeated before each draw, unless you want a different texture for each draw):
21 | ```C++
22 | myProgram->getUniformSampler("mySampler")->set(myTexture);
23 | myFramebuffer->draw(myProgram, *myMesh);
24 | ```
25 |
26 | ## My contribution
27 | I am playing with integrating Proland in a project, and Proland runs on Ork. Since Ork does not allways build and run out of the box, the are some modifications to be done.
28 |
29 |
--------------------------------------------------------------------------------
/examples/meshes/cube.mesh:
--------------------------------------------------------------------------------
1 | -1 1 -1 1 -1 1
2 | triangles
3 | 4
4 | 0 3 float false
5 | 1 3 float false
6 | 2 2 float false
7 | 3 4 ubyte true
8 | 36
9 | -1 -1 +1 0 0 +1 0 0 255 0 0 0
10 | +1 -1 +1 0 0 +1 1 0 255 0 0 0
11 | +1 +1 +1 0 0 +1 1 1 255 0 0 0
12 | +1 +1 +1 0 0 +1 1 1 255 0 0 0
13 | -1 +1 +1 0 0 +1 0 1 255 0 0 0
14 | -1 -1 +1 0 0 +1 0 0 255 0 0 0
15 | +1 -1 +1 +1 0 0 0 0 0 255 0 0
16 | +1 -1 -1 +1 0 0 1 0 0 255 0 0
17 | +1 +1 -1 +1 0 0 1 1 0 255 0 0
18 | +1 +1 -1 +1 0 0 1 1 0 255 0 0
19 | +1 +1 +1 +1 0 0 0 1 0 255 0 0
20 | +1 -1 +1 +1 0 0 0 0 0 255 0 0
21 | -1 +1 +1 0 +1 0 0 0 0 0 255 0
22 | +1 +1 +1 0 +1 0 1 0 0 0 255 0
23 | +1 +1 -1 0 +1 0 1 1 0 0 255 0
24 | +1 +1 -1 0 +1 0 1 1 0 0 255 0
25 | -1 +1 -1 0 +1 0 0 1 0 0 255 0
26 | -1 +1 +1 0 +1 0 0 0 0 0 255 0
27 | +1 -1 -1 0 0 -1 0 0 0 255 255 0
28 | -1 -1 -1 0 0 -1 1 0 0 255 255 0
29 | -1 +1 -1 0 0 -1 1 1 0 255 255 0
30 | -1 +1 -1 0 0 -1 1 1 0 255 255 0
31 | +1 +1 -1 0 0 -1 0 1 0 255 255 0
32 | +1 -1 -1 0 0 -1 0 0 0 255 255 0
33 | -1 -1 -1 -1 0 0 0 0 255 0 255 0
34 | -1 -1 +1 -1 0 0 1 0 255 0 255 0
35 | -1 +1 +1 -1 0 0 1 1 255 0 255 0
36 | -1 +1 +1 -1 0 0 1 1 255 0 255 0
37 | -1 +1 -1 -1 0 0 0 1 255 0 255 0
38 | -1 -1 -1 -1 0 0 0 0 255 0 255 0
39 | -1 -1 -1 0 -1 0 0 0 255 255 0 0
40 | +1 -1 -1 0 -1 0 1 0 255 255 0 0
41 | +1 -1 +1 0 -1 0 1 1 255 255 0 0
42 | +1 -1 +1 0 -1 0 1 1 255 255 0 0
43 | -1 -1 +1 0 -1 0 0 1 255 255 0 0
44 | -1 -1 -1 0 -1 0 0 0 255 255 0 0
45 | 0
46 | //attributes: position - normal - uv - color
47 |
--------------------------------------------------------------------------------
/doc/figures/scenegraph-example.cpp:
--------------------------------------------------------------------------------
1 | #include "ork/resource/XMLResourceLoader.h"
2 | #include "ork/render/FrameBuffer.h"
3 | #include "ork/ui/GlutWindow.h"
4 | #include "ork/taskgraph/MultithreadScheduler.h"
5 | #include "ork/scenegraph/SceneManager.h"
6 |
7 | using namespace ork;
8 |
9 | class SimpleExample : public GlutWindow
10 | {
11 | public:
12 | ptr manager;
13 |
14 | SimpleExample() : GlutWindow(Window::Parameters())
15 | {
16 | ptr l = new XMLResourceLoader();
17 | l->addPath("resources/textures");
18 | l->addPath("resources/shaders");
19 | l->addPath("resources/meshes");
20 | l->addPath("resources/methods");
21 | l->addPath("resources/scenes");
22 |
23 | ptr r = new ResourceManager(l, 8);
24 |
25 | manager = new SceneManager();
26 | manager->setResourceManager(r);
27 | manager->setScheduler(new MultithreadScheduler());
28 | manager->setRoot(r->loadResource("scene").cast());
29 | manager->setCameraNode("camera");
30 | manager->setCameraMethod("draw");
31 | }
32 |
33 | virtual void redisplay(double t, double dt)
34 | {
35 | ptr fb = FrameBuffer::getDefault();
36 | fb->clear(true, false, true);
37 | manager->update(t, dt);
38 | manager->draw();
39 | Window::redisplay(t, dt);
40 | }
41 |
42 | // rest of the code unchanged
43 | };
44 |
--------------------------------------------------------------------------------
/doc/figures/example.cpp:
--------------------------------------------------------------------------------
1 | #include "ork/render/FrameBuffer.h"
2 | #include "ork/ui/GlutWindow.h"
3 |
4 | using namespace ork;
5 |
6 | class SimpleExample : public GlutWindow
7 | {
8 | public:
9 | ptr< Mesh > m;
10 | ptr p;
11 |
12 | SimpleExample() : GlutWindow(Window::Parameters())
13 | {
14 | m = new Mesh(TRIANGLE_STRIP, GPU_STATIC);
15 | m->addAttributeType(0, 2, A32F, false);
16 | m->addVertex(vec2f(-1, -1));
17 | m->addVertex(vec2f(+1, -1));
18 | m->addVertex(vec2f(-1, +1));
19 | m->addVertex(vec2f(+1, +1));
20 |
21 | unsigned char data[16] = {
22 | 0, 255, 0, 255,
23 | 255, 0, 255, 0,
24 | 0, 255, 0, 255,
25 | 255, 0, 255, 0
26 | };
27 | ptr tex = new Texture2D(4, 4, R8, RED, UNSIGNED_BYTE,
28 | Texture::Parameters().mag(NEAREST), Buffer::Parameters(), CPUBuffer(data));
29 |
30 | p = new Program(new Module(330, NULL, "\
31 | #version 330\n\
32 | uniform sampler2D sampler;\n\
33 | uniform vec2 scale;\n\
34 | layout(location = 0) out vec4 data;\n\
35 | void main() {\n\
36 | data = texture(sampler, gl_FragCoord.xy * scale).rrrr;\n\
37 | }\n"));
38 |
39 | p->getUniformSampler("sampler")->set(tex);
40 | }
41 |
42 | virtual void redisplay(double t, double dt)
43 | {
44 | ptr fb = FrameBuffer::getDefault();
45 | fb->clear(true, false, false);
46 | fb->draw(p, *m);
47 | GlutWindow::redisplay(t, dt);
48 | }
49 |
50 | virtual void reshape(int x, int y)
51 | {
52 | FrameBuffer::getDefault()->setViewport(vec4(0, 0, x, y));
53 | p->getUniform2f("scale")->set(vec2f(1.0f / x, 1.0f / y));
54 | GlutWindow::reshape(x, y);
55 | idle(false);
56 | }
57 | };
58 |
59 | int main(int argc, char** argv)
60 | {
61 | atexit(Object::exit);
62 | ptr app = new SimpleExample();
63 | app->start();
64 | return 0;
65 | }
66 |
--------------------------------------------------------------------------------
/libraries/tinyxml/tinyxmlerror.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | www.sourceforge.net/projects/tinyxml
3 | Original code (2.0 and earlier )copyright (c) 2000-2006 Lee Thomason (www.grinninglizard.com)
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any
7 | damages arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any
10 | purpose, including commercial applications, and to alter it and
11 | redistribute it freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must
14 | not claim that you wrote the original software. If you use this
15 | software in a product, an acknowledgment in the product documentation
16 | would be appreciated but is not required.
17 |
18 | 2. Altered source versions must be plainly marked as such, and
19 | must not be misrepresented as being the original software.
20 |
21 | 3. This notice may not be removed or altered from any source
22 | distribution.
23 | */
24 |
25 | #include "tinyxml.h"
26 |
27 | // The goal of the seperate error file is to make the first
28 | // step towards localization. tinyxml (currently) only supports
29 | // english error messages, but the could now be translated.
30 | //
31 | // It also cleans up the code a bit.
32 | //
33 |
34 | const char* TiXmlBase::errorString[ TIXML_ERROR_STRING_COUNT ] =
35 | {
36 | "No error",
37 | "Error",
38 | "Failed to open file",
39 | "Memory allocation failed.",
40 | "Error parsing Element.",
41 | "Failed to read Element name",
42 | "Error reading Element value.",
43 | "Error reading Attributes.",
44 | "Error: empty tag.",
45 | "Error reading end tag.",
46 | "Error parsing Unknown.",
47 | "Error parsing Comment.",
48 | "Error parsing Declaration.",
49 | "Error document empty.",
50 | "Error null (0) or unexpected EOF found in input stream.",
51 | "Error parsing CDATA.",
52 | "Error when TiXmlDocument added to document, because TiXmlDocument can only be at the root.",
53 | };
54 |
--------------------------------------------------------------------------------
/LICENSE.TXT:
--------------------------------------------------------------------------------
1 | /*
2 | * Ork: a small object-oriented OpenGL Rendering Kernel.
3 | * Website : http://ork.gforge.inria.fr/
4 | * Copyright (c) 2008-2015 INRIA - LJK (CNRS - Grenoble University)
5 | * All rights reserved.
6 | * Redistribution and use in source and binary forms, with or without
7 | * modification, are permitted provided that the following conditions are met:
8 | *
9 | * 1. Redistributions of source code must retain the above copyright notice,
10 | * this list of conditions and the following disclaimer.
11 | *
12 | * 2. Redistributions in binary form must reproduce the above copyright notice,
13 | * this list of conditions and the following disclaimer in the documentation
14 | * and/or other materials provided with the distribution.
15 | *
16 | * 3. Neither the name of the copyright holder nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software without
18 | * specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
28 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29 | * OF THE POSSIBILITY OF SUCH DAMAGE.
30 | *
31 | */
32 | /*
33 | * Ork is distributed under the BSD3 Licence.
34 | * For any assistance, feedback and remarks, you can check out the
35 | * mailing list on the project page :
36 | * http://ork.gforge.inria.fr/
37 | */
38 | /*
39 | * Main authors: Eric Bruneton, Antoine Begault, Guillaume Piolat.
40 | */
41 |
42 |
--------------------------------------------------------------------------------
/ork/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | set(LIBNAME "ork")
2 |
3 | # Sources
4 | include_directories("${PROJECT_SOURCE_DIR}" "${PROJECT_SOURCE_DIR}/libraries" "${PROJECT_SOURCE_DIR}/libraries/*")
5 | file(GLOB SOURCE_FILES *.cpp */*.cpp)
6 |
7 | # Libraries
8 | set(LIBS GL GLU GLEW pthread stb_image tinyxml Xinerama Xcursor)
9 | if(UNIX)
10 | set(LIBS ${LIBS} rt)
11 | endif(UNIX)
12 |
13 | #message(STATUS "Using libs: " ${LIBS})
14 | #message(STATUS "GLFW needs: " ${GLFW_STATIC_LIBRARIES})
15 | # Static or shared?
16 | set(LIBTYPE STATIC)
17 | set(GLFWLIBS ${GLFW_STATIC_LIBRARIES})
18 | if(BUILD_SHARED)
19 | set(LIBTYPE SHARED)
20 | set(GLFWLIBS glfw3)
21 | endif(BUILD_SHARED)
22 | set(LIBS ${LIBS} ${GLFWLIBS})
23 | message(STATUS "GLFW libs for " ${LIBTYPE} " library: " ${GLFWLIBS})
24 |
25 | # Create a static library
26 | add_library(${LIBNAME} ${LIBTYPE} ${SOURCE_FILES})
27 | target_link_libraries(${LIBNAME} ${LIBS})
28 |
29 | # Adds SO Version and subversion. To be added to ensure ABI/API compatibility.
30 | #SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES SOVERSION ${ORK_VERSION_MAJOR} VERSION ${ORK_VERSION})
31 |
32 | set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
33 |
34 | link_directories(${PROJECT_SOURCE_DIR}/lib)
35 |
36 | # Install headers
37 | FOREACH(subdir core math render resource scenegraph taskgraph ui util)
38 | FILE(GLOB include-files ${subdir}/*.h)
39 | INSTALL(FILES ${include-files} DESTINATION include/ork/${subdir})
40 | ENDFOREACH(subdir)
41 |
42 | # Install library
43 | INSTALL(TARGETS ork LIBRARY DESTINATION ${LIB_INSTALL_DIR} ARCHIVE DESTINATION ${LIB_INSTALL_DIR})
44 |
45 | message(STATUS "Setting ork cflags for installation package")
46 | SET(ORK_CFLAGS "-DORK_API= -DTIXML_USE_STL" )
47 | if(USE_SHARED_PTR)
48 | message(STATUS "Setting shared ptr usage to final package")
49 | set(ORK_CFLAGS ${ORK_CFLAGS} "-DUSE_SHARED_PTR")
50 | endif(USE_SHARED_PTR)
51 | if(USE_FREEGLUT)
52 | message(STATUS "Setting freeglut usage to final package")
53 | set(ORK_CFLAGS ${ORK_CFLAGS} "-DUSEFREEGLUT")
54 | endif(USE_FREEGLUT)
55 |
56 | message(STATUS "ork cflags: " ${ORK_CFLAGS})
57 |
58 | CONFIGURE_FILE(ork.pc.in ${PROJECT_BINARY_DIR}/ork.pc @ONLY)
59 | INSTALL(FILES ${PROJECT_BINARY_DIR}/ork.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
60 |
--------------------------------------------------------------------------------
/ork/taskgraph/TaskFactory.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Ork: a small object-oriented OpenGL Rendering Kernel.
3 | * Website : http://ork.gforge.inria.fr/
4 | * Copyright (c) 2008-2015 INRIA - LJK (CNRS - Grenoble University)
5 | * All rights reserved.
6 | * Redistribution and use in source and binary forms, with or without
7 | * modification, are permitted provided that the following conditions are met:
8 | *
9 | * 1. Redistributions of source code must retain the above copyright notice,
10 | * this list of conditions and the following disclaimer.
11 | *
12 | * 2. Redistributions in binary form must reproduce the above copyright notice,
13 | * this list of conditions and the following disclaimer in the documentation
14 | * and/or other materials provided with the distribution.
15 | *
16 | * 3. Neither the name of the copyright holder nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software without
18 | * specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
28 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29 | * OF THE POSSIBILITY OF SUCH DAMAGE.
30 | *
31 | */
32 | /*
33 | * Ork is distributed under the BSD3 Licence.
34 | * For any assistance, feedback and remarks, you can check out the
35 | * mailing list on the project page :
36 | * http://ork.gforge.inria.fr/
37 | */
38 | /*
39 | * Main authors: Eric Bruneton, Antoine Begault, Guillaume Piolat.
40 | */
41 |
42 | #include "ork/taskgraph/TaskFactory.h"
43 |
44 | namespace ork
45 | {
46 |
47 | TaskFactory::TaskFactory(const char *type) : Object(type)
48 | {
49 | }
50 |
51 | TaskFactory::~TaskFactory()
52 | {
53 | }
54 |
55 | }
56 |
--------------------------------------------------------------------------------
/ork/resource/ResourceLoader.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Ork: a small object-oriented OpenGL Rendering Kernel.
3 | * Website : http://ork.gforge.inria.fr/
4 | * Copyright (c) 2008-2015 INRIA - LJK (CNRS - Grenoble University)
5 | * All rights reserved.
6 | * Redistribution and use in source and binary forms, with or without
7 | * modification, are permitted provided that the following conditions are met:
8 | *
9 | * 1. Redistributions of source code must retain the above copyright notice,
10 | * this list of conditions and the following disclaimer.
11 | *
12 | * 2. Redistributions in binary form must reproduce the above copyright notice,
13 | * this list of conditions and the following disclaimer in the documentation
14 | * and/or other materials provided with the distribution.
15 | *
16 | * 3. Neither the name of the copyright holder nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software without
18 | * specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
28 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29 | * OF THE POSSIBILITY OF SUCH DAMAGE.
30 | *
31 | */
32 | /*
33 | * Ork is distributed under the BSD3 Licence.
34 | * For any assistance, feedback and remarks, you can check out the
35 | * mailing list on the project page :
36 | * http://ork.gforge.inria.fr/
37 | */
38 | /*
39 | * Main authors: Eric Bruneton, Antoine Begault, Guillaume Piolat.
40 | */
41 |
42 | #include "ork/resource/ResourceLoader.h"
43 |
44 | namespace ork
45 | {
46 |
47 | ResourceLoader::ResourceLoader() : Object("ResourceLoader")
48 | {
49 | }
50 |
51 | ResourceLoader::~ResourceLoader()
52 | {
53 | }
54 |
55 | }
56 |
--------------------------------------------------------------------------------
/ork/taskgraph/Scheduler.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Ork: a small object-oriented OpenGL Rendering Kernel.
3 | * Website : http://ork.gforge.inria.fr/
4 | * Copyright (c) 2008-2015 INRIA - LJK (CNRS - Grenoble University)
5 | * All rights reserved.
6 | * Redistribution and use in source and binary forms, with or without
7 | * modification, are permitted provided that the following conditions are met:
8 | *
9 | * 1. Redistributions of source code must retain the above copyright notice,
10 | * this list of conditions and the following disclaimer.
11 | *
12 | * 2. Redistributions in binary form must reproduce the above copyright notice,
13 | * this list of conditions and the following disclaimer in the documentation
14 | * and/or other materials provided with the distribution.
15 | *
16 | * 3. Neither the name of the copyright holder nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software without
18 | * specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
28 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29 | * OF THE POSSIBILITY OF SUCH DAMAGE.
30 | *
31 | */
32 | /*
33 | * Ork is distributed under the BSD3 Licence.
34 | * For any assistance, feedback and remarks, you can check out the
35 | * mailing list on the project page :
36 | * http://ork.gforge.inria.fr/
37 | */
38 | /*
39 | * Main authors: Eric Bruneton, Antoine Begault, Guillaume Piolat.
40 | */
41 |
42 | #include "ork/taskgraph/Scheduler.h"
43 |
44 | namespace ork
45 | {
46 |
47 | Scheduler::Scheduler(const char* type) : Object(type)
48 | {
49 | }
50 |
51 | Scheduler::~Scheduler()
52 | {
53 | }
54 |
55 | void Scheduler::swap(ptr s)
56 | {
57 | }
58 |
59 | }
60 |
--------------------------------------------------------------------------------
/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | project(Ork CXX C)
2 | cmake_minimum_required(VERSION 2.6)
3 | cmake_policy(VERSION 2.6)
4 |
5 | SET(ORK_VERSION_MAJOR 3)
6 | SET(ORK_VERSION_MINOR 2)
7 | SET(ORK_VERSION "${ORK_VERSION_MAJOR}.${ORK_VERSION_MINOR}")
8 |
9 | # Avoid source tree pollution
10 | if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
11 | message(FATAL_ERROR "In-source builds are not permitted. Make a separate folder for building:\nmkdir build; cd build; cmake ..\nBefore that, remove the files already created:\nrm -rf CMakeCache.txt CMakeFiles")
12 | endif(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
13 |
14 | # Add a sensible build type default and warning because empty means no optimization and no debug info.
15 | if(NOT CMAKE_BUILD_TYPE)
16 | message("WARNING: CMAKE_BUILD_TYPE is not defined!\n Defaulting to CMAKE_BUILD_TYPE=RelWithDebInfo. Use ccmake to set a proper value.")
17 | set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." FORCE)
18 | endif(NOT CMAKE_BUILD_TYPE)
19 |
20 | # Common deps
21 | find_package(PkgConfig)
22 |
23 | PKG_CHECK_MODULES(Glew glew REQUIRED)
24 | include_directories(${Glew_INCLUDE_DIRS})
25 | link_directories(${Glew_LIBRARY_DIRS})
26 |
27 | PKG_CHECK_MODULES(GLFW glfw3 REQUIRED)
28 | include_directories(${GLFW_INCLUDE_DIRS})
29 | link_directories(${GLFW_LIBRARY_DIRS})
30 |
31 | find_package(GLUT)
32 | #find_package(OpenGL)
33 |
34 |
35 | set(LIB_INSTALL_DIR "lib" CACHE STRING "Library directory name (lib/lib32/lib64)" )
36 |
37 | set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
38 | add_definitions("-DORK_API=" "-DTIXML_USE_STL" "-fPIC")
39 |
40 | option(BUILD_SHARED "Build shared library instead of static" OFF)
41 | option(BUILD_EXAMPLES "Build examples" ON )
42 | option(BUILD_TESTS "Build tests" ON )
43 | option(USE_SHARED_PTR "Use std::shared_ptr" ON )
44 | option(USE_FREEGLUT "Use freeglut" ON )
45 |
46 | if(USE_SHARED_PTR)
47 | add_definitions("-DUSE_SHARED_PTR")
48 | endif(USE_SHARED_PTR)
49 | if(USE_FREEGLUT)
50 | add_definitions("-DUSEFREEGLUT")
51 | endif(USE_FREEGLUT)
52 |
53 |
54 | # Sub dirs
55 | add_subdirectory(libraries)
56 | add_subdirectory(ork)
57 |
58 | if(BUILD_EXAMPLES)
59 | add_subdirectory(examples)
60 | endif(BUILD_EXAMPLES)
61 |
62 | if(BUILD_TESTS)
63 | add_subdirectory(test)
64 | endif(BUILD_TESTS)
65 |
--------------------------------------------------------------------------------
/examples/Main.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Ork: a small object-oriented OpenGL Rendering Kernel.
3 | * Website : http://ork.gforge.inria.fr/
4 | * Copyright (c) 2008-2015 INRIA - LJK (CNRS - Grenoble University)
5 | * All rights reserved.
6 | * Redistribution and use in source and binary forms, with or without
7 | * modification, are permitted provided that the following conditions are met:
8 | *
9 | * 1. Redistributions of source code must retain the above copyright notice,
10 | * this list of conditions and the following disclaimer.
11 | *
12 | * 2. Redistributions in binary form must reproduce the above copyright notice,
13 | * this list of conditions and the following disclaimer in the documentation
14 | * and/or other materials provided with the distribution.
15 | *
16 | * 3. Neither the name of the copyright holder nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software without
18 | * specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
28 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29 | * OF THE POSSIBILITY OF SUCH DAMAGE.
30 | *
31 | */
32 | /*
33 | * Ork is distributed under the BSD3 Licence.
34 | * For any assistance, feedback and remarks, you can check out the
35 | * mailing list on the project page :
36 | * http://ork.gforge.inria.fr/
37 | */
38 | /*
39 | * Main authors: Eric Bruneton, Antoine Begault, Guillaume Piolat.
40 | */
41 |
42 | #ifndef _ORK_MAIN_
43 | #define _ORK_MAIN_
44 |
45 | class MainFunction
46 | {
47 | public:
48 | typedef int (*mainFunction)(int argc, char* argv[]);
49 |
50 | MainFunction(const char* name, mainFunction f);
51 | };
52 |
53 | int mainFunction(int argc, char* argv[]);
54 |
55 | #endif
56 |
--------------------------------------------------------------------------------
/ork/ui/DebugCallback.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Ork: a small object-oriented OpenGL Rendering Kernel.
3 | * Website : http://ork.gforge.inria.fr/
4 | * Copyright (c) 2008-2015 INRIA - LJK (CNRS - Grenoble University)
5 | * All rights reserved.
6 | * Redistribution and use in source and binary forms, with or without
7 | * modification, are permitted provided that the following conditions are met:
8 | *
9 | * 1. Redistributions of source code must retain the above copyright notice,
10 | * this list of conditions and the following disclaimer.
11 | *
12 | * 2. Redistributions in binary form must reproduce the above copyright notice,
13 | * this list of conditions and the following disclaimer in the documentation
14 | * and/or other materials provided with the distribution.
15 | *
16 | * 3. Neither the name of the copyright holder nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software without
18 | * specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
28 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29 | * OF THE POSSIBILITY OF SUCH DAMAGE.
30 | *
31 | */
32 | /*
33 | * Ork is distributed under the BSD3 Licence.
34 | * For any assistance, feedback and remarks, you can check out the
35 | * mailing list on the project page :
36 | * http://ork.gforge.inria.fr/
37 | */
38 | /*
39 | * Main authors: Eric Bruneton, Antoine Begault, Guillaume Piolat.
40 | */
41 | #ifndef DEBUGCALLBACK_H_INCLUDED
42 | #define DEBUGCALLBACK_H_INCLUDED
43 |
44 | #ifndef CALLBACK
45 | #define CALLBACK
46 | #endif
47 |
48 | namespace ork
49 | {
50 |
51 | void CALLBACK debugCallback(unsigned int source, unsigned int type,
52 | unsigned int id, unsigned int severity,
53 | int length, const char* message, const void* userParam);
54 |
55 | }
56 |
57 | #endif // DEBUGCALLBACK_H_INCLUDED
58 |
--------------------------------------------------------------------------------
/ork/render/CPUBuffer.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Ork: a small object-oriented OpenGL Rendering Kernel.
3 | * Website : http://ork.gforge.inria.fr/
4 | * Copyright (c) 2008-2015 INRIA - LJK (CNRS - Grenoble University)
5 | * All rights reserved.
6 | * Redistribution and use in source and binary forms, with or without
7 | * modification, are permitted provided that the following conditions are met:
8 | *
9 | * 1. Redistributions of source code must retain the above copyright notice,
10 | * this list of conditions and the following disclaimer.
11 | *
12 | * 2. Redistributions in binary form must reproduce the above copyright notice,
13 | * this list of conditions and the following disclaimer in the documentation
14 | * and/or other materials provided with the distribution.
15 | *
16 | * 3. Neither the name of the copyright holder nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software without
18 | * specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
28 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29 | * OF THE POSSIBILITY OF SUCH DAMAGE.
30 | *
31 | */
32 | /*
33 | * Ork is distributed under the BSD3 Licence.
34 | * For any assistance, feedback and remarks, you can check out the
35 | * mailing list on the project page :
36 | * http://ork.gforge.inria.fr/
37 | */
38 | /*
39 | * Main authors: Eric Bruneton, Antoine Begault, Guillaume Piolat.
40 | */
41 |
42 | #include "ork/render/CPUBuffer.h"
43 |
44 | #include
45 |
46 | #include "ork/render/FrameBuffer.h"
47 |
48 | namespace ork
49 | {
50 |
51 | CPUBuffer::CPUBuffer(const void *data)
52 | {
53 | p = data;
54 | }
55 |
56 | CPUBuffer::~CPUBuffer()
57 | {
58 | }
59 |
60 | void CPUBuffer::bind(int target) const
61 | {
62 | glBindBuffer(target, 0);
63 | assert(FrameBuffer::getError() == GL_NO_ERROR);
64 | }
65 |
66 | void *CPUBuffer::data(int offset) const
67 | {
68 | return (void*)((char*)p + offset);
69 | }
70 |
71 | void CPUBuffer::unbind(int target) const
72 | {
73 | }
74 |
75 | void CPUBuffer::dirty() const
76 | {
77 | }
78 |
79 | }
80 |
--------------------------------------------------------------------------------
/test/Test.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Ork: a small object-oriented OpenGL Rendering Kernel.
3 | * Website : http://ork.gforge.inria.fr/
4 | * Copyright (c) 2008-2015 INRIA - LJK (CNRS - Grenoble University)
5 | * All rights reserved.
6 | * Redistribution and use in source and binary forms, with or without
7 | * modification, are permitted provided that the following conditions are met:
8 | *
9 | * 1. Redistributions of source code must retain the above copyright notice,
10 | * this list of conditions and the following disclaimer.
11 | *
12 | * 2. Redistributions in binary form must reproduce the above copyright notice,
13 | * this list of conditions and the following disclaimer in the documentation
14 | * and/or other materials provided with the distribution.
15 | *
16 | * 3. Neither the name of the copyright holder nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software without
18 | * specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
28 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29 | * OF THE POSSIBILITY OF SUCH DAMAGE.
30 | *
31 | */
32 | /*
33 | * Ork is distributed under the BSD3 Licence.
34 | * For any assistance, feedback and remarks, you can check out the
35 | * mailing list on the project page :
36 | * http://ork.gforge.inria.fr/
37 | */
38 | /*
39 | * Main authors: Eric Bruneton, Antoine Begault, Guillaume Piolat.
40 | */
41 |
42 | #ifndef _ORK_TEST_
43 | #define _ORK_TEST_
44 |
45 | #include
46 | #include
47 |
48 | typedef void (*testFunction)();
49 |
50 | class TestSuite
51 | {
52 | public:
53 | std::vector tests;
54 |
55 | std::vector testNames;
56 |
57 | std::vector testVersions;
58 |
59 | static TestSuite *getInstance();
60 |
61 | private:
62 | static TestSuite *INSTANCE;
63 | };
64 |
65 | class Test
66 | {
67 | public:
68 | Test(const char *name, testFunction test, int majorVersion = 3);
69 | };
70 |
71 | void test(bool result, const char* file, int line);
72 |
73 | #define TEST(x) void x(); Test _##x(#x, x); void x()
74 |
75 | #define TEST4(x) void x(); Test _##x(#x, x, 4); void x()
76 |
77 | #define ASSERT(x) test(x, __FILE__, __LINE__)
78 |
79 | #endif
80 |
--------------------------------------------------------------------------------
/ork/resource/ResourceDescriptor.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Ork: a small object-oriented OpenGL Rendering Kernel.
3 | * Website : http://ork.gforge.inria.fr/
4 | * Copyright (c) 2008-2015 INRIA - LJK (CNRS - Grenoble University)
5 | * All rights reserved.
6 | * Redistribution and use in source and binary forms, with or without
7 | * modification, are permitted provided that the following conditions are met:
8 | *
9 | * 1. Redistributions of source code must retain the above copyright notice,
10 | * this list of conditions and the following disclaimer.
11 | *
12 | * 2. Redistributions in binary form must reproduce the above copyright notice,
13 | * this list of conditions and the following disclaimer in the documentation
14 | * and/or other materials provided with the distribution.
15 | *
16 | * 3. Neither the name of the copyright holder nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software without
18 | * specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
28 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29 | * OF THE POSSIBILITY OF SUCH DAMAGE.
30 | *
31 | */
32 | /*
33 | * Ork is distributed under the BSD3 Licence.
34 | * For any assistance, feedback and remarks, you can check out the
35 | * mailing list on the project page :
36 | * http://ork.gforge.inria.fr/
37 | */
38 | /*
39 | * Main authors: Eric Bruneton, Antoine Begault, Guillaume Piolat.
40 | */
41 |
42 | #include "ork/resource/ResourceDescriptor.h"
43 |
44 | namespace ork
45 | {
46 |
47 | ResourceDescriptor::ResourceDescriptor(const TiXmlElement *descriptor, unsigned char *data, unsigned int size) :
48 | Object("ResourceDescriptor"), data(data), size(size)
49 | {
50 | this->descriptor = descriptor;
51 | assert(this->descriptor != NULL);
52 | }
53 |
54 | ResourceDescriptor::~ResourceDescriptor()
55 | {
56 | delete descriptor;
57 | clearData();
58 | }
59 |
60 | unsigned char *ResourceDescriptor::getData() const
61 | {
62 | return data;
63 | }
64 |
65 | unsigned int ResourceDescriptor::getSize() const
66 | {
67 | return size;
68 | }
69 |
70 | void ResourceDescriptor::clearData()
71 | {
72 | if (data != NULL) {
73 | delete[] data;
74 | data = NULL;
75 | }
76 | }
77 |
78 | }
79 |
--------------------------------------------------------------------------------
/ork/scenegraph/Method.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Ork: a small object-oriented OpenGL Rendering Kernel.
3 | * Website : http://ork.gforge.inria.fr/
4 | * Copyright (c) 2008-2015 INRIA - LJK (CNRS - Grenoble University)
5 | * All rights reserved.
6 | * Redistribution and use in source and binary forms, with or without
7 | * modification, are permitted provided that the following conditions are met:
8 | *
9 | * 1. Redistributions of source code must retain the above copyright notice,
10 | * this list of conditions and the following disclaimer.
11 | *
12 | * 2. Redistributions in binary form must reproduce the above copyright notice,
13 | * this list of conditions and the following disclaimer in the documentation
14 | * and/or other materials provided with the distribution.
15 | *
16 | * 3. Neither the name of the copyright holder nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software without
18 | * specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
28 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29 | * OF THE POSSIBILITY OF SUCH DAMAGE.
30 | *
31 | */
32 | /*
33 | * Ork is distributed under the BSD3 Licence.
34 | * For any assistance, feedback and remarks, you can check out the
35 | * mailing list on the project page :
36 | * http://ork.gforge.inria.fr/
37 | */
38 | /*
39 | * Main authors: Eric Bruneton, Antoine Begault, Guillaume Piolat.
40 | */
41 |
42 | #include "ork/scenegraph/Method.h"
43 |
44 | #include "ork/scenegraph/SceneNode.h"
45 |
46 | namespace ork
47 | {
48 |
49 | Method::Method(ptr body) : Object("Method"), enabled(true)
50 | {
51 | taskFactory = body;
52 | }
53 |
54 | Method::~Method()
55 | {
56 | }
57 |
58 | ptr Method::getOwner()
59 | {
60 | return owner;
61 | }
62 |
63 | bool Method::isEnabled()
64 | {
65 | return enabled;
66 | }
67 |
68 | void Method::setIsEnabled(bool enabled)
69 | {
70 | this->enabled = enabled;
71 | }
72 |
73 | ptr Method::getTaskFactory()
74 | {
75 | return taskFactory;
76 | }
77 |
78 | void Method::setTaskFactory(ptr taskFactory)
79 | {
80 | this->taskFactory = taskFactory;
81 | }
82 |
83 | ptr Method::getTask()
84 | {
85 | return taskFactory->getTask(this);
86 | }
87 |
88 | }
89 |
--------------------------------------------------------------------------------
/ork/taskgraph/TaskFactory.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Ork: a small object-oriented OpenGL Rendering Kernel.
3 | * Website : http://ork.gforge.inria.fr/
4 | * Copyright (c) 2008-2015 INRIA - LJK (CNRS - Grenoble University)
5 | * All rights reserved.
6 | * Redistribution and use in source and binary forms, with or without
7 | * modification, are permitted provided that the following conditions are met:
8 | *
9 | * 1. Redistributions of source code must retain the above copyright notice,
10 | * this list of conditions and the following disclaimer.
11 | *
12 | * 2. Redistributions in binary form must reproduce the above copyright notice,
13 | * this list of conditions and the following disclaimer in the documentation
14 | * and/or other materials provided with the distribution.
15 | *
16 | * 3. Neither the name of the copyright holder nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software without
18 | * specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
28 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29 | * OF THE POSSIBILITY OF SUCH DAMAGE.
30 | *
31 | */
32 | /*
33 | * Ork is distributed under the BSD3 Licence.
34 | * For any assistance, feedback and remarks, you can check out the
35 | * mailing list on the project page :
36 | * http://ork.gforge.inria.fr/
37 | */
38 | /*
39 | * Main authors: Eric Bruneton, Antoine Begault, Guillaume Piolat.
40 | */
41 |
42 | #ifndef _ORK_TASK_GRAPH_FACTORY_H_
43 | #define _ORK_TASK_GRAPH_FACTORY_H_
44 |
45 | #include "ork/taskgraph/Task.h"
46 |
47 | namespace ork
48 | {
49 |
50 | /**
51 | * An object that can create Task.
52 | * @ingroup taskgraph
53 | */
54 | class ORK_API TaskFactory : public Object
55 | {
56 | public:
57 | /**
58 | * Creates a new task factory.
59 | *
60 | * @param type the type of this factory.
61 | */
62 | TaskFactory(const char* type);
63 |
64 | /**
65 | * Deletes this task factory.
66 | */
67 | virtual ~TaskFactory();
68 |
69 | /**
70 | * Creates a new task.
71 | *
72 | * @param context an optional parameter to control the task creation.
73 | * @return the created task.
74 | */
75 | virtual ptr getTask(ptr