Skip to content

Commit

Permalink
Merge pull request #33 from mortennobel/1.0.10
Browse files Browse the repository at this point in the history
1.0.10
  • Loading branch information
mortennobel authored Apr 21, 2018
2 parents a9c1ec1 + 2d13264 commit 11291ee
Show file tree
Hide file tree
Showing 54 changed files with 6,369 additions and 2,335 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/mortennobel/SimpleRenderEngine/master/LICENSE)
[![Build Status](https://travis-ci.org/mortennobel/SimpleRenderEngine.svg?branch=master)](https://travis-ci.org/mortennobel/SimpleRenderEngine)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/86403818b8b54161a6fef03248c0b828)](https://www.codacy.com/app/mortennobel/SimpleRenderEngine?utm_source=github.com&utm_medium=referral&utm_content=mortennobel/SimpleRenderEngine&utm_campaign=Badge_Grade)

Expand Down Expand Up @@ -48,7 +49,7 @@ API documentation is defined in header files.
* https://www.libsdl.org/projects/SDL_image/ Simple Direct Layer Image 2.x
* http://glm.g-truc.net/ OpenGL Mathematics (bundled)
* https://www.opengl.org/registry/ OpenGL Registry
* https://github.com/ocornut/imgui ImGui 1.53 (bundled)
* https://github.com/ocornut/imgui ImGui 1.60 (bundled)
* https://github.com/BalazsJako/ImGuiColorTextEdit ImGuiColorTextEdit (bundled)
* https://github.com/kazuho/picojson PicoJSON(bundled)

16 changes: 8 additions & 8 deletions em-build-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ emcc -Iinclude src/imgui/imgui.cpp \
src/sre/Log.cpp \
src/sre/Skybox.cpp \
src/sre/impl/UniformSet.cpp \
examples/skybox-example.cpp \
-O2 -std=c++14 -s USE_WEBGL2=1 -s FORCE_FILESYSTEM=1 -s TOTAL_MEMORY=33554432 -s USE_SDL_IMAGE=2 -s SDL2_IMAGE_FORMATS='["png"]' --embed-file examples_data/cube-negx.png --embed-file examples_data/cube-negy.png --embed-file examples_data/cube-negz.png --embed-file examples_data/cube-posx.png --embed-file examples_data/cube-posy.png --embed-file examples_data/cube-posz.png -s USE_SDL=2 -o html_examples/$FILENAME.html
examples/10_skybox-example.cpp \
-O2 -std=c++14 -s USE_WEBGL2=1 -s FORCE_FILESYSTEM=1 -s TOTAL_MEMORY=33554432 -s USE_SDL_IMAGE=2 -s SDL2_IMAGE_FORMATS='["png"]' --embed-file examples_data/cube-negx.png --embed-file examples_data/cube-negy.png --embed-file examples_data/cube-negz.png --embed-file examples_data/cube-posx.png --embed-file examples_data/cube-posy.png --embed-file examples_data/cube-posz.png -s USE_SDL=2 -o html_examples/10_skybox-example.html


emcc -Iinclude src/imgui/imgui.cpp \
Expand All @@ -60,8 +60,8 @@ emcc -Iinclude src/imgui/imgui.cpp \
src/sre/Log.cpp \
src/sre/Skybox.cpp \
src/sre/impl/UniformSet.cpp \
examples/render-to-texture.cpp \
-O2 -std=c++14 -s USE_WEBGL2=1 -s FORCE_FILESYSTEM=1 -s TOTAL_MEMORY=33554432 -s USE_SDL_IMAGE=2 -s SDL2_IMAGE_FORMATS='["png"]' --embed-file examples_data/cube-negx.png --embed-file examples_data/cube-negy.png --embed-file examples_data/cube-negz.png --embed-file examples_data/cube-posx.png --embed-file examples_data/cube-posy.png --embed-file examples_data/cube-posz.png -s USE_SDL=2 -o html_examples/render-to-texture.html
examples/12_render-to-texture.cpp \
-O2 -std=c++14 -s USE_WEBGL2=1 -s FORCE_FILESYSTEM=1 -s TOTAL_MEMORY=33554432 -s USE_SDL_IMAGE=2 -s SDL2_IMAGE_FORMATS='["png"]' --embed-file examples_data/cube-negx.png --embed-file examples_data/cube-negy.png --embed-file examples_data/cube-negz.png --embed-file examples_data/cube-posx.png --embed-file examples_data/cube-posy.png --embed-file examples_data/cube-posz.png -s USE_SDL=2 -o html_examples/12_render-to-texture.html

emcc -Iinclude src/imgui/imgui.cpp \
src/imgui/imgui_draw.cpp \
Expand All @@ -87,8 +87,8 @@ emcc -Iinclude src/imgui/imgui.cpp \
src/sre/Log.cpp \
src/sre/Skybox.cpp \
src/sre/impl/UniformSet.cpp \
examples/matcap.cpp \
-O2 -std=c++14 -s USE_WEBGL2=1 -s FORCE_FILESYSTEM=1 -s TOTAL_MEMORY=33554432 -s USE_SDL_IMAGE=2 -s SDL2_IMAGE_FORMATS='["png"]' --embed-file examples_data/suzanne.obj --embed-file examples_data/matcap_00001.png --embed-file examples_data/matcap_00002.png --embed-file examples_data/matcap_00003.png --embed-file examples_data/matcap_00004.png -s USE_SDL=2 -o html_examples/matcap.html
examples/07_matcap.cpp \
-O2 -std=c++14 -s USE_WEBGL2=1 -s FORCE_FILESYSTEM=1 -s TOTAL_MEMORY=33554432 -s USE_SDL_IMAGE=2 -s SDL2_IMAGE_FORMATS='["png"]' --embed-file examples_data/suzanne.obj --embed-file examples_data/matcap_00001.png --embed-file examples_data/matcap_00002.png --embed-file examples_data/matcap_00003.png --embed-file examples_data/matcap_00004.png -s USE_SDL=2 -o html_examples/07_matcap.html

emcc -Iinclude src/imgui/imgui.cpp \
src/imgui/imgui_draw.cpp \
Expand All @@ -114,5 +114,5 @@ emcc -Iinclude src/imgui/imgui.cpp \
src/sre/Log.cpp \
src/sre/Skybox.cpp \
src/sre/impl/UniformSet.cpp \
examples/picking.cpp \
-O2 -std=c++14 -s USE_WEBGL2=1 -s FORCE_FILESYSTEM=1 -s TOTAL_MEMORY=33554432 -s USE_SDL_IMAGE=2 -s SDL2_IMAGE_FORMATS='["png"]' -s USE_SDL=2 -o html_examples/picking.html
examples/09_picking.cpp \
-O2 -std=c++14 -s USE_WEBGL2=1 -s FORCE_FILESYSTEM=1 -s TOTAL_MEMORY=33554432 -s USE_SDL_IMAGE=2 -s SDL2_IMAGE_FORMATS='["png"]' -s USE_SDL=2 -o html_examples/09_picking.html
2 changes: 1 addition & 1 deletion em-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ emcc -Iinclude src/imgui/imgui.cpp \
#-O3 -g4 -s ASSERTIONS=1 -std=c++14 -s USE_WEBGL2=1 -s FORCE_FILESYSTEM=1 -s TOTAL_MEMORY=67108864 -s USE_SDL_IMAGE=2 -s SDL2_IMAGE_FORMATS='["png"]' --preload-file test_data -s USE_SDL=2 -o html/$FILENAME.html
done

for FILENAME in skybox-example render-to-texture matcap benchmark64k custom-mesh-layout gui hello-engine hello-engine-raw obj-viewer picking spheres spinning-cube spinning-primitives-tex sprite-example
for FILENAME in 00_hello-engine 01_hello-engine-raw 02_spheres 03_spinning-cube 04_spinning-primitives-tex 05_obj-viewer 06_custom-mesh-layout 07_matcap 08_gui 09_picking 10_skybox-example 11_sprite-example 12_render-to-texture 13_benchmark64k 14_spinning-primitives-openvr 15_cloth_simulation
do
echo $FILENAME
emcc -Iinclude src/imgui/imgui.cpp \
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 0 additions & 4 deletions examples/spheres.cpp → examples/02_spheres.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,13 @@ class Spheres{

rp.draw(mesh, pos1, mat1);

checkGLError();
rp.draw(mesh, pos2, mat2);

static sre::Inspector inspector;
inspector.update();
if (showInspector){
inspector.gui();
}

checkGLError();

}
private:
float time;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
22 changes: 15 additions & 7 deletions examples/picking.cpp → examples/09_picking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,32 +70,40 @@ class PickingExample {
}

void render(){
auto renderPass = RenderPass::create()
// Render scene to framebuffer (without gui)
auto sceneRenderPass = RenderPass::create()
.withCamera(camera)
.withClearColor(true,{0, 0, 0, 1})
.withGUI(false)
.build();

const float speed = .5f;
int index = 0;
for (int x=0;x<2;x++){
for (int y=0;y<2;y++){
renderPass.draw(mesh[index], glm::translate(glm::vec3(-1.5+x*3,-1.5+y*3,0)), mat[index]);
sceneRenderPass.draw(mesh[index], glm::translate(glm::vec3(-1.5+x*3,-1.5+y*3,0)), mat[index]);
index++;
}
}
sceneRenderPass.finish();

auto pixelValues = sceneRenderPass.readPixels(mouseX, mouseY); // read pixel values from framebuffer

// render gui to framebuffer
auto guiRenderPass = RenderPass::create()
.withClearColor(false)
.withGUI(true)
.build();

drawTopTextAndColor(pixelValue);
static Inspector inspector;
inspector.update();
if (showInspector){
inspector.gui();
}

renderPass.finish();
auto pixelValues = renderPass.readPixels(mouseX, mouseY); // read pixel values from defualt framebuffer (before gui is rendered)
guiRenderPass.finish();

pixelValue = pixelValues[0];


}

void drawTopTextAndColor(sre::Color color){
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,17 @@ class SpinningPrimitivesOpenVRExample {
r.startEventLoop(vr);
}

~SpinningPrimitivesOpenVRExample()
{
vr.reset();
material.reset();
for (int i=0;i<4;i++)
{
mesh[i].reset();
}
skybox.reset();
}

void render(){
auto renderPass = RenderPass::create()
.withCamera(camera)
Expand All @@ -105,6 +116,7 @@ class SpinningPrimitivesOpenVRExample {
vr->lookAt(eye, at, up);
}
vr->debugGUI();

i++;
}

Expand All @@ -129,8 +141,9 @@ class SpinningPrimitivesOpenVRExample {
glm::vec3 eye = { 0,0,6 };
glm::vec3 at = { 0,0,0 };
glm::vec3 up = { 0,1,0 };
SDLRenderer r;
std::shared_ptr<sre::VR> vr;
SDLRenderer r;

Camera camera;
std::shared_ptr<Material> material;
std::shared_ptr<Mesh> mesh[4];
Expand All @@ -141,7 +154,7 @@ class SpinningPrimitivesOpenVRExample {
};

int main() {
new SpinningPrimitivesOpenVRExample();
SpinningPrimitivesOpenVRExample obj();

return 0;
}
Expand Down
Loading

0 comments on commit 11291ee

Please sign in to comment.