SQC-15_online #1
@ -134,6 +134,7 @@
|
||||
<ClInclude Include="array2d.h" />
|
||||
<ClInclude Include="array3d.h" />
|
||||
<ClInclude Include="blockinfo.h" />
|
||||
<ClInclude Include="boostinfo.h" />
|
||||
<ClInclude Include="bullet.h" />
|
||||
<ClInclude Include="chunk.h" />
|
||||
<ClInclude Include="define.h" />
|
||||
@ -147,6 +148,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="blockinfo.cpp" />
|
||||
<ClCompile Include="boostinfo.cpp" />
|
||||
<ClCompile Include="bullet.cpp" />
|
||||
<ClCompile Include="chunk.cpp" />
|
||||
<ClCompile Include="netprotocol.cpp" />
|
||||
|
@ -54,6 +54,9 @@
|
||||
<ClInclude Include="transformation.h">
|
||||
<Filter>Fichiers d%27en-tête</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="boostinfo.h">
|
||||
<Filter>Fichiers d%27en-tête</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="world.cpp">
|
||||
@ -80,5 +83,8 @@
|
||||
<ClCompile Include="transformation.cpp">
|
||||
<Filter>Fichiers sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="boostinfo.cpp">
|
||||
<Filter>Fichiers sources</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
32
SQCSim-common/boostinfo.cpp
Normal file
32
SQCSim-common/boostinfo.cpp
Normal file
@ -0,0 +1,32 @@
|
||||
#include "boostinfo.h"
|
||||
#include <iostream>
|
||||
|
||||
BoostInfo::BoostInfo(BoostType type, const std::string& name, float u, float v, float s, int dur) : m_type(type), m_name(name), m_u(u), m_v(v), m_s(s), m_durability(dur)
|
||||
{
|
||||
}
|
||||
|
||||
BoostInfo::~BoostInfo()
|
||||
{
|
||||
}
|
||||
|
||||
BoostType BoostInfo::GetType() const
|
||||
{
|
||||
return m_type;
|
||||
}
|
||||
|
||||
void BoostInfo::GetTexture(float& u, float& v, float& s)
|
||||
{
|
||||
u = m_u;
|
||||
v = m_v;
|
||||
s = m_s;
|
||||
}
|
||||
|
||||
void BoostInfo::Show() const
|
||||
{
|
||||
std::cout << "Type: " << m_type << std::endl;
|
||||
std::cout << "Nom: " << m_name << std::endl;
|
||||
std::cout << "Durabilite: " << m_durability << std::endl;
|
||||
std::cout << "Coordonnees Texture: " << m_u << ", " << m_v << ", " << m_s << std::endl;
|
||||
}
|
||||
|
||||
|
29
SQCSim-common/boostinfo.h
Normal file
29
SQCSim-common/boostinfo.h
Normal file
@ -0,0 +1,29 @@
|
||||
#ifndef BOOSTINFO_H__
|
||||
#define BOOSTINFO_H__
|
||||
|
||||
#include <string>
|
||||
#include "define.h"
|
||||
|
||||
class BoostInfo
|
||||
{
|
||||
public:
|
||||
BoostInfo(BoostType type, const std::string& name, float u, float v, float s, int dur);
|
||||
~BoostInfo();
|
||||
|
||||
BoostType GetType() const;
|
||||
|
||||
void GetTexture(float& u, float& v, float& s);
|
||||
|
||||
void Show() const;
|
||||
|
||||
private:
|
||||
BoostType m_type;
|
||||
float m_u;
|
||||
float m_v;
|
||||
float m_s;
|
||||
std::string m_name;
|
||||
int m_durability;
|
||||
|
||||
};
|
||||
|
||||
#endif // BOOSTINFO_H__
|
@ -27,14 +27,20 @@
|
||||
#define THREADS_UPDATE_CHUNKS 6
|
||||
#define THREADS_DELETE_CHUNKS 3
|
||||
|
||||
#define VIEW_DISTANCE 512 // Si les chunks arrêtent de s'afficher pendant une game et qu'il y a un access violation quand tu quitte, il faut augmenter ce chiffre.
|
||||
#define VIEW_DISTANCE 512 // Si les chunks arr<EFBFBD>tent de s'afficher pendant une game et qu'il y a un access violation quand tu quitte, il faut augmenter ce chiffre.
|
||||
#define TEXTURE_SIZE 512
|
||||
#define MAX_BULLETS 512
|
||||
|
||||
#define TIME_SPEED_BOOST 10 //secondes
|
||||
#define TIME_DAMAGE_BOOST 10 //secondes
|
||||
#define TIME_INVINCIBLE_BOOST 4 //secondes
|
||||
#define STRENGTH_SPEED_BOOST 10 //Pourcentage
|
||||
#define BULLET_TIME .1
|
||||
|
||||
typedef uint8_t BlockType;
|
||||
typedef uint8_t BoostType;
|
||||
enum BLOCK_TYPE { BTYPE_AIR, BTYPE_DIRT, BTYPE_GRASS, BTYPE_METAL, BTYPE_ICE, BTYPE_LAST };
|
||||
enum BOOST_TYPE { BTYPE_SPEED, BTYPE_HEAL, BTYPE_DAMAGE, BTYPE_INVINCIBLE, BTYPE_BOOST_LAST };
|
||||
enum ANIM_TYPE { STILL = 0, SHOOTING = 8, JUMPING = 16, JUMPINGSHOOTING = 24, DEAD = 32, TYPE_LAST = 40};
|
||||
enum ANIM_POS {FRONT, QUARTER_FRONT_LEFT, QUATER_FRONT_RIGHT, PROFIL_LEFT, PROFIL_RIGHT, QUARTER_BACK_LEFT, QUARTER_BACK_RIGHT, BACK , POS_LAST};
|
||||
typedef uint64_t Timestamp;
|
||||
|
@ -61,6 +61,11 @@ Vector3f Player::GetInput(bool front, bool back, bool left, bool right, bool jum
|
||||
delta.y += jump? .32f: shoot? .1f : 0.f;
|
||||
m_airborne = true;
|
||||
}
|
||||
if (boostspeed)
|
||||
{
|
||||
delta.x += STRENGTH_SPEED_BOOST / 100 * delta.x;
|
||||
delta.z += STRENGTH_SPEED_BOOST / 100 * delta.z;
|
||||
}
|
||||
|
||||
if (shoot) // Recoil!
|
||||
TurnTopBottom(-1);
|
||||
@ -182,7 +187,7 @@ Player::Sound Player::ApplyPhysics(Vector3f input, World* world, float elapsedTi
|
||||
else isStep = false;
|
||||
m_POV = m_position.y;
|
||||
m_POV += m_airborne ? 0 : (sin(bobbingtime) - 0.5f) * (abs(m_velocity.x) + abs(m_velocity.z)) * .2f;
|
||||
|
||||
RemoveBooster(elapsedTime);
|
||||
return snd;
|
||||
}
|
||||
|
||||
@ -196,6 +201,49 @@ void Player::ApplyTransformation(Transformation& transformation, bool rel, bool
|
||||
}
|
||||
}
|
||||
|
||||
void Player::GetBooster(Booster boosttype)
|
||||
{
|
||||
if (boosttype == SPEED)
|
||||
{
|
||||
boostspeed = true;
|
||||
timeboostspeed = 0;
|
||||
}
|
||||
if (boosttype == HEAL)
|
||||
{
|
||||
m_hp = 100;
|
||||
}
|
||||
if (boosttype == DAMAGE)
|
||||
{
|
||||
boostdamage = true;
|
||||
timeboostdamage = 0;
|
||||
}
|
||||
if (boosttype == INVINCIBLE)
|
||||
{
|
||||
boostinvincible = true;
|
||||
boostinvincible = 0;
|
||||
}
|
||||
}
|
||||
void Player::RemoveBooster(float elapsedtime)
|
||||
{
|
||||
if (boostspeed)
|
||||
{
|
||||
timeboostspeed += elapsedtime;
|
||||
if (timeboostspeed >= TIME_SPEED_BOOST)
|
||||
boostspeed = false;
|
||||
}
|
||||
if (boostdamage)
|
||||
{
|
||||
timeboostdamage += elapsedtime;
|
||||
if (timeboostdamage >= TIME_DAMAGE_BOOST)
|
||||
boostdamage = false;
|
||||
}
|
||||
if (boostinvincible)
|
||||
{
|
||||
timeboostinvincible += elapsedtime;
|
||||
if (timeboostinvincible >= TIME_INVINCIBLE_BOOST)
|
||||
boostinvincible = false;
|
||||
}
|
||||
}
|
||||
void Player::SetDirection(Vector3f dir) { m_direction = dir; }
|
||||
|
||||
Vector3f Player::GetPosition() const { return Vector3f(m_position.x + CHUNK_SIZE_X * WORLD_SIZE_X / 2, m_position.y, m_position.z + CHUNK_SIZE_Z * WORLD_SIZE_Y / 2); }
|
||||
|
@ -11,6 +11,7 @@ class World;
|
||||
class Player {
|
||||
public:
|
||||
enum Sound { NOSOUND, STEP, FALL };
|
||||
enum Booster { SPEED, HEAL, DAMAGE, INVINCIBLE };
|
||||
|
||||
Player(const Vector3f& position, float rotX = 0, float rotY = 0);
|
||||
~Player();
|
||||
@ -19,6 +20,8 @@ public:
|
||||
void TurnTopBottom(float value);
|
||||
Vector3f GetInput(bool front, bool back, bool left, bool right, bool jump, bool dash, float elapsedTime);
|
||||
Sound ApplyPhysics(Vector3f input, World* world, float elapsedTime);
|
||||
void GetBooster(Booster boosttype);
|
||||
void RemoveBooster(float elapsedtime);
|
||||
void ApplyTransformation(Transformation& transformation, bool rel = true, bool rot = true) const;
|
||||
|
||||
void SetDirection(Vector3f dir);
|
||||
@ -47,15 +50,20 @@ protected:
|
||||
float m_rotX = 0;
|
||||
float m_rotY = 0;
|
||||
float m_POV;
|
||||
float timeboostspeed;
|
||||
float timeboostdamage;
|
||||
float timeboostinvincible;
|
||||
|
||||
float m_hp;
|
||||
|
||||
bool m_airborne;
|
||||
bool boostspeed;
|
||||
bool boostdamage;
|
||||
bool boostinvincible;
|
||||
|
||||
|
||||
|
||||
Vector3f InterpolatePosition(const Vector3f& vec1, const Vector3f& vec2, const Timestamp& tim1, const Timestamp& tim2, const Timestamp& now);
|
||||
|
||||
};
|
||||
#endif //_PLAYER_H__
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="audio.h" />
|
||||
<ClInclude Include="booster.h" />
|
||||
<ClInclude Include="connector.h" />
|
||||
<ClInclude Include="define.h" />
|
||||
<ClInclude Include="engine.h" />
|
||||
@ -36,6 +37,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="audio.cpp" />
|
||||
<ClCompile Include="booster.cpp" />
|
||||
<ClCompile Include="connector.cpp" />
|
||||
<ClCompile Include="engine.cpp" />
|
||||
<ClCompile Include="main.cpp" />
|
||||
|
@ -53,6 +53,9 @@
|
||||
<ClInclude Include="remoteplayer.h">
|
||||
<Filter>Fichiers d%27en-tête</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="booster.h">
|
||||
<Filter>Fichiers d%27en-tête</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="engine.cpp">
|
||||
@ -97,5 +100,8 @@
|
||||
<ClCompile Include="remoteplayer.cpp">
|
||||
<Filter>Fichiers sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="booster.cpp">
|
||||
<Filter>Fichiers sources</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
46
SQCSim2021/booster.cpp
Normal file
46
SQCSim2021/booster.cpp
Normal file
@ -0,0 +1,46 @@
|
||||
#include "booster.h";
|
||||
|
||||
void Booster::RenderBillboard(const Vector3f pos, TextureAtlas& textureAtlas, TextureAtlas::TextureIndex idx, Shader& shader, Transformation tran)
|
||||
{
|
||||
//
|
||||
//Vector3f playerToQuad = m_player.GetPosition() - m_position;
|
||||
//playerToQuad.Normalize();
|
||||
//Vector3f targetPosition = m_player.GetPosition() + playerToQuad * 10.0f;
|
||||
//Matrix4f rotationMatrix;
|
||||
//rotationMatrix.SetLookAt(m_position, targetPosition, Vector3f(0, 1, 0));
|
||||
//glMultMatrixf(rotationMatrix.GetInternalValues());
|
||||
float x = pos.x;
|
||||
float y = pos.y;
|
||||
float z = pos.z;
|
||||
float width = 1.0f;
|
||||
float height = 1.0f;
|
||||
//Pt override les collisions.. a ce point la je sais pas quoi faire
|
||||
|
||||
//Matrix4 mat4 = tran.GetMatrix();
|
||||
//mat4 VP = pMatrix * vMatrix;
|
||||
//Vector3f CameraRight = Vector3f(mat4.Get11(), mat4.Get21(), mat4.Get31());
|
||||
//Vector3f CameraUp = Vector3f(mat4.Get12(), mat4.Get22(), mat4.Get32());
|
||||
|
||||
//Vector3f v1 = (m_position + CameraRight * 0.5 * width + CameraUp * -0.5 * width);
|
||||
//Vector3f v2 = (m_position + CameraRight * 0.5 * width + CameraUp * 0.5 * width);
|
||||
//Vector3f v4 = (m_position + CameraRight * -0.5 * width + CameraUp * -0.5 * width);
|
||||
//Vector3f v3 = (m_position + CameraRight * -0.5 * width + CameraUp * 0.5 * width);
|
||||
|
||||
//tran.ApplyTranslation(m_position);
|
||||
float u, v, w, h;
|
||||
//glDisable(GL_DEPTH_TEST);
|
||||
shader.Use();
|
||||
textureAtlas.Bind();
|
||||
textureAtlas.TextureIndexToCoord(idx, u, v, w, h);
|
||||
//glLoadIdentity();
|
||||
glLoadMatrixf(tran.GetMatrix().GetInternalValues());
|
||||
glBegin(GL_QUADS);
|
||||
glTexCoord2f(u, v); glVertex3f(x - width / 2., y - height, z); //glVertex3f(v4.x, v4.y, v4.z);//glVertex3f(0, 50, 0);
|
||||
glTexCoord2f(u + w, v); glVertex3f(x + width / 2., y - height, z); //glVertex3f(v3.x, v3.y, v3.z); //glVertex3f(50,50, 0);
|
||||
glTexCoord2f(u + w, v + h); glVertex3f(x + width / 2., y, z); //glVertex3f(v2.x, v2.y, v2.z); //glVertex3f(50, 0, 0);
|
||||
glTexCoord2f(u, v + h); glVertex3f(x - width / 2., y, z); //glVertex3f(v1.x, v1.y, v1.z);// glVertex3f(0, 0, 0);
|
||||
glEnd();
|
||||
shader.Disable();
|
||||
//tran.ApplyTranslation(-m_position);
|
||||
//glEnable(GL_DEPTH_TEST);
|
||||
}
|
14
SQCSim2021/booster.h
Normal file
14
SQCSim2021/booster.h
Normal file
@ -0,0 +1,14 @@
|
||||
#ifndef BOOSTER_H__
|
||||
#define BOOSTER_H__
|
||||
#include "define.h"
|
||||
#include "textureatlas.h"
|
||||
#include "shader.h"
|
||||
#include "../SQCSim-common/vector3.h"
|
||||
#include "../SQCSim-common/transformation.h"
|
||||
|
||||
|
||||
class Booster {
|
||||
public:
|
||||
void RenderBillboard(const Vector3f pos, TextureAtlas& textureAtlas, TextureAtlas::TextureIndex idx, Shader& shader, Transformation tran);
|
||||
};
|
||||
#endif
|
@ -35,5 +35,6 @@
|
||||
#define AUDIO_PATH "./media/audio/"
|
||||
#define CHUNK_PATH "./media/chunks/"
|
||||
#define MENU_ITEM_PATH "./media/menu_items/"
|
||||
#define BOOSTER_TEXTURE_PATH "./media/textures/Booster/"
|
||||
|
||||
#endif // DEFINE_H__
|
||||
|
@ -450,6 +450,10 @@ void Engine::LoadResource() {
|
||||
TextureAtlas::TextureIndex texIceIndex = m_textureAtlas.AddTexture(TEXTURE_PATH "metal2.png");
|
||||
TextureAtlas::TextureIndex texGrassIndex = m_textureAtlas.AddTexture(TEXTURE_PATH "grass.png");
|
||||
TextureAtlas::TextureIndex texMetalIndex = m_textureAtlas.AddTexture(TEXTURE_PATH "dirt.png");
|
||||
TextureAtlas::TextureIndex texBoostHeal = m_textureAtlas.AddTexture(BOOSTER_TEXTURE_PATH "BoosterVert.png");
|
||||
TextureAtlas::TextureIndex texBoostDmg = m_textureAtlas.AddTexture(BOOSTER_TEXTURE_PATH "BoosterRouge.png");
|
||||
TextureAtlas::TextureIndex texBoostSpd = m_textureAtlas.AddTexture(BOOSTER_TEXTURE_PATH "BoosterBleu.png");
|
||||
TextureAtlas::TextureIndex texBoostInv = m_textureAtlas.AddTexture(BOOSTER_TEXTURE_PATH "BoosterJaune.png");
|
||||
|
||||
|
||||
//AJOUTER LES TEXTURES DANS L'ORDRE DE L'ÉNUM
|
||||
@ -496,6 +500,15 @@ void Engine::LoadResource() {
|
||||
m_blockinfo[BTYPE_METAL] = new BlockInfo(BTYPE_METAL, "Metal", u, v, s, 1);
|
||||
m_textureAtlas.TextureIndexToCoord(texIceIndex, u, v, s, s);
|
||||
m_blockinfo[BTYPE_ICE] = new BlockInfo(BTYPE_ICE, "Ice", u, v, s, 1);
|
||||
m_textureAtlas.TextureIndexToCoord(texBoostHeal, u, v, s, s);
|
||||
m_boostinfo[BTYPE_HEAL] = new BoostInfo(BTYPE_HEAL, "Heal", u, v, s, 1);
|
||||
m_textureAtlas.TextureIndexToCoord(texBoostDmg, u, v, s, s);
|
||||
m_boostinfo[BTYPE_DAMAGE] = new BoostInfo(BTYPE_DAMAGE, "Dmg", u, v, s, 1);
|
||||
m_textureAtlas.TextureIndexToCoord(texBoostSpd, u, v, s, s);
|
||||
m_boostinfo[BTYPE_SPEED] = new BoostInfo(BTYPE_SPEED, "Spd", u, v, s, 1);
|
||||
m_textureAtlas.TextureIndexToCoord(texIceIndex, u, v, s, s);
|
||||
m_boostinfo[BTYPE_INVINCIBLE] = new BoostInfo(BTYPE_INVINCIBLE, "Inv", u, v, s, 1);
|
||||
|
||||
|
||||
|
||||
m_animeAtlas.TextureIndexToCoord(0, u, v, s, s);
|
||||
@ -1181,9 +1194,8 @@ void Engine::Render(float elapsedTime) {
|
||||
//m_remotePlayer.ApplyTransformation(remotePlayer, false);
|
||||
m_world.Update(m_bullets, m_player.GetPosition(), m_blockinfo);
|
||||
m_renderer.UpdateMesh(&m_world, m_player.GetPosition(), m_blockinfo);
|
||||
|
||||
m_remotePlayer.Render(m_animeAtlas, m_shader01, all, elapsedTime);
|
||||
|
||||
m_remotePlayer.Render(m_textureAtlas, m_shader01, all, elapsedTime);
|
||||
m_booster.RenderBillboard({ 120,20,120 }, m_textureAtlas, texBoostHeal, m_shader01, all);
|
||||
|
||||
if (m_isSkybox) m_renderer.RenderWorld(&m_world, m_renderCount, m_player.GetPosition(), m_player.GetDirection(), all, m_shader01, m_textureAtlas);
|
||||
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include <unordered_map>
|
||||
#include "../SQCSim-common/array2d.h"
|
||||
#include "../SQCSim-common/blockinfo.h"
|
||||
#include "../SQCSim-common/boostinfo.h"
|
||||
#include "../SQCSim-common/bullet.h"
|
||||
#include "../SQCSim-common/chunk.h"
|
||||
#include "../SQCSim-common/world.h"
|
||||
@ -22,6 +23,7 @@
|
||||
#include "connector.h"
|
||||
#include "renderer.h"
|
||||
#include "remoteplayer.h"
|
||||
#include "booster.h"
|
||||
|
||||
|
||||
class Engine : public OpenglContext {
|
||||
@ -68,11 +70,13 @@ private:
|
||||
Connector m_conn;
|
||||
Shader m_shader01;
|
||||
BlockInfo* m_blockinfo[BTYPE_LAST];
|
||||
BoostInfo* m_boostinfo[BTYPE_BOOST_LAST];
|
||||
TextureAtlas m_textureAtlas = TextureAtlas(BTYPE_LAST);
|
||||
TextureAtlas m_animeAtlas = TextureAtlas(TYPE_LAST + POS_LAST);
|
||||
|
||||
World m_world = World();
|
||||
Renderer m_renderer = Renderer();
|
||||
Booster m_booster = Booster();
|
||||
|
||||
Texture m_textureCrosshair;
|
||||
Texture m_textureFont;
|
||||
@ -84,6 +88,8 @@ private:
|
||||
Texture m_textureMultiText;
|
||||
Texture m_textureTitle;
|
||||
|
||||
TextureAtlas::TextureIndex texBoostHeal;
|
||||
|
||||
Skybox m_skybox;
|
||||
Audio m_audio = Audio(AUDIO_PATH "start.wav");
|
||||
|
||||
|
BIN
SQCSim2021/media/textures/Booster/BoosterVert.png
Normal file
BIN
SQCSim2021/media/textures/Booster/BoosterVert.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
@ -8,7 +8,6 @@
|
||||
#include "texture.h"
|
||||
#include "openglcontext.h"
|
||||
#include "vertexbuffer.h"
|
||||
#include "texture.h"
|
||||
#include "../SQCSim-common/matrix4.h"
|
||||
|
||||
class RemotePlayer : public Player {
|
||||
|
@ -1,4 +1,9 @@
|
||||
#include "renderer.h"
|
||||
#include <iostream>
|
||||
#include <cstring>
|
||||
|
||||
#include <thread>
|
||||
#include <queue>
|
||||
|
||||
Renderer::Renderer() {
|
||||
m_meshes.Reset(nullptr);
|
||||
@ -131,7 +136,8 @@ void Renderer::RenderWorld(World* origin, int& rendercount, const Vector3f& play
|
||||
}
|
||||
shader.Disable();
|
||||
glStencilFunc(GL_GREATER, 1, 0xFF);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
void Renderer::UpdateMesh(World* origin, const Vector3f& player, BlockInfo* blockinfo[BTYPE_LAST]) {
|
||||
int cx = player.x;
|
||||
@ -238,6 +244,30 @@ void Renderer::UpdateMesh(World* origin, const Vector3f& player, BlockInfo* bloc
|
||||
}
|
||||
}
|
||||
|
||||
void Renderer::RenderBillboard(const Vector3f pos, TextureAtlas textureAtlas, TextureAtlas::TextureIndex idx, Shader& shader, Transformation tran)
|
||||
{
|
||||
//float x = pos.x;
|
||||
//float y = pos.y;
|
||||
//float z = pos.z;
|
||||
//float width = 1.0f;
|
||||
//float height = 1.0f;
|
||||
|
||||
//float u, v, w, h;
|
||||
//shader.Use();
|
||||
//textureAtlas.Bind();
|
||||
//textureAtlas.TextureIndexToCoord(idx, u, v, w, h);
|
||||
|
||||
//glLoadMatrixf(tran.GetMatrix().GetInternalValues());
|
||||
//glBegin(GL_QUADS);
|
||||
//glTexCoord2f(u, v); glVertex3f(x - width / 2., y - height, z); //glVertex3f(v4.x, v4.y, v4.z);//glVertex3f(0, 50, 0);
|
||||
//glTexCoord2f(u + w, v); glVertex3f(x + width / 2., y - height, z); //glVertex3f(v3.x, v3.y, v3.z); //glVertex3f(50,50, 0);
|
||||
//glTexCoord2f(u + w, v + h); glVertex3f(x + width / 2., y, z); //glVertex3f(v2.x, v2.y, v2.z); //glVertex3f(50, 0, 0);
|
||||
//glTexCoord2f(u, v + h); glVertex3f(x - width / 2., y, z); //glVertex3f(v1.x, v1.y, v1.z);// glVertex3f(0, 0, 0);
|
||||
//glEnd();
|
||||
//shader.Disable();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Renderer::RenderPlayer(Player* player, Transformation tran) const {
|
||||
}
|
||||
|
@ -9,6 +9,9 @@
|
||||
#include "textureatlas.h"
|
||||
#include "shader.h"
|
||||
#include "remoteplayer.h"
|
||||
#include "openglcontext.h"
|
||||
#include "vertexbuffer.h"
|
||||
#include "../SQCSim-common/matrix4.h"
|
||||
|
||||
class Renderer {
|
||||
private:
|
||||
@ -16,6 +19,7 @@ private:
|
||||
|
||||
TextureAtlas* m_playertext = nullptr;
|
||||
Shader* m_playershader = nullptr;
|
||||
bool test = true;
|
||||
|
||||
public:
|
||||
Renderer();
|
||||
@ -25,6 +29,8 @@ public:
|
||||
|
||||
void UpdateMesh(World* origin, const Vector3f& player, BlockInfo* blockinfo[BTYPE_LAST]);
|
||||
|
||||
void RenderBillboard(const Vector3f pos, TextureAtlas textureAtlas, TextureAtlas::TextureIndex idx, Shader& shader, Transformation tran);
|
||||
|
||||
void RenderWorld(World* origin, int& rendercount, const Vector3f& player_pos, const Vector3f& player_dir, Transformation world, Shader& shader, TextureAtlas& atlas) const;
|
||||
void RenderPlayer(Player* player, Transformation tran) const;
|
||||
void RenderPlayer(RemotePlayer* rplayer, const Vector3f& player_pos, const Vector3f& player_dir) const;
|
||||
|
Loading…
Reference in New Issue
Block a user