La till lite ljus och annan skit. Började på defucked rendering och det gick ju jävligt bra fucktiskt.
This commit is contained in:
+29
-2
@@ -40,11 +40,38 @@ void GameWorld::Initialize()
|
||||
physics->Mass = 10;
|
||||
}
|
||||
|
||||
for(int i = 0; i < 10; i++)
|
||||
{
|
||||
auto TankTest = CreateEntity();
|
||||
auto transform = AddComponent<Components::Transform>(TankTest, "Transform");
|
||||
transform->Position = glm::vec3(1.5f, 0.7f, 5.f);
|
||||
|
||||
auto model = AddComponent<Components::Model>(TankTest, "Model");
|
||||
model->ModelFile = "Models/Placeholders/tank/Chassi.obj";
|
||||
}
|
||||
|
||||
for(int i = 0; i < 83; i++)
|
||||
{
|
||||
auto light = CreateEntity();
|
||||
auto transform = AddComponent<Components::Transform>(light, "Transform");
|
||||
transform->Position = glm::vec3((float)(2*i)*glm::sin((float)i), 3, (float)(2*i)*glm::cos((float)i));
|
||||
|
||||
auto pointLight = AddComponent<Components::PointLight>(light, "PointLight");
|
||||
pointLight->Specular = glm::vec3(0.1f, 0.1f, 0.1f);
|
||||
pointLight->Diffuse = glm::vec3(0.05f, 0.36f, 1.f);
|
||||
pointLight->constantAttenuation = 0.03f;
|
||||
pointLight->linearAttenuation = 0.009f;
|
||||
pointLight->quadraticAttenuation = 0.07f;
|
||||
pointLight->spotExponent = 0.0f;
|
||||
|
||||
auto model = AddComponent<Components::Model>(light, "Model");
|
||||
model->ModelFile = "Models/Placeholders/PhysicsTest/PointLight.obj";
|
||||
}
|
||||
|
||||
for(int i = 0; i < 500; i++)
|
||||
{
|
||||
auto ball = CreateEntity();
|
||||
auto transform = AddComponent<Components::Transform>(ball, "Transform");
|
||||
transform->Position = glm::vec3(0, 5 + i*2, 0);
|
||||
transform->Position = glm::vec3(i/5.f, 5 + i*2, i/5.f);
|
||||
transform->Scale = glm::vec3(1.0f, 1.0f, 1.0f);
|
||||
transform->Orientation = glm::quat(glm::vec3(0.0f, 0.0f, 0.0f));
|
||||
auto model = AddComponent<Components::Model>(ball, "Model");
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
#version 430
|
||||
|
||||
in vec2 TexCoord0;
|
||||
in vec3 Normal0;
|
||||
in vec3 WorldPos0;
|
||||
|
||||
layout (location = 0) out vec3 WorldPosOut;
|
||||
layout (location = 1) out vec3 DiffuseOut;
|
||||
layout (location = 2) out vec3 NormalOut;
|
||||
layout (location = 3) out vec3 TexCoordOut;
|
||||
|
||||
uniform sampler2D gColorMap;
|
||||
|
||||
void main()
|
||||
{
|
||||
WorldPosOut = WorldPos0;
|
||||
DiffuseOut = texture(gColorMap, TexCoord0).xyz;
|
||||
NormalOut = normalize(Normal0);
|
||||
TexCoordOut = vec3(TexCoord0, 0.0);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
#version 430
|
||||
|
||||
layout (location = 0) in vec3 Position;
|
||||
layout (location = 1) in vec2 TexCoord;
|
||||
layout (location = 2) in vec3 Normal;
|
||||
|
||||
uniform mat4 gWVP;
|
||||
uniform mat4 gWorld;
|
||||
|
||||
out vec2 TexCoord0;
|
||||
out vec3 Normal0;
|
||||
out vec3 WorldPos0;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = gWVP * vec4(Position, 1.0);
|
||||
TexCoord0 = TexCoord;
|
||||
Normal0 = (gWorld * vec4(Normal, 0.0)).xyz;
|
||||
WorldPos0 = (gWorld * vec4(Position, 1.0)).xyz;
|
||||
}
|
||||
@@ -41,7 +41,7 @@ Systems::PhysicsSystem::PhysicsSystem(World* world) : System(world)
|
||||
worldInfo.m_broadPhaseBorderBehaviour = hkpWorldCinfo::BROADPHASE_BORDER_FIX_ENTITY; // just fix the entity if the object falls off too far
|
||||
|
||||
// You must specify the size of the broad phase - objects should not be simulated outside this region
|
||||
worldInfo.setBroadPhaseWorldSize(1000.0f);
|
||||
worldInfo.setBroadPhaseWorldSize(10000.0f);
|
||||
m_PhysicsWorld = new hkpWorld(worldInfo);
|
||||
}
|
||||
// Register all collision agents, even though only box - box will be used in this particular example.
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
#include "PrecompiledHeader.h"
|
||||
#include "gBuffer.h"
|
||||
|
||||
bool GBuffer::Init(unsigned int WindowWidth, unsigned int WindowHeight)
|
||||
{
|
||||
// Create the FBO
|
||||
glGenFramebuffers(1, &m_fbo);
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_fbo);
|
||||
|
||||
// Create the gbuffer textures
|
||||
glGenTextures(ARRAY_SIZE_IN_ELEMENTS(m_textures), m_textures);
|
||||
glGenTextures(1, &m_depthTexture);
|
||||
|
||||
for (unsigned int i = 0 ; i < ARRAY_SIZE_IN_ELEMENTS(m_textures) ; i++) {
|
||||
glBindTexture(GL_TEXTURE_2D, m_textures[i]);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB32F, WindowWidth, WindowHeight, 0, GL_RGB, GL_FLOAT, NULL);
|
||||
glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + i, GL_TEXTURE_2D, m_textures[i], 0);
|
||||
}
|
||||
|
||||
// depth
|
||||
glBindTexture(GL_TEXTURE_2D, m_depthTexture);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT32F, WindowWidth, WindowHeight, 0, GL_DEPTH_COMPONENT, GL_FLOAT,
|
||||
NULL);
|
||||
glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, m_depthTexture, 0);
|
||||
|
||||
GLenum DrawBuffers[] = { GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2, GL_COLOR_ATTACHMENT3 };
|
||||
glDrawBuffers(ARRAY_SIZE_IN_ELEMENTS(DrawBuffers), DrawBuffers);
|
||||
|
||||
GLenum Status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
|
||||
|
||||
if (Status != GL_FRAMEBUFFER_COMPLETE) {
|
||||
printf("FB error, status: 0x%x\n", Status);
|
||||
return false;
|
||||
}
|
||||
|
||||
// restore default FBO
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
#ifndef gBuffer_h__
|
||||
#define gBuffer_h__
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
class GBuffer
|
||||
{
|
||||
public:
|
||||
|
||||
enum GBUFFER_TEXTURE_TYPE {
|
||||
GBUFFER_TEXTURE_TYPE_POSITION,
|
||||
GBUFFER_TEXTURE_TYPE_DIFFUSE,
|
||||
GBUFFER_TEXTURE_TYPE_NORMAL,
|
||||
GBUFFER_TEXTURE_TYPE_TEXCOORD,
|
||||
GBUFFER_NUM_TEXTURES
|
||||
};
|
||||
|
||||
GBuffer();
|
||||
|
||||
~GBuffer();
|
||||
|
||||
bool Init(unsigned int WindowWidth, unsigned int WindowHeight);
|
||||
|
||||
void BindForWriting();
|
||||
|
||||
void BindForReading();
|
||||
|
||||
private:
|
||||
|
||||
GLuint m_fbo;
|
||||
GLuint m_textures[GBUFFER_NUM_TEXTURES];
|
||||
GLuint m_depthTexture;
|
||||
};
|
||||
|
||||
#endif //gBuffer_h__
|
||||
@@ -157,36 +157,6 @@
|
||||
<ClInclude Include="..\..\src\CubemapTexture.h">
|
||||
<Filter>Rendering</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\Components\BoxShape.h">
|
||||
<Filter>Physics\Components</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\Components\CompoundShape.h">
|
||||
<Filter>Physics\Components</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\Components\BallSocketConstraint.h">
|
||||
<Filter>Physics\Components</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\Components\HingeConstraint.h">
|
||||
<Filter>Physics\Components</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\Components\MeshShape.h">
|
||||
<Filter>Physics\Components</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\Components\SliderConstraint.h">
|
||||
<Filter>Physics\Components</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\Components\SphereShape.h">
|
||||
<Filter>Physics\Components</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\Components\StaticMeshShape.h">
|
||||
<Filter>Physics\Components</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\Components\Vehicle.h">
|
||||
<Filter>Physics\Components</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\Components\Wheel.h">
|
||||
<Filter>Physics\Components</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\Components\Physics.h">
|
||||
<Filter>Physics\Components</Filter>
|
||||
</ClInclude>
|
||||
@@ -242,6 +212,8 @@
|
||||
<ClInclude Include="..\..\src\Sound.h">
|
||||
<Filter>Audio</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\Components\Box.h" />
|
||||
<ClInclude Include="..\..\src\Components\Sphere.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\..\src\Shaders\AABB.frag.glsl">
|
||||
|
||||
Reference in New Issue
Block a user