Added clickable buttons; Custom button textures can be specified; Added default cubemap
This commit is contained in:
1 parent
cd41123beb
commit
805a1cef1f
41 files changed
+409
-104
No files matched your search
@@ -76,7 +76,7 @@ namespace nf {
|
||||
|
||||
switch (m_type) {
|
||||
case Type::UI: {
|
||||
view = glm::mat4(1.0);
|
||||
|
||||
break;
|
||||
}
|
||||
case Type::FIRST_PERSON: {
|
||||
@@ -91,15 +91,6 @@ namespace nf {
|
||||
m_pitch = 89.0f;
|
||||
if (m_pitch < -89.0f)
|
||||
m_pitch = -89.0f;
|
||||
glm::vec3 rotation;
|
||||
rotation.x = std::cos(glm::radians(m_yaw)) * std::cos(glm::radians(m_pitch));
|
||||
rotation.y = std::sin(glm::radians(m_pitch));
|
||||
rotation.z = std::sin(glm::radians(m_yaw)) * std::cos(glm::radians(m_pitch));
|
||||
rotation = glm::normalize(rotation);
|
||||
m_front = { rotation.x, rotation.y, rotation.z };
|
||||
glm::vec3 position(m_position.x, m_position.y, m_position.z);
|
||||
glm::vec3 up(0.0, 1.0, 0.0);
|
||||
view = glm::lookAt(position, position + rotation, up);
|
||||
break;
|
||||
}
|
||||
case Type::ORBIT: {
|
||||
@@ -113,6 +104,16 @@ namespace nf {
|
||||
}
|
||||
glm::vec3 pos(m_position.x, m_position.y, m_position.z);
|
||||
entityShader->setUniform("camera.pos", pos);
|
||||
|
||||
glm::vec3 rotation;
|
||||
rotation.x = std::cos(glm::radians(m_yaw)) * std::cos(glm::radians(m_pitch));
|
||||
rotation.y = std::sin(glm::radians(m_pitch));
|
||||
rotation.z = std::sin(glm::radians(m_yaw)) * std::cos(glm::radians(m_pitch));
|
||||
rotation = glm::normalize(rotation);
|
||||
m_front = { rotation.x, rotation.y, rotation.z };
|
||||
glm::vec3 position(m_position.x, m_position.y, m_position.z);
|
||||
glm::vec3 up(0.0, 1.0, 0.0);
|
||||
view = glm::lookAt(position, position + rotation, up);
|
||||
entityShader->setUniform("view", view);
|
||||
|
||||
glm::mat4 cubemapView = glm::mat4(glm::mat3(view));
|
||||
|
||||
@@ -0,0 +1,136 @@
|
||||
#include "Button.h"
|
||||
|
||||
#include "GL/glew.h"
|
||||
|
||||
#include "Application.h"
|
||||
#include "Input.h"
|
||||
#include "Texture.h"
|
||||
#include "Shader.h"
|
||||
|
||||
namespace nf {
|
||||
Button::Button() :
|
||||
m_idleTexture(nullptr),
|
||||
m_hoverTexture(nullptr),
|
||||
m_pressedTexture(nullptr),
|
||||
m_currentTexture(nullptr),
|
||||
m_scale(1.0f),
|
||||
m_opacity(1.0f),
|
||||
m_clicked(false),
|
||||
m_triggered(false)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Button::create(const Vec2& position, std::string string, Asset* buttonAsset, double scale, double opacity) {
|
||||
m_constructed = true;
|
||||
m_position = position;
|
||||
m_string = string;
|
||||
if (m_string.size()) {
|
||||
m_text.create(m_string, Vec2(0.0, 0.0));
|
||||
m_text.centered(true);
|
||||
}
|
||||
m_scale = (float)scale * 0.3f;
|
||||
m_opacity = (float)opacity;
|
||||
m_text.setOpacity(m_opacity);
|
||||
AButton* button;
|
||||
if ((button = dynamic_cast<AButton*>(buttonAsset)) == nullptr)
|
||||
Error("Non-button asset passed to Button::create!");
|
||||
m_idleTexture = new Texture(&button->idleTex);
|
||||
m_hoverTexture = new Texture(&button->hoverTex);
|
||||
m_pressedTexture = new Texture(&button->pressedTex);
|
||||
if (!((m_idleTexture->getDimensions() == m_hoverTexture->getDimensions()) && (m_idleTexture->getDimensions() == m_pressedTexture->getDimensions()))) {
|
||||
Error("Button images are not the same size!");
|
||||
}
|
||||
float tc[3][4] = {
|
||||
0.0, 1.0,
|
||||
0.0, 0.0,
|
||||
1.0, 0.0,
|
||||
0.0, 1.0,
|
||||
1.0, 0.0,
|
||||
1.0, 1.0
|
||||
};
|
||||
m_vao = new VertexArray;
|
||||
m_vao->addBuffer(nullptr, 0);
|
||||
m_vao->push<float>(2);
|
||||
m_vao->finishBufferLayout();
|
||||
m_vao->addBuffer(tc, sizeof(tc));
|
||||
m_vao->push<float>(2);
|
||||
m_vao->finishBufferLayout();
|
||||
|
||||
Application::getApp()->getCurrentState()->m_nfObjects.push_back(this);
|
||||
}
|
||||
|
||||
const char* Button::identity() {
|
||||
return "button";
|
||||
}
|
||||
|
||||
void Button::render(Shader* shader, unsigned int windowWidth, unsigned int windowHeight, Application* app, Shader* textShader) {
|
||||
float posX = (float)m_position.x * windowWidth, posY = (float)m_position.y * windowHeight;
|
||||
float scale = windowWidth / 5.0f;
|
||||
|
||||
Vec2 texDim = m_idleTexture->getDimensions();
|
||||
float height = scale * m_scale;
|
||||
float width = ((float)texDim.x / (float)texDim.y) * scale * m_scale;
|
||||
if (m_centeredX)
|
||||
posX = ((float)windowWidth - width) / 2;
|
||||
if (m_centeredY)
|
||||
posY = ((float)windowHeight - height) / 2;
|
||||
|
||||
m_currentTexture = m_idleTexture;
|
||||
Vec2 mousePos = app->getMousePos();
|
||||
m_triggered = false;
|
||||
if (mousePos.x >= posX && mousePos.x <= posX + width && mousePos.y <= windowHeight - posY && mousePos.y >= (windowHeight - posY) - height) {
|
||||
m_currentTexture = m_hoverTexture;
|
||||
if (app->isMouse(NFI_LEFTMOUSE))
|
||||
m_clicked = true;
|
||||
else if (m_clicked) {
|
||||
m_triggered = true;
|
||||
m_clicked = false;
|
||||
}
|
||||
}
|
||||
else m_clicked = false;
|
||||
|
||||
if (m_clicked)
|
||||
m_currentTexture = m_pressedTexture;
|
||||
float vb[] = {
|
||||
posX, posY + height,
|
||||
posX, posY,
|
||||
posX + width, posY,
|
||||
posX, posY + height,
|
||||
posX + width, posY,
|
||||
posX + width, posY + height
|
||||
};
|
||||
|
||||
m_currentTexture->bind();
|
||||
m_vao->setBufferData(0, vb, sizeof(vb));
|
||||
shader->setUniform("opacity", m_opacity);
|
||||
glDrawArrays(GL_TRIANGLES, 0, 6);
|
||||
|
||||
if (m_string.size()) {
|
||||
Vec2 pos = Vec2(posX, posY);
|
||||
m_text.render(textShader, windowWidth, windowHeight, true, width, height, pos);
|
||||
}
|
||||
}
|
||||
|
||||
bool Button::isClicked() {
|
||||
return m_triggered;
|
||||
}
|
||||
|
||||
void Button::destroy() {
|
||||
m_constructed = false;
|
||||
m_clicked = false;
|
||||
m_position = Vec2(0.0);
|
||||
m_centeredX = m_centeredY = false;
|
||||
if (!m_idleTexture->isBaseAsset())
|
||||
delete m_idleTexture;
|
||||
if (!m_hoverTexture->isBaseAsset())
|
||||
delete m_hoverTexture;
|
||||
if (!m_pressedTexture->isBaseAsset())
|
||||
delete m_pressedTexture;
|
||||
delete m_vao;
|
||||
}
|
||||
|
||||
Button::~Button() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "stb_image.h"
|
||||
|
||||
#include "Application.h"
|
||||
#include "Shader.h"
|
||||
#include "Assets.h"
|
||||
|
||||
namespace nf {
|
||||
@@ -19,6 +20,7 @@ namespace nf {
|
||||
m_constructed = true;
|
||||
ACubemap& cm = *(ACubemap*)cubemapAsset;
|
||||
glGenTextures(1, &m_id);
|
||||
glActiveTexture(GL_TEXTURE12);
|
||||
glBindTexture(GL_TEXTURE_CUBE_MAP, m_id);
|
||||
struct CMFace {
|
||||
CMFace(unsigned char* d, unsigned int w, unsigned int h, unsigned int nc) :
|
||||
@@ -61,6 +63,8 @@ namespace nf {
|
||||
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
|
||||
glBindTexture(GL_TEXTURE_CUBE_MAP, 0);
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
|
||||
float vb[] = {
|
||||
-1.0f, 1.0f, -1.0f,
|
||||
@@ -117,8 +121,10 @@ namespace nf {
|
||||
return m_constructed;
|
||||
}
|
||||
|
||||
void Cubemap::render() {
|
||||
void Cubemap::render(Shader* shader) {
|
||||
m_vao->bind();
|
||||
glActiveTexture(GL_TEXTURE12);
|
||||
shader->setUniform("cm", 12);
|
||||
glBindTexture(GL_TEXTURE_CUBE_MAP, m_id);
|
||||
glDepthFunc(GL_LEQUAL);
|
||||
glDrawArrays(GL_TRIANGLES, 0, 36);
|
||||
|
||||
@@ -19,16 +19,18 @@ namespace nf {
|
||||
|
||||
void Entity::create(Asset* modelAsset) {
|
||||
m_constructed = true;
|
||||
AModel& model = *(AModel*)modelAsset;
|
||||
if (model.alreadyLoaded) {
|
||||
m_model = model.loadedModel;
|
||||
AModel* model;
|
||||
if ((model = dynamic_cast<AModel*>(modelAsset)) == nullptr)
|
||||
Error("Non-model asset passed to Entity::create!");
|
||||
if (model->alreadyLoaded) {
|
||||
m_model = model->loadedModel;
|
||||
}
|
||||
else {
|
||||
m_model = new Model(&model);
|
||||
model.alreadyLoaded = true;
|
||||
model.loadedModel = m_model;
|
||||
m_model = new Model(model);
|
||||
model->alreadyLoaded = true;
|
||||
model->loadedModel = m_model;
|
||||
}
|
||||
m_model->setBaseAsset(model.isBaseAsset);
|
||||
|
||||
Application::getApp()->getCurrentState()->m_nfObjects.push_back(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,12 +24,18 @@ namespace nf {
|
||||
m_ib = new IndexBuffer(ib, ibCount);
|
||||
if (diffTex) {
|
||||
m_hasDiffuse = true;
|
||||
m_diffuseTexture = new Texture(diffTex);
|
||||
if (diffTex->alreadyLoaded)
|
||||
m_diffuseTexture = diffTex->loadedTexture;
|
||||
else
|
||||
m_diffuseTexture = new Texture(diffTex);
|
||||
}
|
||||
m_diffColor = diffColor;
|
||||
if (specTex) {
|
||||
m_hasSpecular = true;
|
||||
m_specularTexture = new Texture(specTex);
|
||||
if (specTex->alreadyLoaded)
|
||||
m_specularTexture = specTex->loadedTexture;
|
||||
else
|
||||
m_specularTexture = new Texture(specTex);
|
||||
}
|
||||
m_shininess = shininess;
|
||||
}
|
||||
@@ -63,7 +69,7 @@ namespace nf {
|
||||
}
|
||||
|
||||
Model::Model(AModel* model) :
|
||||
m_base(false)
|
||||
m_base(model->isBaseAsset)
|
||||
{
|
||||
std::string obj = model->data;
|
||||
unsigned int startMtlPos = obj.find("newmtl");
|
||||
@@ -281,10 +287,6 @@ namespace nf {
|
||||
}
|
||||
}
|
||||
|
||||
void Model::setBaseAsset(bool isBase) {
|
||||
m_base = isBase;
|
||||
}
|
||||
|
||||
bool Model::isBaseAsset() {
|
||||
return m_base;
|
||||
}
|
||||
|
||||
@@ -92,11 +92,12 @@ namespace nf {
|
||||
return "text";
|
||||
}
|
||||
|
||||
void Text::render(Shader* shader, unsigned int windowWidth, unsigned int windowHeight) {
|
||||
void Text::render(Shader* shader, unsigned int windowWidth, unsigned int windowHeight, bool onButton, float buttonWidth, float buttonHeight, const Vec2& buttonPos) {
|
||||
float scale = windowWidth / 4000.0f;
|
||||
m_vao->bind();
|
||||
std::string::const_iterator si;
|
||||
if (onButton)
|
||||
scale *= buttonHeight / 100.0f;
|
||||
float currX = (float)m_position.x * windowWidth, currY = (float)m_position.y * windowHeight;
|
||||
std::string::const_iterator si;
|
||||
if (m_centeredX || m_centeredY) {
|
||||
float textWidth = 0.0f;
|
||||
float textHeight = 0.0f;
|
||||
@@ -110,7 +111,23 @@ namespace nf {
|
||||
currX = ((float)windowWidth - textWidth) / 2;
|
||||
if (m_centeredY)
|
||||
currY = ((float)windowHeight - textHeight) / 2;
|
||||
|
||||
if (onButton) {
|
||||
while (textWidth > buttonWidth - 20) {
|
||||
scale -= 0.01f;
|
||||
textHeight = textWidth = 0.0f;
|
||||
for (si = m_string.begin(); si != m_string.end(); si++) {
|
||||
Character& c = m_font->m_characters[*si];
|
||||
textWidth += (c.advance >> 6) * scale * m_scale;
|
||||
if (c.size.y >= textHeight)
|
||||
textHeight = (float)c.size.y * scale * m_scale;
|
||||
}
|
||||
}
|
||||
currX = (((float)buttonWidth - textWidth) / 2) + (float)buttonPos.x;
|
||||
currY = (((float)buttonHeight - textHeight) / 2) + (float)buttonPos.y;
|
||||
}
|
||||
}
|
||||
|
||||
glm::vec3 color = { m_color.x, m_color.y, m_color.z };
|
||||
shader->setUniform("textColor", color);
|
||||
shader->setUniform("opacity", m_opacity);
|
||||
@@ -120,7 +137,7 @@ namespace nf {
|
||||
float y = currY - float(c.size.y - c.bearing.y) * scale * m_scale;
|
||||
float w = (float)c.size.x * scale * m_scale;
|
||||
float h = (float)c.size.y * scale * m_scale;
|
||||
float vb[3][4] = {
|
||||
float vb[] = {
|
||||
x, y + h,
|
||||
x, y,
|
||||
x + w, y,
|
||||
@@ -128,7 +145,7 @@ namespace nf {
|
||||
x + w, y,
|
||||
x + w, y + h
|
||||
};
|
||||
float tc[3][4] = {
|
||||
float tc[] = {
|
||||
0.0, 0.0,
|
||||
0.0, 1.0,
|
||||
1.0, 1.0,
|
||||
@@ -138,6 +155,7 @@ namespace nf {
|
||||
};
|
||||
glActiveTexture(GL_TEXTURE10);
|
||||
glBindTexture(GL_TEXTURE_2D, c.texID);
|
||||
m_vao->bind();
|
||||
m_vao->setBufferData(0, vb, sizeof(vb));
|
||||
m_vao->setBufferData(1, tc, sizeof(tc));
|
||||
shader->setUniform("text", 10);
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace nf {
|
||||
return "none";
|
||||
}
|
||||
|
||||
void UIElement::setPosition(float x, float y) {
|
||||
void UIElement::setPosition(double x, double y) {
|
||||
m_position = Vec2(x, y);
|
||||
}
|
||||
void UIElement::setPosition(const Vec2& position) {
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "GL/glew.h"
|
||||
|
||||
#include "Application.h"
|
||||
#include "Assets.h"
|
||||
#include "Texture.h"
|
||||
#include "Shader.h"
|
||||
@@ -17,7 +18,9 @@ namespace nf {
|
||||
|
||||
void UITexture::create(Asset* textureAsset, const Vec2& position, double scale, double opacity) {
|
||||
m_constructed = true;
|
||||
ATexture* tex = (ATexture*)textureAsset;
|
||||
ATexture* tex;
|
||||
if ((tex = dynamic_cast<ATexture*>(textureAsset)) == nullptr)
|
||||
Error("Non-texture asset passed to UITexture::create!");
|
||||
m_position = position;
|
||||
m_scale = (float)scale;
|
||||
m_opacity = (float)opacity;
|
||||
@@ -28,13 +31,23 @@ namespace nf {
|
||||
m_texture = new Texture(tex);
|
||||
}
|
||||
|
||||
float tc[] = {
|
||||
0.0, 1.0,
|
||||
0.0, 0.0,
|
||||
1.0, 0.0,
|
||||
0.0, 1.0,
|
||||
1.0, 0.0,
|
||||
1.0, 1.0
|
||||
};
|
||||
m_vao = new VertexArray;
|
||||
m_vao->addBuffer(nullptr, 0);
|
||||
m_vao->push<float>(2);
|
||||
m_vao->finishBufferLayout();
|
||||
m_vao->addBuffer(nullptr, 0);
|
||||
m_vao->addBuffer(tc, sizeof(tc));
|
||||
m_vao->push<float>(2);
|
||||
m_vao->finishBufferLayout();
|
||||
|
||||
Application::getApp()->getCurrentState()->m_nfObjects.push_back(this);
|
||||
}
|
||||
|
||||
const char* UITexture::identity() {
|
||||
@@ -68,17 +81,9 @@ namespace nf {
|
||||
posX + width, posY,
|
||||
posX + width, posY + height
|
||||
};
|
||||
float tc[3][4] = {
|
||||
0.0, 1.0,
|
||||
0.0, 0.0,
|
||||
1.0, 0.0,
|
||||
0.0, 1.0,
|
||||
1.0, 0.0,
|
||||
1.0, 1.0
|
||||
};
|
||||
|
||||
m_texture->bind();
|
||||
m_vao->setBufferData(0, vb, sizeof(vb));
|
||||
m_vao->setBufferData(1, tc, sizeof(tc));
|
||||
shader->setUniform("opacity", m_opacity);
|
||||
glDrawArrays(GL_TRIANGLES, 0, 6);
|
||||
}
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
#include "Shader.h"
|
||||
#include "Light.h"
|
||||
#include "Entity.h"
|
||||
#include "Model.h"
|
||||
#include "Cubemap.h"
|
||||
#include "UIElement.h"
|
||||
#include "Button.h"
|
||||
#include "Camera.h"
|
||||
#include "Utility.h"
|
||||
|
||||
@@ -67,31 +67,7 @@ namespace nf {
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
|
||||
m_baseAP.load("base.nfpack");
|
||||
const char* entityVertex = m_baseAP["entityVertex.shader"]->data;
|
||||
const char* entityFragment = m_baseAP["entityFragment.shader"]->data;
|
||||
m_entityShader = new Shader(entityVertex, entityFragment);
|
||||
const char* textVertex = m_baseAP["textVertex.shader"]->data;
|
||||
const char* textFragment = m_baseAP["textFragment.shader"]->data;
|
||||
m_textShader = new Shader(textVertex, textFragment);
|
||||
const char* uiTextureVertex = m_baseAP["uiTextureVertex.shader"]->data;
|
||||
const char* uiTextureFragment = m_baseAP["uiTextureFragment.shader"]->data;
|
||||
m_uiTextureShader = new Shader(uiTextureVertex, uiTextureFragment);
|
||||
const char* cubemapVertex = m_baseAP["cubemapVertex.shader"]->data;
|
||||
const char* cubemapFragment = m_baseAP["cubemapFragment.shader"]->data;
|
||||
m_cubemapShader = new Shader(cubemapVertex, cubemapFragment);
|
||||
const char* fadeVertex = m_baseAP["fadeVertex.shader"]->data;
|
||||
const char* fadeFragment = m_baseAP["fadeFragment.shader"]->data;
|
||||
m_fadeShader = new Shader(fadeVertex, fadeFragment);
|
||||
|
||||
BaseAssets::cube = (AModel*)m_baseAP["cube.obj"];
|
||||
BaseAssets::plane = (AModel*)m_baseAP["plane.obj"];
|
||||
BaseAssets::sphere = (AModel*)m_baseAP["sphere.obj"];
|
||||
BaseAssets::cone = (AModel*)m_baseAP["cone.obj"];
|
||||
BaseAssets::cylinder = (AModel*)m_baseAP["cylinder.obj"];
|
||||
BaseAssets::torus = (AModel*)m_baseAP["torus.obj"];
|
||||
BaseAssets::logo = (ATexture*)m_baseAP["logo.png"];
|
||||
BaseAssets::defaultFont = (AFont*)m_baseAP["default.ttf"];
|
||||
loadBaseAssets();
|
||||
|
||||
float fadeVB[] = {
|
||||
-1.0, -1.0,
|
||||
@@ -168,7 +144,7 @@ namespace nf {
|
||||
//Draw cubemap where there isn't anything else
|
||||
if (m_cubemap != nullptr) {
|
||||
m_cubemapShader->setUniform("proj", proj);
|
||||
m_cubemap->render();
|
||||
m_cubemap->render(m_cubemapShader);
|
||||
}
|
||||
m_cubemap = nullptr;
|
||||
|
||||
@@ -179,13 +155,19 @@ namespace nf {
|
||||
UIElement& curr = *draw;
|
||||
if (curr.identity() == "text") {
|
||||
m_textShader->setUniform("proj", proj);
|
||||
curr.render(m_textShader, m_app->getConfig().width, m_app->getConfig().height);
|
||||
Text& text = *(Text*)draw;
|
||||
text.render(m_textShader, m_app->getConfig().width, m_app->getConfig().height);
|
||||
continue;
|
||||
}
|
||||
if (curr.identity() == "texture") {
|
||||
else if (curr.identity() == "texture") {
|
||||
m_uiTextureShader->setUniform("proj", proj);
|
||||
curr.render(m_uiTextureShader, m_app->getConfig().width, m_app->getConfig().height);
|
||||
}
|
||||
else if (curr.identity() == "button") {
|
||||
m_uiTextureShader->setUniform("proj", proj);
|
||||
Button& button = *(Button*)draw;
|
||||
button.render(m_uiTextureShader, m_app->getConfig().width, m_app->getConfig().height, m_app, m_textShader);
|
||||
}
|
||||
}
|
||||
m_lUI.clear();
|
||||
|
||||
@@ -236,6 +218,36 @@ namespace nf {
|
||||
Error("OpenGL error " + std::to_string(err));
|
||||
}
|
||||
|
||||
void Renderer::loadBaseAssets() {
|
||||
m_baseAP.load("base.nfpack");
|
||||
const char* entityVertex = m_baseAP["entityVertex.shader"]->data;
|
||||
const char* entityFragment = m_baseAP["entityFragment.shader"]->data;
|
||||
m_entityShader = new Shader(entityVertex, entityFragment);
|
||||
const char* textVertex = m_baseAP["textVertex.shader"]->data;
|
||||
const char* textFragment = m_baseAP["textFragment.shader"]->data;
|
||||
m_textShader = new Shader(textVertex, textFragment);
|
||||
const char* uiTextureVertex = m_baseAP["uiTextureVertex.shader"]->data;
|
||||
const char* uiTextureFragment = m_baseAP["uiTextureFragment.shader"]->data;
|
||||
m_uiTextureShader = new Shader(uiTextureVertex, uiTextureFragment);
|
||||
const char* cubemapVertex = m_baseAP["cubemapVertex.shader"]->data;
|
||||
const char* cubemapFragment = m_baseAP["cubemapFragment.shader"]->data;
|
||||
m_cubemapShader = new Shader(cubemapVertex, cubemapFragment);
|
||||
const char* fadeVertex = m_baseAP["fadeVertex.shader"]->data;
|
||||
const char* fadeFragment = m_baseAP["fadeFragment.shader"]->data;
|
||||
m_fadeShader = new Shader(fadeVertex, fadeFragment);
|
||||
|
||||
BaseAssets::cube = (AModel*)m_baseAP["cube.obj"];
|
||||
BaseAssets::plane = (AModel*)m_baseAP["plane.obj"];
|
||||
BaseAssets::sphere = (AModel*)m_baseAP["sphere.obj"];
|
||||
BaseAssets::cone = (AModel*)m_baseAP["cone.obj"];
|
||||
BaseAssets::cylinder = (AModel*)m_baseAP["cylinder.obj"];
|
||||
BaseAssets::torus = (AModel*)m_baseAP["torus.obj"];
|
||||
BaseAssets::logo = (ATexture*)m_baseAP["logo.png"];
|
||||
BaseAssets::cubemap = (ACubemap*)m_baseAP["default.cm"];
|
||||
BaseAssets::font = (AFont*)m_baseAP["default.ttf"];
|
||||
BaseAssets::button = (AButton*)m_baseAP["default.button"];
|
||||
}
|
||||
|
||||
Renderer::~Renderer() {
|
||||
delete m_entityShader;
|
||||
delete m_textShader;
|
||||
|
||||
Reference in new issue
Block a user