Skip to content

Commit

Permalink
#5893: Patches attach suitable geometry to the render entity, they ar…
Browse files Browse the repository at this point in the history
…e appearing in lit render mode now
  • Loading branch information
codereader committed Jan 30, 2022
1 parent e8b3e60 commit eacb2ea
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
12 changes: 6 additions & 6 deletions libs/render/RenderableGeometry.h
Expand Up @@ -162,7 +162,8 @@ class RenderableGeometry :
}

_renderEntity = entity;
_renderEntity->addRenderable(getRenderAdapter(), _shader);
ensureRenderAdapter();
_renderEntity->addRenderable(_renderAdapter, _shader);
}

void detachFromEntity()
Expand All @@ -174,23 +175,22 @@ class RenderableGeometry :
}
}

protected:

/**
* Returns the adapter class suitable to attach this geometry as surface to a render entity
* Creates the adapter class suitable to attach this geometry as surface to a render entity
* The surface will have an identity transform (all vertices specified in world coords).
* This adapter will be valid as long as this geometry is attached to the IGeometryRenderer,
* otherwise no access to the stored vertices/indices is possible.
*/
const IRenderableObject::Ptr& getRenderAdapter()
void ensureRenderAdapter()
{
if (!_renderAdapter)
{
_renderAdapter = std::make_shared<RenderAdapter>(*this);
}

return _renderAdapter;
}

protected:
// Removes the geometry from the attached shader. Does nothing if no geometry has been added.
void removeGeometry()
{
Expand Down
1 change: 1 addition & 0 deletions radiantcore/patch/PatchNode.cpp
Expand Up @@ -347,6 +347,7 @@ void PatchNode::onPreRender(const VolumeTest& volume)
if (volume.fill())
{
_renderableSurfaceSolid.update(m_patch._shader.getGLShader());
_renderableSurfaceSolid.attachToEntity(_renderEntity);
}
else
{
Expand Down

0 comments on commit eacb2ea

Please sign in to comment.