Skip to content

Commit

Permalink
Merge branch 'release/v0.8.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
bernstein committed Jun 6, 2014
2 parents 279d6ee + 9fbdd23 commit c6eca4e
Show file tree
Hide file tree
Showing 18 changed files with 75 additions and 88 deletions.
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 4)
set(GUACAMOLE_PATCH 5)
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/Renderer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class GUA_DLL Renderer {
typedef std::shared_ptr<gua::concurrent::Doublebuffer<Item> > Mailbox;
typedef std::pair<Mailbox, std::thread> Renderclient;

void renderclient(Mailbox& in, Pipeline* pipe);
static void renderclient(Mailbox in, Pipeline* pipe);

std::vector<Renderclient> render_clients_;
FpsCounter application_fps_;
Expand Down
2 changes: 0 additions & 2 deletions include/gua/renderer/ShadowMap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ class ShadowMap {
float split_4,
float near_clipping_in_sun_direction);

bool pre_compile_shaders(RenderContext const& ctx);

GBuffer* get_buffer() const {return buffer_;}
std::vector<math::mat4> const& get_projection_view_matrices() const {return projection_view_matrices_;}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ template <typename value_t> void contour_map_binary<value_t>::initialize() {
boost::bind(&base_type::contour_segment_type::clip_horizontal, _1));

std::set<typename base_type::value_type> vsplits;
_determine_splits(vsplits, point_type::v, this->_contour_segments);
this->_determine_splits(vsplits, point_type::v, this->_contour_segments);

std::set<interval_type> vpartition;
_intervals_from_splits(vsplits, vpartition);
this->_intervals_from_splits(vsplits, vpartition);

BOOST_FOREACH(interval_type const & v_interval, vpartition) {
contour_segment_container segments_in_v_interval;
Expand All @@ -63,10 +63,10 @@ template <typename value_t> void contour_map_binary<value_t>::initialize() {
}

std::set<value_type> usplits;
_determine_splits(usplits, point_type::u, segments_in_v_interval);
this->_determine_splits(usplits, point_type::u, segments_in_v_interval);

std::set<interval_type> upartition;
_intervals_from_splits(usplits, upartition);
this->_intervals_from_splits(usplits, upartition);

contour_interval cells_in_v_interval;
value_type umin = usplits.empty() ? 0 : *usplits.begin();
Expand All @@ -77,12 +77,12 @@ template <typename value_t> void contour_map_binary<value_t>::initialize() {
BOOST_FOREACH(interval_type const & u_interval, upartition) {
contour_cell cell;

_contours_in_interval(u_interval,
this->_contours_in_interval(u_interval,
point_type::u,
segments_in_v_interval,
cell.overlapping_segments);

std::size_t intersections = _contours_greater(
std::size_t intersections = this->_contours_greater(
u_interval.center(), point_type::u, segments_in_v_interval);
cell.inside = (intersections % 2 == 1);
cell.interval_u = u_interval;
Expand Down
18 changes: 8 additions & 10 deletions include/gua/scenegraph/GeometryNode.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,6 @@ class GUA_DLL GeometryNode : public Node {

public:



/**
* A value describing the shadow's quality.
*/
ShadowMode get_shadow_mode() const { return shadow_mode_; }
void set_shadow_mode(ShadowMode v) { shadow_mode_ = v; }

/**
* Constructor.
*
Expand Down Expand Up @@ -94,6 +86,12 @@ class GUA_DLL GeometryNode : public Node {
std::string const& get_material() const;
void set_material(std::string const& v);

/**
* A value describing the shadow's quality.
*/
ShadowMode get_shadow_mode() const { return shadow_mode_; }
void set_shadow_mode(ShadowMode v) { shadow_mode_ = v; }

/**
* Updates bounding box by accessing the ressource in the databse
*/
Expand All @@ -112,13 +110,13 @@ class GUA_DLL GeometryNode : public Node {

protected:

virtual std::shared_ptr<Node> copy() const = 0;
// virtual std::shared_ptr<Node> copy() const = 0;

std::string filename_;
std::string material_;

ShadowMode shadow_mode_;
bool filename_changed_;
bool filename_changed_;
bool material_changed_;
};

Expand Down
8 changes: 5 additions & 3 deletions src/gua/renderer/CompositePass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,12 @@ void CompositePass::print_shaders(std::string const& directory,

bool CompositePass::pre_compile_shaders(RenderContext const& ctx) {

if (composite_shader_) return composite_shader_->upload_to(ctx);
if (ray_generation_shader_) return ray_generation_shader_->upload_to(ctx);
bool success(true);

return false;
if (composite_shader_) success &= composite_shader_->upload_to(ctx);
if (ray_generation_shader_) success &= ray_generation_shader_->upload_to(ctx);

return success;
}

////////////////////////////////////////////////////////////////////////////////
Expand Down
29 changes: 15 additions & 14 deletions src/gua/renderer/GBufferPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ GBufferPass::GBufferPass(Pipeline* pipeline)
bfc_rasterizer_state_(),
no_bfc_rasterizer_state_(),
bbox_rasterizer_state_(),
depth_stencil_state_()
depth_stencil_state_()
{
initialize_trimesh_ubershader(pipeline->get_context());
}
Expand Down Expand Up @@ -83,21 +83,22 @@ void GBufferPass::create(
////////////////////////////////////////////////////////////////////////////////

void GBufferPass::cleanup(RenderContext const& ctx) {
Pass::cleanup(ctx);
Pass::cleanup(ctx);
}

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

bool GBufferPass::pre_compile_shaders(const gua::RenderContext& ctx) {
bool success{true};

for (auto const& shader : ubershaders_) {
success &= shader.second->upload_to(ctx);
}
bool success(true);

return success;
for (auto const& shader : ubershaders_) {
success &= shader.second->upload_to(ctx);
}

////////////////////////////////////////////////////////////////////////////////
return success;
}

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

void GBufferPass::rendering(SerializedScene const& scene,
SceneGraph const& graph,
Expand Down Expand Up @@ -282,7 +283,7 @@ void GBufferPass::display_bboxes(RenderContext const& ctx,
SerializedScene const& scene,
std::size_t viewid) {


auto meshubershader = ubershaders_[typeid(TriMeshNode)];

if (pipeline_->config.enable_bbox_display()) {
Expand Down Expand Up @@ -317,7 +318,7 @@ void GBufferPass::display_bboxes(RenderContext const& ctx,

void GBufferPass::display_rays(RenderContext const& ctx,
SerializedScene const& scene,
std::size_t viewid)
std::size_t viewid)
{
auto meshubershader = ubershaders_[typeid(TriMeshNode)];

Expand Down Expand Up @@ -345,7 +346,7 @@ void GBufferPass::display_rays(RenderContext const& ctx,
void GBufferPass::display_quads(RenderContext const& ctx,
SerializedScene const& scene,
CameraMode eye,
std::size_t viewid)
std::size_t viewid)
{
auto meshubershader = ubershaders_[typeid(TriMeshNode)];

Expand Down Expand Up @@ -459,15 +460,15 @@ void GBufferPass::initialize_state_objects(RenderContext const& ctx) {
////////////////////////////////////////////////////////////////////////////////

void GBufferPass::apply_material_mapping(
std::set<std::string> const& materials)
std::set<std::string> const& materials)
{
cached_materials_ = materials;

for ( auto const& shader : ubershaders_ )
{
shader.second->create(cached_materials_);
}

}

////////////////////////////////////////////////////////////////////////////////
Expand Down
15 changes: 7 additions & 8 deletions src/gua/renderer/LightingPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,9 @@ LayerMapping const* LightingPass::get_gbuffer_mapping() const {

bool LightingPass::pre_compile_shaders(RenderContext const& ctx) {

bool success(false);
bool success(true);

if (shader_) success = shader_->upload_to(ctx);
if (success) success = shadow_map_.pre_compile_shaders(ctx);
if (shader_) success &= shader_->upload_to(ctx);

return success;
}
Expand Down Expand Up @@ -268,11 +267,11 @@ void LightingPass::rendering(SerializedScene const& scene,
target->unbind(ctx);
ctx.render_context->reset_state_objects();

shadow_map_.render(ctx,
scene_graph,
scene.center_of_interest,
camera,
light->get_cached_world_transform(),
shadow_map_.render(ctx,
scene_graph,
scene.center_of_interest,
camera,
light->get_cached_world_transform(),
light->data.get_shadow_map_size());

shader_->get_program()->use(ctx);
Expand Down
20 changes: 11 additions & 9 deletions src/gua/renderer/PostFXPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ void PostFXPass::init_resources(RenderContext const& ctx) {

void PostFXPass::render_scene(Camera const& camera,
SceneGraph const&,
RenderContext const& ctx,
RenderContext const& ctx,
std::size_t viewid) {
init_resources(ctx);

Expand Down Expand Up @@ -806,16 +806,18 @@ void PostFXPass::print_shaders(std::string const& directory,

bool PostFXPass::pre_compile_shaders(RenderContext const& ctx) {

for (auto shader: postfx_shaders_) {
if (shader) shader->upload_to(ctx);
}
bool success(true);

for (auto shader: postfx_shaders_) {
if (shader) success &= shader->upload_to(ctx);
}

if (god_ray_shader_) return god_ray_shader_->upload_to(ctx);
if (fullscreen_texture_shader_) return fullscreen_texture_shader_->upload_to(ctx);
if (glow_shader_) return glow_shader_->upload_to(ctx);
if (luminance_shader_) return luminance_shader_->upload_to(ctx);
if (god_ray_shader_) success &= god_ray_shader_->upload_to(ctx);
if (fullscreen_texture_shader_) success &= fullscreen_texture_shader_->upload_to(ctx);
if (glow_shader_) success &= glow_shader_->upload_to(ctx);
if (luminance_shader_) success &= luminance_shader_->upload_to(ctx);

return false;
return success;
}

}
4 changes: 2 additions & 2 deletions src/gua/renderer/Renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Renderer::~Renderer() {
for (auto& rc : render_clients_) { rc.second.join(); }
}

void Renderer::renderclient(Mailbox& in, Pipeline* pipe) {
void Renderer::renderclient(Mailbox in, Pipeline* pipe) {
FpsCounter fpsc(20);
fpsc.start();

Expand All @@ -73,7 +73,7 @@ Renderer::Renderer(std::vector<Pipeline*> const& pipelines)
auto p = spawnDoublebufferred<Item>();
render_clients_.emplace_back(
std::make_pair(p.first,
std::thread(&Renderer::renderclient, this, p.second, pipe)));
std::thread(Renderer::renderclient, p.second, pipe)));
}
}

Expand Down
3 changes: 1 addition & 2 deletions src/gua/renderer/ShaderProgram.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,10 +233,9 @@ bool ShaderProgram::upload_to(RenderContext const & context) const {
// if (programs_[context.id]->info_log() != "")
// std::cout << programs_[context.id]->info_log().c_str() << std::endl;

return true;
}

return false;
return true;
}

////////////////////////////////////////////////////////////////////////////////
Expand Down
21 changes: 3 additions & 18 deletions src/gua/renderer/ShadowMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,25 +47,10 @@ ShadowMap::ShadowMap(Pipeline* pipeline)
////////////////////////////////////////////////////////////////////////////////

ShadowMap::~ShadowMap() {
if (buffer_)
if (buffer_)
delete buffer_;
}

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

bool ShadowMap::pre_compile_shaders(RenderContext const& ctx) {

bool success(true);

for (auto const& shader : pipeline_->get_geometry_ubershaders() )
{
success &= shader.second->upload_to(ctx);
}

return success;
}


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

void ShadowMap::update_members(RenderContext const & ctx, unsigned map_size) {
Expand Down Expand Up @@ -96,7 +81,7 @@ void ShadowMap::update_members(RenderContext const & ctx, unsigned map_size) {

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

void ShadowMap::cleanup(RenderContext const& context)
void ShadowMap::cleanup(RenderContext const& context)
{
if (buffer_) buffer_->remove_buffers(context);
}
Expand Down Expand Up @@ -131,7 +116,7 @@ void ShadowMap::render_geometry(RenderContext const & ctx,
GeometryUberShader* ubershader = nullptr;

// get appropriate ubershader
if (!type.second.empty())
if (!type.second.empty())
{
auto const& filename = type.second.front()->get_filename();
auto geometry = GeometryDatabase::instance()->lookup(filename);
Expand Down
2 changes: 0 additions & 2 deletions src/gua/renderer/TriMeshLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ namespace gua {
}
else {

std::cout << file_name << " " << flags << std::endl;

bool fileload_succeed = false;

if (is_supported(file_name))
Expand Down
4 changes: 3 additions & 1 deletion src/gua/scenegraph/NURBSNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@ namespace gua {

////////////////////////////////////////////////////////////////////////////////
std::shared_ptr<Node> NURBSNode::copy() const {
return std::make_shared<NURBSNode>(get_name(), filename_, material_, get_transform());
auto result(std::make_shared<NURBSNode>(get_name(), filename_, material_, get_transform()));
result->shadow_mode_ = shadow_mode_;
return result;
}

}
4 changes: 3 additions & 1 deletion src/gua/scenegraph/PBRNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ namespace gua {

////////////////////////////////////////////////////////////////////////////////
std::shared_ptr<Node> PBRNode::copy() const {
return std::make_shared<PBRNode>(get_name(), filename_, material_, get_transform());
auto result(std::make_shared<PBRNode>(get_name(), filename_, material_, get_transform()));
result->shadow_mode_ = shadow_mode_;
return result;
}
}
4 changes: 3 additions & 1 deletion src/gua/scenegraph/TriMeshNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,8 @@ namespace gua {
////////////////////////////////////////////////////////////////////////////////

std::shared_ptr<Node> TriMeshNode::copy() const {
return std::make_shared<TriMeshNode>(get_name(), filename_, material_, get_transform());
auto result(std::make_shared<TriMeshNode>(get_name(), filename_, material_, get_transform()));
result->shadow_mode_ = shadow_mode_;
return result;
}
}
Loading

0 comments on commit c6eca4e

Please sign in to comment.