Socket côté client!
This commit is contained in:
parent
3ff2634e51
commit
8bc74624c3
@ -12,6 +12,7 @@
|
|||||||
#define CHUNK_SIZE_Z 4
|
#define CHUNK_SIZE_Z 4
|
||||||
#define MAX_SELECTION_DISTANCE 5
|
#define MAX_SELECTION_DISTANCE 5
|
||||||
#define SEED 12345
|
#define SEED 12345
|
||||||
|
#define COUNTDOWN 300
|
||||||
|
|
||||||
#define WORLD_SIZE_X 64
|
#define WORLD_SIZE_X 64
|
||||||
#define WORLD_SIZE_Y 64
|
#define WORLD_SIZE_Y 64
|
||||||
|
@ -38,7 +38,6 @@
|
|||||||
<ClInclude Include="textureatlas.h" />
|
<ClInclude Include="textureatlas.h" />
|
||||||
<ClInclude Include="tool.h" />
|
<ClInclude Include="tool.h" />
|
||||||
<ClInclude Include="transformation.h" />
|
<ClInclude Include="transformation.h" />
|
||||||
<ClInclude Include="vector3.h" />
|
|
||||||
<ClInclude Include="vertexbuffer.h" />
|
<ClInclude Include="vertexbuffer.h" />
|
||||||
<ClInclude Include="world.h" />
|
<ClInclude Include="world.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
@ -62,6 +61,11 @@
|
|||||||
<ClCompile Include="vertexbuffer.cpp" />
|
<ClCompile Include="vertexbuffer.cpp" />
|
||||||
<ClCompile Include="world.cpp" />
|
<ClCompile Include="world.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\SQCSim-common\SQCSim-common.vcxproj">
|
||||||
|
<Project>{ee91ab12-4225-4a4d-931d-69d72f6d91fb}</Project>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
<PropertyGroup Label="Globals">
|
<PropertyGroup Label="Globals">
|
||||||
<ProjectGuid>{A21FD938-1FEA-4687-AB86-0EABAC30877B}</ProjectGuid>
|
<ProjectGuid>{A21FD938-1FEA-4687-AB86-0EABAC30877B}</ProjectGuid>
|
||||||
<Keyword>Win32Proj</Keyword>
|
<Keyword>Win32Proj</Keyword>
|
||||||
|
@ -38,9 +38,6 @@
|
|||||||
<ClInclude Include="transformation.h">
|
<ClInclude Include="transformation.h">
|
||||||
<Filter>Fichiers d%27en-tête</Filter>
|
<Filter>Fichiers d%27en-tête</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="vector3.h">
|
|
||||||
<Filter>Fichiers d%27en-tête</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="player.h">
|
<ClInclude Include="player.h">
|
||||||
<Filter>Fichiers d%27en-tête</Filter>
|
<Filter>Fichiers d%27en-tête</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include <irrKlang.h>
|
#include <irrKlang.h>
|
||||||
#include <ik_ISoundSource.h>
|
#include <ik_ISoundSource.h>
|
||||||
#include "define.h"
|
#include "define.h"
|
||||||
#include "vector3.h"
|
#include "../SQCSim-common/vector3.h"
|
||||||
|
|
||||||
class Audio {
|
class Audio {
|
||||||
private:
|
private:
|
||||||
|
@ -1,18 +1,51 @@
|
|||||||
#include "connector.h"
|
#include "connector.h"
|
||||||
|
|
||||||
Connector::Connector()
|
Connector::Connector() {}
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
Connector::~Connector()
|
Connector::~Connector() {}
|
||||||
{
|
|
||||||
}
|
int Connector::Init() {
|
||||||
|
#ifdef _WIN32
|
||||||
|
if (WSAStartup(MAKEWORD(2, 2), &m_wsaData) != 0) { /* Initialisation de l'environnement reseau (Windows only) */
|
||||||
|
std::cout << "Initialisation WinSock." << std::endl;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
m_sock_udp = socket(AF_INET, SOCK_DGRAM, 0);
|
||||||
|
if (m_sock_udp == INVALID_SOCKET) { /* Creation du socket UDP */
|
||||||
|
std::cout << "Creation Socket UDP." << std::endl;
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_sock_tcp = socket(AF_INET, SOCK_STREAM, 0);
|
||||||
|
if (m_sock_tcp == INVALID_SOCKET) { /* Creation du socket TCP */
|
||||||
|
std::cout << "Creation Socket TCP." << std::endl;
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Creation structure donnes descripteur du socket serveur */
|
||||||
|
sockaddr_in addr;
|
||||||
|
addr.sin_family = AF_INET;
|
||||||
|
addr.sin_port = htons(SRV_PORT);
|
||||||
|
addr.sin_addr.s_addr = htonl(INADDR_ANY);
|
||||||
|
|
||||||
|
if (bind(m_sock_udp, (sockaddr*)&addr, sizeof(addr)) != 0) { /* Associer le socket UDP au port */
|
||||||
|
std::cout << "Association Socket UDP." << std::endl;
|
||||||
|
return 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bind(m_sock_tcp, (sockaddr*)&addr, sizeof(addr)) != 0) { /* Associer le socket TCP au port */
|
||||||
|
std::cout << "Association Socket TCP." << std::endl;
|
||||||
|
return 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::cout << "It is the voork!" << std::endl;
|
||||||
|
|
||||||
int Connector::Init(sockaddr_in srv_addr) {
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Connector::Connect(std::string name) {
|
int Connector::Connect(sockaddr_in srv_addr, std::string name) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,41 +2,26 @@
|
|||||||
#define CONNECTOR_H__
|
#define CONNECTOR_H__
|
||||||
|
|
||||||
#include "define.h"
|
#include "define.h"
|
||||||
#include "vector3.h"
|
#include "../SQCSim-common/netprotocol.h"
|
||||||
|
|
||||||
struct Input { // vers serveur
|
|
||||||
Timestamp timestamp;
|
|
||||||
UINT8 keys; // 0bFBLRJS__
|
|
||||||
Vector3f direction;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct Output { // autres joueurs du serveur
|
|
||||||
Timestamp timestamp;
|
|
||||||
UINT64 id = 0;
|
|
||||||
Vector3f position, direction;
|
|
||||||
bool is_shooting, is_jumping;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct Sync { // du serveur
|
|
||||||
Timestamp timestamp;
|
|
||||||
UINT64 sid = 0;
|
|
||||||
Vector3f position;
|
|
||||||
};
|
|
||||||
|
|
||||||
class Connector {
|
class Connector {
|
||||||
public:
|
public:
|
||||||
Connector();
|
Connector();
|
||||||
~Connector();
|
~Connector();
|
||||||
|
|
||||||
int Init(sockaddr_in srv_addr);
|
int Init();
|
||||||
int Connect(std::string name);
|
int Connect(sockaddr_in srv_addr, std::string name);
|
||||||
UINT64 getId() const;
|
UINT64 getId() const;
|
||||||
unsigned int getSeed() const;
|
unsigned int getSeed() const;
|
||||||
|
|
||||||
//void SendInput();
|
//void SendInput();
|
||||||
//int Sync();
|
//int Sync();
|
||||||
private:
|
private:
|
||||||
SOCKET m_sock = 0;
|
#ifdef _WIN32
|
||||||
|
WSADATA m_wsaData;
|
||||||
|
#endif
|
||||||
|
SOCKET m_sock_udp = 0,
|
||||||
|
m_sock_tcp = 0;
|
||||||
std::string m_name = "";
|
std::string m_name = "";
|
||||||
UINT64 m_sid = 0,
|
UINT64 m_sid = 0,
|
||||||
m_tid = 0;
|
m_tid = 0;
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
#ifndef DEFINE_H__
|
#ifndef CLI_DEFINE_H__
|
||||||
#define DEFINE_H__
|
#define CLI_DEFINE_H__
|
||||||
|
|
||||||
#include <SFML/Window.hpp>
|
#include <SFML/Window.hpp>
|
||||||
#include <SFML/Graphics.hpp>
|
#include <SFML/Graphics.hpp>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
|
#include "../SQCSim-common/define.h"
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
@ -14,21 +15,11 @@
|
|||||||
#include <gl/GLU.h>
|
#include <gl/GLU.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define NETWORK_TEST false
|
|
||||||
|
|
||||||
|
#define NETWORK_TEST true
|
||||||
#define SRV_ADDR "127.0.0.1"
|
#define SRV_ADDR "127.0.0.1"
|
||||||
#define SRV_PORT 1025
|
#define COUNTDOWN 300
|
||||||
#define CLI_PORT 1026
|
|
||||||
|
|
||||||
#define CHUNK_SIZE_X 4
|
|
||||||
#define CHUNK_SIZE_Y 64
|
|
||||||
#define CHUNK_SIZE_Z 4
|
|
||||||
#define MAX_SELECTION_DISTANCE 5
|
|
||||||
#define BASE_WIDTH 640
|
|
||||||
#define BASE_HEIGHT 480
|
|
||||||
#define SEED 12345
|
|
||||||
|
|
||||||
#define WORLD_SIZE_X 64
|
|
||||||
#define WORLD_SIZE_Y 64
|
|
||||||
|
|
||||||
#define FRAMES_RENDER_CHUNKS 1
|
#define FRAMES_RENDER_CHUNKS 1
|
||||||
#define FRAMES_UPDATE_CHUNKS 1
|
#define FRAMES_UPDATE_CHUNKS 1
|
||||||
@ -38,39 +29,8 @@
|
|||||||
#define THREADS_UPDATE_CHUNKS 3
|
#define THREADS_UPDATE_CHUNKS 3
|
||||||
#define THREADS_DELETE_CHUNKS 3
|
#define THREADS_DELETE_CHUNKS 3
|
||||||
|
|
||||||
#define VIEW_DISTANCE 512
|
#define BASE_WIDTH 640
|
||||||
#define TEXTURE_SIZE 512
|
#define BASE_HEIGHT 480
|
||||||
#define MAX_BULLETS 512
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
|
|
||||||
#pragma comment(lib,"wsock32.lib") // Pour pouvoir faire fonctionner le linker sans le vcxproject
|
|
||||||
|
|
||||||
#include <Windows.h>
|
|
||||||
#include <cstdio>
|
|
||||||
#include <ctime>
|
|
||||||
|
|
||||||
#define popen _popen
|
|
||||||
#define pclose _pclose
|
|
||||||
|
|
||||||
#else // Pas _WIN32
|
|
||||||
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <time.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <sys/socket.h>
|
|
||||||
#include <arpa/inet.h>
|
|
||||||
#include <netinet/in.h>
|
|
||||||
|
|
||||||
#define SOCKET int
|
|
||||||
#define INVALID_SOCKET -1
|
|
||||||
#define closesocket close
|
|
||||||
|
|
||||||
#endif // _WIN32
|
|
||||||
|
|
||||||
typedef uint8_t BlockType;
|
|
||||||
enum BLOCK_TYPE { BTYPE_AIR, BTYPE_DIRT, BTYPE_GRASS, BTYPE_METAL, BTYPE_ICE, BTYPE_LAST };
|
|
||||||
typedef std::chrono::system_clock::time_point Timestamp;
|
|
||||||
|
|
||||||
#define TEXTURE_PATH "./media/textures/"
|
#define TEXTURE_PATH "./media/textures/"
|
||||||
#define SHADER_PATH "./media/shaders/"
|
#define SHADER_PATH "./media/shaders/"
|
||||||
|
@ -55,11 +55,11 @@ void Engine::Init() {
|
|||||||
addr.sin_port = htons(SRV_PORT);
|
addr.sin_port = htons(SRV_PORT);
|
||||||
addr.sin_addr.s_addr = inet_addr(srvaddr);
|
addr.sin_addr.s_addr = inet_addr(srvaddr);
|
||||||
|
|
||||||
if (!m_conn->Init(addr)) {
|
if (!m_conn.Init()) {
|
||||||
if (m_conn->Connect(playname)) {
|
if (m_conn.Connect(addr, playname)) {
|
||||||
// setup jeu en réseau.
|
// setup jeu en réseau.
|
||||||
seed = m_conn->getSeed();
|
seed = m_conn.getSeed();
|
||||||
std::cout << "ID reçu du serveur: " << std::to_string(m_conn->getId()) << "!" << std::endl;
|
std::cout << "ID reçu du serveur: " << std::to_string(m_conn.getId()) << "!" << std::endl;
|
||||||
}
|
}
|
||||||
else std::cout << "Erreur de connexion." << std::endl;
|
else std::cout << "Erreur de connexion." << std::endl;
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ private:
|
|||||||
void DrawHud(float elapsedTime, BlockType bloc);
|
void DrawHud(float elapsedTime, BlockType bloc);
|
||||||
void PrintText(float x, float y, float scale, const std::string& t);
|
void PrintText(float x, float y, float scale, const std::string& t);
|
||||||
|
|
||||||
Connector* m_conn = nullptr;
|
Connector m_conn;
|
||||||
Shader m_shader01;
|
Shader m_shader01;
|
||||||
BlockInfo* m_blockinfo[BTYPE_LAST];
|
BlockInfo* m_blockinfo[BTYPE_LAST];
|
||||||
TextureAtlas m_textureAtlas = TextureAtlas(BTYPE_LAST);
|
TextureAtlas m_textureAtlas = TextureAtlas(BTYPE_LAST);
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "define.h"
|
#include "define.h"
|
||||||
#include "vector3.h"
|
#include "../SQCSim-common/vector3.h"
|
||||||
|
|
||||||
#ifndef M_PI
|
#ifndef M_PI
|
||||||
#define M_PI 3.14159265f
|
#define M_PI 3.14159265f
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#ifndef _PLAYER_H__
|
#ifndef _PLAYER_H__
|
||||||
#define _PLAYER_H__
|
#define _PLAYER_H__
|
||||||
#include "vector3.h"
|
#include "../SQCSim-common/vector3.h"
|
||||||
#include "transformation.h"
|
#include "transformation.h"
|
||||||
#include "audio.h"
|
#include "audio.h"
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#define TRANSFORMATION_H__
|
#define TRANSFORMATION_H__
|
||||||
|
|
||||||
#include "matrix4.h"
|
#include "matrix4.h"
|
||||||
#include "vector3.h"
|
#include "../SQCSim-common/vector3.h"
|
||||||
#include <stack>
|
#include <stack>
|
||||||
|
|
||||||
class Transformation
|
class Transformation
|
||||||
|
@ -1,219 +0,0 @@
|
|||||||
#ifndef VECTOR3_H__
|
|
||||||
#define VECTOR3_H__
|
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include <cmath>
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
class Vector3
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
Vector3();
|
|
||||||
Vector3(const T& x, const T& y, const T& z);
|
|
||||||
~Vector3();
|
|
||||||
|
|
||||||
T Length() const;
|
|
||||||
void Normalize();
|
|
||||||
void Zero();
|
|
||||||
|
|
||||||
T Dot(const Vector3<T>& v) const;
|
|
||||||
Vector3<T> Cross(const Vector3<T>& v) const;
|
|
||||||
|
|
||||||
Vector3<T> operator+(const Vector3<T>& v) const;
|
|
||||||
Vector3<T> operator-(const Vector3<T>& v) const;
|
|
||||||
Vector3<T> operator-() const;
|
|
||||||
Vector3<T> operator+(const T& v) const;
|
|
||||||
Vector3<T> operator-(const T& v) const;
|
|
||||||
Vector3<T> operator/(const T& v) const;
|
|
||||||
Vector3<T> operator*(const T& v) const;
|
|
||||||
|
|
||||||
Vector3<T>& operator=(const Vector3<T>& v);
|
|
||||||
|
|
||||||
Vector3<T>& operator+=(const Vector3<T>& v);
|
|
||||||
Vector3<T>& operator-=(const Vector3<T>& v);
|
|
||||||
Vector3<T>& operator+=(const T& v);
|
|
||||||
Vector3<T>& operator-=(const T& v);
|
|
||||||
Vector3<T>& operator/=(const T& v);
|
|
||||||
Vector3<T>& operator*=(const T& v);
|
|
||||||
|
|
||||||
bool operator==(const Vector3<T>& v) const;
|
|
||||||
bool operator!=(const Vector3<T>& v) const;
|
|
||||||
|
|
||||||
void Afficher() const;
|
|
||||||
|
|
||||||
public:
|
|
||||||
T x, y, z;
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef Vector3<int> Vector3i;
|
|
||||||
typedef Vector3<float> Vector3f;
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
inline std::ostream& operator<<(std::ostream& out, const Vector3<T>& v)
|
|
||||||
{
|
|
||||||
out << "[" << v.x << ", " << v.y << ", " << v.z << "]";
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
Vector3<T>::Vector3()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
Vector3<T>::Vector3(const T& x, const T& y, const T& z) : x(x), y(y), z(z)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
Vector3<T>::~Vector3()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
T Vector3<T>::Length() const
|
|
||||||
{
|
|
||||||
return sqrt(x*x + y*y + z*z);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
void Vector3<T>::Normalize()
|
|
||||||
{
|
|
||||||
T len = Length();
|
|
||||||
if (len != 0)
|
|
||||||
{
|
|
||||||
x /= len;
|
|
||||||
y /= len;
|
|
||||||
z /= len;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
void Vector3<T>::Zero()
|
|
||||||
{
|
|
||||||
x = y = z = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
T Vector3<T>::Dot(const Vector3<T>& v) const
|
|
||||||
{
|
|
||||||
return (x * v.x) + (y * v.y) + (z * v.z);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
Vector3<T> Vector3<T>::Cross(const Vector3<T>& v) const
|
|
||||||
{
|
|
||||||
return Vector3<T>(
|
|
||||||
y * v.z - v.y * z,
|
|
||||||
z * v.x - v.z * x,
|
|
||||||
x * v.y - v.x * y);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
Vector3<T> Vector3<T>::operator+(const Vector3<T>& v) const
|
|
||||||
{
|
|
||||||
return Vector3<T>(x + v.x, y + v.y, z + v.z);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
Vector3<T> Vector3<T>::operator-(const Vector3<T>& v) const
|
|
||||||
{
|
|
||||||
return Vector3<T>(x - v.x, y - v.y, z - v.z);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
Vector3<T> Vector3<T>::operator-() const
|
|
||||||
{
|
|
||||||
return Vector3<T>(-x, -y, -z);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
Vector3<T> Vector3<T>::operator+(const T& v) const
|
|
||||||
{
|
|
||||||
return Vector3<T>(x + v, y + v, z + v);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
Vector3<T> Vector3<T>::operator-(const T& v) const
|
|
||||||
{
|
|
||||||
return Vector3<T>(x - v, y - v, z - v);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
Vector3<T> Vector3<T>::operator/(const T& v) const
|
|
||||||
{
|
|
||||||
return Vector3<T>(x / v, y / v, z / v);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
Vector3<T> Vector3<T>::operator*(const T& v) const
|
|
||||||
{
|
|
||||||
return Vector3<T>(x * v, y * v, z * v);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
Vector3<T>& Vector3<T>::operator=(const Vector3<T>& v)
|
|
||||||
{
|
|
||||||
x = v.x;
|
|
||||||
y = v.y;
|
|
||||||
z = v.z;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
Vector3<T>& Vector3<T>::operator+=(const Vector3<T>& v)
|
|
||||||
{
|
|
||||||
return (*this = *this + v);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
Vector3<T>& Vector3<T>::operator-=(const Vector3<T>& v)
|
|
||||||
{
|
|
||||||
return (*this = *this - v);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
Vector3<T>& Vector3<T>::operator+=(const T& v)
|
|
||||||
{
|
|
||||||
return (*this = *this + v);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
Vector3<T>& Vector3<T>::operator-=(const T& v)
|
|
||||||
{
|
|
||||||
return (*this = *this - v);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
Vector3<T>& Vector3<T>::operator/=(const T& v)
|
|
||||||
{
|
|
||||||
return (*this = *this / v);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
Vector3<T>& Vector3<T>::operator*=(const T& v)
|
|
||||||
{
|
|
||||||
return (*this = *this * v);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
bool Vector3<T>::operator==(const Vector3<T>& v) const
|
|
||||||
{
|
|
||||||
return (x == v.x && y == v.y && z == v.z);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
bool Vector3<T>::operator!=(const Vector3<T>& v) const
|
|
||||||
{
|
|
||||||
return !(*this == v);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
void Vector3<T>::Afficher() const
|
|
||||||
{
|
|
||||||
std::cout << "[" << x << ", " << y << ", " << z << "]" << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endif // VECTOR3_H__
|
|
@ -8,7 +8,7 @@
|
|||||||
#include "define.h"
|
#include "define.h"
|
||||||
#include "chunk.h"
|
#include "chunk.h"
|
||||||
#include "array2d.h"
|
#include "array2d.h"
|
||||||
#include "vector3.h"
|
#include "../SQCSim-common/vector3.h"
|
||||||
#include "player.h"
|
#include "player.h"
|
||||||
#include "transformation.h"
|
#include "transformation.h"
|
||||||
#include "shader.h"
|
#include "shader.h"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user