resolving conflicts by merge
This commit is contained in:
commit
8e5e96e3ee
@ -15,4 +15,7 @@ bool Environment::downPressed = false;
|
||||
Vector3f Environment::cameraShift = {0, 0, 0};
|
||||
Vector3f Environment::characterPos = {0, 0, 0};
|
||||
|
||||
|
||||
float Environment::violaCurrentIdleFrame = 0.f;
|
||||
|
||||
} // namespace ZL
|
||||
|
||||
@ -17,6 +17,8 @@ public:
|
||||
|
||||
static Vector3f cameraShift;
|
||||
static Vector3f characterPos;
|
||||
|
||||
static float violaCurrentIdleFrame;
|
||||
};
|
||||
|
||||
} // namespace ZL
|
||||
|
||||
@ -37,7 +37,8 @@ void GameObjectManager::initialize() {
|
||||
coneMeshMutable.RefreshVBO();
|
||||
|
||||
// Load bone animations
|
||||
bx.LoadFromFile("mesh_armature_and_animation_data.txt");
|
||||
//bx.LoadFromFile("./violetta001.txt");
|
||||
bx.LoadFromFile("./idleviola001.txt");
|
||||
|
||||
// Create active object
|
||||
ActiveObject ao1;
|
||||
@ -230,6 +231,16 @@ void GameObjectManager::updateScene(size_t ms) {
|
||||
if (rooms[current_room_index].roomLogic) {
|
||||
rooms[current_room_index].roomLogic(*this, ms);
|
||||
}
|
||||
|
||||
Environment::violaCurrentIdleFrame += ms / 24.f;
|
||||
|
||||
while (Environment::violaCurrentIdleFrame > 40)
|
||||
{
|
||||
Environment::violaCurrentIdleFrame -= 40;
|
||||
}
|
||||
|
||||
bx.Interpolate(int(Environment::violaCurrentIdleFrame));
|
||||
|
||||
}
|
||||
|
||||
bool GameObjectManager::isPointInObject(int screenX, int screenY, int objectScreenX, int objectScreenY) const {
|
||||
|
||||
@ -6,7 +6,9 @@
|
||||
#include <vector>
|
||||
#include "ActiveObject.h"
|
||||
#include "Room.h"
|
||||
#ifdef __linux__
|
||||
#include <SDL2/SDL.h>
|
||||
#endif
|
||||
#include "OpenGlExtensions.h"
|
||||
|
||||
namespace ZL {
|
||||
@ -51,7 +53,7 @@ public:
|
||||
static const float INVENTORY_MARGIN;
|
||||
|
||||
private:
|
||||
int animationCounter = 0;
|
||||
//int animationCounter = 0;
|
||||
int lastMouseX = 0; // Добавляем переменные для хранения позиции мыши
|
||||
int lastMouseY = 0;
|
||||
int current_room_index;
|
||||
|
||||
113
RenderSystem.cpp
113
RenderSystem.cpp
@ -4,6 +4,8 @@
|
||||
#include "Inventory.h"
|
||||
#include <GL/gl.h>
|
||||
|
||||
|
||||
|
||||
namespace ZL {
|
||||
|
||||
void RenderSystem::initialize() {
|
||||
@ -12,7 +14,7 @@ void RenderSystem::initialize() {
|
||||
renderer.InitOpenGL();
|
||||
}
|
||||
|
||||
void RenderSystem::drawScene(const GameObjectManager& gameObjects) {
|
||||
void RenderSystem::drawScene(GameObjectManager& gameObjects) {
|
||||
static const std::string defaultShaderName = "default";
|
||||
static const std::string vPositionName = "vPosition";
|
||||
static const std::string vTexCoordName = "vTexCoord";
|
||||
@ -22,6 +24,90 @@ void RenderSystem::drawScene(const GameObjectManager& gameObjects) {
|
||||
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
|
||||
|
||||
glViewport(0, 0, Environment::width, Environment::height);
|
||||
/*
|
||||
renderer.shaderManager.PushShader(defaultShaderName);
|
||||
renderer.RenderUniform1i(textureUniformName, 0);
|
||||
|
||||
renderer.EnableVertexAttribArray(vPositionName);
|
||||
renderer.EnableVertexAttribArray(vTexCoordName);
|
||||
*/
|
||||
drawWorld(gameObjects);
|
||||
//drawUI(gameObjects);
|
||||
|
||||
/*renderer.DisableVertexAttribArray(vPositionName);
|
||||
renderer.DisableVertexAttribArray(vTexCoordName);
|
||||
renderer.shaderManager.PopShader();*/
|
||||
|
||||
CheckGlError();
|
||||
}
|
||||
|
||||
void RenderSystem::drawViola(GameObjectManager& gameObjects)
|
||||
{
|
||||
static const std::string defaultShaderName = "default";
|
||||
static const std::string colorShaderName = "defaultColor";
|
||||
|
||||
static const std::string vPositionName = "vPosition";
|
||||
static const std::string vTexCoordName = "vTexCoord";
|
||||
static const std::string vColorName = "vColor";
|
||||
static const std::string textureUniformName = "Texture";
|
||||
|
||||
renderer.shaderManager.PushShader(colorShaderName);
|
||||
|
||||
renderer.EnableVertexAttribArray(vPositionName);
|
||||
renderer.PushPerspectiveProjectionMatrix(1.0 / 1.5,
|
||||
static_cast<float>(Environment::width) / static_cast<float>(Environment::height),
|
||||
50, 10000);
|
||||
renderer.PushMatrix();
|
||||
|
||||
renderer.LoadIdentity();
|
||||
renderer.TranslateMatrix({ 0,0, -100 * Environment::zoom });
|
||||
|
||||
float t = 0.3;
|
||||
renderer.RotateMatrix(QuatFromRotateAroundX(t * M_PI / 2.0));
|
||||
renderer.ScaleMatrix(10);
|
||||
|
||||
renderer.RotateMatrix(QuatFromRotateAroundX(-M_PI / 2.0));
|
||||
//float t = 0.3;
|
||||
|
||||
//renderer.RotateMatrix(QuatFromRotateAroundX(t * M_PI / 2.0));
|
||||
|
||||
|
||||
gameObjects.bxMutable.AssignFrom(gameObjects.bx.mesh);
|
||||
gameObjects.bxMutable.RefreshVBO();
|
||||
renderer.DrawVertexRenderStruct(gameObjects.bxMutable);
|
||||
|
||||
|
||||
renderer.PopMatrix();
|
||||
renderer.PopProjectionMatrix();
|
||||
renderer.DisableVertexAttribArray(vPositionName);
|
||||
|
||||
renderer.shaderManager.PopShader();
|
||||
}
|
||||
|
||||
void RenderSystem::drawWorld(GameObjectManager& gameObjects) {
|
||||
static const std::string defaultShaderName = "default";
|
||||
static const std::string colorShaderName = "defaultColor";
|
||||
|
||||
static const std::string vPositionName = "vPosition";
|
||||
static const std::string vTexCoordName = "vTexCoord";
|
||||
static const std::string vColorName = "vColor";
|
||||
static const std::string textureUniformName = "Texture";
|
||||
|
||||
/*
|
||||
renderer.shaderManager.PushShader(defaultShaderName);
|
||||
renderer.RenderUniform1i(textureUniformName, 0);
|
||||
|
||||
renderer.EnableVertexAttribArray(vPositionName);
|
||||
renderer.EnableVertexAttribArray(vTexCoordName);
|
||||
*/
|
||||
|
||||
|
||||
|
||||
// Draw cone
|
||||
//glBindTexture(GL_TEXTURE_2D, gameObjects.coneTexturePtr->getTexID());
|
||||
//renderer.DrawVertexRenderStruct(gameObjects.coneMeshMutable);
|
||||
|
||||
drawViola(gameObjects);
|
||||
|
||||
renderer.shaderManager.PushShader(defaultShaderName);
|
||||
renderer.RenderUniform1i(textureUniformName, 0);
|
||||
@ -29,33 +115,18 @@ void RenderSystem::drawScene(const GameObjectManager& gameObjects) {
|
||||
renderer.EnableVertexAttribArray(vPositionName);
|
||||
renderer.EnableVertexAttribArray(vTexCoordName);
|
||||
|
||||
drawWorld(gameObjects);
|
||||
drawUI(gameObjects);
|
||||
|
||||
renderer.DisableVertexAttribArray(vPositionName);
|
||||
renderer.DisableVertexAttribArray(vTexCoordName);
|
||||
renderer.shaderManager.PopShader();
|
||||
|
||||
CheckGlError();
|
||||
}
|
||||
|
||||
void RenderSystem::drawWorld(const GameObjectManager& gameObjects) {
|
||||
renderer.PushPerspectiveProjectionMatrix(1.0 / 1.5,
|
||||
static_cast<float>(Environment::width) / static_cast<float>(Environment::height),
|
||||
renderer.PushPerspectiveProjectionMatrix(1.0 / 1.5,
|
||||
static_cast<float>(Environment::width) / static_cast<float>(Environment::height),
|
||||
50, 10000);
|
||||
renderer.PushMatrix();
|
||||
|
||||
renderer.LoadIdentity();
|
||||
renderer.TranslateMatrix({ 0,0, -100 * Environment::zoom });
|
||||
|
||||
|
||||
float t = 0.3;
|
||||
renderer.RotateMatrix(QuatFromRotateAroundX(t * M_PI / 2.0));
|
||||
|
||||
|
||||
// Draw cone
|
||||
glBindTexture(GL_TEXTURE_2D, gameObjects.coneTexturePtr->getTexID());
|
||||
renderer.DrawVertexRenderStruct(gameObjects.coneMeshMutable);
|
||||
|
||||
renderer.TranslateMatrix(Environment::cameraShift);
|
||||
|
||||
// Draw active objects
|
||||
@ -80,6 +151,10 @@ void RenderSystem::drawWorld(const GameObjectManager& gameObjects) {
|
||||
|
||||
renderer.PopMatrix();
|
||||
renderer.PopProjectionMatrix();
|
||||
|
||||
renderer.DisableVertexAttribArray(vPositionName);
|
||||
renderer.DisableVertexAttribArray(vTexCoordName);
|
||||
renderer.shaderManager.PopShader();
|
||||
|
||||
// Store matrix for UI rendering
|
||||
currentProjectionModelView = latestProjectionModelView;
|
||||
|
||||
@ -9,7 +9,7 @@ class RenderSystem {
|
||||
public:
|
||||
RenderSystem() = default;
|
||||
void initialize();
|
||||
void drawScene(const GameObjectManager& gameObjects);
|
||||
void drawScene(GameObjectManager& gameObjects);
|
||||
Renderer& getRenderer() { return renderer; }
|
||||
|
||||
void worldToScreenCoordinates(Vector3f objectPos,
|
||||
@ -18,9 +18,11 @@ public:
|
||||
int& screenX, int& screenY);
|
||||
|
||||
private:
|
||||
void drawWorld(const GameObjectManager& gameObjects);
|
||||
void drawWorld(GameObjectManager& gameObjects);
|
||||
void drawUI(const GameObjectManager& gameObjects);
|
||||
|
||||
void drawViola(GameObjectManager& gameObjects);
|
||||
|
||||
Renderer renderer;
|
||||
ShaderManager shaderManager;
|
||||
Matrix4f currentProjectionModelView; // Добавлено для хранения матрицы между drawWorld и drawUI
|
||||
|
||||
17612
idleviola001.txt
Normal file
17612
idleviola001.txt
Normal file
File diff suppressed because it is too large
Load Diff
17612
idleviola002.txt
Normal file
17612
idleviola002.txt
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user