mirror of
https://github.com/rwengine/openrw.git
synced 2024-11-25 11:52:40 +01:00
Convert Renderer to unique_ptr
This commit is contained in:
parent
c49b4bbd50
commit
9e4e97a58e
@ -57,12 +57,12 @@ void DebugDraw::drawContactPoint(const btVector3 &pointOnB,
|
||||
RW_UNUSED(color);
|
||||
}
|
||||
|
||||
void DebugDraw::flush(GameRenderer *renderer) {
|
||||
void DebugDraw::flush(GameRenderer &renderer) {
|
||||
if (lines.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
renderer->getRenderer()->useProgram(shaderProgram);
|
||||
renderer.getRenderer().useProgram(shaderProgram);
|
||||
|
||||
lineBuff->uploadVertices(lines);
|
||||
dbuff->addGeometry(lineBuff.get());
|
||||
@ -75,9 +75,9 @@ void DebugDraw::flush(GameRenderer *renderer) {
|
||||
dp.count = lines.size();
|
||||
dp.diffuse = 1.f;
|
||||
|
||||
renderer->getRenderer()->drawArrays(glm::mat4(1.f), dbuff.get(), dp);
|
||||
renderer.getRenderer().drawArrays(glm::mat4(1.f), dbuff.get(), dp);
|
||||
|
||||
renderer->getRenderer()->invalidate();
|
||||
renderer.getRenderer().invalidate();
|
||||
|
||||
glUseProgram(0);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
|
@ -38,7 +38,7 @@ public:
|
||||
void setDebugMode(int debugMode) override;
|
||||
int getDebugMode() const override;
|
||||
|
||||
void flush(GameRenderer *renderer);
|
||||
void flush(GameRenderer &renderer);
|
||||
|
||||
void setShaderProgram(Renderer::ShaderProgram *shaderProgram) {
|
||||
this->shaderProgram = shaderProgram;
|
||||
|
@ -43,9 +43,9 @@ struct ParticleVert {
|
||||
GameRenderer::GameRenderer(Logger* log, GameData* _data)
|
||||
: data(_data)
|
||||
, logger(log)
|
||||
, map(renderer, _data)
|
||||
, water(this)
|
||||
, text(this) {
|
||||
, map(*renderer, _data)
|
||||
, water(*this)
|
||||
, text(*this) {
|
||||
logger->info("Renderer", renderer->getIDString());
|
||||
|
||||
worldProg =
|
||||
@ -171,7 +171,7 @@ GameRenderer::~GameRenderer() {
|
||||
|
||||
void GameRenderer::setupRender() {
|
||||
// Set the viewport
|
||||
const glm::ivec2& vp = getRenderer()->getViewport();
|
||||
const glm::ivec2& vp = getRenderer().getViewport();
|
||||
glViewport(0, 0, vp.x, vp.y);
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, framebufferName);
|
||||
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
|
||||
@ -239,7 +239,7 @@ void GameRenderer::renderWorld(GameWorld* world, const ViewCamera& camera,
|
||||
|
||||
renderer->pushDebugGroup("Water");
|
||||
|
||||
water.render(this, world);
|
||||
water.render(*this, world);
|
||||
|
||||
profWater = renderer->popDebugGroup();
|
||||
|
||||
|
@ -37,7 +37,7 @@ class GameRenderer {
|
||||
Logger* logger;
|
||||
|
||||
/** The low-level drawing interface to use */
|
||||
std::shared_ptr<Renderer> renderer = std::make_shared<OpenGLRenderer>();
|
||||
std::unique_ptr<Renderer> renderer = std::make_unique<OpenGLRenderer>();
|
||||
|
||||
// Temporary variables used during rendering
|
||||
float _renderAlpha{0.f};
|
||||
@ -80,8 +80,8 @@ public:
|
||||
DrawBuffer skyDbuff;
|
||||
GeometryBuffer skyGbuff;
|
||||
|
||||
GameData* getData() const {
|
||||
return data;
|
||||
const GameData& getData() const {
|
||||
return *data;
|
||||
}
|
||||
|
||||
size_t getCulledCount() {
|
||||
@ -119,8 +119,8 @@ public:
|
||||
void setupRender();
|
||||
void renderPostProcess();
|
||||
|
||||
std::shared_ptr<Renderer> getRenderer() {
|
||||
return renderer;
|
||||
Renderer& getRenderer() {
|
||||
return *renderer;
|
||||
}
|
||||
|
||||
void setViewport(int w, int h);
|
||||
|
@ -46,7 +46,7 @@ void main()
|
||||
outColour = vec4(colour.rgb + c.rgb, colour.a * c.a);
|
||||
})";
|
||||
|
||||
MapRenderer::MapRenderer(std::shared_ptr<Renderer> renderer, GameData* _data)
|
||||
MapRenderer::MapRenderer(Renderer &renderer, GameData* _data)
|
||||
: data(_data), renderer(renderer) {
|
||||
rectGeom.uploadVertices<VertexP2>(
|
||||
{{-.5f, -.5f}, {.5f, -.5f}, {.5f, .5f}, {-.5f, .5f}});
|
||||
@ -64,16 +64,16 @@ MapRenderer::MapRenderer(std::shared_ptr<Renderer> renderer, GameData* _data)
|
||||
circle.addGeometry(&circleGeom);
|
||||
circle.setFaceType(GL_TRIANGLE_FAN);
|
||||
|
||||
rectProg = renderer->createShader(MapVertexShader, MapFragmentShader);
|
||||
rectProg = renderer.createShader(MapVertexShader, MapFragmentShader);
|
||||
|
||||
renderer->setUniform(rectProg.get(), "colour", glm::vec4(1.f));
|
||||
renderer.setUniform(rectProg.get(), "colour", glm::vec4(1.f));
|
||||
}
|
||||
|
||||
#define GAME_MAP_SIZE 4000
|
||||
|
||||
void MapRenderer::draw(GameWorld* world, const MapInfo& mi) {
|
||||
renderer->pushDebugGroup("Map");
|
||||
renderer->useProgram(rectProg.get());
|
||||
renderer.pushDebugGroup("Map");
|
||||
renderer.useProgram(rectProg.get());
|
||||
|
||||
Renderer::DrawParameters dp { };
|
||||
dp.start = 0;
|
||||
@ -87,24 +87,24 @@ void MapRenderer::draw(GameWorld* world, const MapInfo& mi) {
|
||||
// Determine the scale to show the right number of world units on the screen
|
||||
float worldScale = mi.screenSize / mi.worldSize;
|
||||
|
||||
auto proj = renderer->get2DProjection();
|
||||
auto proj = renderer.get2DProjection();
|
||||
glm::mat4 view{1.0f}, model{1.0f};
|
||||
renderer->setUniform(rectProg.get(), "proj", proj);
|
||||
renderer->setUniform(rectProg.get(), "model", glm::mat4(1.0f));
|
||||
renderer->setUniform(rectProg.get(), "colour", glm::vec4(0.f, 0.f, 0.f, 1.f));
|
||||
renderer.setUniform(rectProg.get(), "proj", proj);
|
||||
renderer.setUniform(rectProg.get(), "model", glm::mat4(1.0f));
|
||||
renderer.setUniform(rectProg.get(), "colour", glm::vec4(0.f, 0.f, 0.f, 1.f));
|
||||
|
||||
view = glm::translate(view, glm::vec3(mi.screenPosition, 0.f));
|
||||
|
||||
if (mi.clipToSize) {
|
||||
glm::mat4 circleView = glm::scale(view, glm::vec3(mi.screenSize));
|
||||
renderer->setUniform(rectProg.get(), "view", circleView);
|
||||
renderer.setUniform(rectProg.get(), "view", circleView);
|
||||
dp.count = 182;
|
||||
glEnable(GL_STENCIL_TEST);
|
||||
glStencilFunc(GL_ALWAYS, 1, 0xFF);
|
||||
glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
|
||||
glStencilMask(0xFF);
|
||||
glColorMask(0x00, 0x00, 0x00, 0x00);
|
||||
renderer->drawArrays(glm::mat4(1.0f), &circle, dp);
|
||||
renderer.drawArrays(glm::mat4(1.0f), &circle, dp);
|
||||
glColorMask(0xFF, 0xFF, 0xFF, 0xFF);
|
||||
glStencilFunc(GL_EQUAL, 1, 0xFF);
|
||||
}
|
||||
@ -113,7 +113,7 @@ void MapRenderer::draw(GameWorld* world, const MapInfo& mi) {
|
||||
view = glm::rotate(view, mi.rotation, glm::vec3(0.f, 0.f, 1.f));
|
||||
view = glm::translate(
|
||||
view, glm::vec3(glm::vec2(-1.f, 1.f) * mi.worldCenter, 0.f));
|
||||
renderer->setUniform(rectProg.get(), "view", view);
|
||||
renderer.setUniform(rectProg.get(), "view", view);
|
||||
|
||||
// radar00 = -x, +y
|
||||
// incrementing in X, then Y
|
||||
@ -138,13 +138,13 @@ void MapRenderer::draw(GameWorld* world, const MapInfo& mi) {
|
||||
tilemodel = glm::translate(tilemodel, glm::vec3(tc, 0.f));
|
||||
tilemodel = glm::scale(tilemodel, glm::vec3(tileSize, 1.f));
|
||||
|
||||
renderer->setUniform(rectProg.get(), "model", tilemodel);
|
||||
renderer.setUniform(rectProg.get(), "model", tilemodel);
|
||||
|
||||
renderer->drawArrays(glm::mat4(1.0f), &rect, dp);
|
||||
renderer.drawArrays(glm::mat4(1.0f), &rect, dp);
|
||||
}
|
||||
|
||||
// From here on out we will work in screenspace
|
||||
renderer->setUniform(rectProg.get(), "view", glm::mat4(1.0f));
|
||||
renderer.setUniform(rectProg.get(), "view", glm::mat4(1.0f));
|
||||
|
||||
if (mi.clipToSize) {
|
||||
glDisable(GL_STENCIL_TEST);
|
||||
@ -157,8 +157,8 @@ void MapRenderer::draw(GameWorld* world, const MapInfo& mi) {
|
||||
glm::mat4 model{1.0f};
|
||||
model = glm::translate(model, glm::vec3(mi.screenPosition, 0.0f));
|
||||
model = glm::scale(model, glm::vec3(mi.screenSize * 1.07f));
|
||||
renderer->setUniform(rectProg.get(), "model", model);
|
||||
renderer->drawArrays(glm::mat4(1.0f), &rect, dp);
|
||||
renderer.setUniform(rectProg.get(), "model", model);
|
||||
renderer.drawArrays(glm::mat4(1.0f), &rect, dp);
|
||||
glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE,
|
||||
GL_ZERO);
|
||||
}
|
||||
@ -237,8 +237,8 @@ void MapRenderer::draw(GameWorld* world, const MapInfo& mi) {
|
||||
}
|
||||
|
||||
/// @TODO migrate to using the renderer
|
||||
renderer->invalidate();
|
||||
renderer->popDebugGroup();
|
||||
renderer.invalidate();
|
||||
renderer.popDebugGroup();
|
||||
}
|
||||
|
||||
void MapRenderer::prepareBlip(const glm::vec2& coord, const glm::mat4& view,
|
||||
@ -260,14 +260,14 @@ void MapRenderer::prepareBlip(const glm::vec2& coord, const glm::mat4& view,
|
||||
model = glm::translate(model, viewPos);
|
||||
model = glm::scale(model, glm::vec3(size));
|
||||
model = glm::rotate(model, heading, glm::vec3(0.f, 0.f, 1.f));
|
||||
renderer->setUniform(rectProg.get(), "model", model);
|
||||
renderer.setUniform(rectProg.get(), "model", model);
|
||||
|
||||
GLuint tex = 0;
|
||||
if (!texture.empty()) {
|
||||
auto sprite = data->findSlotTexture("hud", texture);
|
||||
tex = sprite->getName();
|
||||
}
|
||||
renderer->setUniform(rectProg.get(), "colour", colour);
|
||||
renderer.setUniform(rectProg.get(), "colour", colour);
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, tex);
|
||||
|
||||
@ -286,7 +286,7 @@ void MapRenderer::drawBlip(const glm::vec2& coord, const glm::mat4& view,
|
||||
const MapInfo& mi, glm::vec4 colour, float size) {
|
||||
drawBlip(coord, view, mi, "", colour, size);
|
||||
// Draw outline
|
||||
renderer->setUniform(rectProg.get(), "colour", glm::vec4(0.0f, 0.0f, 0.0f, 1.0f));
|
||||
renderer.setUniform(rectProg.get(), "colour", glm::vec4(0.0f, 0.0f, 0.0f, 1.0f));
|
||||
glDrawArrays(GL_LINE_LOOP, 0, 4);
|
||||
}
|
||||
|
||||
|
@ -36,14 +36,14 @@ public:
|
||||
bool clipToSize = true;
|
||||
};
|
||||
|
||||
MapRenderer(std::shared_ptr<Renderer> renderer, GameData* data);
|
||||
MapRenderer(Renderer& renderer, GameData* data);
|
||||
|
||||
void draw(GameWorld* world, const MapInfo& mi);
|
||||
void scaleHUD(const float scale);
|
||||
|
||||
private:
|
||||
GameData* data;
|
||||
std::shared_ptr<Renderer> renderer;
|
||||
Renderer& renderer;
|
||||
|
||||
GeometryBuffer rectGeom;
|
||||
DrawBuffer rect;
|
||||
|
@ -308,8 +308,8 @@ public:
|
||||
float f) override;
|
||||
void useProgram(ShaderProgram* p) override;
|
||||
|
||||
void clear(const glm::vec4& colour, bool clearColour,
|
||||
bool clearDepth) override;
|
||||
void clear(const glm::vec4& colour, bool clearColour = true,
|
||||
bool clearDepth = true) override;
|
||||
|
||||
void setSceneParameters(const SceneUniformData& data) override;
|
||||
|
||||
|
@ -142,13 +142,13 @@ struct TextVertex {
|
||||
}
|
||||
};
|
||||
|
||||
TextRenderer::TextRenderer(GameRenderer* renderer) : renderer(renderer) {
|
||||
textShader = renderer->getRenderer()->createShader(TextVertexShader,
|
||||
TextRenderer::TextRenderer(GameRenderer &renderer) : renderer(renderer) {
|
||||
textShader = renderer.getRenderer().createShader(TextVertexShader,
|
||||
TextFragmentShader);
|
||||
}
|
||||
|
||||
void TextRenderer::setFontTexture(font_t font, const std::string& textureName) {
|
||||
auto ftexture = renderer->getData()->findSlotTexture("fonts", textureName);
|
||||
auto ftexture = renderer.getData().findSlotTexture("fonts", textureName);
|
||||
const glm::u32vec2 textureSize = ftexture->getSize();
|
||||
glm::u8vec2 glyphOffset{textureSize.x / 16, textureSize.x / 16};
|
||||
if (font != FONT_PAGER) {
|
||||
@ -187,8 +187,8 @@ void TextRenderer::renderText(const TextRenderer::TextInfo& ti,
|
||||
if (ti.text.empty() || ti.text[0] == '*')
|
||||
return;
|
||||
|
||||
renderer->getRenderer()->pushDebugGroup("Text");
|
||||
renderer->getRenderer()->useProgram(textShader.get());
|
||||
renderer.getRenderer().pushDebugGroup("Text");
|
||||
renderer.getRenderer().useProgram(textShader.get());
|
||||
|
||||
glm::vec2 coord(0.f, 0.f);
|
||||
glm::vec2 alignment = ti.screenPosition;
|
||||
@ -331,15 +331,15 @@ void TextRenderer::renderText(const TextRenderer::TextInfo& ti,
|
||||
|
||||
// If we need to, draw the background.
|
||||
if (colourBG.a > 0.f) {
|
||||
renderer->drawColour(
|
||||
renderer.drawColour(
|
||||
colourBG, glm::vec4(ti.screenPosition - (ss / 3.f),
|
||||
glm::vec2(maxWidth, maxHeight) + (ss / 2.f)));
|
||||
}
|
||||
|
||||
renderer->getRenderer()->setUniform(
|
||||
textShader.get(), "proj", renderer->getRenderer()->get2DProjection());
|
||||
renderer->getRenderer()->setUniformTexture(textShader.get(), "fontTexture", 0);
|
||||
renderer->getRenderer()->setUniform(textShader.get(), "alignment", alignment);
|
||||
renderer.getRenderer().setUniform(
|
||||
textShader.get(), "proj", renderer.getRenderer().get2DProjection());
|
||||
renderer.getRenderer().setUniformTexture(textShader.get(), "fontTexture", 0);
|
||||
renderer.getRenderer().setUniform(textShader.get(), "alignment", alignment);
|
||||
|
||||
gb.uploadVertices(geo);
|
||||
db.addGeometry(&gb);
|
||||
@ -349,11 +349,11 @@ void TextRenderer::renderText(const TextRenderer::TextInfo& ti,
|
||||
dp.start = 0;
|
||||
dp.blendMode = BlendMode::BLEND_ALPHA;
|
||||
dp.count = gb.getCount();
|
||||
auto ftexture = renderer->getData()->findSlotTexture("fonts", fontMetaData.textureName);
|
||||
auto ftexture = renderer.getData().findSlotTexture("fonts", fontMetaData.textureName);
|
||||
dp.textures = {{ftexture->getName()}};
|
||||
dp.depthMode = DepthMode::OFF;
|
||||
|
||||
renderer->getRenderer()->drawArrays(glm::mat4(1.0f), &db, dp);
|
||||
renderer.getRenderer().drawArrays(glm::mat4(1.0f), &db, dp);
|
||||
|
||||
renderer->getRenderer()->popDebugGroup();
|
||||
renderer.getRenderer().popDebugGroup();
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ public:
|
||||
float widthFrac;
|
||||
};
|
||||
|
||||
TextRenderer(GameRenderer* renderer);
|
||||
TextRenderer(GameRenderer& renderer);
|
||||
~TextRenderer() = default;
|
||||
|
||||
void setFontTexture(font_t font, const std::string& textureName);
|
||||
@ -89,7 +89,7 @@ private:
|
||||
|
||||
std::array<FontMetaData, FONTS_COUNT> fonts;
|
||||
|
||||
GameRenderer* renderer;
|
||||
GameRenderer& renderer;
|
||||
std::unique_ptr<Renderer::ShaderProgram> textShader;
|
||||
|
||||
GeometryBuffer gb;
|
||||
|
@ -13,20 +13,20 @@
|
||||
#include "render/GameShaders.hpp"
|
||||
#include "render/OpenGLRenderer.hpp"
|
||||
|
||||
WaterRenderer::WaterRenderer(GameRenderer* renderer) {
|
||||
WaterRenderer::WaterRenderer(GameRenderer &renderer) {
|
||||
maskDraw.setFaceType(GL_TRIANGLES);
|
||||
gridDraw.setFaceType(GL_TRIANGLES);
|
||||
|
||||
waterProg = renderer->getRenderer()->createShader(
|
||||
waterProg = renderer.getRenderer().createShader(
|
||||
GameShaders::WaterHQ::VertexShader,
|
||||
GameShaders::WaterHQ::FragmentShader);
|
||||
maskProg = renderer->getRenderer()->createShader(
|
||||
maskProg = renderer.getRenderer().createShader(
|
||||
GameShaders::Mask3D::VertexShader, GameShaders::Mask3D::FragmentShader);
|
||||
|
||||
renderer->getRenderer()->setProgramBlockBinding(waterProg.get(), "SceneData", 1);
|
||||
renderer->getRenderer()->setProgramBlockBinding(maskProg.get(), "SceneData", 1);
|
||||
renderer.getRenderer().setProgramBlockBinding(waterProg.get(), "SceneData", 1);
|
||||
renderer.getRenderer().setProgramBlockBinding(maskProg.get(), "SceneData", 1);
|
||||
|
||||
renderer->getRenderer()->setUniformTexture(waterProg.get(), "data", 1);
|
||||
renderer.getRenderer().setUniformTexture(waterProg.get(), "data", 1);
|
||||
|
||||
// Generate grid mesh
|
||||
int gridres = 60;
|
||||
@ -99,8 +99,8 @@ void WaterRenderer::setDataTexture(GLuint fbBinding, GLuint dataTex) {
|
||||
dataTexture = dataTex;
|
||||
}
|
||||
|
||||
void WaterRenderer::render(GameRenderer* renderer, GameWorld* world) {
|
||||
auto r = renderer->getRenderer();
|
||||
void WaterRenderer::render(GameRenderer &renderer, GameWorld* world) {
|
||||
auto& r = renderer.getRenderer();
|
||||
|
||||
auto waterTex = world->data->findSlotTexture("particle", "water_old");
|
||||
RW_CHECK(waterTex != nullptr, "Water texture is null");
|
||||
@ -126,30 +126,30 @@ void WaterRenderer::render(GameRenderer* renderer, GameWorld* world) {
|
||||
glDrawBuffers(1, buffers);
|
||||
glClear(GL_STENCIL_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
|
||||
|
||||
r->useProgram(maskProg.get());
|
||||
r.useProgram(maskProg.get());
|
||||
|
||||
r->drawArrays(m, &maskDraw, wdp);
|
||||
r.drawArrays(m, &maskDraw, wdp);
|
||||
|
||||
glStencilFunc(GL_EQUAL, 1, 0xFF);
|
||||
glStencilMask(0x00);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
|
||||
r->useProgram(waterProg.get());
|
||||
r.useProgram(waterProg.get());
|
||||
|
||||
buffers[0] = GL_COLOR_ATTACHMENT0;
|
||||
glDrawBuffers(1, buffers);
|
||||
|
||||
r->setUniform(waterProg.get(), "time", world->getGameTime());
|
||||
r->setUniform(waterProg.get(), "waveParams",
|
||||
r.setUniform(waterProg.get(), "time", world->getGameTime());
|
||||
r.setUniform(waterProg.get(), "waveParams",
|
||||
glm::vec2(WATER_SCALE, WATER_HEIGHT));
|
||||
auto ivp =
|
||||
glm::inverse(r->getSceneData().projection * r->getSceneData().view);
|
||||
r->setUniform(waterProg.get(), "inverseVP", ivp);
|
||||
glm::inverse(r.getSceneData().projection * r.getSceneData().view);
|
||||
r.setUniform(waterProg.get(), "inverseVP", ivp);
|
||||
|
||||
wdp.count = gridGeom.getCount();
|
||||
wdp.textures = {{waterTex->getName(), dataTexture}};
|
||||
|
||||
r->drawArrays(m, &gridDraw, wdp);
|
||||
r.drawArrays(m, &gridDraw, wdp);
|
||||
|
||||
glDisable(GL_STENCIL_TEST);
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ class GameWorld;
|
||||
*/
|
||||
class WaterRenderer {
|
||||
public:
|
||||
WaterRenderer(GameRenderer* renderer);
|
||||
WaterRenderer(GameRenderer& renderer);
|
||||
~WaterRenderer() = default;
|
||||
|
||||
/**
|
||||
@ -38,7 +38,7 @@ public:
|
||||
/**
|
||||
* Render the water using the currently active render state
|
||||
*/
|
||||
void render(GameRenderer* renderer, GameWorld* world);
|
||||
void render(GameRenderer& renderer, GameWorld* world);
|
||||
|
||||
private:
|
||||
std::unique_ptr<Renderer::ShaderProgram> waterProg = nullptr;
|
||||
|
@ -10,10 +10,10 @@
|
||||
#include <iomanip>
|
||||
#include <sstream>
|
||||
|
||||
void HUDDrawer::drawScriptTimer(GameWorld* world, GameRenderer* render) {
|
||||
void HUDDrawer::drawScriptTimer(GameWorld* world, GameRenderer& render) {
|
||||
if (world->state->scriptTimerVariable) {
|
||||
float scriptTimerTextX = static_cast<float>(
|
||||
render->getRenderer()->getViewport().x - hudParameters.uiOuterMargin);
|
||||
render.getRenderer().getViewport().x - hudParameters.uiOuterMargin);
|
||||
float scriptTimerTextY = hudParameters.uiScriptTimerHeight;
|
||||
|
||||
TextRenderer::TextInfo ti;
|
||||
@ -33,16 +33,16 @@ void HUDDrawer::drawScriptTimer(GameWorld* world, GameRenderer* render) {
|
||||
ti.baseColour = hudParameters.uiShadowColour;
|
||||
ti.screenPosition =
|
||||
glm::vec2(scriptTimerTextX + 1.f, scriptTimerTextY + 1.f);
|
||||
render->text.renderText(ti);
|
||||
render.text.renderText(ti);
|
||||
|
||||
ti.baseColour = hudParameters.uiScriptTimerColour;
|
||||
ti.screenPosition = glm::vec2(scriptTimerTextX, scriptTimerTextY);
|
||||
render->text.renderText(ti);
|
||||
render.text.renderText(ti);
|
||||
}
|
||||
}
|
||||
|
||||
void HUDDrawer::drawMap(ViewCamera& currentView, PlayerController* player,
|
||||
GameWorld* world, GameRenderer* render) {
|
||||
GameWorld* world, GameRenderer& render) {
|
||||
MapRenderer::MapInfo map;
|
||||
|
||||
if (world->state->hudFlash != HudFlash::FlashRadar ||
|
||||
@ -56,7 +56,7 @@ void HUDDrawer::drawMap(ViewCamera& currentView, PlayerController* player,
|
||||
map.worldCenter = glm::vec2(player->getCharacter()->getPosition());
|
||||
}
|
||||
|
||||
const glm::ivec2& vp = render->getRenderer()->getViewport();
|
||||
const glm::ivec2& vp = render.getRenderer().getViewport();
|
||||
|
||||
glm::vec2 mapTop =
|
||||
glm::vec2(hudParameters.uiOuterMargin, vp.y - (hudParameters.uiOuterMargin + hudParameters.uiMapSize));
|
||||
@ -66,19 +66,19 @@ void HUDDrawer::drawMap(ViewCamera& currentView, PlayerController* player,
|
||||
map.screenPosition = (mapTop + mapBottom) / 2.f;
|
||||
map.screenSize = hudParameters.uiMapSize * 0.95f;
|
||||
|
||||
render->map.draw(world, map);
|
||||
render.map.draw(world, map);
|
||||
}
|
||||
}
|
||||
|
||||
void HUDDrawer::drawPlayerInfo(PlayerController* player, GameWorld* world,
|
||||
GameRenderer* render) {
|
||||
float infoTextX = static_cast<float>(render->getRenderer()->getViewport().x -
|
||||
GameRenderer& render) {
|
||||
float infoTextX = static_cast<float>(render.getRenderer().getViewport().x -
|
||||
(hudParameters.uiOuterMargin + hudParameters.uiWeaponSize + hudParameters.uiInfoMargin));
|
||||
float infoTextY = 0.f + hudParameters.uiOuterMargin;
|
||||
float iconX = static_cast<float>(render->getRenderer()->getViewport().x -
|
||||
float iconX = static_cast<float>(render.getRenderer().getViewport().x -
|
||||
(hudParameters.uiOuterMargin + hudParameters.uiWeaponSize));
|
||||
float iconY = hudParameters.uiOuterMargin;
|
||||
float wantedX = static_cast<float>(render->getRenderer()->getViewport().x - hudParameters.uiOuterMargin);
|
||||
float wantedX = static_cast<float>(render.getRenderer().getViewport().x - hudParameters.uiOuterMargin);
|
||||
float wantedY = hudParameters.uiWantedLevelHeight;
|
||||
|
||||
TextRenderer::TextInfo ti;
|
||||
@ -96,12 +96,12 @@ void HUDDrawer::drawPlayerInfo(PlayerController* player, GameWorld* world,
|
||||
|
||||
ti.baseColour = hudParameters.uiShadowColour;
|
||||
ti.screenPosition = glm::vec2(infoTextX + 1.f, infoTextY + 1.f);
|
||||
render->text.renderText(ti);
|
||||
render.text.renderText(ti);
|
||||
|
||||
ti.baseColour = hudParameters.uiTimeColour;
|
||||
ti.screenPosition = glm::vec2(infoTextX, infoTextY);
|
||||
|
||||
render->text.renderText(ti);
|
||||
render.text.renderText(ti);
|
||||
|
||||
infoTextY += hudParameters.uiTextHeight;
|
||||
|
||||
@ -115,12 +115,12 @@ void HUDDrawer::drawPlayerInfo(PlayerController* player, GameWorld* world,
|
||||
|
||||
ti.baseColour = hudParameters.uiShadowColour;
|
||||
ti.screenPosition = glm::vec2(infoTextX + 1.f, infoTextY + 1.f);
|
||||
render->text.renderText(ti);
|
||||
render.text.renderText(ti);
|
||||
|
||||
ti.baseColour = hudParameters.uiMoneyColour;
|
||||
|
||||
ti.screenPosition = glm::vec2(infoTextX, infoTextY);
|
||||
render->text.renderText(ti);
|
||||
render.text.renderText(ti);
|
||||
|
||||
infoTextY += hudParameters.uiTextHeight;
|
||||
|
||||
@ -137,11 +137,11 @@ void HUDDrawer::drawPlayerInfo(PlayerController* player, GameWorld* world,
|
||||
ti.baseColour = hudParameters.uiShadowColour;
|
||||
ti.screenPosition = glm::vec2(infoTextX + 1.f, infoTextY + 1.f);
|
||||
|
||||
render->text.renderText(ti);
|
||||
render.text.renderText(ti);
|
||||
|
||||
ti.baseColour = hudParameters.uiHealthColour;
|
||||
ti.screenPosition = glm::vec2(infoTextX, infoTextY);
|
||||
render->text.renderText(ti);
|
||||
render.text.renderText(ti);
|
||||
}
|
||||
|
||||
if (player->getCharacter()->getCurrentState().armour > 0) {
|
||||
@ -154,11 +154,11 @@ void HUDDrawer::drawPlayerInfo(PlayerController* player, GameWorld* world,
|
||||
ti.baseColour = hudParameters.uiShadowColour;
|
||||
ti.screenPosition =
|
||||
glm::vec2(infoTextX + 1.f - hudParameters.uiArmourOffset, infoTextY + 1.f);
|
||||
render->text.renderText(ti);
|
||||
render.text.renderText(ti);
|
||||
|
||||
ti.baseColour = hudParameters.uiArmourColour;
|
||||
ti.screenPosition = glm::vec2(infoTextX - hudParameters.uiArmourOffset, infoTextY);
|
||||
render->text.renderText(ti);
|
||||
render.text.renderText(ti);
|
||||
}
|
||||
|
||||
GameString s;
|
||||
@ -168,7 +168,7 @@ void HUDDrawer::drawPlayerInfo(PlayerController* player, GameWorld* world,
|
||||
ti.text = s;
|
||||
ti.baseColour = hudParameters.uiShadowColour;
|
||||
ti.screenPosition = glm::vec2(wantedX + 1.f, wantedY + 1.f);
|
||||
render->text.renderText(ti);
|
||||
render.text.renderText(ti);
|
||||
|
||||
#if 0 // Useful for debugging
|
||||
ti.text = "ABCDEFGHIJKLMANOQRTSWXYZ\nM0123456789";
|
||||
@ -176,10 +176,10 @@ void HUDDrawer::drawPlayerInfo(PlayerController* player, GameWorld* world,
|
||||
ti.align = TextRenderer::TextInfo::Left;
|
||||
ti.baseColour = glm::vec3(0.f, 0.f, 0.f);
|
||||
ti.screenPosition = glm::vec2(101.f, 202.f);
|
||||
render->text.renderText(ti);
|
||||
render.text.renderText(ti);
|
||||
ti.baseColour = glm::vec3(1.f, 1.f, 1.f);
|
||||
ti.screenPosition = glm::vec2(100.f, 200.f);
|
||||
render->text.renderText(ti);
|
||||
render.text.renderText(ti);
|
||||
#endif
|
||||
|
||||
auto item = player->getCharacter()->getActiveItem();
|
||||
@ -200,13 +200,13 @@ void HUDDrawer::drawPlayerInfo(PlayerController* player, GameWorld* world,
|
||||
}
|
||||
|
||||
TextureData::Handle itemTexture =
|
||||
render->getData()->findSlotTexture("hud", itemTextureName);
|
||||
render.getData().findSlotTexture("hud", itemTextureName);
|
||||
RW_CHECK(itemTexture != nullptr, "Item has 0 texture");
|
||||
if (itemTexture != nullptr) {
|
||||
RW_CHECK(itemTexture->getName() != 0, "Item has 0 texture");
|
||||
render->drawTexture(
|
||||
itemTexture.get(),
|
||||
glm::vec4(iconX, iconY, hudParameters.uiWeaponSize, hudParameters.uiWeaponSize));
|
||||
render.drawTexture(itemTexture.get(),
|
||||
glm::vec4(iconX, iconY, hudParameters.uiWeaponSize,
|
||||
hudParameters.uiWeaponSize));
|
||||
}
|
||||
|
||||
if (weapon.fireType != WeaponData::MELEE) {
|
||||
@ -242,12 +242,12 @@ void HUDDrawer::drawPlayerInfo(PlayerController* player, GameWorld* world,
|
||||
ti.align = TextRenderer::TextInfo::TextAlignment::Center;
|
||||
ti.screenPosition = glm::vec2(iconX + hudParameters.uiWeaponSize / 2.f,
|
||||
iconY + hudParameters.uiWeaponSize - hudParameters.uiAmmoHeight);
|
||||
render->text.renderText(ti);
|
||||
render.text.renderText(ti);
|
||||
}
|
||||
}
|
||||
|
||||
void HUDDrawer::drawHUD(ViewCamera& currentView, PlayerController* player,
|
||||
GameWorld* world, GameRenderer* render) {
|
||||
GameWorld* world, GameRenderer& render) {
|
||||
if (player && player->getCharacter()) {
|
||||
drawMap(currentView, player, world, render);
|
||||
drawPlayerInfo(player, world, render);
|
||||
@ -255,8 +255,8 @@ void HUDDrawer::drawHUD(ViewCamera& currentView, PlayerController* player,
|
||||
}
|
||||
}
|
||||
|
||||
void HUDDrawer::drawOnScreenText(GameWorld* world, GameRenderer* renderer) {
|
||||
const auto vp = glm::vec2(renderer->getRenderer()->getViewport());
|
||||
void HUDDrawer::drawOnScreenText(GameWorld* world, GameRenderer& renderer) {
|
||||
const auto vp = glm::vec2(renderer.getRenderer().getViewport());
|
||||
|
||||
TextRenderer::TextInfo ti;
|
||||
ti.font = FONT_ARIAL;
|
||||
@ -293,7 +293,7 @@ void HUDDrawer::drawOnScreenText(GameWorld* world, GameRenderer* renderer) {
|
||||
ti.screenPosition += shadowPosition;
|
||||
ti.backgroundColour = {0, 0, 0, 0};
|
||||
|
||||
renderer->text.renderText(ti, true);
|
||||
renderer.text.renderText(ti, true);
|
||||
|
||||
ti.screenPosition -= shadowPosition;
|
||||
} else if (t.colourBG.a > 0) {
|
||||
@ -301,7 +301,7 @@ void HUDDrawer::drawOnScreenText(GameWorld* world, GameRenderer* renderer) {
|
||||
}
|
||||
|
||||
ti.baseColour = t.colourFG;
|
||||
renderer->text.renderText(ti);
|
||||
renderer.text.renderText(ti);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -41,17 +41,17 @@ public:
|
||||
void applyHUDScale(float scale);
|
||||
HUDParameters getHUDParameters();
|
||||
void drawHUD(ViewCamera& currentView, PlayerController* player,
|
||||
GameWorld* world, GameRenderer* render);
|
||||
void drawOnScreenText(GameWorld* world, GameRenderer* renderer);
|
||||
GameWorld* world, GameRenderer& render);
|
||||
void drawOnScreenText(GameWorld* world, GameRenderer& renderer);
|
||||
|
||||
private:
|
||||
HUDParameters hudParameters;
|
||||
|
||||
void drawScriptTimer(GameWorld* world, GameRenderer* render);
|
||||
void drawScriptTimer(GameWorld* world, GameRenderer& render);
|
||||
void drawMap(ViewCamera& currentView, PlayerController* player,
|
||||
GameWorld* world, GameRenderer* render);
|
||||
GameWorld* world, GameRenderer& render);
|
||||
void drawPlayerInfo(PlayerController* player, GameWorld* world,
|
||||
GameRenderer* render);
|
||||
GameRenderer& render);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -49,7 +49,7 @@ public:
|
||||
: text(n), callback(cb) {
|
||||
}
|
||||
|
||||
void draw(font_t font, float size, bool active, GameRenderer* r,
|
||||
void draw(font_t font, float size, bool active, GameRenderer& r,
|
||||
glm::vec2& basis) {
|
||||
TextRenderer::TextInfo ti;
|
||||
ti.font = font;
|
||||
@ -61,7 +61,7 @@ public:
|
||||
} else {
|
||||
ti.baseColour = glm::u8vec3(255, 255, 0);
|
||||
}
|
||||
r->text.renderText(ti);
|
||||
r.text.renderText(ti);
|
||||
basis.y += size;
|
||||
}
|
||||
|
||||
@ -97,7 +97,7 @@ public:
|
||||
*/
|
||||
int activeEntry;
|
||||
|
||||
void draw(GameRenderer* r) {
|
||||
void draw(GameRenderer& r) {
|
||||
glm::vec2 basis(offset);
|
||||
for (size_t i = 0; i < entries.size(); ++i) {
|
||||
bool active = false;
|
||||
|
@ -585,9 +585,9 @@ void RWGame::tickObjects(float dt) const {
|
||||
void RWGame::render(float alpha, float time) {
|
||||
RW_PROFILE_SCOPEC(__func__, MP_CORNFLOWERBLUE);
|
||||
|
||||
lastDraws = getRenderer().getRenderer()->getDrawCount();
|
||||
lastDraws = getRenderer().getRenderer().getDrawCount();
|
||||
|
||||
getRenderer().getRenderer()->swap();
|
||||
getRenderer().getRenderer().swap();
|
||||
|
||||
// Update the camera
|
||||
if (!StateManager::get().states.empty()) {
|
||||
@ -611,19 +611,19 @@ void RWGame::render(float alpha, float time) {
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
|
||||
|
||||
renderer.getRenderer()->pushDebugGroup("World");
|
||||
renderer.getRenderer().pushDebugGroup("World");
|
||||
|
||||
renderer.renderWorld(world.get(), viewCam, alpha);
|
||||
|
||||
renderer.getRenderer()->popDebugGroup();
|
||||
renderer.getRenderer().popDebugGroup();
|
||||
|
||||
renderDebugView(time, viewCam);
|
||||
|
||||
if (!world->isPaused()) hudDrawer.drawOnScreenText(world.get(), &renderer);
|
||||
if (!world->isPaused()) hudDrawer.drawOnScreenText(world.get(), renderer);
|
||||
|
||||
if (StateManager::currentState()) {
|
||||
RW_PROFILE_SCOPE("state");
|
||||
StateManager::get().draw(&renderer);
|
||||
StateManager::get().draw(renderer);
|
||||
}
|
||||
}
|
||||
|
||||
@ -635,7 +635,7 @@ void RWGame::renderDebugView(float time, ViewCamera &viewCam) {
|
||||
break;
|
||||
case DebugViewMode::Physics:
|
||||
world->dynamicsWorld->debugDrawWorld();
|
||||
debug.flush(&renderer);
|
||||
debug.flush(renderer);
|
||||
break;
|
||||
case DebugViewMode::Navigation:
|
||||
renderDebugPaths(time);
|
||||
@ -671,8 +671,8 @@ void RWGame::renderDebugStats(float time) {
|
||||
<< "Frame: " << time_ms << "ms\n"
|
||||
<< "Draws/Culls/Textures/Buffers: " << lastDraws << "/"
|
||||
<< renderer.getCulledCount() << "/"
|
||||
<< renderer.getRenderer()->getTextureCount() << "/"
|
||||
<< renderer.getRenderer()->getBufferCount() << "\n"
|
||||
<< renderer.getRenderer().getTextureCount() << "/"
|
||||
<< renderer.getRenderer().getBufferCount() << "\n"
|
||||
<< "Timescale: " << world->state->basic.timeScale;
|
||||
|
||||
TextRenderer::TextInfo ti;
|
||||
@ -785,7 +785,7 @@ void RWGame::renderDebugPaths(float time) {
|
||||
}
|
||||
}
|
||||
|
||||
debug.flush(&renderer);
|
||||
debug.flush(renderer);
|
||||
}
|
||||
|
||||
void RWGame::renderDebugObjects(float time, ViewCamera& camera) {
|
||||
|
@ -9,7 +9,7 @@ const ViewCamera defaultView{{-250.f, -550.f, 75.f},
|
||||
State::State(RWGame *game) : game(game) {
|
||||
}
|
||||
|
||||
void State::draw(GameRenderer *r) {
|
||||
void State::draw(GameRenderer& r) {
|
||||
auto& menu = getCurrentMenu();
|
||||
if (menu) {
|
||||
menu->draw(r);
|
||||
|
@ -25,7 +25,7 @@ public:
|
||||
|
||||
virtual void tick(float dt) = 0;
|
||||
|
||||
virtual void draw(GameRenderer* r);
|
||||
virtual void draw(GameRenderer& r);
|
||||
|
||||
virtual ~State() = default;
|
||||
|
||||
|
@ -59,7 +59,7 @@ public:
|
||||
states.back()->tick(dt);
|
||||
}
|
||||
|
||||
void draw(GameRenderer* r) {
|
||||
void draw(GameRenderer& r) {
|
||||
states.back()->draw(r);
|
||||
}
|
||||
|
||||
|
@ -90,7 +90,7 @@ void BenchmarkState::tick(float dt) {
|
||||
}
|
||||
}
|
||||
|
||||
void BenchmarkState::draw(GameRenderer* r) {
|
||||
void BenchmarkState::draw(GameRenderer& r) {
|
||||
frameCounter++;
|
||||
State::draw(r);
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ public:
|
||||
|
||||
void tick(float dt) override;
|
||||
|
||||
void draw(GameRenderer* r) override;
|
||||
void draw(GameRenderer &r) override;
|
||||
|
||||
void handleEvent(const SDL_Event& event) override;
|
||||
|
||||
|
@ -390,7 +390,7 @@ void DebugState::tick(float dt) {
|
||||
}
|
||||
}
|
||||
|
||||
void DebugState::draw(GameRenderer* r) {
|
||||
void DebugState::draw(GameRenderer& r) {
|
||||
// Draw useful information like camera position.
|
||||
std::stringstream ss;
|
||||
ss << "Camera Position: " << glm::to_string(_debugCam.position) << "\n";
|
||||
@ -403,7 +403,7 @@ void DebugState::draw(GameRenderer* r) {
|
||||
ti.screenPosition = glm::vec2(10.f, 10.f);
|
||||
ti.size = 15.f;
|
||||
ti.baseColour = glm::u8vec3(255);
|
||||
r->text.renderText(ti);
|
||||
r.text.renderText(ti);
|
||||
|
||||
State::draw(r);
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ public:
|
||||
|
||||
void tick(float dt) override;
|
||||
|
||||
void draw(GameRenderer* r) override;
|
||||
void draw(GameRenderer &r) override;
|
||||
|
||||
void handleEvent(const SDL_Event& event) override;
|
||||
|
||||
|
@ -281,9 +281,10 @@ void IngameState::tick(float dt) {
|
||||
}
|
||||
}
|
||||
|
||||
void IngameState::draw(GameRenderer* r) {
|
||||
void IngameState::draw(GameRenderer& r) {
|
||||
if (!getWorld()->state->isCinematic && getWorld()->isCutsceneDone()) {
|
||||
game->getHUDDrawer().drawHUD(_look, game->getWorld()->getPlayer(), getWorld(), r);
|
||||
game->getHUDDrawer().drawHUD(_look, game->getWorld()->getPlayer(),
|
||||
getWorld(), r);
|
||||
}
|
||||
|
||||
State::draw(r);
|
||||
|
@ -53,7 +53,7 @@ public:
|
||||
|
||||
void tick(float dt) override;
|
||||
|
||||
void draw(GameRenderer* r) override;
|
||||
void draw(GameRenderer &r) override;
|
||||
|
||||
void handleEvent(const SDL_Event& event) override;
|
||||
virtual void handlePlayerInput(const SDL_Event& event);
|
||||
|
@ -27,15 +27,16 @@ void LoadingState::handleEvent(const SDL_Event& e) {
|
||||
State::handleEvent(e);
|
||||
}
|
||||
|
||||
void LoadingState::draw(GameRenderer* r) {
|
||||
static auto kLoadingString = GameStringUtil::fromString("Loading...", FONT_ARIAL);
|
||||
void LoadingState::draw(GameRenderer& r) {
|
||||
static auto kLoadingString =
|
||||
GameStringUtil::fromString("Loading...", FONT_ARIAL);
|
||||
// Display some manner of loading screen.
|
||||
TextRenderer::TextInfo ti;
|
||||
ti.text = kLoadingString;
|
||||
auto size = r->getRenderer()->getViewport();
|
||||
auto size = r.getRenderer().getViewport();
|
||||
ti.size = 25.f;
|
||||
ti.screenPosition = glm::vec2(50.f, size.y - ti.size - 50.f);
|
||||
ti.font = FONT_PRICEDOWN;
|
||||
ti.baseColour = glm::u8vec3(255);
|
||||
r->text.renderText(ti);
|
||||
r.text.renderText(ti);
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ public:
|
||||
|
||||
void tick(float dt) override;
|
||||
|
||||
void draw(GameRenderer* r) override;
|
||||
void draw(GameRenderer& r) override;
|
||||
|
||||
bool shouldWorldUpdate() override;
|
||||
|
||||
|
@ -29,10 +29,10 @@ void PauseState::tick(float dt) {
|
||||
RW_UNUSED(dt);
|
||||
}
|
||||
|
||||
void PauseState::draw(GameRenderer* r) {
|
||||
void PauseState::draw(GameRenderer& r) {
|
||||
MapRenderer::MapInfo map;
|
||||
|
||||
auto& vp = r->getRenderer()->getViewport();
|
||||
auto& vp = r.getRenderer().getViewport();
|
||||
|
||||
map.worldSize = 4000.f;
|
||||
map.clipToSize = false;
|
||||
|
@ -13,7 +13,7 @@ public:
|
||||
|
||||
void tick(float dt) override;
|
||||
|
||||
void draw(GameRenderer* r) override;
|
||||
void draw(GameRenderer &r) override;
|
||||
|
||||
void handleEvent(const SDL_Event& event) override;
|
||||
};
|
||||
|
@ -76,8 +76,8 @@ void ViewerWidget::drawModel(GameRenderer& r, ClumpPtr& model) {
|
||||
viewDistance,
|
||||
view, proj);
|
||||
|
||||
r.getRenderer()->useProgram(r.worldProg.get());
|
||||
r.getRenderer()->setSceneParameters(
|
||||
r.getRenderer().useProgram(r.worldProg.get());
|
||||
r.getRenderer().setSceneParameters(
|
||||
{proj, view, glm::vec4(0.15f), glm::vec4(0.7f), glm::vec4(1.f),
|
||||
glm::vec4(0.f), 90.f, vc.frustum.far});
|
||||
model->getFrame()->updateHierarchyTransform();
|
||||
@ -85,7 +85,7 @@ void ViewerWidget::drawModel(GameRenderer& r, ClumpPtr& model) {
|
||||
ObjectRenderer _renderer(world(), vc, 1.f);
|
||||
RenderList renders;
|
||||
_renderer.renderClump(model.get(), glm::mat4(1.0f), nullptr, renders);
|
||||
r.getRenderer()->drawBatched(renders);
|
||||
r.getRenderer().drawBatched(renders);
|
||||
|
||||
drawFrameWidget(model->getFrame().get());
|
||||
r.renderPostProcess();
|
||||
@ -98,8 +98,8 @@ void ViewerWidget::drawObject(GameRenderer &r, GameObject *object) {
|
||||
viewDistance,
|
||||
view, proj);
|
||||
|
||||
r.getRenderer()->useProgram(r.worldProg.get());
|
||||
r.getRenderer()->setSceneParameters(
|
||||
r.getRenderer().useProgram(r.worldProg.get());
|
||||
r.getRenderer().setSceneParameters(
|
||||
{proj, view, glm::vec4(0.15f), glm::vec4(0.7f), glm::vec4(1.f),
|
||||
glm::vec4(0.f), 90.f, vc.frustum.far});
|
||||
|
||||
@ -111,7 +111,7 @@ void ViewerWidget::drawObject(GameRenderer &r, GameObject *object) {
|
||||
const Renderer::RenderInstruction& b) {
|
||||
return a.sortKey < b.sortKey;
|
||||
});
|
||||
r.getRenderer()->drawBatched(renders);
|
||||
r.getRenderer().drawBatched(renders);
|
||||
r.renderPostProcess();
|
||||
}
|
||||
|
||||
@ -144,12 +144,12 @@ void ViewerWidget::paintGL() {
|
||||
|
||||
RW_CHECK(_renderer != nullptr, "GameRenderer is null");
|
||||
auto& r = *_renderer;
|
||||
r.getRenderer()->invalidate();
|
||||
r.getRenderer().invalidate();
|
||||
r.setViewport(width() * devicePixelRatio(), height() * devicePixelRatio());
|
||||
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
|
||||
r.getRenderer()->invalidate();
|
||||
r.getRenderer().invalidate();
|
||||
r.setupRender();
|
||||
|
||||
switch (_viewMode) {
|
||||
@ -187,7 +187,7 @@ void ViewerWidget::drawFrameWidget(ModelFrame* f, const glm::mat4& m) {
|
||||
|
||||
RW_CHECK(_renderer != nullptr, "GameRenderer is null");
|
||||
if(_renderer != nullptr) {
|
||||
_renderer->getRenderer()->drawArrays(thisM, _frameWidgetDraw, dp);
|
||||
_renderer->getRenderer().drawArrays(thisM, _frameWidgetDraw, dp);
|
||||
}
|
||||
|
||||
for (auto c : f->getChildren()) {
|
||||
|
Loading…
Reference in New Issue
Block a user