JAMSPOOK-23 - Camera system in place
- Implemented the camera system into the engine. - Implemented an active follow camera into the game.
This commit is contained in:
parent
2e688b9f62
commit
6226457580
|
@ -31,8 +31,9 @@ JamSpookGame::JamSpookGame():
|
|||
addSystem(assetSystem);
|
||||
|
||||
// Create window
|
||||
// Resolution (256x224 scaled to whatever)
|
||||
Log::write(LogLevel::info, "Game - Constructor - Creating window");
|
||||
mWindow = make_shared<Window>("BouncyBalls", 1024, 1024, Window::WindowMode::window);
|
||||
mWindow = make_shared<Window>("BouncyBalls", 480, 272, Window::WindowMode::window);
|
||||
mWindow->hide();
|
||||
|
||||
// Create renderer
|
||||
|
@ -47,6 +48,9 @@ JamSpookGame::JamSpookGame():
|
|||
// Create animation system
|
||||
addSystem(make_shared<AnimationSystem>());
|
||||
|
||||
// Create camera system
|
||||
addSystem(make_shared<CameraSystem>());
|
||||
|
||||
// Create interaction system
|
||||
addSystem(make_shared<InteractionSystem>());
|
||||
shared_ptr<InteractionSystem> interactionSystem = dynamic_pointer_cast<InteractionSystem>(findSystem(IDCache::get("InteractionSystem")));
|
||||
|
@ -96,7 +100,7 @@ JamSpookGame::JamSpookGame():
|
|||
// 16.0f/9.0f,
|
||||
|
||||
// mCamera = camFactory->createPerspective(vec3(1.0f, 100.0f, 0.0f),
|
||||
mCamera = camFactory->createPerspective(vec3(-60.0f, 40.0f, 60.0f),
|
||||
mCamera = camFactory->createPerspective(vec3(0.0f, 0.0f, 0.0f), // The follow cam implementation will change the position during runtime.
|
||||
vec3(0.0f, -20.0f, 0.0f),
|
||||
vec3(0.0f, 1.0f, 0.0f),
|
||||
90.0f/2,
|
||||
|
@ -302,10 +306,52 @@ void JamSpookGame::set()
|
|||
dynamic_pointer_cast<InteractionSystem>(findSystem(IDCache::get("InteractionSystem"))),
|
||||
renderLayerGame);
|
||||
|
||||
kartFactory->createKart(vec3(0, 3, 0), // position
|
||||
vec3(0, 180, 0)); // euler degrees rotation, XYZ
|
||||
shared_ptr<Entity> kartEntity = kartFactory->createKart(
|
||||
vec3(0, 3, 0), // position
|
||||
vec3(0, 180, 0)); // euler degrees rotation, XYZ
|
||||
|
||||
kartFactory.reset();
|
||||
|
||||
// Create the follow camera, and lock it to the kart
|
||||
unique_ptr<CameraFactory> cameraFactory = make_unique<CameraFactory>();
|
||||
cameraFactory->createActiveFollowCamera("followKartCamera",
|
||||
mCamera,
|
||||
kartEntity,
|
||||
vec3(0 ,10 ,-25),
|
||||
vec3(0, 5, 0));
|
||||
cameraFactory.reset();
|
||||
|
||||
|
||||
|
||||
/**
|
||||
const string name,
|
||||
shared_ptr<Camera>,
|
||||
weak_ptr<Entity> wTargetEntity,
|
||||
const vec3 cameraPositionOffset,
|
||||
const vec3 targetPositionOffset
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Set game state
|
||||
setGameState(ecos::core::GameState::InGame);
|
||||
|
|
|
@ -39,6 +39,10 @@
|
|||
|
||||
#include <ecos/animation/AnimationSystem.h>
|
||||
|
||||
#include <ecos/camera/CameraSystem.h>
|
||||
#include <ecos/camera/CameraFactory.h>
|
||||
#include <ecos/camera/Camera.h>
|
||||
|
||||
#include <ecos/interaction/InteractionSystem.h>
|
||||
|
||||
#include <ecos/graphics/GraphicsSystem.h>
|
||||
|
@ -49,8 +53,6 @@
|
|||
#include <ecos/graphics/ShaderProgramFactory.h>
|
||||
#include <ecos/graphics/DevILSystem.h>
|
||||
#include <ecos/graphics/GL4Renderer.h>
|
||||
#include <ecos/graphics/camera/CameraFactory.h>
|
||||
#include <ecos/graphics/camera/Camera.h>
|
||||
#include <ecos/graphics/loaders/MeshLoader.h>
|
||||
#include <ecos/graphics/loaders/ShaderLoader.h>
|
||||
#include <ecos/graphics/loaders/ShaderProgramLoader.h>
|
||||
|
@ -114,6 +116,10 @@ using ecos::physics::CollisionShapeLoader;
|
|||
|
||||
using ecos::animation::AnimationSystem;
|
||||
|
||||
using ecos::camera::CameraSystem;
|
||||
using ecos::camera::CameraFactory;
|
||||
using ecos::camera::Camera;
|
||||
|
||||
using ecos::interaction::InteractionSystem;
|
||||
using ecos::interaction::InputDeviceState;
|
||||
using ecos::interaction::ButtonState;
|
||||
|
@ -127,8 +133,6 @@ using ecos::graphics::ShaderProgramFactory;
|
|||
using ecos::graphics::DevILSystem;
|
||||
using ecos::graphics::Renderer;
|
||||
using ecos::graphics::GL4Renderer;
|
||||
using ecos::graphics::Camera;
|
||||
using ecos::graphics::CameraFactory;
|
||||
using ecos::graphics::MeshLoader;
|
||||
using ecos::graphics::ShaderLoader;
|
||||
using ecos::graphics::ShaderProgramLoader;
|
||||
|
|
Loading…
Reference in New Issue