mirror of
https://github.com/rwengine/openrw.git
synced 2024-09-18 16:32:32 +02:00
Move first of lower level code into rwlib; tear out GLEW.
This commit is contained in:
parent
e2bd2b704e
commit
14269d8ae5
@ -47,7 +47,7 @@ IF(BUILD_OLD_TOOLS)
|
|||||||
add_subdirectory(datadump)
|
add_subdirectory(datadump)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
add_subdirectory(rwlib)
|
||||||
add_subdirectory(rwengine)
|
add_subdirectory(rwengine)
|
||||||
add_subdirectory(rwgame)
|
add_subdirectory(rwgame)
|
||||||
|
|
||||||
@ -60,4 +60,4 @@ ENDIF()
|
|||||||
|
|
||||||
IF(${BUILD_TESTS})
|
IF(${BUILD_TESTS})
|
||||||
add_subdirectory(tests)
|
add_subdirectory(tests)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
@ -10,9 +10,9 @@ add_library(rwengine
|
|||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(rwengine
|
target_link_libraries(rwengine
|
||||||
|
rwlib
|
||||||
sfml-window
|
sfml-window
|
||||||
sfml-audio
|
sfml-audio
|
||||||
GLEW
|
|
||||||
mad
|
mad
|
||||||
${OPENRW_PLATFORM_LIBS})
|
${OPENRW_PLATFORM_LIBS})
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#include <glm/gtc/quaternion.hpp>
|
#include <glm/gtc/quaternion.hpp>
|
||||||
#include <data/PathData.hpp>
|
#include <data/PathData.hpp>
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <engine/RWTypes.hpp>
|
#include <rw/types.hpp>
|
||||||
|
|
||||||
struct AIGraphNode;
|
struct AIGraphNode;
|
||||||
|
|
||||||
|
@ -4,9 +4,9 @@
|
|||||||
|
|
||||||
class Logger;
|
class Logger;
|
||||||
|
|
||||||
#include <engine/RWTypes.hpp>
|
#include <rw/types.hpp>
|
||||||
#include <loaders/LoaderIMG.hpp>
|
#include <loaders/LoaderIMG.hpp>
|
||||||
#include <loaders/TextureLoader.hpp>
|
#include <loaders/LoaderTXD.hpp>
|
||||||
#include <loaders/LoaderDFF.hpp>
|
#include <loaders/LoaderDFF.hpp>
|
||||||
#include <loaders/LoaderIDE.hpp>
|
#include <loaders/LoaderIDE.hpp>
|
||||||
#include <loaders/LoaderIFP.hpp>
|
#include <loaders/LoaderIFP.hpp>
|
||||||
@ -17,8 +17,8 @@ class Logger;
|
|||||||
#include <data/ZoneData.hpp>
|
#include <data/ZoneData.hpp>
|
||||||
|
|
||||||
#include <audio/MADStream.hpp>
|
#include <audio/MADStream.hpp>
|
||||||
#include <render/TextureData.hpp>
|
#include <gl/TextureData.hpp>
|
||||||
#include <core/FileIndex.hpp>
|
#include <platform/FileIndex.hpp>
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
@ -154,14 +154,6 @@ public:
|
|||||||
|
|
||||||
FileHandle openFile(const std::string& name);
|
FileHandle openFile(const std::string& name);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief getAtlas Returns atlas i, creating it if the situation calls for it.
|
|
||||||
* "the situation" being the last atlas has more than 0 textures packed.
|
|
||||||
* @param i
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
TextureAtlas* getAtlas(size_t i);
|
|
||||||
|
|
||||||
TextureData::Handle findTexture( const std::string& name, const std::string& alpha = "" )
|
TextureData::Handle findTexture( const std::string& name, const std::string& alpha = "" )
|
||||||
{
|
{
|
||||||
return textures[{name, alpha}];
|
return textures[{name, alpha}];
|
||||||
|
@ -5,8 +5,6 @@
|
|||||||
class PlayerController;
|
class PlayerController;
|
||||||
class Logger;
|
class Logger;
|
||||||
|
|
||||||
#include <GL/glew.h>
|
|
||||||
|
|
||||||
class GameData;
|
class GameData;
|
||||||
class GameState;
|
class GameState;
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#ifndef _SAVEGAME_HPP_
|
#ifndef _SAVEGAME_HPP_
|
||||||
#define _SAVEGAME_HPP_
|
#define _SAVEGAME_HPP_
|
||||||
|
|
||||||
#include <engine/RWTypes.hpp>
|
#include <rw/types.hpp>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@ -48,4 +48,4 @@ public:
|
|||||||
static std::vector<SaveGameInfo> getAllSaveGameInfo();
|
static std::vector<SaveGameInfo> getAllSaveGameInfo();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <WorkContext.hpp>
|
#include <job/WorkContext.hpp>
|
||||||
#include <data/ResourceHandle.hpp>
|
#include <data/ResourceHandle.hpp>
|
||||||
#include <core/FileIndex.hpp>
|
#include <platform/FileIndex.hpp>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of a worker that loads a resource in the background.
|
* Implementation of a worker that loads a resource in the background.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#ifndef _LOADERCUTSCENEDAT_HPP_
|
#ifndef _LOADERCUTSCENEDAT_HPP_
|
||||||
#define _LOADERCUTSCENEDAT_HPP_
|
#define _LOADERCUTSCENEDAT_HPP_
|
||||||
#include <core/FileHandle.hpp>
|
#include <platform/FileHandle.hpp>
|
||||||
#include <data/CutsceneData.hpp>
|
#include <data/CutsceneData.hpp>
|
||||||
|
|
||||||
class LoaderCutsceneDAT
|
class LoaderCutsceneDAT
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#ifndef _LOADERGXT_HPP_
|
#ifndef _LOADERGXT_HPP_
|
||||||
#define _LOADERGXT_HPP_
|
#define _LOADERGXT_HPP_
|
||||||
#include <core/FileHandle.hpp>
|
#include <platform/FileHandle.hpp>
|
||||||
#include <data/GameTexts.hpp>
|
#include <data/GameTexts.hpp>
|
||||||
|
|
||||||
class LoaderGXT
|
class LoaderGXT
|
||||||
|
@ -1,40 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
#ifndef _TEXTURELOADER_HPP_
|
|
||||||
#define _TEXTURELOADER_HPP_
|
|
||||||
|
|
||||||
#define GLEW_STATIC
|
|
||||||
#include <GL/glew.h>
|
|
||||||
|
|
||||||
#include <loaders/rwbinarystream.h>
|
|
||||||
|
|
||||||
#include <WorkContext.hpp>
|
|
||||||
#include <core/FileHandle.hpp>
|
|
||||||
#include <functional>
|
|
||||||
#include <string>
|
|
||||||
#include <map>
|
|
||||||
|
|
||||||
class GameData;
|
|
||||||
|
|
||||||
class TextureLoader
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
bool loadFromMemory(FileHandle file, GameData* gameData);
|
|
||||||
};
|
|
||||||
|
|
||||||
// TODO: refactor this interface to be more like ModelLoader so they can be rolled into one.
|
|
||||||
class LoadTextureArchiveJob : public WorkJob
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
GameData* _gameData;
|
|
||||||
std::string _file;
|
|
||||||
FileHandle data;
|
|
||||||
public:
|
|
||||||
|
|
||||||
LoadTextureArchiveJob(WorkContext* context, GameData* gd, const std::string& file);
|
|
||||||
|
|
||||||
void work();
|
|
||||||
|
|
||||||
void complete();
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
@ -2,7 +2,7 @@
|
|||||||
#ifndef _WEATHERLOADER_HPP_
|
#ifndef _WEATHERLOADER_HPP_
|
||||||
#define _WEATHERLOADER_HPP_
|
#define _WEATHERLOADER_HPP_
|
||||||
|
|
||||||
#include <engine/RWTypes.hpp>
|
#include <rw/types.hpp>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
@ -2,11 +2,11 @@
|
|||||||
#ifndef _GAMEOBJECT_HPP_
|
#ifndef _GAMEOBJECT_HPP_
|
||||||
#define _GAMEOBJECT_HPP_
|
#define _GAMEOBJECT_HPP_
|
||||||
|
|
||||||
#include <engine/RWTypes.hpp>
|
#include <rw/types.hpp>
|
||||||
#include <objects/ObjectTypes.hpp>
|
#include <objects/ObjectTypes.hpp>
|
||||||
#include <loaders/LoaderIDE.hpp>
|
#include <loaders/LoaderIDE.hpp>
|
||||||
#include <loaders/LoaderIPL.hpp>
|
#include <loaders/LoaderIPL.hpp>
|
||||||
#include <render/Model.hpp>
|
#include <data/Model.hpp>
|
||||||
#include <glm/gtc/quaternion.hpp>
|
#include <glm/gtc/quaternion.hpp>
|
||||||
#include <glm/gtc/matrix_transform.hpp>
|
#include <glm/gtc/matrix_transform.hpp>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include <LinearMath/btIDebugDraw.h>
|
#include <LinearMath/btIDebugDraw.h>
|
||||||
#include <render/GameRenderer.hpp>
|
#include <render/GameRenderer.hpp>
|
||||||
#include "Model.hpp"
|
#include <data/Model.hpp>
|
||||||
|
|
||||||
class DebugDraw : public btIDebugDraw
|
class DebugDraw : public btIDebugDraw
|
||||||
{
|
{
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
|
|
||||||
class Logger;
|
class Logger;
|
||||||
|
|
||||||
#define GLEW_STATIC
|
#include <gl/gl_core_3_3.h>
|
||||||
#include <GL/glew.h>
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
#ifndef _OPENGLRENDERER_HPP_
|
#ifndef _OPENGLRENDERER_HPP_
|
||||||
#define _OPENGLRENDERER_HPP_
|
#define _OPENGLRENDERER_HPP_
|
||||||
|
|
||||||
#include <engine/RWTypes.hpp>
|
#include <rw/types.hpp>
|
||||||
#include <render/DrawBuffer.hpp>
|
#include <gl/DrawBuffer.hpp>
|
||||||
#include <render/GeometryBuffer.hpp>
|
#include <gl/GeometryBuffer.hpp>
|
||||||
|
|
||||||
// Maximum depth of debug group stack
|
// Maximum depth of debug group stack
|
||||||
#define MAX_DEBUG_DEPTH 5
|
#define MAX_DEBUG_DEPTH 5
|
||||||
|
@ -1,56 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
#ifndef _TEXTURE_ATLAS_HPP_
|
|
||||||
#define _TEXTURE_ATLAS_HPP_
|
|
||||||
#include <GL/glew.h>
|
|
||||||
|
|
||||||
class TextureAtlas
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @brief width Width of the backing texture.
|
|
||||||
*/
|
|
||||||
size_t width;
|
|
||||||
/**
|
|
||||||
* @brief height Height of the backing texture.
|
|
||||||
*/
|
|
||||||
size_t height;
|
|
||||||
|
|
||||||
GLuint textureName;
|
|
||||||
|
|
||||||
size_t X; // X edge of latest texture.
|
|
||||||
size_t Y; // Y of current row.
|
|
||||||
size_t rowHeight; // Maximum texture height for the current row.
|
|
||||||
|
|
||||||
size_t textureCount;
|
|
||||||
|
|
||||||
bool finalized;
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
TextureAtlas(size_t w, size_t h);
|
|
||||||
|
|
||||||
~TextureAtlas();
|
|
||||||
|
|
||||||
void packTexture(void* data, size_t w, size_t h, float& s, float& t, float& sX, float& sY);
|
|
||||||
|
|
||||||
void packTextureFormat(void* data, GLenum format, GLenum type, size_t w, size_t h, float& s, float& t, float& sX, float& sY);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief canPack Returns true if enough space remains in the atlas
|
|
||||||
* for the given texture sizes to be packed.
|
|
||||||
* @param w
|
|
||||||
* @param h
|
|
||||||
* @param n
|
|
||||||
* @return True on success, false on failure.
|
|
||||||
*/
|
|
||||||
bool canPack(size_t* w, size_t* h, size_t n) const;
|
|
||||||
|
|
||||||
size_t getTextureCount() const;
|
|
||||||
|
|
||||||
GLint getName() const;
|
|
||||||
|
|
||||||
bool isFinalized() const;
|
|
||||||
|
|
||||||
void finalize();
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <glm/glm.hpp>
|
#include <glm/glm.hpp>
|
||||||
#include "TextureData.hpp"
|
#include <gl/TextureData.hpp>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a scene effect: lighting, particles etc.
|
* Represents a scene effect: lighting, particles etc.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <engine/RWTypes.hpp>
|
#include <rw/types.hpp>
|
||||||
#include <render/OpenGLRenderer.hpp>
|
#include <render/OpenGLRenderer.hpp>
|
||||||
|
|
||||||
class GameRenderer;
|
class GameRenderer;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#include <objects/CharacterObject.hpp>
|
#include <objects/CharacterObject.hpp>
|
||||||
#include <objects/VehicleObject.hpp>
|
#include <objects/VehicleObject.hpp>
|
||||||
|
|
||||||
#include <render/Model.hpp>
|
#include <data/Model.hpp>
|
||||||
#include <engine/Animator.hpp>
|
#include <engine/Animator.hpp>
|
||||||
#include <items/WeaponItem.hpp>
|
#include <items/WeaponItem.hpp>
|
||||||
#include <boost/concept_check.hpp>
|
#include <boost/concept_check.hpp>
|
||||||
@ -390,7 +390,7 @@ bool Activities::ExitVehicle::update(CharacterObject *character, CharacterContro
|
|||||||
|
|
||||||
#include <engine/GameWorld.hpp>
|
#include <engine/GameWorld.hpp>
|
||||||
#include <engine/GameData.hpp>
|
#include <engine/GameData.hpp>
|
||||||
#include <render/Model.hpp>
|
#include <data/Model.hpp>
|
||||||
bool Activities::ShootWeapon::update(CharacterObject *character, CharacterController *controller)
|
bool Activities::ShootWeapon::update(CharacterObject *character, CharacterController *controller)
|
||||||
{
|
{
|
||||||
auto& wepdata = _item->getWeaponData();
|
auto& wepdata = _item->getWeaponData();
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#include <data/Skeleton.hpp>
|
#include <data/Skeleton.hpp>
|
||||||
#include <render/Model.hpp>
|
#include <data/Model.hpp>
|
||||||
#include <glm/gtc/matrix_transform.hpp>
|
#include <glm/gtc/matrix_transform.hpp>
|
||||||
|
|
||||||
Skeleton::FrameTransform Skeleton::IdentityTransform = { glm::vec3(0.f), glm::quat() };
|
Skeleton::FrameTransform Skeleton::IdentityTransform = { glm::vec3(0.f), glm::quat() };
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include <engine/Animator.hpp>
|
#include <engine/Animator.hpp>
|
||||||
#include <loaders/LoaderDFF.hpp>
|
#include <loaders/LoaderDFF.hpp>
|
||||||
#include <render/Model.hpp>
|
#include <data/Model.hpp>
|
||||||
#include <data/Skeleton.hpp>
|
#include <data/Skeleton.hpp>
|
||||||
#include <glm/gtc/matrix_transform.hpp>
|
#include <glm/gtc/matrix_transform.hpp>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
@ -4,12 +4,11 @@
|
|||||||
#include <loaders/LoaderIPL.hpp>
|
#include <loaders/LoaderIPL.hpp>
|
||||||
#include <loaders/LoaderDFF.hpp>
|
#include <loaders/LoaderDFF.hpp>
|
||||||
#include <loaders/LoaderIDE.hpp>
|
#include <loaders/LoaderIDE.hpp>
|
||||||
#include <render/TextureAtlas.hpp>
|
|
||||||
#include <loaders/LoaderCOL.hpp>
|
#include <loaders/LoaderCOL.hpp>
|
||||||
#include <data/ObjectData.hpp>
|
#include <data/ObjectData.hpp>
|
||||||
#include <data/WeaponData.hpp>
|
#include <data/WeaponData.hpp>
|
||||||
#include <script/SCMFile.hpp>
|
#include <script/SCMFile.hpp>
|
||||||
#include <render/Model.hpp>
|
#include <data/Model.hpp>
|
||||||
|
|
||||||
#include <loaders/GenericDATLoader.hpp>
|
#include <loaders/GenericDATLoader.hpp>
|
||||||
#include <loaders/LoaderGXT.hpp>
|
#include <loaders/LoaderGXT.hpp>
|
||||||
@ -423,7 +422,7 @@ void GameData::loadTXD(const std::string& name, bool async)
|
|||||||
|
|
||||||
loadedFiles[name] = true;
|
loadedFiles[name] = true;
|
||||||
|
|
||||||
auto j = new LoadTextureArchiveJob(workContext, this, name);
|
auto j = new LoadTextureArchiveJob(workContext, &index, textures, name);
|
||||||
|
|
||||||
if( async ) {
|
if( async ) {
|
||||||
workContext->queueJob( j );
|
workContext->queueJob( j );
|
||||||
@ -566,20 +565,6 @@ FileHandle GameData::openFile(const std::string &name)
|
|||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
|
|
||||||
TextureAtlas* GameData::getAtlas(size_t i)
|
|
||||||
{
|
|
||||||
if( i < atlases.size() ) {
|
|
||||||
return atlases[i];
|
|
||||||
}
|
|
||||||
if( i == atlases.size() && (i == 0 || atlases[i-1]->getTextureCount() > 0) ) {
|
|
||||||
GLint max_texture_size;
|
|
||||||
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max_texture_size);
|
|
||||||
atlases.push_back(new TextureAtlas(max_texture_size/2, max_texture_size/2));
|
|
||||||
return atlases[i];
|
|
||||||
}
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
int GameData::getWaterIndexAt(const glm::vec3 &ws) const
|
int GameData::getWaterIndexAt(const glm::vec3 &ws) const
|
||||||
{
|
{
|
||||||
auto wX = (int) ((ws.x + WATER_WORLD_SIZE/2.f) / (WATER_WORLD_SIZE/WATER_HQ_DATA_SIZE));
|
auto wX = (int) ((ws.x + WATER_WORLD_SIZE/2.f) / (WATER_WORLD_SIZE/WATER_HQ_DATA_SIZE));
|
||||||
|
@ -9,9 +9,9 @@
|
|||||||
#include <ai/DefaultAIController.hpp>
|
#include <ai/DefaultAIController.hpp>
|
||||||
#include <ai/TrafficDirector.hpp>
|
#include <ai/TrafficDirector.hpp>
|
||||||
#include <BulletCollision/CollisionDispatch/btGhostObject.h>
|
#include <BulletCollision/CollisionDispatch/btGhostObject.h>
|
||||||
#include <render/Model.hpp>
|
#include <data/Model.hpp>
|
||||||
#include <data/WeaponData.hpp>
|
#include <data/WeaponData.hpp>
|
||||||
#include <WorkContext.hpp>
|
#include <job/WorkContext.hpp>
|
||||||
|
|
||||||
// 3 isn't enough to cause a factory.
|
// 3 isn't enough to cause a factory.
|
||||||
#include <objects/CharacterObject.hpp>
|
#include <objects/CharacterObject.hpp>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include <items/WeaponItem.hpp>
|
#include <items/WeaponItem.hpp>
|
||||||
#include <objects/CharacterObject.hpp>
|
#include <objects/CharacterObject.hpp>
|
||||||
#include <ai/CharacterController.hpp>
|
#include <ai/CharacterController.hpp>
|
||||||
#include <render/Model.hpp>
|
#include <data/Model.hpp>
|
||||||
#include <engine/Animator.hpp>
|
#include <engine/Animator.hpp>
|
||||||
#include <engine/GameWorld.hpp>
|
#include <engine/GameWorld.hpp>
|
||||||
#include <objects/ProjectileObject.hpp>
|
#include <objects/ProjectileObject.hpp>
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#include <dynamics/RaycastCallbacks.hpp>
|
#include <dynamics/RaycastCallbacks.hpp>
|
||||||
#include <data/CollisionModel.hpp>
|
#include <data/CollisionModel.hpp>
|
||||||
#include <data/Skeleton.hpp>
|
#include <data/Skeleton.hpp>
|
||||||
#include <render/Model.hpp>
|
#include <data/Model.hpp>
|
||||||
#include <engine/Animator.hpp>
|
#include <engine/Animator.hpp>
|
||||||
#include <engine/GameData.hpp>
|
#include <engine/GameData.hpp>
|
||||||
|
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
#include "render/DebugDraw.hpp"
|
#include "render/DebugDraw.hpp"
|
||||||
|
|
||||||
#define GLEW_STATIC
|
|
||||||
#include <GL/glew.h>
|
|
||||||
|
|
||||||
#include <glm/glm.hpp>
|
#include <glm/glm.hpp>
|
||||||
#include <glm/gtc/matrix_transform.hpp>
|
#include <glm/gtc/matrix_transform.hpp>
|
||||||
#include <glm/gtc/type_ptr.hpp>
|
#include <glm/gtc/type_ptr.hpp>
|
||||||
|
@ -2,8 +2,7 @@
|
|||||||
#include <engine/GameWorld.hpp>
|
#include <engine/GameWorld.hpp>
|
||||||
#include <engine/Animator.hpp>
|
#include <engine/Animator.hpp>
|
||||||
#include <engine/GameState.hpp>
|
#include <engine/GameState.hpp>
|
||||||
#include <render/TextureAtlas.hpp>
|
#include <data/Model.hpp>
|
||||||
#include <render/Model.hpp>
|
|
||||||
|
|
||||||
#include <objects/CharacterObject.hpp>
|
#include <objects/CharacterObject.hpp>
|
||||||
#include <objects/InstanceObject.hpp>
|
#include <objects/InstanceObject.hpp>
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
#include <render/OpenGLRenderer.hpp>
|
#include <render/OpenGLRenderer.hpp>
|
||||||
#include <GL/glew.h>
|
|
||||||
#include <glm/gtc/type_ptr.hpp>
|
#include <glm/gtc/type_ptr.hpp>
|
||||||
#include <glm/gtc/matrix_transform.hpp>
|
#include <glm/gtc/matrix_transform.hpp>
|
||||||
|
|
||||||
@ -160,6 +159,9 @@ void OpenGLRenderer::useProgram(Renderer::ShaderProgram* p)
|
|||||||
OpenGLRenderer::OpenGLRenderer()
|
OpenGLRenderer::OpenGLRenderer()
|
||||||
: currentDbuff(nullptr), currentProgram(nullptr), currentDebugDepth(0)
|
: currentDbuff(nullptr), currentProgram(nullptr), currentDebugDepth(0)
|
||||||
{
|
{
|
||||||
|
// We need to query for some profiling exts.
|
||||||
|
ogl_CheckExtensions();
|
||||||
|
|
||||||
glGenBuffers(1, &UBOScene);
|
glGenBuffers(1, &UBOScene);
|
||||||
glGenBuffers(1, &UBOObject);
|
glGenBuffers(1, &UBOObject);
|
||||||
|
|
||||||
@ -327,7 +329,7 @@ void OpenGLRenderer::invalidate()
|
|||||||
void OpenGLRenderer::pushDebugGroup(const std::string& title)
|
void OpenGLRenderer::pushDebugGroup(const std::string& title)
|
||||||
{
|
{
|
||||||
#if RW_USING(RENDER_PROFILER)
|
#if RW_USING(RENDER_PROFILER)
|
||||||
if( GLEW_KHR_debug )
|
if( ogl_ext_KHR_debug )
|
||||||
{
|
{
|
||||||
glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 0, -1, title.c_str());
|
glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 0, -1, title.c_str());
|
||||||
ProfileInfo& prof = profileInfo[currentDebugDepth];
|
ProfileInfo& prof = profileInfo[currentDebugDepth];
|
||||||
@ -345,7 +347,7 @@ void OpenGLRenderer::pushDebugGroup(const std::string& title)
|
|||||||
const Renderer::ProfileInfo& OpenGLRenderer::popDebugGroup()
|
const Renderer::ProfileInfo& OpenGLRenderer::popDebugGroup()
|
||||||
{
|
{
|
||||||
#if RW_USING(RENDER_PROFILER)
|
#if RW_USING(RENDER_PROFILER)
|
||||||
if( GLEW_KHR_debug )
|
if( ogl_ext_KHR_debug )
|
||||||
{
|
{
|
||||||
glPopDebugGroup();
|
glPopDebugGroup();
|
||||||
currentDebugDepth--;
|
currentDebugDepth--;
|
||||||
|
@ -1,89 +0,0 @@
|
|||||||
#include <render/TextureAtlas.hpp>
|
|
||||||
#include <algorithm>
|
|
||||||
|
|
||||||
TextureAtlas::TextureAtlas(size_t w, size_t h)
|
|
||||||
: width(w), height(h), textureName(0), X(0), Y(0), rowHeight(0), textureCount(0), finalized(false)
|
|
||||||
{
|
|
||||||
glGenTextures(1, &textureName);
|
|
||||||
glBindTexture(GL_TEXTURE_2D, textureName);
|
|
||||||
glTexImage2D(
|
|
||||||
GL_TEXTURE_2D, 0, GL_RGBA,
|
|
||||||
width, height, 0,
|
|
||||||
GL_RGBA, GL_UNSIGNED_BYTE, nullptr
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
TextureAtlas::~TextureAtlas()
|
|
||||||
{
|
|
||||||
glDeleteTextures(1, &textureName);
|
|
||||||
}
|
|
||||||
|
|
||||||
void TextureAtlas::packTexture(void *data, size_t w, size_t h, float &s, float &t, float &sX, float &sY)
|
|
||||||
{
|
|
||||||
packTextureFormat(data, GL_RGBA, GL_UNSIGNED_BYTE, w, h, s, t, sX, sY);
|
|
||||||
}
|
|
||||||
|
|
||||||
void TextureAtlas::packTextureFormat(void *data, GLenum format, GLenum type, size_t w, size_t h, float &s, float &t, float &sX, float &sY)
|
|
||||||
{
|
|
||||||
// Ignore null pointer data for testing purposes.
|
|
||||||
if( data != nullptr )
|
|
||||||
{
|
|
||||||
glBindTexture(GL_TEXTURE_2D, textureName);
|
|
||||||
glTexSubImage2D(GL_TEXTURE_2D, 0, X, Y, w, h, format, type, data);
|
|
||||||
}
|
|
||||||
s = X/(float)width;
|
|
||||||
t = Y/(float)height;
|
|
||||||
sX = w/(float)width;
|
|
||||||
sY = h/(float)height;
|
|
||||||
|
|
||||||
rowHeight = std::max(rowHeight, h);
|
|
||||||
X += w;
|
|
||||||
if( X >= width ) {
|
|
||||||
Y += rowHeight;
|
|
||||||
X = rowHeight = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
textureCount++;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool TextureAtlas::canPack(size_t *w, size_t *h, size_t n) const
|
|
||||||
{
|
|
||||||
size_t rwHeight = rowHeight;
|
|
||||||
size_t lX = X, lY = Y;
|
|
||||||
for(size_t i = 0; i < n; ++i) {
|
|
||||||
lX += (w[i]);
|
|
||||||
rwHeight = std::max(rwHeight, h[i]);
|
|
||||||
if(lX >= width) {
|
|
||||||
lY += rwHeight;
|
|
||||||
lX = rwHeight = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(lX <= width && lY <= height) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t TextureAtlas::getTextureCount() const
|
|
||||||
{
|
|
||||||
return textureCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
GLint TextureAtlas::getName() const
|
|
||||||
{
|
|
||||||
return textureName;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool TextureAtlas::isFinalized() const
|
|
||||||
{
|
|
||||||
return finalized;
|
|
||||||
}
|
|
||||||
|
|
||||||
void TextureAtlas::finalize()
|
|
||||||
{
|
|
||||||
glBindTexture(GL_TEXTURE_2D, textureName);
|
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
|
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR_MIPMAP_LINEAR);
|
|
||||||
glGenerateMipmap(GL_TEXTURE_2D);
|
|
||||||
finalized = true;
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
#include <render/TextureData.hpp>
|
|
@ -7,7 +7,7 @@
|
|||||||
#include <objects/VehicleObject.hpp>
|
#include <objects/VehicleObject.hpp>
|
||||||
#include <objects/CharacterObject.hpp>
|
#include <objects/CharacterObject.hpp>
|
||||||
|
|
||||||
#include <render/Model.hpp>
|
#include <data/Model.hpp>
|
||||||
#include <engine/Animator.hpp>
|
#include <engine/Animator.hpp>
|
||||||
#include <engine/GameState.hpp>
|
#include <engine/GameState.hpp>
|
||||||
#include <engine/GameData.hpp>
|
#include <engine/GameData.hpp>
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#include <objects/VehicleObject.hpp>
|
#include <objects/VehicleObject.hpp>
|
||||||
#include <objects/CharacterObject.hpp>
|
#include <objects/CharacterObject.hpp>
|
||||||
|
|
||||||
#include <render/Model.hpp>
|
#include <data/Model.hpp>
|
||||||
#include <render/GameRenderer.hpp>
|
#include <render/GameRenderer.hpp>
|
||||||
#include <engine/Animator.hpp>
|
#include <engine/Animator.hpp>
|
||||||
#include <engine/GameState.hpp>
|
#include <engine/GameState.hpp>
|
||||||
|
@ -25,7 +25,6 @@ target_link_libraries( rwgame
|
|||||||
sfml-network
|
sfml-network
|
||||||
sfml-system
|
sfml-system
|
||||||
${OPENGL_LIBRARIES}
|
${OPENGL_LIBRARIES}
|
||||||
GLEW
|
|
||||||
${BULLET_LIBRARIES})
|
${BULLET_LIBRARIES})
|
||||||
|
|
||||||
install(TARGETS rwgame RUNTIME DESTINATION bin)
|
install(TARGETS rwgame RUNTIME DESTINATION bin)
|
||||||
|
@ -84,9 +84,6 @@ RWGame::RWGame(const std::string& gamepath, int argc, char* argv[])
|
|||||||
window.setVerticalSyncEnabled(true);
|
window.setVerticalSyncEnabled(true);
|
||||||
window.setMouseCursorVisible(false);
|
window.setMouseCursorVisible(false);
|
||||||
|
|
||||||
glewExperimental = GL_TRUE;
|
|
||||||
glewInit();
|
|
||||||
|
|
||||||
log.addReciever(&logPrinter);
|
log.addReciever(&logPrinter);
|
||||||
log.info("Game", "Game directory: " + gamepath);
|
log.info("Game", "Game directory: " + gamepath);
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#include <objects/CharacterObject.hpp>
|
#include <objects/CharacterObject.hpp>
|
||||||
#include <objects/VehicleObject.hpp>
|
#include <objects/VehicleObject.hpp>
|
||||||
#include <objects/ItemPickup.hpp>
|
#include <objects/ItemPickup.hpp>
|
||||||
#include <render/Model.hpp>
|
#include <data/Model.hpp>
|
||||||
#include <items/WeaponItem.hpp>
|
#include <items/WeaponItem.hpp>
|
||||||
#include <engine/GameWorld.hpp>
|
#include <engine/GameWorld.hpp>
|
||||||
#include <engine/GameState.hpp>
|
#include <engine/GameState.hpp>
|
||||||
|
@ -1,6 +1,3 @@
|
|||||||
#define GLEW_STATIC
|
|
||||||
#include <GL/glew.h>
|
|
||||||
|
|
||||||
#include "RWGame.hpp"
|
#include "RWGame.hpp"
|
||||||
|
|
||||||
std::string getGamePath()
|
std::string getGamePath()
|
||||||
|
51
rwlib/CMakeLists.txt
Normal file
51
rwlib/CMakeLists.txt
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
###########################################################
|
||||||
|
## RWLIB
|
||||||
|
###########################################################
|
||||||
|
SET(RWLIB_SOURCES
|
||||||
|
|
||||||
|
# GL stuff is only here temporarily, hoping to move it back to rwengine
|
||||||
|
"source/gl/gl_core_3_3.c"
|
||||||
|
"source/gl/gl_core_3_3.h"
|
||||||
|
"source/gl/DrawBuffer.hpp"
|
||||||
|
"source/gl/DrawBuffer.cpp"
|
||||||
|
"source/gl/GeometryBuffer.hpp"
|
||||||
|
"source/gl/GeometryBuffer.cpp"
|
||||||
|
"source/gl/TextureData.hpp"
|
||||||
|
"source/gl/TextureData.cpp"
|
||||||
|
|
||||||
|
"source/rw/types.hpp"
|
||||||
|
|
||||||
|
"source/platform/FileHandle.hpp"
|
||||||
|
"source/platform/FileIndex.hpp"
|
||||||
|
"source/platform/FileIndex.cpp"
|
||||||
|
|
||||||
|
"source/data/ResourceHandle.hpp"
|
||||||
|
"source/data/Model.hpp"
|
||||||
|
"source/data/Model.cpp"
|
||||||
|
|
||||||
|
"source/loaders/LoaderIMG.hpp"
|
||||||
|
"source/loaders/LoaderIMG.cpp"
|
||||||
|
"source/loaders/RWBinaryStream.hpp"
|
||||||
|
"source/loaders/LoaderDFF.hpp"
|
||||||
|
"source/loaders/LoaderDFF.cpp"
|
||||||
|
"source/loaders/LoaderTXD.hpp"
|
||||||
|
"source/loaders/LoaderTXD.cpp"
|
||||||
|
|
||||||
|
"source/job/WorkContext.hpp"
|
||||||
|
"source/job/WorkContext.cpp"
|
||||||
|
)
|
||||||
|
|
||||||
|
add_library(rwlib
|
||||||
|
|
||||||
|
${RWLIB_SOURCES}
|
||||||
|
)
|
||||||
|
|
||||||
|
include_directories(
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/source")
|
||||||
|
|
||||||
|
target_include_directories(rwlib
|
||||||
|
PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/source")
|
||||||
|
|
||||||
|
target_link_libraries(rwlib
|
||||||
|
${OPENGL_LIBRARIES}
|
||||||
|
${OPENRW_PLATFORM_LIBS})
|
BIN
rwlib/source/a.out
Executable file
BIN
rwlib/source/a.out
Executable file
Binary file not shown.
@ -1,5 +1,4 @@
|
|||||||
#include "render/Model.hpp"
|
#include "data/Model.hpp"
|
||||||
#include <GL/glew.h>
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include <glm/gtc/matrix_transform.hpp>
|
#include <glm/gtc/matrix_transform.hpp>
|
@ -6,13 +6,12 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <GL/glew.h>
|
|
||||||
|
|
||||||
#include <data/ResourceHandle.hpp>
|
#include <data/ResourceHandle.hpp>
|
||||||
#include <loaders/rwbinarystream.h>
|
#include <loaders/RWBinaryStream.hpp>
|
||||||
#include "DrawBuffer.hpp"
|
#include <gl/DrawBuffer.hpp>
|
||||||
#include "GeometryBuffer.hpp"
|
#include <gl/GeometryBuffer.hpp>
|
||||||
#include "TextureData.hpp"
|
#include <gl/TextureData.hpp>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ModelFrame stores the hierarchy of a model's geometry as well as default
|
* ModelFrame stores the hierarchy of a model's geometry as well as default
|
@ -1,5 +1,5 @@
|
|||||||
#include <render/DrawBuffer.hpp>
|
#include <gl/DrawBuffer.hpp>
|
||||||
#include <render/GeometryBuffer.hpp>
|
#include <gl/GeometryBuffer.hpp>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
/* TODO: Come up with a more elegant solution to "WHICH ARRAY IS IT?" */
|
/* TODO: Come up with a more elegant solution to "WHICH ARRAY IS IT?" */
|
@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#ifndef _DRAWBUFFER_HPP_
|
#ifndef _DRAWBUFFER_HPP_
|
||||||
#define _DRAWBUFFER_HPP_
|
#define _DRAWBUFFER_HPP_
|
||||||
#include <GL/glew.h>
|
#include <gl/gl_core_3_3.h>
|
||||||
|
|
||||||
class GeometryBuffer;
|
class GeometryBuffer;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
#include <render/GeometryBuffer.hpp>
|
#include <gl/GeometryBuffer.hpp>
|
||||||
|
|
||||||
GeometryBuffer::GeometryBuffer()
|
GeometryBuffer::GeometryBuffer()
|
||||||
: vbo(0), num(0)
|
: vbo(0), num(0)
|
@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#ifndef _GEOMETRYBUFFER_HPP_
|
#ifndef _GEOMETRYBUFFER_HPP_
|
||||||
#define _GEOMETRYBUFFER_HPP_
|
#define _GEOMETRYBUFFER_HPP_
|
||||||
#include <GL/glew.h>
|
#include <gl/gl_core_3_3.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
/**
|
/**
|
1
rwlib/source/gl/TextureData.cpp
Normal file
1
rwlib/source/gl/TextureData.cpp
Normal file
@ -0,0 +1 @@
|
|||||||
|
#include <gl/TextureData.hpp>
|
@ -1,5 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <GL/gl.h>
|
#include <gl/gl_core_3_3.h>
|
||||||
#include <glm/glm.hpp>
|
#include <glm/glm.hpp>
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
@ -31,4 +31,4 @@ private:
|
|||||||
GLuint texName;
|
GLuint texName;
|
||||||
glm::ivec2 size;
|
glm::ivec2 size;
|
||||||
bool hasAlpha;
|
bool hasAlpha;
|
||||||
};
|
};
|
4604
rwlib/source/gl/gl_core_3_3.c
Normal file
4604
rwlib/source/gl/gl_core_3_3.c
Normal file
File diff suppressed because it is too large
Load Diff
2370
rwlib/source/gl/gl_core_3_3.h
Normal file
2370
rwlib/source/gl/gl_core_3_3.h
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,4 @@
|
|||||||
#include <WorkContext.hpp>
|
#include <job/WorkContext.hpp>
|
||||||
#include <loaders/DataLoader.hpp>
|
|
||||||
|
|
||||||
void LoadWorker::start()
|
void LoadWorker::start()
|
||||||
{
|
{
|
@ -1,6 +1,5 @@
|
|||||||
#include <loaders/LoaderDFF.hpp>
|
#include <loaders/LoaderDFF.hpp>
|
||||||
#include <engine/GameData.hpp>
|
#include <data/Model.hpp>
|
||||||
#include <render/Model.hpp>
|
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
@ -2,16 +2,11 @@
|
|||||||
#ifndef _LOADERDFF_HPP_
|
#ifndef _LOADERDFF_HPP_
|
||||||
#define _LOADERDFF_HPP_
|
#define _LOADERDFF_HPP_
|
||||||
|
|
||||||
#define GLEW_STATIC
|
#include <loaders/RWBinaryStream.hpp>
|
||||||
#include <GL/glew.h>
|
|
||||||
|
|
||||||
#include <loaders/rwbinarystream.h>
|
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <WorkContext.hpp>
|
#include <platform/FileHandle.hpp>
|
||||||
#include <core/FileHandle.hpp>
|
|
||||||
#include <core/FileIndex.hpp>
|
|
||||||
#include <data/ResourceHandle.hpp>
|
#include <data/ResourceHandle.hpp>
|
||||||
|
|
||||||
class Model;
|
class Model;
|
@ -1,7 +1,5 @@
|
|||||||
#include <loaders/TextureLoader.hpp>
|
#include <loaders/LoaderTXD.hpp>
|
||||||
#include <engine/GameData.hpp>
|
#include <gl/TextureData.hpp>
|
||||||
#include <render/TextureAtlas.hpp>
|
|
||||||
#include <render/TextureData.hpp>
|
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
@ -184,7 +182,7 @@ TextureData::Handle createTexture(RW::BSTextureNative& texNative, RW::BinaryStre
|
|||||||
return TextureData::create( textureName, { texNative.width, texNative.height }, transparent );
|
return TextureData::create( textureName, { texNative.width, texNative.height }, transparent );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TextureLoader::loadFromMemory(FileHandle file, GameData *gameData)
|
bool TextureLoader::loadFromMemory(FileHandle file, TextureArchive &inTextures)
|
||||||
{
|
{
|
||||||
auto data = file->data;
|
auto data = file->data;
|
||||||
RW::BinaryStreamSection root(data);
|
RW::BinaryStreamSection root(data);
|
||||||
@ -205,26 +203,31 @@ bool TextureLoader::loadFromMemory(FileHandle file, GameData *gameData)
|
|||||||
|
|
||||||
auto texture = createTexture(texNative, rootSection);
|
auto texture = createTexture(texNative, rootSection);
|
||||||
|
|
||||||
gameData->textures[{name, alpha}] = texture;
|
inTextures[{name, alpha}] = texture;
|
||||||
|
|
||||||
if( !alpha.empty() ) {
|
if( !alpha.empty() ) {
|
||||||
gameData->textures[{name, ""}] = texture;
|
inTextures[{name, ""}] = texture;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO Move the Job system out of the loading code
|
||||||
|
#include <platform/FileIndex.hpp>
|
||||||
|
|
||||||
LoadTextureArchiveJob::LoadTextureArchiveJob(WorkContext *context, GameData *gd, const std::string &file)
|
LoadTextureArchiveJob::LoadTextureArchiveJob(WorkContext *context, FileIndex* index, TextureArchive &inTextures, const std::string &file)
|
||||||
: WorkJob(context), _gameData(gd), _file(file)
|
: WorkJob(context)
|
||||||
|
, archive(inTextures)
|
||||||
|
, fileIndex(index)
|
||||||
|
, _file(file)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadTextureArchiveJob::work()
|
void LoadTextureArchiveJob::work()
|
||||||
{
|
{
|
||||||
data = _gameData->openFile(_file);
|
data = fileIndex->openFile(_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadTextureArchiveJob::complete()
|
void LoadTextureArchiveJob::complete()
|
||||||
@ -232,6 +235,6 @@ void LoadTextureArchiveJob::complete()
|
|||||||
// TODO error status
|
// TODO error status
|
||||||
if(data) {
|
if(data) {
|
||||||
TextureLoader loader;
|
TextureLoader loader;
|
||||||
loader.loadFromMemory(data, _gameData);
|
loader.loadFromMemory(data, archive);
|
||||||
}
|
}
|
||||||
}
|
}
|
42
rwlib/source/loaders/LoaderTXD.hpp
Normal file
42
rwlib/source/loaders/LoaderTXD.hpp
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
#pragma once
|
||||||
|
#ifndef _TEXTURELOADER_HPP_
|
||||||
|
#define _TEXTURELOADER_HPP_
|
||||||
|
|
||||||
|
#include <loaders/RWBinaryStream.hpp>
|
||||||
|
|
||||||
|
#include <job/WorkContext.hpp>
|
||||||
|
#include <platform/FileHandle.hpp>
|
||||||
|
#include <functional>
|
||||||
|
#include <string>
|
||||||
|
#include <map>
|
||||||
|
|
||||||
|
// This might suffice
|
||||||
|
#include <gl/TextureData.hpp>
|
||||||
|
typedef std::map<std::pair<std::string, std::string>, TextureData::Handle> TextureArchive;
|
||||||
|
|
||||||
|
class FileIndex;
|
||||||
|
|
||||||
|
class TextureLoader
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
bool loadFromMemory(FileHandle file, TextureArchive& inTextures);
|
||||||
|
};
|
||||||
|
|
||||||
|
// TODO: refactor this interface to be more like ModelLoader so they can be rolled into one.
|
||||||
|
class LoadTextureArchiveJob : public WorkJob
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
TextureArchive& archive;
|
||||||
|
FileIndex* fileIndex;
|
||||||
|
std::string _file;
|
||||||
|
FileHandle data;
|
||||||
|
public:
|
||||||
|
|
||||||
|
LoadTextureArchiveJob(WorkContext* context, FileIndex* index, TextureArchive& inTextures, const std::string& file);
|
||||||
|
|
||||||
|
void work();
|
||||||
|
|
||||||
|
void complete();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
@ -1,4 +1,4 @@
|
|||||||
#include <core/FileIndex.hpp>
|
#include <platform/FileIndex.hpp>
|
||||||
#include <loaders/LoaderIMG.hpp>
|
#include <loaders/LoaderIMG.hpp>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
@ -29,7 +29,6 @@ target_link_libraries(rwviewer
|
|||||||
sfml-graphics
|
sfml-graphics
|
||||||
sfml-system
|
sfml-system
|
||||||
${OPENGL_LIBRARIES}
|
${OPENGL_LIBRARIES}
|
||||||
GLEW
|
|
||||||
${BULLET_LIBRARIES})
|
${BULLET_LIBRARIES})
|
||||||
qt5_use_modules(rwviewer Widgets OpenGL)
|
qt5_use_modules(rwviewer Widgets OpenGL)
|
||||||
|
|
||||||
|
@ -41,9 +41,6 @@ ViewerWindow::ViewerWindow(QWidget* parent, Qt::WindowFlags flags)
|
|||||||
|
|
||||||
viewerWidget->context()->makeCurrent();
|
viewerWidget->context()->makeCurrent();
|
||||||
|
|
||||||
glewExperimental = 1;
|
|
||||||
glewInit();
|
|
||||||
|
|
||||||
objectViewer = new ObjectViewer(viewerWidget);
|
objectViewer = new ObjectViewer(viewerWidget);
|
||||||
|
|
||||||
connect(this, SIGNAL(loadedData(GameWorld*)), objectViewer, SLOT(showData(GameWorld*)));
|
connect(this, SIGNAL(loadedData(GameWorld*)), objectViewer, SLOT(showData(GameWorld*)));
|
||||||
|
@ -9,7 +9,6 @@ sfml-graphics
|
|||||||
sfml-window
|
sfml-window
|
||||||
sfml-system
|
sfml-system
|
||||||
${OPENGL_LIBRARIES}
|
${OPENGL_LIBRARIES}
|
||||||
GLEW
|
|
||||||
${BULLET_LIBRARIES})
|
${BULLET_LIBRARIES})
|
||||||
|
|
||||||
install(TARGETS ${SCRIPTTOOL} RUNTIME DESTINATION bin)
|
install(TARGETS ${SCRIPTTOOL} RUNTIME DESTINATION bin)
|
||||||
|
@ -18,7 +18,6 @@ target_link_libraries(run_tests
|
|||||||
sfml-system
|
sfml-system
|
||||||
sfml-graphics
|
sfml-graphics
|
||||||
${OPENGL_LIBRARIES}
|
${OPENGL_LIBRARIES}
|
||||||
GLEW
|
|
||||||
BulletDynamics
|
BulletDynamics
|
||||||
BulletCollision
|
BulletCollision
|
||||||
LinearMath
|
LinearMath
|
||||||
|
@ -42,8 +42,6 @@ public:
|
|||||||
|
|
||||||
Global() {
|
Global() {
|
||||||
wnd.create(sf::VideoMode(640, 360), "Testing");
|
wnd.create(sf::VideoMode(640, 360), "Testing");
|
||||||
glewExperimental = GL_TRUE;
|
|
||||||
glewInit();
|
|
||||||
d = new GameData(&log, &work, getGamePath());
|
d = new GameData(&log, &work, getGamePath());
|
||||||
e = new GameWorld(&log, &work, d);
|
e = new GameWorld(&log, &work, d);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user