Skip to content

Commit

Permalink
Merge pull request #148 from GlPortal/topViewDebug_rebased
Browse files Browse the repository at this point in the history
Top view debug rebased
  • Loading branch information
hhirsch authored Jul 31, 2018
2 parents 14e216f + dfa6042 commit d3550a4
Show file tree
Hide file tree
Showing 2 changed files with 269 additions and 74 deletions.
120 changes: 90 additions & 30 deletions include/glPortal/renderer/GameRenderer.hpp
Original file line number Diff line number Diff line change
@@ -1,80 +1,140 @@
#ifndef GAME_RENDERER_HPP
#define GAME_RENDERER_HPP

#include <memory>
#include <string>

#include <radix/core/math/Vector3f.hpp>
#include <array>
#include <radix/renderer/SubRenderer.hpp>

namespace radix {
struct RenderContext;
class Camera;
class Renderer;
class Entity;
}
struct RenderContext;
class Camera;
class Renderer;
class Entity;
struct FrameBuffer;
} // namespace radix

namespace glPortal {

class World;
class Portal;

class GameRenderer : public radix::SubRenderer {
public:
GameRenderer(World& w, radix::Renderer& ren, radix::Camera* cam, double* ptime);
public:
/**
* @brief
*
* @param w
* @param ren
* @param cam
* @param ptime
*/
GameRenderer(World& w, radix::Renderer& ren, radix::Camera* cam,
double* ptime);

~GameRenderer();

/**
* @brief
*/
void render();

/**
* Renders the scene with provided camera parameters
* @brief Renders the scene with provided camera parameters
*
* @param rc
*/
void renderScene(radix::RenderContext& renderContext);

/**
* @brief
*
* @param renderContext
*/
void renderDebugView(radix::RenderContext& renderContext);

/**
* @brief
*
* @param rc
*/
void renderScene(radix::RenderContext &rc);
void renderViewFrames(radix::RenderContext& rc);

void renderDebugView(radix::RenderContext &renderContext);
void renderViewFrames(radix::RenderContext &rc);
void renderViewFrameStencil(radix::RenderContext &rc);
/**
* @brief
*
* @param rc
*/
void renderViewFrameStencil(radix::RenderContext& rc);

/**
* Renders all the entities in the scene regardless of shading
* @brief Renders all the entities in the scene regardless of shading
*
* @param rc
*/
void renderEntities(radix::RenderContext &rc);
void renderEntities(radix::RenderContext& rc);

/**
* @brief renderPortals render both portals color and blend
*
* @param rc
*/
void renderPortals(radix::RenderContext &rc);
void renderPortals(radix::RenderContext& rc);

// GL_ALWAYS 0x0207
// GL_REPLACE 0x1E01
void testPortalStencil(const Portal& portal, radix::RenderContext& renderContext,
const int stencilIndex = 1,
const unsigned int stencilFuncType = 0x0207,
const unsigned int stencilSuccess = 0x1E01);

void renderSceneFromPortal(const radix::Camera& src, const Portal& portal1,
const Portal& portal2, radix::RenderContext&,
const int stencilIndex,
const unsigned int occlusionQueryIndex,
const unsigned int count);

/**
* @brief renderPortal render portal color and blend
*
* @param portal
* @param rc
*/
void renderPortal(radix::Entity* portal, radix::RenderContext& rc,
radix::Renderer& renderer);
void renderStencilPortal(const Portal& portal, radix::RenderContext& rc,
const unsigned int query);

/**
* Renders a single entity regardless of shading
* @brief Renders a single entity regardless of shading
*
* @param rc
* @param e
*/
void renderEntity(radix::RenderContext &rc, const radix::Entity &e);
void renderEntity(radix::RenderContext& rc, const radix::Entity& e);

/**
* Renders the player character using ambient shading
* @brief Renders the player character using ambient shading
*
* @param rc
*/
void renderPlayer(radix::RenderContext &rc);
void renderPlayer(radix::RenderContext& rc);

/**
* Set the camera in the portal so rendering from that portal is possible
* @brief Set the camera in the portal so rendering from that portal is
* possible
* @param cam The camera from which we look at the portal
* @param dest The camera to move inside the portal and point in the right direction
* @param dest The camera to move inside the portal and point in the
* right direction
* @param portal The portal in which to place the camera
* @param otherPortal The counterpart of the portal
*/
static void setCameraInPortal(const radix::Camera &cam, radix::Camera &dest,
const radix::Entity &portal, const radix::Entity &otherPortal);
static void setCameraInPortal(const radix::Camera& cam, radix::Camera& dest,
const radix::Entity& portal,
const radix::Entity& otherPortal);

private:
private:
radix::Camera* camera;
double* dtime;
double time = 0.0;
std::array<unsigned int, 10> occlusionQueryIdx;
std::unique_ptr<radix::FrameBuffer> depthFrameBuffer;
};

} /* namespace glPortal */
Expand Down
Loading

0 comments on commit d3550a4

Please sign in to comment.