Viewport stuff
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#define Components_Camera_h__
|
||||
|
||||
#include "Component.h"
|
||||
#include "Entity.h"
|
||||
|
||||
namespace Components
|
||||
{
|
||||
@@ -13,7 +14,7 @@ struct Camera : Component
|
||||
, NearClip(0.1f)
|
||||
, FarClip(100.f) { }
|
||||
|
||||
std::string Viewport;
|
||||
EntityID Viewport;
|
||||
float FOV;
|
||||
float NearClip;
|
||||
float FarClip;
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
#ifndef Components_Viewport_h__
|
||||
#define Components_Viewport_h__
|
||||
|
||||
#include "Component.h"
|
||||
|
||||
namespace Components
|
||||
{
|
||||
|
||||
struct Viewport : Component
|
||||
{
|
||||
Viewport()
|
||||
: Left(0.f)
|
||||
, Top(0.f)
|
||||
, Right(1.f)
|
||||
, Bottom(1.f) { }
|
||||
|
||||
float Left;
|
||||
float Top;
|
||||
float Right;
|
||||
float Bottom;
|
||||
|
||||
virtual Viewport* Clone() const override { return new Viewport(*this); }
|
||||
};
|
||||
|
||||
}
|
||||
#endif // Components_Viewport_h__
|
||||
@@ -67,6 +67,20 @@ void GameWorld::Initialize()
|
||||
|
||||
RegisterComponents();
|
||||
|
||||
auto viewport1 = CreateEntity();
|
||||
{
|
||||
auto viewport = AddComponent<Components::Viewport>(viewport1, "Transform");
|
||||
viewport->Right = 0.5f;
|
||||
}
|
||||
CommitEntity(viewport1);
|
||||
|
||||
auto viewport2 = CreateEntity();
|
||||
{
|
||||
auto viewport = AddComponent<Components::Viewport>(viewport1, "Transform");
|
||||
viewport->Left = 0.5f;
|
||||
}
|
||||
CommitEntity(viewport2);
|
||||
|
||||
{
|
||||
auto camera = CreateEntity();
|
||||
auto transform = AddComponent<Components::Transform>(camera, "Transform");
|
||||
@@ -74,6 +88,7 @@ void GameWorld::Initialize()
|
||||
transform->Position.y = 20.f;
|
||||
//transform->Orientation = glm::quat(glm::vec3(glm::pi<float>() / 8.f, 0.f, 0.f));
|
||||
auto cameraComp = AddComponent<Components::Camera>(camera, "Camera");
|
||||
cameraComp->Viewport = viewport1;
|
||||
cameraComp->FarClip = 2000.f;
|
||||
auto freeSteering = AddComponent<Components::FreeSteering>(camera, "FreeSteering");
|
||||
CommitEntity(camera);
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "Components/Sprite.h"
|
||||
#include "Components/Template.h"
|
||||
#include "Components/Transform.h"
|
||||
#include "Components/Viewport.h"
|
||||
|
||||
#include "Components/Physics.h"
|
||||
#include "Components/SphereShape.h"
|
||||
|
||||
@@ -147,6 +147,7 @@
|
||||
<ClInclude Include="..\..\src\Components\TowerSteering.h" />
|
||||
<ClInclude Include="..\..\src\Components\Transform.h" />
|
||||
<ClInclude Include="..\..\src\Components\Vehicle.h" />
|
||||
<ClInclude Include="..\..\src\Components\Viewport.h" />
|
||||
<ClInclude Include="..\..\src\Components\Wheel.h" />
|
||||
<ClInclude Include="..\..\src\Components\WheelPair.h" />
|
||||
<ClInclude Include="..\..\src\CubemapTexture.h" />
|
||||
|
||||
@@ -352,6 +352,9 @@
|
||||
<ClInclude Include="..\..\src\Events\BindGamepadButton.h">
|
||||
<Filter>Input\Events</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\Components\Viewport.h">
|
||||
<Filter>Rendering\Components</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\..\src\Shaders\Fragment2.glsl">
|
||||
|
||||
Reference in New Issue
Block a user