~ Changed namespace names for wp::core and wp to a more suited name

Signed-off-by: Alexis Maiquez <almamu@almamu.com>
This commit is contained in:
Alexis Maiquez 2019-08-15 01:53:40 +02:00
parent b201cc2a79
commit 654918904a
83 changed files with 472 additions and 469 deletions

View File

@ -20,93 +20,93 @@ include_directories(${X11_INCLUDE_DIR} ${IRRLICHT_INCLUDE_DIR} ${LZ4_INCLUDE_DIR
add_executable(
wallengine
main.cpp
wallpaperengine/shaders/compiler.h
wallpaperengine/shaders/compiler.cpp
wallpaperengine/project.cpp
wallpaperengine/project.h
wallpaperengine/scene.cpp
wallpaperengine/scene.h
wallpaperengine/object.cpp
wallpaperengine/object.h
wallpaperengine/camera.cpp
wallpaperengine/camera.h
wallpaperengine/core.cpp
wallpaperengine/core.h
wallpaperengine/image.cpp
wallpaperengine/image.h
wallpaperengine/object3d.cpp
wallpaperengine/object3d.h
wallpaperengine/effect.cpp
wallpaperengine/effect.h
wallpaperengine/fs/utils.cpp
wallpaperengine/fs/utils.h
wallpaperengine/irrlicht.cpp
wallpaperengine/irrlicht.h
wallpaperengine/video/renderer.cpp
wallpaperengine/video/renderer.h
wallpaperengine/video/node.cpp
wallpaperengine/video/node.h
wallpaperengine/video/material.cpp
wallpaperengine/video/material.h
wallpaperengine/texture.cpp
wallpaperengine/texture.h
wallpaperengine/irr/CImageLoaderTEX.h
wallpaperengine/irr/CImageLoaderTEX.cpp
wallpaperengine/irr/CPkgReader.h
wallpaperengine/irr/CPkgReader.cpp
wallpaperengine/irr/CFileList.h
wallpaperengine/irr/CFileList.cpp
wallpaperengine/sound.cpp
wallpaperengine/sound.h
WallpaperEngine/shaders/compiler.h
WallpaperEngine/shaders/compiler.cpp
WallpaperEngine/project.cpp
WallpaperEngine/project.h
WallpaperEngine/scene.cpp
WallpaperEngine/scene.h
WallpaperEngine/object.cpp
WallpaperEngine/object.h
WallpaperEngine/camera.cpp
WallpaperEngine/camera.h
WallpaperEngine/Core/Core.cpp
WallpaperEngine/Core/Core.h
WallpaperEngine/image.cpp
WallpaperEngine/image.h
WallpaperEngine/object3d.cpp
WallpaperEngine/object3d.h
WallpaperEngine/effect.cpp
WallpaperEngine/effect.h
WallpaperEngine/fs/utils.cpp
WallpaperEngine/fs/utils.h
WallpaperEngine/irrlicht.cpp
WallpaperEngine/irrlicht.h
WallpaperEngine/video/renderer.cpp
WallpaperEngine/video/renderer.h
WallpaperEngine/video/node.cpp
WallpaperEngine/video/node.h
WallpaperEngine/video/material.cpp
WallpaperEngine/video/material.h
WallpaperEngine/texture.cpp
WallpaperEngine/texture.h
WallpaperEngine/irr/CImageLoaderTEX.h
WallpaperEngine/irr/CImageLoaderTEX.cpp
WallpaperEngine/irr/CPkgReader.h
WallpaperEngine/irr/CPkgReader.cpp
WallpaperEngine/irr/CFileList.h
WallpaperEngine/irr/CFileList.cpp
WallpaperEngine/sound.cpp
WallpaperEngine/sound.h
wallpaperengine/core/CProject.cpp
wallpaperengine/core/CProject.h
wallpaperengine/core/CScene.cpp
wallpaperengine/core/CScene.h
wallpaperengine/core/CObject.cpp
wallpaperengine/core/CObject.h
WallpaperEngine/Core/CProject.cpp
WallpaperEngine/Core/CProject.h
WallpaperEngine/Core/CScene.cpp
WallpaperEngine/Core/CScene.h
WallpaperEngine/Core/CObject.cpp
WallpaperEngine/Core/CObject.h
wallpaperengine/core/Scenes/CCamera.cpp
wallpaperengine/core/Scenes/CCamera.h
wallpaperengine/core/Scenes/CProjection.cpp
wallpaperengine/core/Scenes/CProjection.h
WallpaperEngine/Core/Scenes/CCamera.cpp
WallpaperEngine/Core/Scenes/CCamera.h
WallpaperEngine/Core/Scenes/CProjection.cpp
WallpaperEngine/Core/Scenes/CProjection.h
wallpaperengine/core/Objects/CImage.cpp
wallpaperengine/core/Objects/CImage.h
wallpaperengine/core/Objects/CSound.cpp
wallpaperengine/core/Objects/CSound.h
wallpaperengine/core/Objects/CEffect.cpp
wallpaperengine/core/Objects/CEffect.h
wallpaperengine/core/Objects/Particles/CParticle.cpp
wallpaperengine/core/Objects/Particles/CParticle.h
WallpaperEngine/Core/Objects/CImage.cpp
WallpaperEngine/Core/Objects/CImage.h
WallpaperEngine/Core/Objects/CSound.cpp
WallpaperEngine/Core/Objects/CSound.h
WallpaperEngine/Core/Objects/CEffect.cpp
WallpaperEngine/Core/Objects/CEffect.h
WallpaperEngine/Core/Objects/Particles/CParticle.cpp
WallpaperEngine/Core/Objects/Particles/CParticle.h
wallpaperengine/core/Objects/Particles/CControlPoint.cpp
wallpaperengine/core/Objects/Particles/CControlPoint.h
wallpaperengine/core/Objects/Particles/CEmitter.cpp
wallpaperengine/core/Objects/Particles/CEmitter.h
wallpaperengine/core/Objects/Particles/CInitializer.cpp
wallpaperengine/core/Objects/Particles/CInitializer.h
WallpaperEngine/Core/Objects/Particles/CControlPoint.cpp
WallpaperEngine/Core/Objects/Particles/CControlPoint.h
WallpaperEngine/Core/Objects/Particles/CEmitter.cpp
WallpaperEngine/Core/Objects/Particles/CEmitter.h
WallpaperEngine/Core/Objects/Particles/CInitializer.cpp
WallpaperEngine/Core/Objects/Particles/CInitializer.h
wallpaperengine/core/Objects/Particles/Initializers/CLifeTimeRandom.cpp
wallpaperengine/core/Objects/Particles/Initializers/CLifeTimeRandom.h
wallpaperengine/core/Objects/Particles/Initializers/CSizeRandom.cpp
wallpaperengine/core/Objects/Particles/Initializers/CSizeRandom.h
wallpaperengine/core/Objects/Particles/Initializers/CRotationRandom.cpp
wallpaperengine/core/Objects/Particles/Initializers/CRotationRandom.h
wallpaperengine/core/Objects/Particles/Initializers/CVelocityRandom.cpp
wallpaperengine/core/Objects/Particles/Initializers/CVelocityRandom.h
wallpaperengine/core/Objects/Particles/Initializers/CColorRandom.cpp
wallpaperengine/core/Objects/Particles/Initializers/CColorRandom.h
wallpaperengine/core/Objects/Particles/Initializers/CAlphaRandom.cpp
wallpaperengine/core/Objects/Particles/Initializers/CAlphaRandom.h
wallpaperengine/core/Objects/Particles/Initializers/CAngularVelocityRandom.cpp
wallpaperengine/core/Objects/Particles/Initializers/CAngularVelocityRandom.h
WallpaperEngine/Core/Objects/Particles/Initializers/CLifeTimeRandom.cpp
WallpaperEngine/Core/Objects/Particles/Initializers/CLifeTimeRandom.h
WallpaperEngine/Core/Objects/Particles/Initializers/CSizeRandom.cpp
WallpaperEngine/Core/Objects/Particles/Initializers/CSizeRandom.h
WallpaperEngine/Core/Objects/Particles/Initializers/CRotationRandom.cpp
WallpaperEngine/Core/Objects/Particles/Initializers/CRotationRandom.h
WallpaperEngine/Core/Objects/Particles/Initializers/CVelocityRandom.cpp
WallpaperEngine/Core/Objects/Particles/Initializers/CVelocityRandom.h
WallpaperEngine/Core/Objects/Particles/Initializers/CColorRandom.cpp
WallpaperEngine/Core/Objects/Particles/Initializers/CColorRandom.h
WallpaperEngine/Core/Objects/Particles/Initializers/CAlphaRandom.cpp
WallpaperEngine/Core/Objects/Particles/Initializers/CAlphaRandom.h
WallpaperEngine/Core/Objects/Particles/Initializers/CAngularVelocityRandom.cpp
WallpaperEngine/Core/Objects/Particles/Initializers/CAngularVelocityRandom.h
wallpaperengine/core/Objects/Images/CMaterial.cpp
wallpaperengine/core/Objects/Images/CMaterial.h
WallpaperEngine/Core/Objects/Images/CMaterial.cpp
WallpaperEngine/Core/Objects/Images/CMaterial.h
wallpaperengine/core/Objects/Images/Materials/CPassess.cpp
wallpaperengine/core/Objects/Images/Materials/CPassess.h
WallpaperEngine/Core/Objects/Images/Materials/CPassess.cpp
WallpaperEngine/Core/Objects/Images/Materials/CPassess.h
)
target_link_libraries(wallengine ${X11_LIBRARIES} ${X11_Xxf86vm_LIB} ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES} ${ZLIB_LIBRARIES} ${IRRLICHT_LIBRARY} ${LZ4_LIBRARY} ${SDL_LIBRARY} ${SDL_MIXER_LIBRARIES})

View File

@ -5,9 +5,9 @@
#include "Objects/CSound.h"
#include "Objects/Particles/CParticle.h"
#include "../core.h"
#include "Core.h"
using namespace wp::core;
using namespace WallpaperEngine::Core;
CObject::CObject (
@ -79,35 +79,35 @@ CObject* CObject::fromJSON (json data)
if (image_it != data.end () && (*image_it).is_null () == false)
{
object = Objects::CImage::fromJSON (
data,
visible,
*id_it,
*name_it,
wp::core::ato3vf (*origin_it),
wp::core::ato3vf (*scale_it),
wp::core::ato3vf (*angles_it)
data,
visible,
*id_it,
*name_it,
WallpaperEngine::Core::ato3vf (*origin_it),
WallpaperEngine::Core::ato3vf (*scale_it),
WallpaperEngine::Core::ato3vf (*angles_it)
);
}
else if (sound_it != data.end ())
{
object = Objects::CSound::fromJSON (
data,
visible,
*id_it,
*name_it,
wp::core::ato3vf (*origin_it),
wp::core::ato3vf (*scale_it),
wp::core::ato3vf (*angles_it)
data,
visible,
*id_it,
*name_it,
WallpaperEngine::Core::ato3vf (*origin_it),
WallpaperEngine::Core::ato3vf (*scale_it),
WallpaperEngine::Core::ato3vf (*angles_it)
);
}
else if (particle_it != data.end ())
{
object = Objects::Particles::CParticle::fromFile (
(*particle_it).get <std::string> ().c_str (),
*id_it,
*name_it,
wp::core::ato3vf (*origin_it),
wp::core::ato3vf (*scale_it)
(*particle_it).get <std::string> ().c_str (),
*id_it,
*name_it,
WallpaperEngine::Core::ato3vf (*origin_it),
WallpaperEngine::Core::ato3vf (*scale_it)
);
}
else

View File

@ -5,7 +5,7 @@
#include "Objects/CEffect.h"
namespace wp::core
namespace WallpaperEngine::Core
{
using json = nlohmann::json;

View File

@ -1,10 +1,10 @@
#include <wallpaperengine/fs/utils.h>
#include <WallpaperEngine/fs/utils.h>
#include "CProject.h"
#include "../fs/utils.h"
using namespace wp::core;
using namespace WallpaperEngine::Core;
CProject::CProject (std::string title, std::string type, CScene *scene) :
m_title (std::move (title)),
@ -16,7 +16,7 @@ CProject::CProject (std::string title, std::string type, CScene *scene) :
CProject* CProject::fromFile (const irr::io::path& filename)
{
json content = json::parse (wp::fs::utils::loadFullFile (filename));
json content = json::parse (WallpaperEngine::fs::utils::loadFullFile (filename));
json::const_iterator title = content.find ("title");
json::const_iterator type = content.find ("type");

View File

@ -5,7 +5,7 @@
#include "CScene.h"
namespace wp::core
namespace WallpaperEngine::Core
{
using json = nlohmann::json;

View File

@ -1,10 +1,10 @@
#include "CScene.h"
#include "CProject.h"
#include "../core.h"
#include "Core.h"
#include "../fs/utils.h"
using namespace wp::core;
using namespace WallpaperEngine::Core;
CScene::CScene (
Scenes::CCamera* camera,
@ -48,7 +48,7 @@ CScene::CScene (
CScene* CScene::fromFile (const irr::io::path& filename)
{
json content = json::parse (wp::fs::utils::loadFullFile (filename));
json content = json::parse (WallpaperEngine::fs::utils::loadFullFile (filename));
json::const_iterator camera_it = content.find ("camera");
json::const_iterator general_it = content.find ("general");
@ -174,7 +174,7 @@ CScene* CScene::fromFile (const irr::io::path& filename)
CScene* scene = new CScene (
Scenes::CCamera::fromJSON (*camera_it),
wp::core::atoSColorf (*ambientcolor_it),
WallpaperEngine::Core::atoSColorf (*ambientcolor_it),
*bloom_it,
*bloomstrength_it,
*bloomthreshold_it,
@ -188,9 +188,9 @@ CScene* CScene::fromFile (const irr::io::path& filename)
*camerashakeamplitude_it,
*camerashakeroughness_it,
*camerashakespeed_it,
wp::core::atoSColorf (*clearcolor_it),
WallpaperEngine::Core::atoSColorf (*clearcolor_it),
Scenes::CProjection::fromJSON (*orthogonalprojection_it),
wp::core::atoSColorf (*skylightcolor_it)
WallpaperEngine::Core::atoSColorf (*skylightcolor_it)
);
json::const_iterator cur = (*objects_it).begin ();

View File

@ -9,7 +9,7 @@
#include "Scenes/CCamera.h"
#include "Scenes/CProjection.h"
namespace wp::core
namespace WallpaperEngine::Core
{
using json = nlohmann::json;

View File

@ -0,0 +1,59 @@
#include <irrlicht/irrlicht.h>
#include "Core.h"
irr::core::vector3df WallpaperEngine::Core::ato3vf(const char *str)
{
irr::f32 x = irr::core::fast_atof (str, &str); while (*str == ' ') str ++;
irr::f32 y = irr::core::fast_atof (str, &str); while (*str == ' ') str ++;
irr::f32 z = irr::core::fast_atof (str, &str);
return irr::core::vector3df (x, y, z);
}
irr::core::vector2df WallpaperEngine::Core::ato2vf (const char *str)
{
irr::f32 x = irr::core::fast_atof (str, &str); while (*str == ' ') str ++;
irr::f32 y = irr::core::fast_atof (str, &str);
return irr::core::vector2df (x, y);
}
irr::core::vector3df WallpaperEngine::Core::ato3vf (const std::string& str)
{
return WallpaperEngine::Core::ato3vf (str.c_str ());
}
irr::core::vector2df WallpaperEngine::Core::ato2vf (const std::string& str)
{
return WallpaperEngine::Core::ato2vf (str.c_str ());
}
irr::video::SColorf WallpaperEngine::Core::atoSColorf (const char *str)
{
irr::core::vector3df vector = WallpaperEngine::Core::ato3vf (str);
return irr::video::SColorf (
vector.X,
vector.Y,
vector.Z
);
}
irr::video::SColorf WallpaperEngine::Core::atoSColorf (const std::string& str)
{
return WallpaperEngine::Core::atoSColorf (str.c_str ());
}
irr::video::SColor WallpaperEngine::Core::atoSColor (const char *str)
{
irr::f32 r = irr::core::strtoul10 (str, &str); while (*str == ' ') str ++;
irr::f32 g = irr::core::strtoul10 (str, &str); while (*str == ' ') str ++;
irr::f32 b = irr::core::strtoul10 (str, &str);
return irr::video::SColor (255, r, g, b);
}
irr::video::SColor WallpaperEngine::Core::atoSColor (const std::string& str)
{
return WallpaperEngine::Core::atoSColor (str.c_str ());
}

View File

@ -4,7 +4,7 @@
#include <irrlicht/irrlicht.h>
namespace wp::core
namespace WallpaperEngine::Core
{
irr::core::vector3df ato3vf (const char *str);
irr::core::vector2df ato2vf (const char *str);

View File

@ -4,7 +4,7 @@
#include "../../fs/utils.h"
using namespace wp::core::Objects;
using namespace WallpaperEngine::Core::Objects;
CEffect::CEffect (
std::string name,
@ -27,7 +27,7 @@ CEffect* CEffect::fromJSON (json data)
throw std::runtime_error ("Object effect must have a file");
}
json content = json::parse (wp::fs::utils::loadFullFile ((*file_it).get <std::string> ().c_str ()));
json content = json::parse (WallpaperEngine::fs::utils::loadFullFile ((*file_it).get <std::string> ().c_str ()));
json::const_iterator name_it = content.find ("name");
json::const_iterator description_it = content.find ("description");

View File

@ -5,7 +5,7 @@
#include "Images/CMaterial.h"
namespace wp::core::Objects
namespace WallpaperEngine::Core::Objects
{
using json = nlohmann::json;

View File

@ -1,10 +1,10 @@
#include "CImage.h"
#include "Images/CMaterial.h"
#include "../../core.h"
#include "WallpaperEngine/Core/Core.h"
#include "../../fs/utils.h"
using namespace wp::core::Objects;
using namespace WallpaperEngine::Core::Objects;
CImage::CImage (
Images::CMaterial* material,
@ -21,7 +21,7 @@ CImage::CImage (
}
wp::core::CObject* CImage::fromJSON (
WallpaperEngine::Core::CObject* CImage::fromJSON (
json data,
bool visible,
irr::u32 id,
@ -38,7 +38,7 @@ wp::core::CObject* CImage::fromJSON (
throw std::runtime_error ("Images must have size");
}
json content = json::parse (wp::fs::utils::loadFullFile ((*image_it).get <std::string> ().c_str ()));
json content = json::parse (WallpaperEngine::fs::utils::loadFullFile ((*image_it).get <std::string> ().c_str ()));
json::const_iterator material_it = content.find ("material");
@ -55,6 +55,6 @@ wp::core::CObject* CImage::fromJSON (
origin,
scale,
angles,
wp::core::ato2vf (*size_it)
WallpaperEngine::Core::ato2vf (*size_it)
);
}

View File

@ -3,10 +3,11 @@
#include <nlohmann/json.hpp>
#include <irrlicht/irrlicht.h>
#include "wallpaperengine/core/CObject.h"
#include "Images/CMaterial.h"
namespace wp::core::Objects
#include "../CObject.h"
namespace WallpaperEngine::Core::Objects
{
using json = nlohmann::json;

View File

@ -1,9 +1,9 @@
#include <irrlicht/irrlicht.h>
#include "wallpaperengine/core/CObject.h"
#include "../CObject.h"
#include "CSound.h"
using namespace wp::core::Objects;
using namespace WallpaperEngine::Core::Objects;
CSound::CSound (
bool visible,
irr::u32 id,
@ -15,7 +15,7 @@ CSound::CSound (
{
}
wp::core::CObject* CSound::fromJSON (
WallpaperEngine::Core::CObject* CSound::fromJSON (
json data,
bool visible,
irr::u32 id,

View File

@ -3,9 +3,9 @@
#include <irrlicht/irrlicht.h>
#include <nlohmann/json.hpp>
#include "wallpaperengine/core/CObject.h"
#include "../CObject.h"
namespace wp::core::Objects
namespace WallpaperEngine::Core::Objects
{
using json = nlohmann::json;

View File

@ -5,7 +5,7 @@
#include "../../../fs/utils.h"
using namespace wp::core::Objects::Images;
using namespace WallpaperEngine::Core::Objects::Images;
CMaterial::CMaterial ()
{
@ -14,7 +14,7 @@ CMaterial::CMaterial ()
CMaterial* CMaterial::fromFile (irr::io::path filename)
{
return fromJSON (
json::parse (wp::fs::utils::loadFullFile (filename))
json::parse (WallpaperEngine::fs::utils::loadFullFile (filename))
);
}

View File

@ -5,7 +5,7 @@
#include "Materials/CPassess.h"
namespace wp::core::Objects::Images
namespace WallpaperEngine::Core::Objects::Images
{
using json = nlohmann::json;

View File

@ -1,6 +1,6 @@
#include "CPassess.h"
using namespace wp::core::Objects::Images::Materials;
using namespace WallpaperEngine::Core::Objects::Images::Materials;
CPassess::CPassess (std::string blending, std::string cullmode, std::string depthtest, std::string depthwrite, std::string shader) :
m_blending (std::move(blending)),

View File

@ -2,7 +2,7 @@
#include <nlohmann/json.hpp>
namespace wp::core::Objects::Images::Materials
namespace WallpaperEngine::Core::Objects::Images::Materials
{
using json = nlohmann::json;

View File

@ -1,8 +1,8 @@
#include "CControlPoint.h"
#include "../../../core.h"
#include "WallpaperEngine/Core/Core.h"
using namespace wp::core::Objects::Particles;
using namespace WallpaperEngine::Core::Objects::Particles;
CControlPoint* CControlPoint::fromJSON (json data)
{
@ -19,7 +19,7 @@ CControlPoint* CControlPoint::fromJSON (json data)
if (offset_it != data.end ())
{
controlpoint->setOffset (wp::core::ato3vf (*offset_it));
controlpoint->setOffset (WallpaperEngine::Core::ato3vf (*offset_it));
}
if (flags_it != data.end ())

View File

@ -3,7 +3,7 @@
#include <nlohmann/json.hpp>
#include <irrlicht/irrlicht.h>
namespace wp::core::Objects::Particles
namespace WallpaperEngine::Core::Objects::Particles
{
using json = nlohmann::json;

View File

@ -1,8 +1,8 @@
#include "CEmitter.h"
#include "../../../core.h"
#include "WallpaperEngine/Core/Core.h"
using namespace wp::core::Objects::Particles;
using namespace WallpaperEngine::Core::Objects::Particles;
CEmitter* CEmitter::fromJSON (json data)
{
@ -45,13 +45,13 @@ CEmitter* CEmitter::fromJSON (json data)
}
return new CEmitter (
wp::core::ato3vf (*directions_it),
*distancemax_it,
*distancemin_it,
(id_it == data.end () ? 0 : (irr::u32) (*id_it)),
*name_it,
wp::core::ato3vf (*origin_it),
*rate_it
WallpaperEngine::Core::ato3vf (*directions_it),
*distancemax_it,
*distancemin_it,
(id_it == data.end () ? 0 : (irr::u32) (*id_it)),
*name_it,
WallpaperEngine::Core::ato3vf (*origin_it),
*rate_it
);
}

View File

@ -3,7 +3,7 @@
#include <nlohmann/json.hpp>
#include <irrlicht/irrlicht.h>
namespace wp::core::Objects::Particles
namespace WallpaperEngine::Core::Objects::Particles
{
using json = nlohmann::json;

View File

@ -8,7 +8,7 @@
#include "Initializers/CAlphaRandom.h"
#include "Initializers/CAngularVelocityRandom.h"
using namespace wp::core::Objects::Particles;
using namespace WallpaperEngine::Core::Objects::Particles;
CInitializer* CInitializer::fromJSON (json data)
{

View File

@ -3,7 +3,7 @@
#include <nlohmann/json.hpp>
#include <irrlicht/irrlicht.h>
namespace wp::core::Objects::Particles
namespace WallpaperEngine::Core::Objects::Particles
{
using json = nlohmann::json;

View File

@ -3,7 +3,7 @@
#include <irrlicht/irrlicht.h>
using namespace wp::core::Objects::Particles;
using namespace WallpaperEngine::Core::Objects::Particles;
CParticle* CParticle::fromFile (
const irr::io::path& filename,
@ -12,7 +12,7 @@ CParticle* CParticle::fromFile (
const irr::core::vector3df& origin,
const irr::core::vector3df& scale)
{
json data = json::parse (wp::fs::utils::loadFullFile (filename));
json data = json::parse (WallpaperEngine::fs::utils::loadFullFile (filename));
json::const_iterator controlpoint_it = data.find ("controlpoint");
json::const_iterator starttime_it = data.find ("starttime");
json::const_iterator maxcount_it = data.find ("maxcount");

View File

@ -7,9 +7,9 @@
#include "CEmitter.h"
#include "CInitializer.h"
#include "wallpaperengine/core/CObject.h"
#include "../../CObject.h"
namespace wp::core::Objects::Particles
namespace WallpaperEngine::Core::Objects::Particles
{
using json = nlohmann::json;

View File

@ -1,6 +1,6 @@
#include "CAlphaRandom.h"
using namespace wp::core::Objects::Particles::Initializers;
using namespace WallpaperEngine::Core::Objects::Particles::Initializers;
CAlphaRandom* CAlphaRandom::fromJSON (json data, irr::u32 id)
{

View File

@ -5,7 +5,7 @@
#include <nlohmann/json.hpp>
#include <irrlicht/irrlicht.h>
namespace wp::core::Objects::Particles::Initializers
namespace WallpaperEngine::Core::Objects::Particles::Initializers
{
class CAlphaRandom : CInitializer
{

View File

@ -1,8 +1,8 @@
#include "CAngularVelocityRandom.h"
#include "../../../../core.h"
#include "WallpaperEngine/Core/Core.h"
using namespace wp::core::Objects::Particles::Initializers;
using namespace WallpaperEngine::Core::Objects::Particles::Initializers;
CAngularVelocityRandom* CAngularVelocityRandom::fromJSON (json data, irr::u32 id)
{
@ -20,9 +20,9 @@ CAngularVelocityRandom* CAngularVelocityRandom::fromJSON (json data, irr::u32 id
}
return new CAngularVelocityRandom (
id,
wp::core::ato3vf (*min_it),
wp::core::ato3vf (*max_it)
id,
WallpaperEngine::Core::ato3vf (*min_it),
WallpaperEngine::Core::ato3vf (*max_it)
);
}

View File

@ -5,7 +5,7 @@
#include <nlohmann/json.hpp>
#include <irrlicht/irrlicht.h>
namespace wp::core::Objects::Particles::Initializers
namespace WallpaperEngine::Core::Objects::Particles::Initializers
{
class CAngularVelocityRandom : CInitializer
{

View File

@ -1,8 +1,8 @@
#include "CColorRandom.h"
#include "../../../../core.h"
#include "WallpaperEngine/Core/Core.h"
using namespace wp::core::Objects::Particles::Initializers;
using namespace WallpaperEngine::Core::Objects::Particles::Initializers;
CColorRandom* CColorRandom::fromJSON (json data, irr::u32 id)
{
@ -20,9 +20,9 @@ CColorRandom* CColorRandom::fromJSON (json data, irr::u32 id)
}
return new CColorRandom (
id,
wp::core::atoSColor (*min_it),
wp::core::atoSColor (*max_it)
id,
WallpaperEngine::Core::atoSColor (*min_it),
WallpaperEngine::Core::atoSColor (*max_it)
);
}

View File

@ -5,7 +5,7 @@
#include <nlohmann/json.hpp>
#include <irrlicht/irrlicht.h>
namespace wp::core::Objects::Particles::Initializers
namespace WallpaperEngine::Core::Objects::Particles::Initializers
{
class CColorRandom : CInitializer
{

View File

@ -1,6 +1,6 @@
#include "CLifeTimeRandom.h"
using namespace wp::core::Objects::Particles::Initializers;
using namespace WallpaperEngine::Core::Objects::Particles::Initializers;
CLifeTimeRandom* CLifeTimeRandom::fromJSON (json data, irr::u32 id)
{

View File

@ -5,7 +5,7 @@
#include <nlohmann/json.hpp>
#include <irrlicht/irrlicht.h>
namespace wp::core::Objects::Particles::Initializers
namespace WallpaperEngine::Core::Objects::Particles::Initializers
{
class CLifeTimeRandom : CInitializer
{

View File

@ -1,6 +1,6 @@
#include "CRotationRandom.h"
using namespace wp::core::Objects::Particles::Initializers;
using namespace WallpaperEngine::Core::Objects::Particles::Initializers;
CRotationRandom* CRotationRandom::fromJSON (json data, irr::u32 id)
{

View File

@ -5,7 +5,7 @@
#include <nlohmann/json.hpp>
#include <irrlicht/irrlicht.h>
namespace wp::core::Objects::Particles::Initializers
namespace WallpaperEngine::Core::Objects::Particles::Initializers
{
class CRotationRandom : CInitializer
{

View File

@ -1,6 +1,6 @@
#include "CSizeRandom.h"
using namespace wp::core::Objects::Particles::Initializers;
using namespace WallpaperEngine::Core::Objects::Particles::Initializers;
CSizeRandom* CSizeRandom::fromJSON (json data, irr::u32 id)
{

View File

@ -5,7 +5,7 @@
#include <nlohmann/json.hpp>
#include <irrlicht/irrlicht.h>
namespace wp::core::Objects::Particles::Initializers
namespace WallpaperEngine::Core::Objects::Particles::Initializers
{
class CSizeRandom : CInitializer
{

View File

@ -1,8 +1,8 @@
#include "CVelocityRandom.h"
#include "../../../../core.h"
#include "WallpaperEngine/Core/Core.h"
using namespace wp::core::Objects::Particles::Initializers;
using namespace WallpaperEngine::Core::Objects::Particles::Initializers;
CVelocityRandom* CVelocityRandom::fromJSON (json data, irr::u32 id)
{
@ -20,9 +20,9 @@ CVelocityRandom* CVelocityRandom::fromJSON (json data, irr::u32 id)
}
return new CVelocityRandom (
id,
wp::core::ato3vf (*min_it),
wp::core::ato3vf (*max_it)
id,
WallpaperEngine::Core::ato3vf (*min_it),
WallpaperEngine::Core::ato3vf (*max_it)
);
}

View File

@ -5,7 +5,7 @@
#include <nlohmann/json.hpp>
#include <irrlicht/irrlicht.h>
namespace wp::core::Objects::Particles::Initializers
namespace WallpaperEngine::Core::Objects::Particles::Initializers
{
class CVelocityRandom : CInitializer
{

View File

@ -1,7 +1,7 @@
#include "CCamera.h"
#include "../../core.h"
#include "WallpaperEngine/Core/Core.h"
using namespace wp::core::Scenes;
using namespace WallpaperEngine::Core::Scenes;
CCamera::CCamera (irr::core::vector3df center, irr::core::vector3df eye, irr::core::vector3df up) :
m_center (center),
@ -47,8 +47,8 @@ CCamera* CCamera::fromJSON (json data)
}
return new CCamera (
wp::core::ato3vf (*center_it),
wp::core::ato3vf (*eye_it),
wp::core::ato3vf (*up_it)
WallpaperEngine::Core::ato3vf (*center_it),
WallpaperEngine::Core::ato3vf (*eye_it),
WallpaperEngine::Core::ato3vf (*up_it)
);
}

View File

@ -3,7 +3,7 @@
#include <nlohmann/json.hpp>
#include <irrlicht/irrlicht.h>
namespace wp::core::Scenes
namespace WallpaperEngine::Core::Scenes
{
using json = nlohmann::json;

View File

@ -1,7 +1,7 @@
#include "CProjection.h"
#include "../../core.h"
#include "WallpaperEngine/Core/Core.h"
using namespace wp::core::Scenes;
using namespace WallpaperEngine::Core::Scenes;
CProjection::CProjection (irr::u32 width, irr::u32 height) :
m_width (width),

View File

@ -3,7 +3,7 @@
#include <nlohmann/json.hpp>
#include <irrlicht/irrlicht.h>
namespace wp::core::Scenes
namespace WallpaperEngine::Core::Scenes
{
using json = nlohmann::json;

View File

@ -1,7 +1,7 @@
#include "camera.h"
#include "core.h"
#include "WallpaperEngine/Core/Core.h"
namespace wp
namespace WallpaperEngine
{
camera::camera (json json_data)
{
@ -14,21 +14,21 @@ namespace wp
// get center value first
std::string center = *center_it;
this->m_center = core::ato3vf(center.c_str());
this->m_center = Core::ato3vf(center.c_str());
}
if (eye_it != json_data.end ())
{
std::string eye = *eye_it;
this->m_eye = core::ato3vf(eye.c_str());
this->m_eye = Core::ato3vf(eye.c_str());
}
if (up_it != json_data.end ())
{
std::string up = *up_it;
this->m_up = core::ato3vf(up.c_str());
this->m_up = Core::ato3vf(up.c_str());
}
}

View File

@ -4,7 +4,7 @@
#include <irrlicht/irrlicht.h>
#include <nlohmann/json.hpp>
namespace wp
namespace WallpaperEngine
{
using json = nlohmann::json;

View File

@ -1,15 +1,15 @@
#include <wallpaperengine/fs/utils.h>
#include <WallpaperEngine/fs/utils.h>
#include "shaders/compiler.h"
#include "effect.h"
#include "irrlicht.h"
#include "core.h"
#include "WallpaperEngine/Core/Core.h"
extern irr::f32 g_Time;
namespace wp
namespace WallpaperEngine
{
effect::effect (json json_data, wp::object* parent)
effect::effect (json json_data, WallpaperEngine::object* parent)
{
this->m_parent = parent;
@ -53,11 +53,11 @@ namespace wp
{
irr::io::path texturepath = ("materials/" + (*curtex).get <std::string> () + ".tex").c_str ();
this->m_textures.push_back (new wp::texture (texturepath));
this->m_textures.push_back (new WallpaperEngine::texture (texturepath));
}
}
this->m_content = wp::fs::utils::loadFullFile (this->m_file);
this->m_content = WallpaperEngine::fs::utils::loadFullFile (this->m_file);
this->m_json = json::parse (this->m_content);
json::const_iterator passes = this->m_json.find ("passes");
@ -76,7 +76,7 @@ namespace wp
continue;
irr::io::path material = (*material_it).get <std::string> ().c_str ();
std::string content = wp::fs::utils::loadFullFile (material);
std::string content = WallpaperEngine::fs::utils::loadFullFile (material);
json material_json = json::parse (content);
json::const_iterator shader_passes = material_json.find ("passes");
@ -94,10 +94,10 @@ namespace wp
irr::io::path fragpath = shaderpath + ".frag";
irr::io::path vertpath = shaderpath + ".vert";
this->m_fragShader = new wp::shaders::compiler (fragpath, wp::shaders::compiler::Type::Type_Pixel, &this->m_combos, false);
this->m_vertShader = new wp::shaders::compiler (vertpath, wp::shaders::compiler::Type::Type_Vertex, &this->m_combos, false);
this->m_fragShader = new WallpaperEngine::shaders::compiler (fragpath, WallpaperEngine::shaders::compiler::Type::Type_Pixel, &this->m_combos, false);
this->m_vertShader = new WallpaperEngine::shaders::compiler (vertpath, WallpaperEngine::shaders::compiler::Type::Type_Vertex, &this->m_combos, false);
this->m_materialType = wp::irrlicht::driver->getGPUProgrammingServices ()
this->m_materialType = WallpaperEngine::irrlicht::driver->getGPUProgrammingServices ()
->addHighLevelShaderMaterial (
this->m_vertShader->precompile ().c_str (), "main", irr::video::EVST_VS_2_0,
this->m_fragShader->precompile ().c_str (), "main", irr::video::EPST_PS_2_0,
@ -120,7 +120,7 @@ namespace wp
// first do fragment shaders
for (; cur != end; cur ++)
{
wp::shaders::compiler::ShaderParameter* param = (*cur);
WallpaperEngine::shaders::compiler::ShaderParameter* param = (*cur);
ShaderParameter* parameter = new ShaderParameter;
void* defaultValue = param->defaultValue;
@ -203,7 +203,7 @@ namespace wp
// second do vertex shaders
for (;cur != end; cur ++)
{
wp::shaders::compiler::ShaderParameter* param = (*cur);
WallpaperEngine::shaders::compiler::ShaderParameter* param = (*cur);
if (param == nullptr)
continue;
@ -314,7 +314,7 @@ namespace wp
else if ((*cur).is_string () == true)
{
value = new irr::core::vector3df;
*(irr::core::vector3df*) value = core::ato3vf ((*cur).get <std::string> ().c_str ());
*(irr::core::vector3df*) value = Core::ato3vf ((*cur).get <std::string> ().c_str ());
}
this->m_constants.insert (std::pair <std::string, void*> (name, value));
@ -336,12 +336,12 @@ namespace wp
}
else
{
wp::irrlicht::device->getLogger ()->log ("Unknown type for combo value", name.c_str (), irr::ELL_ERROR);
WallpaperEngine::irrlicht::device->getLogger ()->log ("Unknown type for combo value", name.c_str (), irr::ELL_ERROR);
}
}
}
std::vector<wp::texture*>& effect::getTextureList ()
std::vector<WallpaperEngine::texture*>& effect::getTextureList ()
{
return this->m_textures;
}

View File

@ -8,7 +8,7 @@
#include "object.h"
#include "shaders/compiler.h"
namespace wp
namespace WallpaperEngine
{
using json = nlohmann::json;
@ -17,11 +17,11 @@ namespace wp
class effect : public irr::video::IShaderConstantSetCallBack
{
public:
effect (json json_data, wp::object* parent);
effect (json json_data, WallpaperEngine::object* parent);
virtual void OnSetConstants (irr::video::IMaterialRendererServices* services, int32_t userData);
std::vector <wp::texture*>& getTextureList ();
std::vector <WallpaperEngine::texture*>& getTextureList ();
irr::s32 getMaterialType ();
private:
enum ParameterType
@ -42,21 +42,21 @@ namespace wp
void parseConstantValues (json data);
void parseCombos (json data);
wp::shaders::compiler* m_fragShader;
wp::shaders::compiler* m_vertShader;
WallpaperEngine::shaders::compiler* m_fragShader;
WallpaperEngine::shaders::compiler* m_vertShader;
std::map <std::string, ShaderParameter*> m_vertexVariables;
std::map <std::string, ShaderParameter*> m_pixelVariables;
std::map <std::string, int> m_combos;
std::map <std::string, void*> m_constants;
std::vector <wp::texture*> m_textures;
std::vector <WallpaperEngine::texture*> m_textures;
std::string m_content;
json m_json;
irr::io::path m_file;
irr::s32 m_materialType;
std::vector<void*> m_passes;
wp::object* m_parent;
WallpaperEngine::object* m_parent;
};
}

View File

@ -2,18 +2,18 @@
#include <sys/stat.h>
// filesystem includes
#include <wallpaperengine/fs/utils.h>
#include <WallpaperEngine/fs/utils.h>
// engine includes
#include <wallpaperengine/irrlicht.h>
#include <WallpaperEngine/irrlicht.h>
namespace wp
namespace WallpaperEngine
{
namespace fs
{
std::string utils::loadFullFile (irr::io::path file)
{
irr::io::IReadFile* reader = wp::irrlicht::device->getFileSystem ()->createAndOpenFile (file);
irr::io::IReadFile* reader = WallpaperEngine::irrlicht::device->getFileSystem ()->createAndOpenFile (file);
if (reader == NULL)
throw std::runtime_error ("Cannot open file " + std::string (file.c_str ()) + " for reading");

View File

@ -9,7 +9,7 @@
#include <irrlicht/path.h>
#include <nlohmann/json.hpp>
namespace wp
namespace WallpaperEngine
{
using json = nlohmann::json;

View File

@ -1,16 +1,16 @@
#include <irrlicht/irrlicht.h>
#include <fstream>
#include <wallpaperengine/fs/utils.h>
#include <wallpaperengine/object3d.h>
#include <wallpaperengine/image.h>
#include <WallpaperEngine/fs/utils.h>
#include <WallpaperEngine/object3d.h>
#include <WallpaperEngine/image.h>
#include <wallpaperengine/irrlicht.h>
#include <wallpaperengine/core.h>
#include <WallpaperEngine/irrlicht.h>
#include <WallpaperEngine/Core/Core.h>
namespace wp
namespace WallpaperEngine
{
image::image (json json_data, wp::object* parent) : object3d (object3d::Type::Type_Material, parent)
image::image (json json_data, WallpaperEngine::object* parent) : object3d (object3d::Type::Type_Material, parent)
{
this->m_parent = parent;
@ -27,7 +27,7 @@ namespace wp
if (file_it != json_data.end () && (*file_it).is_string () == true)
{
this->m_file = (*file_it).get <std::string> ().c_str ();
this->m_content = wp::fs::utils::loadFullFile (this->m_file);
this->m_content = WallpaperEngine::fs::utils::loadFullFile (this->m_file);
json content = json::parse (this->m_content);
json::const_iterator it = content.find ("material");
@ -35,7 +35,7 @@ namespace wp
if (it != content.end () && (*it).is_string () == true)
{
irr::io::path materialfile = (*it).get <std::string> ().c_str ();
std::string texturejson_content = wp::fs::utils::loadFullFile (materialfile);
std::string texturejson_content = WallpaperEngine::fs::utils::loadFullFile (materialfile);
json materialcontent = json::parse (texturejson_content);
// now try to read the texture if any
@ -59,7 +59,7 @@ namespace wp
{
irr::io::path texturepath = ("materials/" + (*texturesCur).get <std::string> () + ".tex").c_str ();
this->m_textures.push_back (new wp::texture (texturepath));
this->m_textures.push_back (new WallpaperEngine::texture (texturepath));
}
}
}
@ -90,23 +90,23 @@ namespace wp
m_vertices [3].Color = irr::video::SColor (255, 255, 255, 255);
// once textures are defined, prepare them to be displayed
std::vector<wp::texture*>::const_iterator cur = this->m_textures.begin ();
std::vector<wp::texture*>::const_iterator end = this->m_textures.end ();
std::vector<WallpaperEngine::texture*>::const_iterator cur = this->m_textures.begin ();
std::vector<WallpaperEngine::texture*>::const_iterator end = this->m_textures.end ();
for (irr::u32 i = 0; cur != end; cur ++, i ++)
{
this->getMaterial ().setTexture (i, (*cur)->getIrrTexture ());
}
std::vector<wp::effect*>::const_iterator effect = this->m_parent->getEffects ().begin ();
std::vector<WallpaperEngine::effect*>::const_iterator effect = this->m_parent->getEffects ().begin ();
if (effect != this->m_parent->getEffects ().end ())
{
// loop through the textures the effect is using
std::vector<wp::texture*> list = (*effect)->getTextureList ();
std::vector<WallpaperEngine::texture*> list = (*effect)->getTextureList ();
std::vector<wp::texture*>::const_iterator curtex = list.begin ();
std::vector<wp::texture*>::const_iterator endtex = list.end ();
std::vector<WallpaperEngine::texture*>::const_iterator curtex = list.begin ();
std::vector<WallpaperEngine::texture*>::const_iterator endtex = list.end ();
for (int current = 0; curtex != endtex; curtex ++, current ++)
{
@ -153,8 +153,8 @@ namespace wp
0, 1, 2, 3
};
wp::irrlicht::driver->setMaterial (this->getMaterial ());
wp::irrlicht::driver->drawVertexPrimitiveList (this->m_vertices, 4, indices, 1, irr::video::EVT_STANDARD, irr::scene::EPT_QUADS, irr::video::EIT_16BIT);
WallpaperEngine::irrlicht::driver->setMaterial (this->getMaterial ());
WallpaperEngine::irrlicht::driver->drawVertexPrimitiveList (this->m_vertices, 4, indices, 1, irr::video::EVT_STANDARD, irr::scene::EPT_QUADS, irr::video::EIT_16BIT);
}
}

View File

@ -4,17 +4,17 @@
#include <nlohmann/json.hpp>
#include <irrlicht/irrlicht.h>
#include <wallpaperengine/fs/utils.h>
#include <wallpaperengine/texture.h>
#include <WallpaperEngine/fs/utils.h>
#include <WallpaperEngine/texture.h>
namespace wp
namespace WallpaperEngine
{
using json = nlohmann::json;
class image : public object3d
{
public:
image(json json_data, wp::object* parent);
image(json json_data, WallpaperEngine::object* parent);
irr::video::SMaterial& getMaterial ();
void setFlag(irr::video::E_MATERIAL_FLAG flag, bool newvalue);
void setType(irr::video::E_MATERIAL_TYPE newType);
@ -29,7 +29,7 @@ namespace wp
irr::io::path m_file;
std::string m_content;
std::vector<wp::texture*> m_textures;
std::vector<WallpaperEngine::texture*> m_textures;
};
};

View File

@ -3,7 +3,7 @@
#include <irrlicht/irrlicht.h>
#include <lz4.h>
#include <wallpaperengine/irrlicht.h>
#include <WallpaperEngine/irrlicht.h>
#include <string>
namespace irr {
@ -36,25 +36,25 @@ namespace irr {
if (input->read (buffer, 9) != 9)
{
wp::irrlicht::device->getLogger ()->log ("LOAD TEX: cannot read header\n", input->getFileName ().c_str (), irr::ELL_ERROR);
WallpaperEngine::irrlicht::device->getLogger ()->log ("LOAD TEX: cannot read header\n", input->getFileName ().c_str (), irr::ELL_ERROR);
return nullptr;
}
if (memcmp (buffer, "TEXV0005", 9) != 0)
{
wp::irrlicht::device->getLogger ()->log ("LOAD TEX: not really a tex\n", input->getFileName ().c_str (), irr::ELL_ERROR);
WallpaperEngine::irrlicht::device->getLogger ()->log ("LOAD TEX: not really a tex\n", input->getFileName ().c_str (), irr::ELL_ERROR);
return nullptr;
}
if (input->read (buffer, 9) != 9)
{
wp::irrlicht::device->getLogger ()->log ("LOAD TEX: cannot read second header\n", input->getFileName ().c_str (), irr::ELL_ERROR);
WallpaperEngine::irrlicht::device->getLogger ()->log ("LOAD TEX: cannot read second header\n", input->getFileName ().c_str (), irr::ELL_ERROR);
return nullptr;
}
if (memcmp (buffer, "TEXI0001", 9) != 0)
{
wp::irrlicht::device->getLogger ()->log ("LOAD TEX: not really a tex\n", input->getFileName ().c_str (), irr::ELL_ERROR);
WallpaperEngine::irrlicht::device->getLogger ()->log ("LOAD TEX: not really a tex\n", input->getFileName ().c_str (), irr::ELL_ERROR);
return nullptr;
}
@ -94,19 +94,19 @@ namespace irr {
}
else
{
wp::irrlicht::device->getLogger ()->log ("LOAD TEX: Unknown container type\n", input->getFileName ().c_str (), irr::ELL_ERROR);
WallpaperEngine::irrlicht::device->getLogger ()->log ("LOAD TEX: Unknown container type\n", input->getFileName ().c_str (), irr::ELL_ERROR);
return nullptr;
}
if (format == TextureFormat::A8)
{
wp::irrlicht::device->getLogger ()-> log ("LOAD TEX: A8 not supported\n", input->getFileName ().c_str (), irr::ELL_ERROR);
WallpaperEngine::irrlicht::device->getLogger ()-> log ("LOAD TEX: A8 not supported\n", input->getFileName ().c_str (), irr::ELL_ERROR);
return nullptr;
}
if (format == TextureFormat::RA88)
{
wp::irrlicht::device->getLogger ()->log ("LOAD TEX: RA88 not supported\n", input->getFileName ().c_str (), irr::ELL_ERROR);
WallpaperEngine::irrlicht::device->getLogger ()->log ("LOAD TEX: RA88 not supported\n", input->getFileName ().c_str (), irr::ELL_ERROR);
return nullptr;
}
@ -153,7 +153,7 @@ namespace irr {
{
delete [] decompressedBuffer;
delete [] compressedBuffer;
wp::irrlicht::device->getLogger ()->log ("LOAD TEX: cannot decompress texture data\n", input->getFileName ().c_str (), irr::ELL_ERROR);
WallpaperEngine::irrlicht::device->getLogger ()->log ("LOAD TEX: cannot decompress texture data\n", input->getFileName ().c_str (), irr::ELL_ERROR);
return nullptr;
}
@ -166,13 +166,13 @@ namespace irr {
if (imageFormat == FREE_IMAGE_FORMAT::FIF_UNKNOWN)
{
image = wp::irrlicht::driver->createImage (ECF_A8R8G8B8, irr::core::dimension2d<u32> (width, height));
image = WallpaperEngine::irrlicht::driver->createImage (ECF_A8R8G8B8, irr::core::dimension2d<u32> (width, height));
if (!image)
{
delete [] decompressedBuffer;
delete image;
wp::irrlicht::device->getLogger ()->log ("LOAD TEX: cannot create destination image\n", input->getFileName ().c_str (), irr::ELL_ERROR);
WallpaperEngine::irrlicht::device->getLogger ()->log ("LOAD TEX: cannot create destination image\n", input->getFileName ().c_str (), irr::ELL_ERROR);
return nullptr;
}
@ -188,7 +188,7 @@ namespace irr {
this->loadImageFromDXT1 (image, decompressedBuffer, width, height, mipmap_width, mipmap_height);
break;
case TextureFormat::DXT3:
wp::irrlicht::device->getLogger ()->log ("LOAD TEX: DXT3 textures not supported yet\n", input->getFileName ().c_str (), irr::ELL_ERROR);
WallpaperEngine::irrlicht::device->getLogger ()->log ("LOAD TEX: DXT3 textures not supported yet\n", input->getFileName ().c_str (), irr::ELL_ERROR);
delete [] decompressedBuffer;
delete image;
return nullptr;
@ -214,31 +214,31 @@ namespace irr {
case FREE_IMAGE_FORMAT::FIF_BMP:
// add extension to the file
filename += ".bmp";
file = wp::irrlicht::device->getFileSystem ()->createMemoryReadFile (filebuffer, mipmap_uncompressed_size, filename.c_str (), true);
file = WallpaperEngine::irrlicht::device->getFileSystem ()->createMemoryReadFile (filebuffer, mipmap_uncompressed_size, filename.c_str (), true);
break;
case FREE_IMAGE_FORMAT::FIF_PNG:
// add extension to the file
filename += ".png";
file = wp::irrlicht::device->getFileSystem ()->createMemoryReadFile (filebuffer, mipmap_uncompressed_size, filename.c_str (), true);
file = WallpaperEngine::irrlicht::device->getFileSystem ()->createMemoryReadFile (filebuffer, mipmap_uncompressed_size, filename.c_str (), true);
break;
case FREE_IMAGE_FORMAT::FIF_JPEG:
// add extension to the file
filename += ".jpg";
wp::irrlicht::device->getFileSystem ()->createAndWriteFile ("/tmp/test.jpg", false)->write (filebuffer, mipmap_uncompressed_size);
file = wp::irrlicht::device->getFileSystem ()->createMemoryReadFile (filebuffer, mipmap_uncompressed_size, filename.c_str (), true);
WallpaperEngine::irrlicht::device->getFileSystem ()->createAndWriteFile ("/tmp/test.jpg", false)->write (filebuffer, mipmap_uncompressed_size);
file = WallpaperEngine::irrlicht::device->getFileSystem ()->createMemoryReadFile (filebuffer, mipmap_uncompressed_size, filename.c_str (), true);
break;
case FREE_IMAGE_FORMAT::FIF_GIF:
filename += ".gif";
file = wp::irrlicht::device->getFileSystem ()->createMemoryReadFile (filebuffer, mipmap_uncompressed_size, filename.c_str (), true);
file = WallpaperEngine::irrlicht::device->getFileSystem ()->createMemoryReadFile (filebuffer, mipmap_uncompressed_size, filename.c_str (), true);
break;
default:
wp::irrlicht::device->getLogger ()->log ("LOAD TEX: detected unsupported free-image format\n", input->getFileName ().c_str (), irr::ELL_ERROR);
WallpaperEngine::irrlicht::device->getLogger ()->log ("LOAD TEX: detected unsupported free-image format\n", input->getFileName ().c_str (), irr::ELL_ERROR);
delete [] decompressedBuffer;
delete [] filebuffer;
return nullptr;
}
image = wp::irrlicht::driver->createImageFromFile (file);
image = WallpaperEngine::irrlicht::driver->createImageFromFile (file);
if (!image)
{
@ -246,7 +246,7 @@ namespace irr {
delete [] decompressedBuffer;
delete image;
wp::irrlicht::device->getLogger ()->log ("LOAD TEX: cannot create destination image\n", input->getFileName ().c_str (), irr::ELL_ERROR);
WallpaperEngine::irrlicht::device->getLogger ()->log ("LOAD TEX: cannot create destination image\n", input->getFileName ().c_str (), irr::ELL_ERROR);
return nullptr;
}
}

View File

@ -2,7 +2,7 @@
// Created by almamu on 4/04/19.
//
#include <wallpaperengine/irrlicht.h>
#include <WallpaperEngine/irrlicht.h>
#include "CPkgReader.h"
CArchiveLoaderPkg::CArchiveLoaderPkg(irr::io::IFileSystem* fs)
@ -123,7 +123,7 @@ void CPkgReader::scanPkgHeader ()
if (strcmp ("PKGV0002", headerVersion) != 0 && strcmp ("PKGV0001", headerVersion) != 0)
{
wp::irrlicht::device->getLogger ()->log ("Unexpected package header... Aborting load", this->mFile->getFileName ().c_str (), irr::ELL_ERROR);
WallpaperEngine::irrlicht::device->getLogger ()->log ("Unexpected package header... Aborting load", this->mFile->getFileName ().c_str (), irr::ELL_ERROR);
delete [] headerVersion;
return;

View File

@ -1,6 +1,6 @@
#include <wallpaperengine/irrlicht.h>
#include <WallpaperEngine/irrlicht.h>
namespace wp
namespace WallpaperEngine
{
irr::video::IVideoDriver* irrlicht::driver = nullptr;
irr::IrrlichtDevice* irrlicht::device = nullptr;

View File

@ -3,7 +3,7 @@
#include <irrlicht/irrlicht.h>
namespace wp
namespace WallpaperEngine
{
class irrlicht
{

View File

@ -3,17 +3,17 @@
#include <fstream>
#include <nlohmann/json.hpp>
#include <wallpaperengine/object.h>
#include <wallpaperengine/core.h>
#include <wallpaperengine/object3d.h>
#include <wallpaperengine/image.h>
#include <wallpaperengine/sound.h>
#include <WallpaperEngine/object.h>
#include <WallpaperEngine/Core/Core.h>
#include <WallpaperEngine/object3d.h>
#include <WallpaperEngine/image.h>
#include <WallpaperEngine/sound.h>
namespace wp
namespace WallpaperEngine
{
using json = nlohmann::json;
object::object (json json_data, wp::scene* scene) : m_object3d (nullptr)
object::object (json json_data, WallpaperEngine::scene* scene) : m_object3d (nullptr)
{
this->m_scene = scene;
@ -25,21 +25,21 @@ namespace wp
{
std::string size_s = *size;
this->m_size = core::ato2vf (size_s.c_str ());
this->m_size = Core::ato2vf (size_s.c_str ());
}
if (scale != json_data.end () && scale.value ().is_string () == true)
{
std::string scale_s = *scale;
this->m_scale = core::ato3vf (scale_s.c_str ());
this->m_scale = Core::ato3vf (scale_s.c_str ());
}
if (origin != json_data.end () && origin.value ().is_string () == true)
{
std::string origin_s = *origin;
this->m_origin = core::ato3vf (origin_s.c_str ());
this->m_origin = Core::ato3vf (origin_s.c_str ());
}
json::const_iterator angles = json_data.find ("angles");
@ -50,7 +50,7 @@ namespace wp
{
std::string angles_s = *angles;
this->m_angles = core::ato3vf (angles_s.c_str ());
this->m_angles = Core::ato3vf (angles_s.c_str ());
}
if (id != json_data.end () && (*id).is_null () == false)
@ -107,7 +107,7 @@ namespace wp
switch (_type)
{
case object3d::Type::Type_Material:
this->m_object3d = new wp::image (json_data, this);
this->m_object3d = new WallpaperEngine::image (json_data, this);
break;
case object3d::Type::Type_Model:
@ -117,7 +117,7 @@ namespace wp
break;
case object3d::Type::Type_Sound:
this->m_object3d = new wp::sound ((*sound), this);
this->m_object3d = new WallpaperEngine::sound ((*sound), this);
break;
}
}
@ -164,7 +164,7 @@ namespace wp
return this->m_effects;
}
wp::scene* object::getScene ()
WallpaperEngine::scene* object::getScene ()
{
return this->m_scene;
}

View File

@ -4,11 +4,11 @@
#include <iostream>
#include <irrlicht/irrlicht.h>
#include <nlohmann/json.hpp>
#include <wallpaperengine/video/node.h>
#include <wallpaperengine/effect.h>
#include <wallpaperengine/scene.h>
#include <WallpaperEngine/video/node.h>
#include <WallpaperEngine/effect.h>
#include <WallpaperEngine/scene.h>
namespace wp
namespace WallpaperEngine
{
using json = nlohmann::json;
@ -16,11 +16,11 @@ namespace wp
class scene;
class effect;
class object : public wp::video::node
class object : public WallpaperEngine::video::node
{
public:
object (json json_data, wp::scene* scene);
object (json json_data, WallpaperEngine::scene* scene);
~object ();
irr::core::vector2df& getSize ();
@ -31,13 +31,13 @@ namespace wp
std::vector<effect*>& getEffects ();
wp::scene* getScene ();
WallpaperEngine::scene* getScene ();
void render ();
private:
int m_id;
wp::scene* m_scene;
WallpaperEngine::scene* m_scene;
std::string m_name;
@ -46,7 +46,7 @@ namespace wp
irr::core::vector3df m_origin;
irr::core::vector3df m_angles;
wp::object3d* m_object3d;
WallpaperEngine::object3d* m_object3d;
std::vector<effect*> m_effects;
};
};

View File

@ -1,9 +1,9 @@
#include <wallpaperengine/object3d.h>
#include <wallpaperengine/image.h>
#include <WallpaperEngine/object3d.h>
#include <WallpaperEngine/image.h>
namespace wp
namespace WallpaperEngine
{
object3d::object3d (object3d::Type type, wp::object* parent)
object3d::object3d (object3d::Type type, WallpaperEngine::object* parent)
{
this->m_type = type;
}

View File

@ -1,13 +1,13 @@
#ifndef WALLENGINE_OBJECT3D_H
#define WALLENGINE_OBJECT3D_H
#include <wallpaperengine/video/node.h>
#include <WallpaperEngine/video/node.h>
#include <wallpaperengine/scene.h>
#include <WallpaperEngine/scene.h>
namespace wp
namespace WallpaperEngine
{
class object3d : wp::video::node
class object3d : WallpaperEngine::video::node
{
public:
enum Type
@ -19,7 +19,7 @@ namespace wp
Type_None = 4
};
object3d (Type type, wp::object* parent);
object3d (Type type, WallpaperEngine::object* parent);
virtual void render ();
@ -27,7 +27,7 @@ namespace wp
template <class T> bool is();
protected:
wp::object* m_parent;
WallpaperEngine::object* m_parent;
private:
Type m_type;

View File

@ -3,16 +3,16 @@
#include <fstream>
#include <stdexcept>
#include "wallpaperengine/fs/utils.h"
#include "WallpaperEngine/fs/utils.h"
#include "project.h"
#include "irrlicht.h"
namespace wp
namespace WallpaperEngine
{
project::project (irr::io::path& jsonfile_path)
{
this->m_content = wp::fs::utils::loadFullFile (jsonfile_path);
this->m_content = WallpaperEngine::fs::utils::loadFullFile (jsonfile_path);
this->m_projectFile = json::parse (this->m_content);
json::const_iterator file_it = this->m_projectFile.find ("file");

View File

@ -5,7 +5,7 @@
#include <nlohmann/json.hpp>
#include "scene.h"
namespace wp
namespace WallpaperEngine
{
using json = nlohmann::json;

View File

@ -3,18 +3,18 @@
#include <fstream>
#include <nlohmann/json.hpp>
#include <wallpaperengine/scene.h>
#include <wallpaperengine/camera.h>
#include <WallpaperEngine/scene.h>
#include <WallpaperEngine/camera.h>
#include "wallpaperengine/fs/utils.h"
#include "WallpaperEngine/fs/utils.h"
namespace wp
namespace WallpaperEngine
{
using json = nlohmann::json;
scene::scene (irr::io::path& file)
{
this->m_content = wp::fs::utils::loadFullFile (file);
this->m_content = WallpaperEngine::fs::utils::loadFullFile (file);
this->m_json = json::parse (this->m_content);
// check basic elements

View File

@ -4,16 +4,16 @@
#include <iostream>
#include <irrlicht/irrlicht.h>
#include <nlohmann/json.hpp>
#include <wallpaperengine/object.h>
#include <wallpaperengine/camera.h>
#include <wallpaperengine/video/node.h>
#include <WallpaperEngine/object.h>
#include <WallpaperEngine/camera.h>
#include <WallpaperEngine/video/node.h>
namespace wp
namespace WallpaperEngine
{
using json = nlohmann::json;
class object;
class scene : public wp::video::node
class scene : public WallpaperEngine::video::node
{
public:
scene (irr::io::path& file);

View File

@ -4,16 +4,16 @@
#include <string>
// filesystem
#include <wallpaperengine/fs/utils.h>
#include <WallpaperEngine/fs/utils.h>
// video engine
#include <wallpaperengine/irrlicht.h>
#include <WallpaperEngine/irrlicht.h>
// shader compiler
#include <wallpaperengine/shaders/compiler.h>
#include <wallpaperengine/core.h>
#include <WallpaperEngine/shaders/compiler.h>
#include <WallpaperEngine/Core/Core.h>
namespace wp
namespace WallpaperEngine
{
namespace shaders
{
@ -58,7 +58,7 @@ namespace wp
this->m_content = "";
}
this->m_content.append (wp::fs::utils::loadFullFile (file));
this->m_content.append (WallpaperEngine::fs::utils::loadFullFile (file));
// append file content
this->m_type = type;
@ -244,7 +244,7 @@ namespace wp
std::string compiler::precompile()
{
#define BREAK_IF_ERROR if (this->m_error == true) { wp::irrlicht::device->getLogger ()->log ("ERROR PRE-COMPILING SHADER", irr::ELL_ERROR); wp::irrlicht::device->getLogger ()->log (this->m_errorInfo.c_str (), irr::ELL_ERROR); return ""; }
#define BREAK_IF_ERROR if (this->m_error == true) { WallpaperEngine::irrlicht::device->getLogger ()->log ("ERROR PRE-COMPILING SHADER", irr::ELL_ERROR); WallpaperEngine::irrlicht::device->getLogger ()->log (this->m_errorInfo.c_str (), irr::ELL_ERROR); return ""; }
// parse the shader and find #includes and such things and translate them to the correct name
// also remove any #version definition to prevent errors
std::string::const_iterator it = this->m_content.begin ();
@ -445,8 +445,8 @@ namespace wp
if (this->m_recursive == false)
{
wp::irrlicht::device->getLogger ()->log ("Compiled shader output for", this->m_file.c_str ());
wp::irrlicht::device->getLogger ()->log (this->m_compiledContent.c_str ());
WallpaperEngine::irrlicht::device->getLogger ()->log ("Compiled shader output for", this->m_file.c_str ());
WallpaperEngine::irrlicht::device->getLogger ()->log (this->m_compiledContent.c_str ());
}
return this->m_compiledContent;
@ -464,7 +464,7 @@ namespace wp
if (combo == data.end () || defvalue == data.end ())
{
wp::irrlicht::device->getLogger ()->log ("Cannot parse combo information", irr::ELL_ERROR);
WallpaperEngine::irrlicht::device->getLogger ()->log ("Cannot parse combo information", irr::ELL_ERROR);
return;
}
@ -490,7 +490,7 @@ namespace wp
}
else
{
wp::irrlicht::device->getLogger ()->log ("Cannot parse combo information, unknown type", irr::ELL_ERROR);
WallpaperEngine::irrlicht::device->getLogger ()->log ("Cannot parse combo information, unknown type", irr::ELL_ERROR);
}
}
}
@ -506,7 +506,7 @@ namespace wp
if (material == data.end () || defvalue == data.end ())
{
if (type != "sampler2D")
wp::irrlicht::device->getLogger ()->log ("Cannot parse parameter info for ", name.c_str (), irr::ELL_ERROR);
WallpaperEngine::irrlicht::device->getLogger ()->log ("Cannot parse parameter info for ", name.c_str (), irr::ELL_ERROR);
return;
}
@ -531,7 +531,7 @@ namespace wp
}
else
{
irr::core::vector3df tmp = wp::core::ato3vf ((*defvalue).get <std::string> ().c_str ());
irr::core::vector3df tmp = WallpaperEngine::Core::ato3vf ((*defvalue).get <std::string> ().c_str ());
irr::core::vector3df* vector = new irr::core::vector3df;
vector->X = tmp.X;
@ -555,7 +555,7 @@ namespace wp
else
{
irr::core::vector2df* vector = new irr::core::vector2df;
irr::core::vector2df tmp = wp::core::ato2vf ((*defvalue).get <std::string> ().c_str ());
irr::core::vector2df tmp = WallpaperEngine::Core::ato2vf ((*defvalue).get <std::string> ().c_str ());
vector->X = tmp.X;
vector->Y = tmp.Y;

View File

@ -6,9 +6,9 @@
#include <vector>
#include <map>
#include <wallpaperengine/fs/utils.h>
#include <WallpaperEngine/fs/utils.h>
namespace wp
namespace WallpaperEngine
{
namespace shaders
{

View File

@ -7,9 +7,9 @@
#include "sound.h"
#include "irrlicht.h"
namespace wp
namespace WallpaperEngine
{
sound::sound (json json_data, wp::object* parent) : object3d (object3d::Type::Type_Material, parent)
sound::sound (json json_data, WallpaperEngine::object* parent) : object3d (object3d::Type::Type_Material, parent)
{
json::const_iterator cur = json_data.begin ();
json::const_iterator end = json_data.end ();
@ -31,7 +31,7 @@ namespace wp
{
SDL_RWops* sdlRwops = nullptr;
Mix_Music* music = nullptr;
irr::io::IReadFile* readfile = wp::irrlicht::device->getFileSystem ()->createAndOpenFile ((*cur).c_str ());
irr::io::IReadFile* readfile = WallpaperEngine::irrlicht::device->getFileSystem ()->createAndOpenFile ((*cur).c_str ());
int filesize = readfile->getSize ();
char* filebuffer = new char [filesize];
@ -43,7 +43,7 @@ namespace wp
if (music == nullptr)
{
wp::irrlicht::device->getLogger ()->log ("Cannot load audio", Mix_GetError (), irr::ELL_ERROR);
WallpaperEngine::irrlicht::device->getLogger ()->log ("Cannot load audio", Mix_GetError (), irr::ELL_ERROR);
}
this->m_bufferReader.push_back (sdlRwops);
@ -58,7 +58,7 @@ namespace wp
{
if (Mix_PlayMusic ((*mixcur), -1) == -1)
{
wp::irrlicht::device->getLogger ()->log ("Cannot play audio", Mix_GetError (), irr::ELL_ERROR);
WallpaperEngine::irrlicht::device->getLogger ()->log ("Cannot play audio", Mix_GetError (), irr::ELL_ERROR);
}
}
}

View File

@ -5,17 +5,17 @@
#include <irrlicht/irrlicht.h>
#include <SDL_mixer.h>
#include <wallpaperengine/object3d.h>
#include <wallpaperengine/object.h>
#include <WallpaperEngine/object3d.h>
#include <WallpaperEngine/object.h>
namespace wp
namespace WallpaperEngine
{
using json = nlohmann::json;
class sound : public wp::object3d
class sound : public WallpaperEngine::object3d
{
public:
sound (json json_data, wp::object* parent);
sound (json json_data, WallpaperEngine::object* parent);
void play ();

View File

@ -1,14 +1,14 @@
#include <wallpaperengine/texture.h>
#include <WallpaperEngine/texture.h>
#include <stdexcept>
#include <lz4.h>
#include "irrlicht.h"
namespace wp
namespace WallpaperEngine
{
texture::texture (irr::io::path& file)
{
this->m_texture = wp::irrlicht::driver->getTexture (file);
this->m_texture = WallpaperEngine::irrlicht::driver->getTexture (file);
}
irr::video::ITexture* texture::getIrrTexture ()

View File

@ -3,7 +3,7 @@
#include <irrlicht/irrlicht.h>
namespace wp
namespace WallpaperEngine
{
class texture
{

View File

@ -1,11 +1,11 @@
#include <wallpaperengine/irrlicht.h>
#include <wallpaperengine/video/material.h>
#include <WallpaperEngine/irrlicht.h>
#include <WallpaperEngine/video/material.h>
namespace wp
namespace WallpaperEngine
{
namespace video
{
material::material (irr::core::vector3df origin, wp::scene *scene)
material::material (irr::core::vector3df origin, WallpaperEngine::scene *scene)
{
m_origin = origin;
m_scene = scene;
@ -56,8 +56,8 @@ namespace wp
0, 1, 2, 3
};
wp::irrlicht::driver->setMaterial (m_material);
wp::irrlicht::driver->drawVertexPrimitiveList (m_vertices, 4, indices, 1, irr::video::EVT_STANDARD, irr::scene::EPT_QUADS, irr::video::EIT_16BIT);
WallpaperEngine::irrlicht::driver->setMaterial (m_material);
WallpaperEngine::irrlicht::driver->drawVertexPrimitiveList (m_vertices, 4, indices, 1, irr::video::EVT_STANDARD, irr::scene::EPT_QUADS, irr::video::EIT_16BIT);
}
}
}

View File

@ -3,17 +3,17 @@
#include <irrlicht/vector3d.h>
#include <wallpaperengine/scene.h>
#include <wallpaperengine/video/node.h>
#include <WallpaperEngine/scene.h>
#include <WallpaperEngine/video/node.h>
namespace wp
namespace WallpaperEngine
{
namespace video
{
class material : public node
{
public:
material (irr::core::vector3df origin, wp::scene* scene);
material (irr::core::vector3df origin, WallpaperEngine::scene* scene);
void render ();
irr::video::SMaterial& getMaterial ();
void setFlag(irr::video::E_MATERIAL_FLAG flag, bool newvalue);
@ -23,7 +23,7 @@ namespace wp
irr::video::S3DVertex m_vertices [4];
irr::video::SMaterial m_material;
irr::core::vector3df m_origin;
wp::scene* m_scene;
WallpaperEngine::scene* m_scene;
};
}
}

View File

@ -1,6 +1,6 @@
#include <wallpaperengine/video/node.h>
#include <WallpaperEngine/video/node.h>
namespace wp
namespace WallpaperEngine
{
namespace video
{

View File

@ -1,7 +1,7 @@
#ifndef WALLENGINE_NODE_H
#define WALLENGINE_NODE_H
namespace wp
namespace WallpaperEngine
{
namespace video
{

View File

@ -1,7 +1,7 @@
#include <wallpaperengine/irrlicht.h>
#include <wallpaperengine/video/renderer.h>
#include <WallpaperEngine/irrlicht.h>
#include <WallpaperEngine/video/renderer.h>
namespace wp
namespace WallpaperEngine
{
namespace video
{
@ -10,7 +10,7 @@ namespace wp
s_nodes.push_back (node);
}
void renderer::setupOrthographicCamera (wp::scene* scene)
void renderer::setupOrthographicCamera (WallpaperEngine::scene* scene)
{
setupOrthographicCamera (
scene->getProjectionWidth (),
@ -31,19 +31,19 @@ namespace wp
znear,
zfar
);
wp::irrlicht::camera = wp::irrlicht::device->getSceneManager ()->addCameraSceneNode (0, position, lookat);
wp::irrlicht::camera->setProjectionMatrix (orthoProjection);
WallpaperEngine::irrlicht::camera = WallpaperEngine::irrlicht::device->getSceneManager ()->addCameraSceneNode (0, position, lookat);
WallpaperEngine::irrlicht::camera->setProjectionMatrix (orthoProjection);
wp::irrlicht::driver->setTransform (irr::video::ETS_PROJECTION, orthoProjection);
wp::irrlicht::driver->setTransform (irr::video::ETS_VIEW, identity);
wp::irrlicht::driver->setTransform (irr::video::ETS_WORLD, identity);
WallpaperEngine::irrlicht::driver->setTransform (irr::video::ETS_PROJECTION, orthoProjection);
WallpaperEngine::irrlicht::driver->setTransform (irr::video::ETS_VIEW, identity);
WallpaperEngine::irrlicht::driver->setTransform (irr::video::ETS_WORLD, identity);
}
void renderer::render ()
{
if (wp::irrlicht::driver == nullptr) return;
if (WallpaperEngine::irrlicht::driver == nullptr) return;
wp::irrlicht::driver->beginScene(true, true, irr::video::SColor(0, 0, 0, 0));
WallpaperEngine::irrlicht::driver->beginScene(true, true, irr::video::SColor(0, 0, 0, 0));
std::vector<node*>::const_iterator cur = s_nodes.begin ();
std::vector<node*>::const_iterator end = s_nodes.end ();
@ -53,7 +53,7 @@ namespace wp
(*cur)->render ();
}
wp::irrlicht::driver->endScene ();
WallpaperEngine::irrlicht::driver->endScene ();
}
std::vector<node*> renderer::s_nodes;

View File

@ -3,10 +3,10 @@
#include <vector>
#include <wallpaperengine/video/node.h>
#include <wallpaperengine/scene.h>
#include <WallpaperEngine/video/node.h>
#include <WallpaperEngine/scene.h>
namespace wp
namespace WallpaperEngine
{
namespace video
{
@ -14,7 +14,7 @@ namespace wp
{
public:
static void queueNode (node* node);
static void setupOrthographicCamera (wp::scene* scene);
static void setupOrthographicCamera (WallpaperEngine::scene* scene);
static void setupOrthographicCamera (irr::f32 width, irr::f32 height, irr::core::vector3df position, irr::core::vector3df lookat, irr::f32 znear, irr::f32 zfar);
static void render ();

View File

@ -1,17 +1,19 @@
#include <iostream>
#include <irrlicht/irrlicht.h>
#include <sstream>
#include <wallpaperengine/video/renderer.h>
#include <wallpaperengine/video/material.h>
#include <wallpaperengine/irr/CPkgReader.h>
#include <WallpaperEngine/video/renderer.h>
#include <WallpaperEngine/video/material.h>
#include <WallpaperEngine/irr/CPkgReader.h>
#include <getopt.h>
#include <SDL_mixer.h>
#include <SDL.h>
#include "wallpaperengine/shaders/compiler.h"
#include "wallpaperengine/project.h"
#include "wallpaperengine/irrlicht.h"
#include "wallpaperengine/irr/CImageLoaderTEX.h"
#include "WallpaperEngine/shaders/compiler.h"
#include "WallpaperEngine/project.h"
#include "WallpaperEngine/irrlicht.h"
#include "WallpaperEngine/irr/CImageLoaderTEX.h"
#include "WallpaperEngine/Core/CProject.h"
int WinID = 0;
irr::SIrrlichtCreationParameters _irr_params;
@ -38,29 +40,29 @@ int init_irrlicht()
_irr_params.LoggingLevel = irr::ELL_DEBUG;
_irr_params.WindowId = reinterpret_cast<void*> (WinID);
wp::irrlicht::device = irr::createDeviceEx (_irr_params);
WallpaperEngine::irrlicht::device = irr::createDeviceEx (_irr_params);
if (wp::irrlicht::device == nullptr)
if (WallpaperEngine::irrlicht::device == nullptr)
{
return 1;
}
wp::irrlicht::device->setWindowCaption (L"Test game");
wp::irrlicht::driver = wp::irrlicht::device->getVideoDriver();
WallpaperEngine::irrlicht::device->setWindowCaption (L"Test game");
WallpaperEngine::irrlicht::driver = WallpaperEngine::irrlicht::device->getVideoDriver();
// check for ps and vs support
if (
wp::irrlicht::driver->queryFeature (irr::video::EVDF_PIXEL_SHADER_1_1) == false &&
wp::irrlicht::driver->queryFeature (irr::video::EVDF_ARB_FRAGMENT_PROGRAM_1) == false)
WallpaperEngine::irrlicht::driver->queryFeature (irr::video::EVDF_PIXEL_SHADER_1_1) == false &&
WallpaperEngine::irrlicht::driver->queryFeature (irr::video::EVDF_ARB_FRAGMENT_PROGRAM_1) == false)
{
wp::irrlicht::device->getLogger ()->log ("WARNING: Pixel shaders disabled because of missing driver/hardware support");
WallpaperEngine::irrlicht::device->getLogger ()->log ("WARNING: Pixel shaders disabled because of missing driver/hardware support");
}
if (
wp::irrlicht::driver->queryFeature (irr::video::EVDF_VERTEX_SHADER_1_1) == false &&
wp::irrlicht::driver->queryFeature (irr::video::EVDF_ARB_VERTEX_PROGRAM_1) == false)
WallpaperEngine::irrlicht::driver->queryFeature (irr::video::EVDF_VERTEX_SHADER_1_1) == false &&
WallpaperEngine::irrlicht::driver->queryFeature (irr::video::EVDF_ARB_VERTEX_PROGRAM_1) == false)
{
wp::irrlicht::device->getLogger ()->log ("WARNING: Vertex shaders disabled because of missing driver/hardware support");
WallpaperEngine::irrlicht::device->getLogger ()->log ("WARNING: Vertex shaders disabled because of missing driver/hardware support");
}
return 0;
@ -69,11 +71,11 @@ int init_irrlicht()
void preconfigure_wallpaper_engine ()
{
// load the assets from wallpaper engine
wp::irrlicht::device->getFileSystem ()->addFileArchive ("assets.zip", true, false);
WallpaperEngine::irrlicht::device->getFileSystem ()->addFileArchive ("assets.zip", true, false);
// register custom loaders
wp::irrlicht::driver->addExternalImageLoader (new irr::video::CImageLoaderTex ());
wp::irrlicht::device->getFileSystem ()->addArchiveLoader (new CArchiveLoaderPkg (wp::irrlicht::device->getFileSystem ()));
WallpaperEngine::irrlicht::driver->addExternalImageLoader (new irr::video::CImageLoaderTex ());
WallpaperEngine::irrlicht::device->getFileSystem ()->addArchiveLoader (new CArchiveLoaderPkg (WallpaperEngine::irrlicht::device->getFileSystem ()));
}
void print_help (const char* route)
@ -162,20 +164,20 @@ int main (int argc, char* argv[])
// pkg mode
case 1:
wallpaper_path = wp::irrlicht::device->getFileSystem ()->getAbsolutePath (path.c_str ());
wallpaper_path = WallpaperEngine::irrlicht::device->getFileSystem ()->getAbsolutePath (path.c_str ());
project_path = wallpaper_path + "project.json";
scene_path = wallpaper_path + "scene.pkg";
wp::irrlicht::device->getFileSystem ()->addFileArchive (scene_path, true, false); // add the pkg file to the lookup list
WallpaperEngine::irrlicht::device->getFileSystem ()->addFileArchive (scene_path, true, false); // add the pkg file to the lookup list
break;
// folder mode
case 2:
wallpaper_path = wp::irrlicht::device->getFileSystem ()->getAbsolutePath (path.c_str ());
wallpaper_path = WallpaperEngine::irrlicht::device->getFileSystem ()->getAbsolutePath (path.c_str ());
project_path = wallpaper_path + "project.json";
// set our working directory
wp::irrlicht::device->getFileSystem ()->changeWorkingDirectoryTo (wallpaper_path);
WallpaperEngine::irrlicht::device->getFileSystem ()->changeWorkingDirectoryTo (wallpaper_path);
break;
default:
@ -188,7 +190,7 @@ int main (int argc, char* argv[])
if (SDL_Init (SDL_INIT_AUDIO) < 0 || mixer_flags != Mix_Init (mixer_flags))
{
wp::irrlicht::device->getLogger ()->log ("Cannot initialize SDL audio system", irr::ELL_ERROR);
WallpaperEngine::irrlicht::device->getLogger ()->log ("Cannot initialize SDL audio system", irr::ELL_ERROR);
return -1;
}
@ -196,40 +198,40 @@ int main (int argc, char* argv[])
Mix_OpenAudio (22050, AUDIO_S16SYS, 2, 640);
}
wp::project* wp_project = new wp::project (project_path);
WallpaperEngine::project* wp_project = new WallpaperEngine::project (project_path);
if (wp_project->getScene ()->isOrthogonal() == true)
{
wp::video::renderer::setupOrthographicCamera (wp_project->getScene ());
WallpaperEngine::video::renderer::setupOrthographicCamera (wp_project->getScene ());
}
else
{
wp::irrlicht::device->getLogger ()->log ("Non-orthogonal cameras not supported yet!!", irr::ELL_ERROR);
WallpaperEngine::irrlicht::device->getLogger ()->log ("Non-orthogonal cameras not supported yet!!", irr::ELL_ERROR);
return -2;
}
// register nodes
wp::video::renderer::queueNode (wp_project->getScene ());
WallpaperEngine::video::renderer::queueNode (wp_project->getScene ());
int32_t lastTime = 0;
int32_t minimumTime = 1000 / 90;
int32_t currentTime = 0;
while (wp::irrlicht::device->run () && wp::irrlicht::driver)
while (WallpaperEngine::irrlicht::device->run () && WallpaperEngine::irrlicht::driver)
{
// if (device->isWindowActive ())
{
currentTime = wp::irrlicht::device->getTimer ()->getTime ();
currentTime = WallpaperEngine::irrlicht::device->getTimer ()->getTime ();
g_Time = currentTime / 1000.0f;
if (currentTime - lastTime > minimumTime)
{
wp::video::renderer::render ();
WallpaperEngine::video::renderer::render ();
lastTime = currentTime;
}
else
{
wp::irrlicht::device->sleep (1, false);
WallpaperEngine::irrlicht::device->sleep (1, false);
}
}
}

View File

@ -1,59 +0,0 @@
#include <irrlicht/fast_atof.h>
#include "core.h"
irr::core::vector3df wp::core::ato3vf(const char *str)
{
irr::f32 x = irr::core::fast_atof (str, &str); while (*str == ' ') str ++;
irr::f32 y = irr::core::fast_atof (str, &str); while (*str == ' ') str ++;
irr::f32 z = irr::core::fast_atof (str, &str);
return irr::core::vector3df (x, y, z);
}
irr::core::vector2df wp::core::ato2vf (const char *str)
{
irr::f32 x = irr::core::fast_atof (str, &str); while (*str == ' ') str ++;
irr::f32 y = irr::core::fast_atof (str, &str);
return irr::core::vector2df (x, y);
}
irr::core::vector3df wp::core::ato3vf (const std::string& str)
{
return wp::core::ato3vf (str.c_str ());
}
irr::core::vector2df wp::core::ato2vf (const std::string& str)
{
return wp::core::ato2vf (str.c_str ());
}
irr::video::SColorf wp::core::atoSColorf (const char *str)
{
irr::core::vector3df vector = wp::core::ato3vf (str);
return irr::video::SColorf (
vector.X,
vector.Y,
vector.Z
);
}
irr::video::SColorf wp::core::atoSColorf (const std::string& str)
{
return wp::core::atoSColorf (str.c_str ());
}
irr::video::SColor wp::core::atoSColor (const char *str)
{
irr::f32 r = irr::core::strtoul10 (str, &str); while (*str == ' ') str ++;
irr::f32 g = irr::core::strtoul10 (str, &str); while (*str == ' ') str ++;
irr::f32 b = irr::core::strtoul10 (str, &str);
return irr::video::SColor (255, r, g, b);
}
irr::video::SColor wp::core::atoSColor (const std::string& str)
{
return wp::core::atoSColor (str.c_str ());
}