Skip to content

Commit

Permalink
Merge branch 'release/v0.8.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
bernstein committed Jun 5, 2014
2 parents d337a9b + 384ee91 commit 279d6ee
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 34 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@ tags
.vim.custom
tests/tests
plugins/guacamole-oculus/example-oculus/example-oculus
examples/multicontext/multicontext
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ PROJECT(GUACAMOLE CXX)
# version number
set(GUACAMOLE_MAJOR 0)
set(GUACAMOLE_MINOR 8)
set(GUACAMOLE_PATCH 3)
set(GUACAMOLE_PATCH 4)
set(GUACAMOLE_VERSION ${GUACAMOLE_MAJOR}.${GUACAMOLE_MINOR}.${GUACAMOLE_PATCH})
set(GUACAMOLE_DESCRIPTION "GUACAMOLE - an astonishing virtual reality engine")
set(GUACAMOLE_HOMEPAGE "http://www.GUACAMOLE.org")
Expand Down
2 changes: 1 addition & 1 deletion include/gua/renderer/GBufferPass.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class GBufferPass : public GeometryPass {

void initialize_state_objects(RenderContext const& ctx);

void initialize_trimesh_ubershader() const;
void initialize_trimesh_ubershader(RenderContext const& ctx) const;

private: // attributes

Expand Down
2 changes: 1 addition & 1 deletion include/gua/renderer/Pipeline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,9 @@ class GUA_DLL Pipeline {
return prerender_pipelines_;
}


inline float get_application_fps() const { return application_fps_; }
inline float get_rendering_fps() const { return rendering_fps_; }
inline RenderContext const& get_context() const { return *context_; };

SerializedScene const& get_current_scene(CameraMode mode) const;

Expand Down
54 changes: 23 additions & 31 deletions src/gua/renderer/GBufferPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,14 @@
#include <gua/traverse.hpp>

#include <gua/renderer/Pipeline.hpp>
#include <gua/renderer/TriMeshRessource.hpp>
#include <gua/renderer/TriMeshUberShader.hpp>
#include <gua/renderer/TriMeshRessource.hpp>
#include <gua/renderer/GeometryRessource.hpp>
#include <gua/renderer/GeometryUberShader.hpp>

#include <gua/scenegraph/GeometryNode.hpp>
#include <gua/scenegraph/SceneGraph.hpp>
#include <gua/scenegraph/TriMeshNode.hpp>

#include <gua/databases.hpp>
#include <gua/databases/GeometryDatabase.hpp>
Expand All @@ -54,7 +55,7 @@ GBufferPass::GBufferPass(Pipeline* pipeline)
bbox_rasterizer_state_(),
depth_stencil_state_()
{
initialize_trimesh_ubershader();
initialize_trimesh_ubershader(pipeline->get_context());
}

////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -280,14 +281,9 @@ void GBufferPass::rendering(SerializedScene const& scene,
void GBufferPass::display_bboxes(RenderContext const& ctx,
SerializedScene const& scene,
std::size_t viewid) {
if (!ubershaders_.count(typeid(TriMeshRessource))) {
auto ubershader = TriMeshRessource().create_ubershader();
ubershader->cleanup(ctx);
ubershader->create(cached_materials_);
ubershaders_[typeid(TriMeshRessource)] = ubershader;
}

auto meshubershader = ubershaders_[typeid(TriMeshRessource)];

auto meshubershader = ubershaders_[typeid(TriMeshNode)];

if (pipeline_->config.enable_bbox_display()) {
meshubershader->get_program()->use(ctx);
Expand Down Expand Up @@ -323,14 +319,7 @@ void GBufferPass::display_rays(RenderContext const& ctx,
SerializedScene const& scene,
std::size_t viewid)
{
if (!ubershaders_.count(typeid(TriMeshRessource))) {
auto ubershader = TriMeshRessource().create_ubershader();
ubershader->cleanup(ctx);
ubershader->create(cached_materials_);
ubershaders_[typeid(TriMeshRessource)] = ubershader;
}

auto meshubershader = ubershaders_[typeid(TriMeshRessource)];
auto meshubershader = ubershaders_[typeid(TriMeshNode)];

if (pipeline_->config.enable_ray_display()) {
meshubershader->get_program()->use(ctx);
Expand Down Expand Up @@ -358,15 +347,7 @@ void GBufferPass::display_quads(RenderContext const& ctx,
CameraMode eye,
std::size_t viewid)
{

if (!ubershaders_.count(typeid(TriMeshRessource))) {
auto ubershader = TriMeshRessource().create_ubershader();
ubershader->cleanup(ctx);
ubershader->create(cached_materials_);
ubershaders_[typeid(TriMeshRessource)] = ubershader;
}

auto meshubershader = ubershaders_[typeid(TriMeshRessource)];
auto meshubershader = ubershaders_[typeid(TriMeshNode)];

if (!scene.textured_quads_.empty()) {
meshubershader->get_program()->use(ctx);
Expand Down Expand Up @@ -492,16 +473,27 @@ void GBufferPass::apply_material_mapping(
////////////////////////////////////////////////////////////////////////////////

LayerMapping const* GBufferPass::get_gbuffer_mapping() const {
return ubershaders_[typeid(TriMeshRessource)]->get_gbuffer_mapping();
std::type_index trimesh_type = typeid(TriMeshNode);

if (!ubershaders_.count(trimesh_type)) {
// trimesh shader has not been created yet -> return dummy mapping
return TriMeshRessource().create_ubershader()->get_gbuffer_mapping();
} else {
return ubershaders_[trimesh_type]->get_gbuffer_mapping();
}
}

////////////////////////////////////////////////////////////////////////////////

void GBufferPass::initialize_trimesh_ubershader() const
void GBufferPass::initialize_trimesh_ubershader(RenderContext const& ctx) const
{
if (!ubershaders_.count(typeid(TriMeshRessource)))
{
ubershaders_[typeid(TriMeshRessource)] = TriMeshRessource().create_ubershader();
std::type_index trimesh_type = typeid(TriMeshNode);

if (!ubershaders_.count(trimesh_type)) {
auto ubershader = TriMeshRessource().create_ubershader();
ubershader->cleanup(ctx);
ubershader->create(cached_materials_);
ubershaders_[trimesh_type] = ubershader;
}
}

Expand Down

0 comments on commit 279d6ee

Please sign in to comment.