Rename RenderWindow to Window
This commit is contained in:
parent
fa94998898
commit
2e125d889c
16 changed files with 66 additions and 66 deletions
|
@ -304,7 +304,7 @@ void Console::drawBackground() {
|
||||||
transform = glm::scale(transform, glm::vec3(_opts.width, height, 1.0f));
|
transform = glm::scale(transform, glm::vec3(_opts.width, height, 1.0f));
|
||||||
|
|
||||||
ShaderUniforms uniforms;
|
ShaderUniforms uniforms;
|
||||||
uniforms.combined.general.projection = RenderWindow::instance().getOrthoProjection();
|
uniforms.combined.general.projection = Window::instance().getOrthoProjection();
|
||||||
uniforms.combined.general.model = move(transform);
|
uniforms.combined.general.model = move(transform);
|
||||||
uniforms.combined.general.color = glm::vec4(0.0f, 0.0f, 0.0f, 1.0f);
|
uniforms.combined.general.color = glm::vec4(0.0f, 0.0f, 0.0f, 1.0f);
|
||||||
uniforms.combined.general.alpha = 0.5f;
|
uniforms.combined.general.alpha = 0.5f;
|
||||||
|
|
|
@ -96,7 +96,7 @@ int Game::run() {
|
||||||
} else {
|
} else {
|
||||||
playVideo("legal");
|
playVideo("legal");
|
||||||
}
|
}
|
||||||
RenderWindow::instance().show();
|
Window::instance().show();
|
||||||
|
|
||||||
runMainLoop();
|
runMainLoop();
|
||||||
deinitSubsystems();
|
deinitSubsystems();
|
||||||
|
@ -108,7 +108,7 @@ void Game::initSubsystems() {
|
||||||
initResourceProviders();
|
initResourceProviders();
|
||||||
loadModuleNames();
|
loadModuleNames();
|
||||||
|
|
||||||
RenderWindow::instance().init(_options.graphics, this);
|
Window::instance().init(_options.graphics, this);
|
||||||
Strings::instance().init(_path);
|
Strings::instance().init(_path);
|
||||||
Meshes::instance().init();
|
Meshes::instance().init();
|
||||||
Textures::instance().init();
|
Textures::instance().init();
|
||||||
|
@ -155,9 +155,9 @@ void Game::loadModuleNames() {
|
||||||
void Game::setCursorType(CursorType type) {
|
void Game::setCursorType(CursorType type) {
|
||||||
if (_cursorType != type) {
|
if (_cursorType != type) {
|
||||||
if (type == CursorType::None) {
|
if (type == CursorType::None) {
|
||||||
RenderWindow::instance().setCursor(nullptr);
|
Window::instance().setCursor(nullptr);
|
||||||
} else {
|
} else {
|
||||||
RenderWindow::instance().setCursor(Cursors::instance().get(type));
|
Window::instance().setCursor(Cursors::instance().get(type));
|
||||||
}
|
}
|
||||||
_cursorType = type;
|
_cursorType = type;
|
||||||
}
|
}
|
||||||
|
@ -327,19 +327,19 @@ void Game::drawAll() {
|
||||||
// Compute derived PBR IBL textures from queued environment maps
|
// Compute derived PBR IBL textures from queued environment maps
|
||||||
PBRIBL::instance().refresh();
|
PBRIBL::instance().refresh();
|
||||||
|
|
||||||
RenderWindow::instance().clear();
|
Window::instance().clear();
|
||||||
|
|
||||||
if (_video) {
|
if (_video) {
|
||||||
_video->draw();
|
_video->draw();
|
||||||
} else {
|
} else {
|
||||||
drawWorld();
|
drawWorld();
|
||||||
drawGUI();
|
drawGUI();
|
||||||
RenderWindow::instance().drawCursor();
|
Window::instance().drawCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
_profileOverlay.draw();
|
_profileOverlay.draw();
|
||||||
|
|
||||||
RenderWindow::instance().swapBuffers();
|
Window::instance().swapBuffers();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Game::drawWorld() {
|
void Game::drawWorld() {
|
||||||
|
@ -502,7 +502,7 @@ void Game::runMainLoop() {
|
||||||
_ticks = SDL_GetTicks();
|
_ticks = SDL_GetTicks();
|
||||||
|
|
||||||
while (!_quit) {
|
while (!_quit) {
|
||||||
RenderWindow::instance().processEvents(_quit);
|
Window::instance().processEvents(_quit);
|
||||||
|
|
||||||
update();
|
update();
|
||||||
drawAll();
|
drawAll();
|
||||||
|
@ -592,7 +592,7 @@ void Game::loadCharacterGeneration() {
|
||||||
|
|
||||||
void Game::deinitSubsystems() {
|
void Game::deinitSubsystems() {
|
||||||
AudioPlayer::instance().deinit();
|
AudioPlayer::instance().deinit();
|
||||||
RenderWindow::instance().deinit();
|
Window::instance().deinit();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Game::startCharacterGeneration() {
|
void Game::startCharacterGeneration() {
|
||||||
|
@ -904,7 +904,7 @@ void Game::setPaused(bool paused) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Game::setRelativeMouseMode(bool relative) {
|
void Game::setRelativeMouseMode(bool relative) {
|
||||||
RenderWindow::instance().setRelativeMouseMode(relative);
|
Window::instance().setRelativeMouseMode(relative);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace game
|
} // namespace game
|
||||||
|
|
|
@ -245,7 +245,7 @@ void HUD::drawHealth(int memberIndex) {
|
||||||
transform = glm::scale(transform, glm::vec3(w, h, 1.0f));
|
transform = glm::scale(transform, glm::vec3(w, h, 1.0f));
|
||||||
|
|
||||||
ShaderUniforms uniforms;
|
ShaderUniforms uniforms;
|
||||||
uniforms.combined.general.projection = RenderWindow::instance().getOrthoProjection();
|
uniforms.combined.general.projection = Window::instance().getOrthoProjection();
|
||||||
uniforms.combined.general.model = move(transform);
|
uniforms.combined.general.model = move(transform);
|
||||||
uniforms.combined.general.color = glm::vec4(1.0f, 0.0f, 0.0f, 1.0f);
|
uniforms.combined.general.color = glm::vec4(1.0f, 0.0f, 0.0f, 1.0f);
|
||||||
|
|
||||||
|
|
|
@ -114,7 +114,7 @@ void ProfileOverlay::drawBackground() {
|
||||||
transform = glm::scale(transform, glm::vec3(kFrameWidth, 2.0f * _font->height(), 1.0f));
|
transform = glm::scale(transform, glm::vec3(kFrameWidth, 2.0f * _font->height(), 1.0f));
|
||||||
|
|
||||||
ShaderUniforms uniforms(Shaders::instance().defaultUniforms());
|
ShaderUniforms uniforms(Shaders::instance().defaultUniforms());
|
||||||
uniforms.combined.general.projection = RenderWindow::instance().getOrthoProjection();
|
uniforms.combined.general.projection = Window::instance().getOrthoProjection();
|
||||||
uniforms.combined.general.model = move(transform);
|
uniforms.combined.general.model = move(transform);
|
||||||
uniforms.combined.general.color = glm::vec4(0.0f, 0.0f, 0.0f, 1.0f);
|
uniforms.combined.general.color = glm::vec4(0.0f, 0.0f, 0.0f, 1.0f);
|
||||||
uniforms.combined.general.alpha = 0.5f;
|
uniforms.combined.general.alpha = 0.5f;
|
||||||
|
|
|
@ -210,7 +210,7 @@ void SelectionOverlay::drawReticle(Texture &texture, const glm::vec3 &screenCoor
|
||||||
transform = glm::scale(transform, glm::vec3(width, height, 1.0f));
|
transform = glm::scale(transform, glm::vec3(width, height, 1.0f));
|
||||||
|
|
||||||
ShaderUniforms uniforms;
|
ShaderUniforms uniforms;
|
||||||
uniforms.combined.general.projection = RenderWindow::instance().getOrthoProjection();
|
uniforms.combined.general.projection = Window::instance().getOrthoProjection();
|
||||||
uniforms.combined.general.model = move(transform);
|
uniforms.combined.general.model = move(transform);
|
||||||
|
|
||||||
Shaders::instance().activate(ShaderProgram::SimpleGUI, uniforms);
|
Shaders::instance().activate(ShaderProgram::SimpleGUI, uniforms);
|
||||||
|
@ -234,7 +234,7 @@ void SelectionOverlay::drawTitleBar() {
|
||||||
transform = glm::scale(transform, glm::vec3(kTitleBarWidth, barHeight, 1.0f));
|
transform = glm::scale(transform, glm::vec3(kTitleBarWidth, barHeight, 1.0f));
|
||||||
|
|
||||||
ShaderUniforms uniforms;
|
ShaderUniforms uniforms;
|
||||||
uniforms.combined.general.projection = RenderWindow::instance().getOrthoProjection();
|
uniforms.combined.general.projection = Window::instance().getOrthoProjection();
|
||||||
uniforms.combined.general.model = move(transform);
|
uniforms.combined.general.model = move(transform);
|
||||||
uniforms.combined.general.color = glm::vec4(0.0f, 0.0f, 0.0f, 1.0f);
|
uniforms.combined.general.color = glm::vec4(0.0f, 0.0f, 0.0f, 1.0f);
|
||||||
uniforms.combined.general.alpha = 0.5f;
|
uniforms.combined.general.alpha = 0.5f;
|
||||||
|
@ -267,7 +267,7 @@ void SelectionOverlay::drawHealthBar() {
|
||||||
transform = glm::scale(transform, glm::vec3(w, kHealthBarHeight, 1.0f));
|
transform = glm::scale(transform, glm::vec3(w, kHealthBarHeight, 1.0f));
|
||||||
|
|
||||||
ShaderUniforms uniforms;
|
ShaderUniforms uniforms;
|
||||||
uniforms.combined.general.projection = RenderWindow::instance().getOrthoProjection();
|
uniforms.combined.general.projection = Window::instance().getOrthoProjection();
|
||||||
uniforms.combined.general.model = move(transform);
|
uniforms.combined.general.model = move(transform);
|
||||||
uniforms.combined.general.color = glm::vec4(getColorFromSelectedObject(), 1.0f);
|
uniforms.combined.general.color = glm::vec4(getColorFromSelectedObject(), 1.0f);
|
||||||
|
|
||||||
|
@ -298,7 +298,7 @@ void SelectionOverlay::drawActionBar() {
|
||||||
transform = glm::scale(transform, glm::vec3(kActionWidth, kActionHeight, 1.0f));
|
transform = glm::scale(transform, glm::vec3(kActionWidth, kActionHeight, 1.0f));
|
||||||
|
|
||||||
ShaderUniforms uniforms;
|
ShaderUniforms uniforms;
|
||||||
uniforms.combined.general.projection = RenderWindow::instance().getOrthoProjection();
|
uniforms.combined.general.projection = Window::instance().getOrthoProjection();
|
||||||
uniforms.combined.general.model = move(transform);
|
uniforms.combined.general.model = move(transform);
|
||||||
|
|
||||||
Shaders::instance().activate(ShaderProgram::SimpleGUI, uniforms);
|
Shaders::instance().activate(ShaderProgram::SimpleGUI, uniforms);
|
||||||
|
@ -319,7 +319,7 @@ void SelectionOverlay::drawActionBar() {
|
||||||
transform = glm::scale(transform, glm::vec3(kActionWidth, kActionWidth, 1.0f));
|
transform = glm::scale(transform, glm::vec3(kActionWidth, kActionWidth, 1.0f));
|
||||||
|
|
||||||
ShaderUniforms uniforms;
|
ShaderUniforms uniforms;
|
||||||
uniforms.combined.general.projection = RenderWindow::instance().getOrthoProjection();
|
uniforms.combined.general.projection = Window::instance().getOrthoProjection();
|
||||||
uniforms.combined.general.model = move(transform);
|
uniforms.combined.general.model = move(transform);
|
||||||
|
|
||||||
Shaders::instance().activate(ShaderProgram::SimpleGUI, uniforms);
|
Shaders::instance().activate(ShaderProgram::SimpleGUI, uniforms);
|
||||||
|
|
|
@ -114,7 +114,7 @@ void Map::drawArea(Mode mode, const glm::vec4 &bounds) {
|
||||||
transform = glm::scale(transform, glm::vec3(_areaTexture->width(), _areaTexture->height(), 1.0f));
|
transform = glm::scale(transform, glm::vec3(_areaTexture->width(), _areaTexture->height(), 1.0f));
|
||||||
|
|
||||||
ShaderUniforms uniforms;
|
ShaderUniforms uniforms;
|
||||||
uniforms.combined.general.projection = RenderWindow::instance().getOrthoProjection();
|
uniforms.combined.general.projection = Window::instance().getOrthoProjection();
|
||||||
uniforms.combined.general.model = transform;
|
uniforms.combined.general.model = transform;
|
||||||
Shaders::instance().activate(ShaderProgram::SimpleGUI, uniforms);
|
Shaders::instance().activate(ShaderProgram::SimpleGUI, uniforms);
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ void Map::drawArea(Mode mode, const glm::vec4 &bounds) {
|
||||||
transform = glm::scale(transform, glm::vec3(bounds[2], bounds[3], 1.0f));
|
transform = glm::scale(transform, glm::vec3(bounds[2], bounds[3], 1.0f));
|
||||||
|
|
||||||
ShaderUniforms uniforms;
|
ShaderUniforms uniforms;
|
||||||
uniforms.combined.general.projection = RenderWindow::instance().getOrthoProjection();
|
uniforms.combined.general.projection = Window::instance().getOrthoProjection();
|
||||||
uniforms.combined.general.model = move(transform);
|
uniforms.combined.general.model = move(transform);
|
||||||
|
|
||||||
Shaders::instance().activate(ShaderProgram::SimpleGUI, uniforms);
|
Shaders::instance().activate(ShaderProgram::SimpleGUI, uniforms);
|
||||||
|
@ -165,7 +165,7 @@ void Map::drawNotes(Mode mode, const glm::vec4 &bounds) {
|
||||||
transform = glm::scale(transform, glm::vec3(noteSize, noteSize, 1.0f));
|
transform = glm::scale(transform, glm::vec3(noteSize, noteSize, 1.0f));
|
||||||
|
|
||||||
ShaderUniforms uniforms;
|
ShaderUniforms uniforms;
|
||||||
uniforms.combined.general.projection = RenderWindow::instance().getOrthoProjection();
|
uniforms.combined.general.projection = Window::instance().getOrthoProjection();
|
||||||
uniforms.combined.general.model = transform;
|
uniforms.combined.general.model = transform;
|
||||||
uniforms.combined.general.color = glm::vec4(selected ? getHilightColor(_game->gameId()) : getBaseColor(_game->gameId()), 1.0f);
|
uniforms.combined.general.color = glm::vec4(selected ? getHilightColor(_game->gameId()) : getBaseColor(_game->gameId()), 1.0f);
|
||||||
|
|
||||||
|
@ -247,7 +247,7 @@ void Map::drawPartyLeader(Mode mode, const glm::vec4 &bounds) {
|
||||||
transform = glm::scale(transform, glm::vec3(kArrowSize, kArrowSize, 1.0f));
|
transform = glm::scale(transform, glm::vec3(kArrowSize, kArrowSize, 1.0f));
|
||||||
|
|
||||||
ShaderUniforms uniforms;
|
ShaderUniforms uniforms;
|
||||||
uniforms.combined.general.projection = RenderWindow::instance().getOrthoProjection();
|
uniforms.combined.general.projection = Window::instance().getOrthoProjection();
|
||||||
uniforms.combined.general.model = move(transform);
|
uniforms.combined.general.model = move(transform);
|
||||||
|
|
||||||
Shaders::instance().activate(ShaderProgram::SimpleGUI, uniforms);
|
Shaders::instance().activate(ShaderProgram::SimpleGUI, uniforms);
|
||||||
|
|
|
@ -259,7 +259,7 @@ void Control::drawBorder(const Border &border, const glm::ivec2 &offset, const g
|
||||||
|
|
||||||
ShaderUniforms uniforms;
|
ShaderUniforms uniforms;
|
||||||
uniforms.combined.featureMask |= _discardEnabled ? UniformFeatureFlags::discard : 0;
|
uniforms.combined.featureMask |= _discardEnabled ? UniformFeatureFlags::discard : 0;
|
||||||
uniforms.combined.general.projection = RenderWindow::instance().getOrthoProjection();
|
uniforms.combined.general.projection = Window::instance().getOrthoProjection();
|
||||||
uniforms.combined.general.model = move(transform);
|
uniforms.combined.general.model = move(transform);
|
||||||
uniforms.combined.general.discardColor = glm::vec4(_discardColor, 1.0f);
|
uniforms.combined.general.discardColor = glm::vec4(_discardColor, 1.0f);
|
||||||
Shaders::instance().activate(ShaderProgram::SimpleGUI, uniforms);
|
Shaders::instance().activate(ShaderProgram::SimpleGUI, uniforms);
|
||||||
|
@ -297,7 +297,7 @@ void Control::drawBorder(const Border &border, const glm::ivec2 &offset, const g
|
||||||
transform = glm::rotate(transform, glm::pi<float>(), glm::vec3(1.0f, 0.0f, 0.0f));
|
transform = glm::rotate(transform, glm::pi<float>(), glm::vec3(1.0f, 0.0f, 0.0f));
|
||||||
|
|
||||||
ShaderUniforms uniforms;
|
ShaderUniforms uniforms;
|
||||||
uniforms.combined.general.projection = RenderWindow::instance().getOrthoProjection();
|
uniforms.combined.general.projection = Window::instance().getOrthoProjection();
|
||||||
uniforms.combined.general.model = move(transform);
|
uniforms.combined.general.model = move(transform);
|
||||||
uniforms.combined.general.color = glm::vec4(color, 1.0f);
|
uniforms.combined.general.color = glm::vec4(color, 1.0f);
|
||||||
|
|
||||||
|
@ -313,7 +313,7 @@ void Control::drawBorder(const Border &border, const glm::ivec2 &offset, const g
|
||||||
transform = glm::rotate(transform, glm::half_pi<float>(), glm::vec3(0.0f, 0.0f, 1.0f));
|
transform = glm::rotate(transform, glm::half_pi<float>(), glm::vec3(0.0f, 0.0f, 1.0f));
|
||||||
|
|
||||||
ShaderUniforms uniforms;
|
ShaderUniforms uniforms;
|
||||||
uniforms.combined.general.projection = RenderWindow::instance().getOrthoProjection();
|
uniforms.combined.general.projection = Window::instance().getOrthoProjection();
|
||||||
uniforms.combined.general.model = move(transform);
|
uniforms.combined.general.model = move(transform);
|
||||||
uniforms.combined.general.color = glm::vec4(color, 1.0f);
|
uniforms.combined.general.color = glm::vec4(color, 1.0f);
|
||||||
|
|
||||||
|
@ -333,7 +333,7 @@ void Control::drawBorder(const Border &border, const glm::ivec2 &offset, const g
|
||||||
transform = glm::scale(transform, glm::vec3(width, border.dimension, 1.0f));
|
transform = glm::scale(transform, glm::vec3(width, border.dimension, 1.0f));
|
||||||
|
|
||||||
ShaderUniforms uniforms;
|
ShaderUniforms uniforms;
|
||||||
uniforms.combined.general.projection = RenderWindow::instance().getOrthoProjection();
|
uniforms.combined.general.projection = Window::instance().getOrthoProjection();
|
||||||
uniforms.combined.general.model = move(transform);
|
uniforms.combined.general.model = move(transform);
|
||||||
uniforms.combined.general.color = glm::vec4(color, 1.0f);
|
uniforms.combined.general.color = glm::vec4(color, 1.0f);
|
||||||
|
|
||||||
|
@ -348,7 +348,7 @@ void Control::drawBorder(const Border &border, const glm::ivec2 &offset, const g
|
||||||
transform = glm::scale(transform, glm::vec3(width, border.dimension, 1.0f));
|
transform = glm::scale(transform, glm::vec3(width, border.dimension, 1.0f));
|
||||||
|
|
||||||
ShaderUniforms uniforms;
|
ShaderUniforms uniforms;
|
||||||
uniforms.combined.general.projection = RenderWindow::instance().getOrthoProjection();
|
uniforms.combined.general.projection = Window::instance().getOrthoProjection();
|
||||||
uniforms.combined.general.model = move(transform);
|
uniforms.combined.general.model = move(transform);
|
||||||
uniforms.combined.general.color = glm::vec4(color, 1.0f);
|
uniforms.combined.general.color = glm::vec4(color, 1.0f);
|
||||||
|
|
||||||
|
@ -371,7 +371,7 @@ void Control::drawBorder(const Border &border, const glm::ivec2 &offset, const g
|
||||||
transform = glm::scale(transform, glm::vec3(border.dimension, border.dimension, 1.0f));
|
transform = glm::scale(transform, glm::vec3(border.dimension, border.dimension, 1.0f));
|
||||||
|
|
||||||
ShaderUniforms uniforms;
|
ShaderUniforms uniforms;
|
||||||
uniforms.combined.general.projection = RenderWindow::instance().getOrthoProjection();
|
uniforms.combined.general.projection = Window::instance().getOrthoProjection();
|
||||||
uniforms.combined.general.model = move(transform);
|
uniforms.combined.general.model = move(transform);
|
||||||
uniforms.combined.general.color = glm::vec4(color, 1.0f);
|
uniforms.combined.general.color = glm::vec4(color, 1.0f);
|
||||||
|
|
||||||
|
@ -386,7 +386,7 @@ void Control::drawBorder(const Border &border, const glm::ivec2 &offset, const g
|
||||||
transform = glm::scale(transform, glm::vec3(border.dimension, border.dimension, 1.0f));
|
transform = glm::scale(transform, glm::vec3(border.dimension, border.dimension, 1.0f));
|
||||||
|
|
||||||
ShaderUniforms uniforms;
|
ShaderUniforms uniforms;
|
||||||
uniforms.combined.general.projection = RenderWindow::instance().getOrthoProjection();
|
uniforms.combined.general.projection = Window::instance().getOrthoProjection();
|
||||||
uniforms.combined.general.model = move(transform);
|
uniforms.combined.general.model = move(transform);
|
||||||
uniforms.combined.general.color = glm::vec4(color, 1.0f);
|
uniforms.combined.general.color = glm::vec4(color, 1.0f);
|
||||||
|
|
||||||
|
@ -401,7 +401,7 @@ void Control::drawBorder(const Border &border, const glm::ivec2 &offset, const g
|
||||||
transform = glm::scale(transform, glm::vec3(border.dimension, border.dimension, 1.0f));
|
transform = glm::scale(transform, glm::vec3(border.dimension, border.dimension, 1.0f));
|
||||||
|
|
||||||
ShaderUniforms uniforms;
|
ShaderUniforms uniforms;
|
||||||
uniforms.combined.general.projection = RenderWindow::instance().getOrthoProjection();
|
uniforms.combined.general.projection = Window::instance().getOrthoProjection();
|
||||||
uniforms.combined.general.model = move(transform);
|
uniforms.combined.general.model = move(transform);
|
||||||
uniforms.combined.general.color = glm::vec4(color, 1.0f);
|
uniforms.combined.general.color = glm::vec4(color, 1.0f);
|
||||||
|
|
||||||
|
@ -416,7 +416,7 @@ void Control::drawBorder(const Border &border, const glm::ivec2 &offset, const g
|
||||||
transform = glm::scale(transform, glm::vec3(border.dimension, border.dimension, 1.0f));
|
transform = glm::scale(transform, glm::vec3(border.dimension, border.dimension, 1.0f));
|
||||||
|
|
||||||
ShaderUniforms uniforms;
|
ShaderUniforms uniforms;
|
||||||
uniforms.combined.general.projection = RenderWindow::instance().getOrthoProjection();
|
uniforms.combined.general.projection = Window::instance().getOrthoProjection();
|
||||||
uniforms.combined.general.model = move(transform);
|
uniforms.combined.general.model = move(transform);
|
||||||
uniforms.combined.general.color = glm::vec4(color, 1.0f);
|
uniforms.combined.general.color = glm::vec4(color, 1.0f);
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@ void ImageButton::drawIcon(
|
||||||
transform = glm::scale(transform, glm::vec3(_extent.height, _extent.height, 1.0f));
|
transform = glm::scale(transform, glm::vec3(_extent.height, _extent.height, 1.0f));
|
||||||
|
|
||||||
ShaderUniforms uniforms;
|
ShaderUniforms uniforms;
|
||||||
uniforms.combined.general.projection = RenderWindow::instance().getOrthoProjection();
|
uniforms.combined.general.projection = Window::instance().getOrthoProjection();
|
||||||
uniforms.combined.general.model = move(transform);
|
uniforms.combined.general.model = move(transform);
|
||||||
uniforms.combined.general.color = glm::vec4(color, 1.0f);
|
uniforms.combined.general.color = glm::vec4(color, 1.0f);
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ void ImageButton::drawIcon(
|
||||||
transform = glm::scale(transform, glm::vec3(_extent.height, _extent.height, 1.0f));
|
transform = glm::scale(transform, glm::vec3(_extent.height, _extent.height, 1.0f));
|
||||||
|
|
||||||
ShaderUniforms uniforms;
|
ShaderUniforms uniforms;
|
||||||
uniforms.combined.general.projection = RenderWindow::instance().getOrthoProjection();
|
uniforms.combined.general.projection = Window::instance().getOrthoProjection();
|
||||||
uniforms.combined.general.model = move(transform);
|
uniforms.combined.general.model = move(transform);
|
||||||
uniforms.combined.general.color = glm::vec4(1.0f);
|
uniforms.combined.general.color = glm::vec4(1.0f);
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ void ProgressBar::draw(const glm::ivec2 &offset, const vector<string> &text) {
|
||||||
transform = glm::scale(transform, glm::vec3(w, _extent.height, 1.0f));
|
transform = glm::scale(transform, glm::vec3(w, _extent.height, 1.0f));
|
||||||
|
|
||||||
ShaderUniforms uniforms;
|
ShaderUniforms uniforms;
|
||||||
uniforms.combined.general.projection = RenderWindow::instance().getOrthoProjection();
|
uniforms.combined.general.projection = Window::instance().getOrthoProjection();
|
||||||
uniforms.combined.general.model = move(transform);
|
uniforms.combined.general.model = move(transform);
|
||||||
|
|
||||||
Shaders::instance().activate(ShaderProgram::SimpleGUI, uniforms);
|
Shaders::instance().activate(ShaderProgram::SimpleGUI, uniforms);
|
||||||
|
|
|
@ -64,7 +64,7 @@ void ScrollBar::drawThumb(const glm::ivec2 &offset) {
|
||||||
_thumb.image->bind();
|
_thumb.image->bind();
|
||||||
|
|
||||||
ShaderUniforms uniforms;
|
ShaderUniforms uniforms;
|
||||||
uniforms.combined.general.projection = RenderWindow::instance().getOrthoProjection();
|
uniforms.combined.general.projection = Window::instance().getOrthoProjection();
|
||||||
|
|
||||||
// Top edge
|
// Top edge
|
||||||
uniforms.combined.general.model = glm::translate(glm::mat4(1.0f), glm::vec3(_extent.left + offset.x, _extent.top + _extent.width + offset.y, 0.0f));
|
uniforms.combined.general.model = glm::translate(glm::mat4(1.0f), glm::vec3(_extent.left + offset.x, _extent.top + _extent.width + offset.y, 0.0f));
|
||||||
|
@ -124,7 +124,7 @@ void ScrollBar::drawUpArrow(const glm::ivec2 &offset) {
|
||||||
transform = glm::scale(transform, glm::vec3(_extent.width, _extent.width, 1.0f));
|
transform = glm::scale(transform, glm::vec3(_extent.width, _extent.width, 1.0f));
|
||||||
|
|
||||||
ShaderUniforms uniforms;
|
ShaderUniforms uniforms;
|
||||||
uniforms.combined.general.projection = RenderWindow::instance().getOrthoProjection();
|
uniforms.combined.general.projection = Window::instance().getOrthoProjection();
|
||||||
uniforms.combined.general.model = move(transform);
|
uniforms.combined.general.model = move(transform);
|
||||||
|
|
||||||
Shaders::instance().activate(ShaderProgram::SimpleGUI, uniforms);
|
Shaders::instance().activate(ShaderProgram::SimpleGUI, uniforms);
|
||||||
|
@ -138,7 +138,7 @@ void ScrollBar::drawDownArrow(const glm::ivec2 &offset) {
|
||||||
transform = glm::rotate(transform, glm::pi<float>(), glm::vec3(1.0f, 0.0f, 0.0f));
|
transform = glm::rotate(transform, glm::pi<float>(), glm::vec3(1.0f, 0.0f, 0.0f));
|
||||||
|
|
||||||
ShaderUniforms uniforms;
|
ShaderUniforms uniforms;
|
||||||
uniforms.combined.general.projection = RenderWindow::instance().getOrthoProjection();
|
uniforms.combined.general.projection = Window::instance().getOrthoProjection();
|
||||||
uniforms.combined.general.model = move(transform);
|
uniforms.combined.general.model = move(transform);
|
||||||
|
|
||||||
Shaders::instance().activate(ShaderProgram::SimpleGUI, uniforms);
|
Shaders::instance().activate(ShaderProgram::SimpleGUI, uniforms);
|
||||||
|
|
|
@ -258,7 +258,7 @@ void GUI::drawBackground() {
|
||||||
transform = glm::scale(transform, glm::vec3(_gfxOpts.width, _gfxOpts.height, 1.0f));
|
transform = glm::scale(transform, glm::vec3(_gfxOpts.width, _gfxOpts.height, 1.0f));
|
||||||
|
|
||||||
ShaderUniforms uniforms;
|
ShaderUniforms uniforms;
|
||||||
uniforms.combined.general.projection = RenderWindow::instance().getOrthoProjection();
|
uniforms.combined.general.projection = Window::instance().getOrthoProjection();
|
||||||
uniforms.combined.general.model = move(transform);
|
uniforms.combined.general.model = move(transform);
|
||||||
|
|
||||||
Shaders::instance().activate(ShaderProgram::SimpleGUI, uniforms);
|
Shaders::instance().activate(ShaderProgram::SimpleGUI, uniforms);
|
||||||
|
|
|
@ -53,7 +53,7 @@ void Cursor::draw() {
|
||||||
transform = glm::scale(transform, glm::vec3(texture->width(), texture->height(), 1.0f));
|
transform = glm::scale(transform, glm::vec3(texture->width(), texture->height(), 1.0f));
|
||||||
|
|
||||||
ShaderUniforms uniforms;
|
ShaderUniforms uniforms;
|
||||||
uniforms.combined.general.projection = RenderWindow::instance().getOrthoProjection();
|
uniforms.combined.general.projection = Window::instance().getOrthoProjection();
|
||||||
uniforms.combined.general.model = move(transform);
|
uniforms.combined.general.model = move(transform);
|
||||||
|
|
||||||
Shaders::instance().activate(ShaderProgram::SimpleGUI, uniforms);
|
Shaders::instance().activate(ShaderProgram::SimpleGUI, uniforms);
|
||||||
|
|
|
@ -72,7 +72,7 @@ void Font::draw(const string &text, const glm::vec3 &position, const glm::vec3 &
|
||||||
|
|
||||||
ShaderUniforms uniforms(Shaders::instance().defaultUniforms());
|
ShaderUniforms uniforms(Shaders::instance().defaultUniforms());
|
||||||
uniforms.combined.featureMask |= UniformFeatureFlags::text;
|
uniforms.combined.featureMask |= UniformFeatureFlags::text;
|
||||||
uniforms.combined.general.projection = RenderWindow::instance().getOrthoProjection();
|
uniforms.combined.general.projection = Window::instance().getOrthoProjection();
|
||||||
uniforms.combined.general.color = glm::vec4(color, 1.0f);
|
uniforms.combined.general.color = glm::vec4(color, 1.0f);
|
||||||
|
|
||||||
int numBlocks = static_cast<int>(text.size()) / kMaxCharacters;
|
int numBlocks = static_cast<int>(text.size()) / kMaxCharacters;
|
||||||
|
|
|
@ -34,12 +34,12 @@ namespace reone {
|
||||||
|
|
||||||
namespace render {
|
namespace render {
|
||||||
|
|
||||||
RenderWindow &RenderWindow::instance() {
|
Window &Window::instance() {
|
||||||
static RenderWindow instance;
|
static Window instance;
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderWindow::init(GraphicsOptions options, IEventHandler *eventHandler) {
|
void Window::init(GraphicsOptions options, IEventHandler *eventHandler) {
|
||||||
if (!eventHandler) {
|
if (!eventHandler) {
|
||||||
throw invalid_argument("eventHandler must not be null");
|
throw invalid_argument("eventHandler must not be null");
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ void RenderWindow::init(GraphicsOptions options, IEventHandler *eventHandler) {
|
||||||
_inited = true;
|
_inited = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderWindow::initSDL() {
|
void Window::initSDL() {
|
||||||
SDL_Init(SDL_INIT_VIDEO);
|
SDL_Init(SDL_INIT_VIDEO);
|
||||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
|
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
|
||||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 3);
|
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 3);
|
||||||
|
@ -82,7 +82,7 @@ void RenderWindow::initSDL() {
|
||||||
SDL_GL_SetSwapInterval(0);
|
SDL_GL_SetSwapInterval(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int RenderWindow::getWindowFlags() const {
|
int Window::getWindowFlags() const {
|
||||||
int flags = SDL_WINDOW_OPENGL | SDL_WINDOW_HIDDEN;
|
int flags = SDL_WINDOW_OPENGL | SDL_WINDOW_HIDDEN;
|
||||||
if (_options.fullscreen) {
|
if (_options.fullscreen) {
|
||||||
flags |= SDL_WINDOW_FULLSCREEN;
|
flags |= SDL_WINDOW_FULLSCREEN;
|
||||||
|
@ -90,7 +90,7 @@ int RenderWindow::getWindowFlags() const {
|
||||||
return flags;
|
return flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderWindow::initGL() {
|
void Window::initGL() {
|
||||||
glewInit();
|
glewInit();
|
||||||
|
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
|
@ -99,11 +99,11 @@ void RenderWindow::initGL() {
|
||||||
glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS);
|
glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderWindow::~RenderWindow() {
|
Window::~Window() {
|
||||||
deinit();
|
deinit();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderWindow::deinit() {
|
void Window::deinit() {
|
||||||
if (_inited) {
|
if (_inited) {
|
||||||
SDL_GL_DeleteContext(_context);
|
SDL_GL_DeleteContext(_context);
|
||||||
SDL_DestroyWindow(_window);
|
SDL_DestroyWindow(_window);
|
||||||
|
@ -112,11 +112,11 @@ void RenderWindow::deinit() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderWindow::show() {
|
void Window::show() {
|
||||||
SDL_ShowWindow(_window);
|
SDL_ShowWindow(_window);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderWindow::processEvents(bool &quit) {
|
void Window::processEvents(bool &quit) {
|
||||||
if (!_inited) return;
|
if (!_inited) return;
|
||||||
|
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
|
@ -127,7 +127,7 @@ void RenderWindow::processEvents(bool &quit) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RenderWindow::handleEvent(const SDL_Event &event, bool &quit) {
|
bool Window::handleEvent(const SDL_Event &event, bool &quit) {
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
case SDL_QUIT:
|
case SDL_QUIT:
|
||||||
quit = true;
|
quit = true;
|
||||||
|
@ -141,7 +141,7 @@ bool RenderWindow::handleEvent(const SDL_Event &event, bool &quit) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RenderWindow::handleKeyDownEvent(const SDL_KeyboardEvent &event, bool &quit) {
|
bool Window::handleKeyDownEvent(const SDL_KeyboardEvent &event, bool &quit) {
|
||||||
switch (event.keysym.scancode) {
|
switch (event.keysym.scancode) {
|
||||||
case SDL_SCANCODE_C:
|
case SDL_SCANCODE_C:
|
||||||
if (event.keysym.mod & KMOD_CTRL) {
|
if (event.keysym.mod & KMOD_CTRL) {
|
||||||
|
@ -155,11 +155,11 @@ bool RenderWindow::handleKeyDownEvent(const SDL_KeyboardEvent &event, bool &quit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderWindow::clear() const {
|
void Window::clear() const {
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderWindow::drawCursor() const {
|
void Window::drawCursor() const {
|
||||||
if (_relativeMouseMode) return;
|
if (_relativeMouseMode) return;
|
||||||
|
|
||||||
int x, y;
|
int x, y;
|
||||||
|
@ -171,22 +171,22 @@ void RenderWindow::drawCursor() const {
|
||||||
_cursor->draw();
|
_cursor->draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderWindow::swapBuffers() const {
|
void Window::swapBuffers() const {
|
||||||
if (_inited) {
|
if (_inited) {
|
||||||
SDL_GL_SwapWindow(_window);
|
SDL_GL_SwapWindow(_window);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::mat4 RenderWindow::getOrthoProjection(float near, float far) const {
|
glm::mat4 Window::getOrthoProjection(float near, float far) const {
|
||||||
return glm::ortho(0.0f, static_cast<float>(_options.width), static_cast<float>(_options.height), 0.0f, near, far);
|
return glm::ortho(0.0f, static_cast<float>(_options.width), static_cast<float>(_options.height), 0.0f, near, far);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderWindow::setRelativeMouseMode(bool enabled) {
|
void Window::setRelativeMouseMode(bool enabled) {
|
||||||
SDL_SetRelativeMouseMode(enabled ? SDL_TRUE : SDL_FALSE);
|
SDL_SetRelativeMouseMode(enabled ? SDL_TRUE : SDL_FALSE);
|
||||||
_relativeMouseMode = enabled;
|
_relativeMouseMode = enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderWindow::setCursor(const shared_ptr<Cursor> &cursor) {
|
void Window::setCursor(const shared_ptr<Cursor> &cursor) {
|
||||||
_cursor = cursor;
|
_cursor = cursor;
|
||||||
SDL_ShowCursor(!static_cast<bool>(cursor));
|
SDL_ShowCursor(!static_cast<bool>(cursor));
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,11 +32,11 @@ namespace reone {
|
||||||
|
|
||||||
namespace render {
|
namespace render {
|
||||||
|
|
||||||
class RenderWindow : boost::noncopyable {
|
class Window : boost::noncopyable {
|
||||||
public:
|
public:
|
||||||
static RenderWindow &instance();
|
static Window &instance();
|
||||||
|
|
||||||
~RenderWindow();
|
~Window();
|
||||||
|
|
||||||
void init(GraphicsOptions options, IEventHandler *eventHandler = nullptr);
|
void init(GraphicsOptions options, IEventHandler *eventHandler = nullptr);
|
||||||
void deinit();
|
void deinit();
|
||||||
|
@ -62,7 +62,7 @@ private:
|
||||||
bool _relativeMouseMode { false };
|
bool _relativeMouseMode { false };
|
||||||
std::shared_ptr<Cursor> _cursor;
|
std::shared_ptr<Cursor> _cursor;
|
||||||
|
|
||||||
RenderWindow() = default;
|
Window() = default;
|
||||||
|
|
||||||
void initSDL();
|
void initSDL();
|
||||||
void initGL();
|
void initGL();
|
||||||
|
|
|
@ -232,7 +232,7 @@ void WorldRenderPipeline::applyHorizontalBlur() {
|
||||||
|
|
||||||
ShaderUniforms uniforms;
|
ShaderUniforms uniforms;
|
||||||
uniforms.combined.featureMask |= UniformFeatureFlags::blur;
|
uniforms.combined.featureMask |= UniformFeatureFlags::blur;
|
||||||
uniforms.combined.general.projection = RenderWindow::instance().getOrthoProjection();
|
uniforms.combined.general.projection = Window::instance().getOrthoProjection();
|
||||||
uniforms.combined.general.model = move(transform);
|
uniforms.combined.general.model = move(transform);
|
||||||
uniforms.combined.blur.resolution = glm::vec2(w, h);
|
uniforms.combined.blur.resolution = glm::vec2(w, h);
|
||||||
uniforms.combined.blur.direction = glm::vec2(1.0f, 0.0f);
|
uniforms.combined.blur.direction = glm::vec2(1.0f, 0.0f);
|
||||||
|
@ -260,7 +260,7 @@ void WorldRenderPipeline::applyVerticalBlur() {
|
||||||
|
|
||||||
ShaderUniforms uniforms;
|
ShaderUniforms uniforms;
|
||||||
uniforms.combined.featureMask |= UniformFeatureFlags::blur;
|
uniforms.combined.featureMask |= UniformFeatureFlags::blur;
|
||||||
uniforms.combined.general.projection = RenderWindow::instance().getOrthoProjection();
|
uniforms.combined.general.projection = Window::instance().getOrthoProjection();
|
||||||
uniforms.combined.general.model = move(transform);
|
uniforms.combined.general.model = move(transform);
|
||||||
uniforms.combined.blur.resolution = glm::vec2(_opts.width, _opts.height);
|
uniforms.combined.blur.resolution = glm::vec2(_opts.width, _opts.height);
|
||||||
uniforms.combined.blur.direction = glm::vec2(0.0f, 1.0f);
|
uniforms.combined.blur.direction = glm::vec2(0.0f, 1.0f);
|
||||||
|
@ -293,7 +293,7 @@ void WorldRenderPipeline::drawResult() {
|
||||||
//_shadowsDepth->bind();
|
//_shadowsDepth->bind();
|
||||||
|
|
||||||
ShaderUniforms uniforms;
|
ShaderUniforms uniforms;
|
||||||
uniforms.combined.general.projection = RenderWindow::instance().getOrthoProjection();
|
uniforms.combined.general.projection = Window::instance().getOrthoProjection();
|
||||||
uniforms.combined.general.model = move(transform);
|
uniforms.combined.general.model = move(transform);
|
||||||
|
|
||||||
Shaders::instance().activate(ShaderProgram::SimpleDebugCubeMap, uniforms);
|
Shaders::instance().activate(ShaderProgram::SimpleDebugCubeMap, uniforms);
|
||||||
|
@ -307,7 +307,7 @@ void WorldRenderPipeline::drawResult() {
|
||||||
_verticalBlurColor->bind();
|
_verticalBlurColor->bind();
|
||||||
|
|
||||||
ShaderUniforms uniforms;
|
ShaderUniforms uniforms;
|
||||||
uniforms.combined.general.projection = RenderWindow::instance().getOrthoProjection();
|
uniforms.combined.general.projection = Window::instance().getOrthoProjection();
|
||||||
uniforms.combined.general.model = move(transform);
|
uniforms.combined.general.model = move(transform);
|
||||||
|
|
||||||
Shaders::instance().activate(ShaderProgram::SimplePresentWorld, uniforms);
|
Shaders::instance().activate(ShaderProgram::SimplePresentWorld, uniforms);
|
||||||
|
|
Loading…
Reference in a new issue