Moving projection to viewport
This commit is contained in:
@@ -13,9 +13,9 @@ public:
|
|||||||
virtual ~Entity();
|
virtual ~Entity();
|
||||||
|
|
||||||
template<typename Component, typename... Args>
|
template<typename Component, typename... Args>
|
||||||
void attachComponent(Args... args)
|
Component& attachComponent(Args... args)
|
||||||
{
|
{
|
||||||
scene->attachComponent<Component>(identifier, args...);
|
return scene->attachComponent<Component>(identifier, args...);
|
||||||
}
|
}
|
||||||
protected:
|
protected:
|
||||||
PScene scene;
|
PScene scene;
|
||||||
|
|||||||
@@ -30,11 +30,11 @@ void MeshAsset::load()
|
|||||||
void MeshAsset::addMesh(PMesh mesh)
|
void MeshAsset::addMesh(PMesh mesh)
|
||||||
{
|
{
|
||||||
std::scoped_lock lck(lock);
|
std::scoped_lock lck(lock);
|
||||||
meshes.push_back(mesh);
|
meshes.add(mesh);
|
||||||
referencedMaterials.push_back(mesh->referencedMaterial);
|
referencedMaterials.add(mesh->referencedMaterial);
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<PMesh> MeshAsset::getMeshes()
|
const Array<PMesh> MeshAsset::getMeshes()
|
||||||
{
|
{
|
||||||
std::scoped_lock lck(lock);
|
std::scoped_lock lck(lock);
|
||||||
return meshes;
|
return meshes;
|
||||||
|
|||||||
@@ -15,11 +15,10 @@ public:
|
|||||||
virtual void save() override;
|
virtual void save() override;
|
||||||
virtual void load() override;
|
virtual void load() override;
|
||||||
void addMesh(PMesh mesh);
|
void addMesh(PMesh mesh);
|
||||||
const std::vector<PMesh> getMeshes();
|
const Array<PMesh> getMeshes();
|
||||||
//Workaround while no editor
|
//Workaround while no editor
|
||||||
std::vector<PMaterialAsset> referencedMaterials;
|
Array<PMaterialAsset> referencedMaterials;
|
||||||
private:
|
Array<PMesh> meshes;
|
||||||
std::vector<PMesh> meshes;
|
|
||||||
};
|
};
|
||||||
DEFINE_REF(MeshAsset)
|
DEFINE_REF(MeshAsset)
|
||||||
} // namespace Seele
|
} // namespace Seele
|
||||||
@@ -61,6 +61,10 @@ void MeshLoader::loadMaterials(const aiScene* scene, Array<PMaterialAsset>& glob
|
|||||||
};
|
};
|
||||||
matCode["code"]["baseColor"] = "return diffuseTexture.Sample(textureSampler, input.texCoords[0]).xyz;";
|
matCode["code"]["baseColor"] = "return diffuseTexture.Sample(textureSampler, input.texCoords[0]).xyz;";
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
matCode["code"]["baseColor"] = "return input.vertexColor.xyz;";
|
||||||
|
}
|
||||||
if(material->GetTexture(aiTextureType_SPECULAR, 0, &texPath) == AI_SUCCESS)
|
if(material->GetTexture(aiTextureType_SPECULAR, 0, &texPath) == AI_SUCCESS)
|
||||||
{
|
{
|
||||||
std::string texFilename = std::filesystem::path(texPath.C_Str()).replace_extension("asset").stem().string();
|
std::string texFilename = std::filesystem::path(texPath.C_Str()).replace_extension("asset").stem().string();
|
||||||
@@ -143,6 +147,23 @@ VertexStreamComponent createVertexStream(uint32 size, aiVector2D* sourceData, Gf
|
|||||||
vertexBuffer->transferOwnership(Gfx::QueueType::GRAPHICS);
|
vertexBuffer->transferOwnership(Gfx::QueueType::GRAPHICS);
|
||||||
return VertexStreamComponent(vertexBuffer, 0, vbInfo.vertexSize, Gfx::SE_FORMAT_R32G32_SFLOAT);
|
return VertexStreamComponent(vertexBuffer, 0, vbInfo.vertexSize, Gfx::SE_FORMAT_R32G32_SFLOAT);
|
||||||
}
|
}
|
||||||
|
VertexStreamComponent createVertexStream(uint32 size, aiColor4D* sourceData, Gfx::PGraphics graphics)
|
||||||
|
{
|
||||||
|
Array<Math::Vector4> buffer(size);
|
||||||
|
for(uint32 i = 0; i < size; ++i)
|
||||||
|
{
|
||||||
|
buffer[i] = Math::Vector4(sourceData[i].r, sourceData[i].g, sourceData[i].b, sourceData[i].a);
|
||||||
|
}
|
||||||
|
VertexBufferCreateInfo vbInfo;
|
||||||
|
vbInfo.numVertices = size;
|
||||||
|
vbInfo.vertexSize = sizeof(Math::Vector4);
|
||||||
|
vbInfo.resourceData.data = (uint8 *)buffer.data();
|
||||||
|
vbInfo.resourceData.owner = Gfx::QueueType::DEDICATED_TRANSFER;
|
||||||
|
vbInfo.resourceData.size = sizeof(Math::Vector4) * buffer.size();
|
||||||
|
Gfx::PVertexBuffer vertexBuffer = graphics->createVertexBuffer(vbInfo);
|
||||||
|
vertexBuffer->transferOwnership(Gfx::QueueType::GRAPHICS);
|
||||||
|
return VertexStreamComponent(vertexBuffer, 0, vbInfo.vertexSize, Gfx::SE_FORMAT_R32G32_SFLOAT);
|
||||||
|
}
|
||||||
void MeshLoader::loadGlobalMeshes(const aiScene* scene, Array<PMesh>& globalMeshes, const Array<PMaterialAsset>& materials)
|
void MeshLoader::loadGlobalMeshes(const aiScene* scene, Array<PMesh>& globalMeshes, const Array<PMaterialAsset>& materials)
|
||||||
{
|
{
|
||||||
for (uint32 meshIndex = 0; meshIndex < scene->mNumMeshes; ++meshIndex)
|
for (uint32 meshIndex = 0; meshIndex < scene->mNumMeshes; ++meshIndex)
|
||||||
@@ -172,7 +193,7 @@ void MeshLoader::loadGlobalMeshes(const aiScene* scene, Array<PMesh>& globalMesh
|
|||||||
}
|
}
|
||||||
if(mesh->HasVertexColors(0))
|
if(mesh->HasVertexColors(0))
|
||||||
{
|
{
|
||||||
//data.colorComponent = createVertexStream(mesh->mNumVertices, mesh->mColors[0], graphics);
|
data.colorComponent = createVertexStream(mesh->mNumVertices, mesh->mColors[0], graphics);
|
||||||
}
|
}
|
||||||
vertexShaderInput->setData(std::move(data));
|
vertexShaderInput->setData(std::move(data));
|
||||||
vertexShaderInput->init(graphics);
|
vertexShaderInput->init(graphics);
|
||||||
|
|||||||
@@ -8,12 +8,8 @@ using namespace Seele::Component;
|
|||||||
using namespace Seele::Math;
|
using namespace Seele::Math;
|
||||||
|
|
||||||
Camera::Camera()
|
Camera::Camera()
|
||||||
: aspectRatio(0)
|
: bNeedsViewBuild(false)
|
||||||
, fieldOfView(glm::radians(70.f))
|
|
||||||
, bNeedsViewBuild(false)
|
|
||||||
, bNeedsProjectionBuild(false)
|
|
||||||
, viewMatrix(Matrix4())
|
, viewMatrix(Matrix4())
|
||||||
, projectionMatrix(Matrix4())
|
|
||||||
{
|
{
|
||||||
yaw = 0;
|
yaw = 0;
|
||||||
pitch = 0;
|
pitch = 0;
|
||||||
@@ -54,14 +50,6 @@ void Camera::moveY(float amount)
|
|||||||
bNeedsViewBuild = true;
|
bNeedsViewBuild = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Camera::setViewport(Gfx::PViewport newViewport)
|
|
||||||
{
|
|
||||||
viewport = newViewport;
|
|
||||||
aspectRatio = viewport->getSizeX() / (float)viewport->getSizeY();
|
|
||||||
|
|
||||||
bNeedsProjectionBuild = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Camera::buildViewMatrix()
|
void Camera::buildViewMatrix()
|
||||||
{
|
{
|
||||||
Vector eyePos = getTransform().getPosition();//getAbsoluteTransform().getPosition();
|
Vector eyePos = getTransform().getPosition();//getAbsoluteTransform().getPosition();
|
||||||
@@ -71,18 +59,3 @@ void Camera::buildViewMatrix()
|
|||||||
|
|
||||||
bNeedsViewBuild = false;
|
bNeedsViewBuild = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Camera::buildProjectionMatrix()
|
|
||||||
{
|
|
||||||
projectionMatrix = glm::perspective(fieldOfView, aspectRatio, 1.0f, 1000.f);
|
|
||||||
static Matrix4 correctionMatrix =
|
|
||||||
Matrix4(
|
|
||||||
Vector4(1, 0, 0, 0),
|
|
||||||
Vector4(0, 1, 0, 0),
|
|
||||||
Vector4(0, 0, 0.5f, 0),
|
|
||||||
Vector4(0, 0, 0.5f, 1));
|
|
||||||
projectionMatrix = correctionMatrix * projectionMatrix;
|
|
||||||
bNeedsProjectionBuild = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -20,11 +20,6 @@ struct Camera
|
|||||||
assert (!bNeedsViewBuild);
|
assert (!bNeedsViewBuild);
|
||||||
return viewMatrix;
|
return viewMatrix;
|
||||||
}
|
}
|
||||||
Math::Matrix4 getProjectionMatrix() const
|
|
||||||
{
|
|
||||||
assert (!bNeedsProjectionBuild);
|
|
||||||
return projectionMatrix;
|
|
||||||
}
|
|
||||||
Math::Vector getCameraPosition() const
|
Math::Vector getCameraPosition() const
|
||||||
{
|
{
|
||||||
return Math::Vector(viewMatrix[3]);
|
return Math::Vector(viewMatrix[3]);
|
||||||
@@ -34,21 +29,13 @@ struct Camera
|
|||||||
void mouseScroll(float x);
|
void mouseScroll(float x);
|
||||||
void moveX(float amount);
|
void moveX(float amount);
|
||||||
void moveY(float amount);
|
void moveY(float amount);
|
||||||
float aspectRatio;
|
|
||||||
float fieldOfView;
|
|
||||||
void buildViewMatrix();
|
void buildViewMatrix();
|
||||||
void buildProjectionMatrix();
|
|
||||||
Math::Matrix4 viewMatrix;
|
Math::Matrix4 viewMatrix;
|
||||||
Math::Matrix4 projectionMatrix;
|
|
||||||
//Transforms relative to actor
|
//Transforms relative to actor
|
||||||
float yaw;
|
float yaw;
|
||||||
float pitch;
|
float pitch;
|
||||||
private:
|
private:
|
||||||
bool bNeedsViewBuild;
|
bool bNeedsViewBuild;
|
||||||
bool bNeedsProjectionBuild;
|
|
||||||
|
|
||||||
Gfx::PViewport viewport;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
} // namespace Component
|
} // namespace Component
|
||||||
} // namespace Seele
|
} // namespace Seele
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "Graphics/GraphicsResources.h"
|
#include "Asset/MeshAsset.h"
|
||||||
|
|
||||||
namespace Seele
|
namespace Seele
|
||||||
{
|
{
|
||||||
@@ -7,9 +7,7 @@ namespace Component
|
|||||||
{
|
{
|
||||||
struct StaticMesh
|
struct StaticMesh
|
||||||
{
|
{
|
||||||
PVertexShaderInput vertexBuffer;
|
PMeshAsset mesh;
|
||||||
Gfx::PIndexBuffer indexBuffer;
|
|
||||||
PMaterialAsset material;
|
|
||||||
};
|
};
|
||||||
} // namespace Component
|
} // namespace Component
|
||||||
} // namespace Seele
|
} // namespace Seele
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ struct WindowCreateInfo
|
|||||||
struct ViewportCreateInfo
|
struct ViewportCreateInfo
|
||||||
{
|
{
|
||||||
Math::URect dimensions;
|
Math::URect dimensions;
|
||||||
|
float fieldOfView = 1.222f; // 70 deg
|
||||||
};
|
};
|
||||||
// doesnt own the data, only proxy it
|
// doesnt own the data, only proxy it
|
||||||
struct BulkResourceData
|
struct BulkResourceData
|
||||||
|
|||||||
@@ -506,6 +506,7 @@ Viewport::Viewport(PWindow owner, const ViewportCreateInfo &viewportInfo)
|
|||||||
, sizeY(viewportInfo.dimensions.size.y)
|
, sizeY(viewportInfo.dimensions.size.y)
|
||||||
, offsetX(viewportInfo.dimensions.offset.x)
|
, offsetX(viewportInfo.dimensions.offset.x)
|
||||||
, offsetY(viewportInfo.dimensions.offset.y)
|
, offsetY(viewportInfo.dimensions.offset.y)
|
||||||
|
, fieldOfView(viewportInfo.fieldOfView)
|
||||||
, owner(owner)
|
, owner(owner)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -514,3 +515,15 @@ Viewport::~Viewport()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Math::Matrix4 Viewport::getProjectionMatrix() const
|
||||||
|
{
|
||||||
|
if(fieldOfView > 0.0f)
|
||||||
|
{
|
||||||
|
return glm::perspective(fieldOfView, sizeX / static_cast<float>(sizeY), 0.1f, 1000.0f);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return glm::ortho(0.0f, (float)sizeX, (float)sizeY, 0.0f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -650,16 +650,18 @@ public:
|
|||||||
virtual ~Viewport();
|
virtual ~Viewport();
|
||||||
virtual void resize(uint32 newX, uint32 newY) = 0;
|
virtual void resize(uint32 newX, uint32 newY) = 0;
|
||||||
virtual void move(uint32 newOffsetX, uint32 newOffsetY) = 0;
|
virtual void move(uint32 newOffsetX, uint32 newOffsetY) = 0;
|
||||||
inline PWindow getOwner() const {return owner;}
|
constexpr PWindow getOwner() const {return owner;}
|
||||||
inline uint32 getSizeX() const {return sizeX;}
|
constexpr uint32 getSizeX() const {return sizeX;}
|
||||||
inline uint32 getSizeY() const {return sizeY;}
|
constexpr uint32 getSizeY() const {return sizeY;}
|
||||||
inline uint32 getOffsetX() const {return offsetX;}
|
constexpr uint32 getOffsetX() const {return offsetX;}
|
||||||
inline uint32 getOffsetY() const {return offsetY;}
|
constexpr uint32 getOffsetY() const {return offsetY;}
|
||||||
|
Math::Matrix4 getProjectionMatrix() const;
|
||||||
protected:
|
protected:
|
||||||
uint32 sizeX;
|
uint32 sizeX;
|
||||||
uint32 sizeY;
|
uint32 sizeY;
|
||||||
uint32 offsetX;
|
uint32 offsetX;
|
||||||
uint32 offsetY;
|
uint32 offsetY;
|
||||||
|
float fieldOfView;
|
||||||
PWindow owner;
|
PWindow owner;
|
||||||
};
|
};
|
||||||
DEFINE_REF(Viewport)
|
DEFINE_REF(Viewport)
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ void BasePass::beginFrame(const Component::Camera& cam)
|
|||||||
BulkResourceData uniformUpdate;
|
BulkResourceData uniformUpdate;
|
||||||
|
|
||||||
viewParams.viewMatrix = cam.getViewMatrix();
|
viewParams.viewMatrix = cam.getViewMatrix();
|
||||||
viewParams.projectionMatrix = cam.getProjectionMatrix();
|
viewParams.projectionMatrix = viewport->getProjectionMatrix();
|
||||||
viewParams.cameraPosition = Math::Vector4(cam.getCameraPosition(), 0);
|
viewParams.cameraPosition = Math::Vector4(cam.getCameraPosition(), 0);
|
||||||
viewParams.screenDimensions = Math::Vector2(static_cast<float>(viewport->getSizeX()), static_cast<float>(viewport->getSizeY()));
|
viewParams.screenDimensions = Math::Vector2(static_cast<float>(viewport->getSizeX()), static_cast<float>(viewport->getSizeY()));
|
||||||
uniformUpdate.size = sizeof(ViewParameter);
|
uniformUpdate.size = sizeof(ViewParameter);
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ void DepthPrepass::beginFrame(const Component::Camera& cam)
|
|||||||
BulkResourceData uniformUpdate;
|
BulkResourceData uniformUpdate;
|
||||||
|
|
||||||
viewParams.viewMatrix = cam.getViewMatrix();
|
viewParams.viewMatrix = cam.getViewMatrix();
|
||||||
viewParams.projectionMatrix = cam.getProjectionMatrix();
|
viewParams.projectionMatrix = viewport->getProjectionMatrix();
|
||||||
viewParams.cameraPosition = Math::Vector4(cam.getCameraPosition(), 0);
|
viewParams.cameraPosition = Math::Vector4(cam.getCameraPosition(), 0);
|
||||||
viewParams.screenDimensions = Math::Vector2(static_cast<float>(viewport->getSizeX()), static_cast<float>(viewport->getSizeY()));
|
viewParams.screenDimensions = Math::Vector2(static_cast<float>(viewport->getSizeX()), static_cast<float>(viewport->getSizeY()));
|
||||||
uniformUpdate.size = sizeof(ViewParameter);
|
uniformUpdate.size = sizeof(ViewParameter);
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ void LightCullingPass::beginFrame(const Component::Camera& cam)
|
|||||||
|
|
||||||
BulkResourceData uniformUpdate;
|
BulkResourceData uniformUpdate;
|
||||||
viewParams.viewMatrix = cam.getViewMatrix();
|
viewParams.viewMatrix = cam.getViewMatrix();
|
||||||
viewParams.projectionMatrix = cam.getProjectionMatrix();
|
viewParams.projectionMatrix = viewport->getProjectionMatrix();
|
||||||
viewParams.cameraPosition = Math::Vector4(cam.getCameraPosition(), 0);
|
viewParams.cameraPosition = Math::Vector4(cam.getCameraPosition(), 0);
|
||||||
viewParams.screenDimensions = Math::Vector2(static_cast<float>(viewportWidth), static_cast<float>(viewportHeight));
|
viewParams.screenDimensions = Math::Vector2(static_cast<float>(viewportWidth), static_cast<float>(viewportHeight));
|
||||||
uniformUpdate.size = sizeof(ViewParameter);
|
uniformUpdate.size = sizeof(ViewParameter);
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ TextPass::~TextPass()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextPass::beginFrame(const Component::Camera& cam)
|
void TextPass::beginFrame(const Component::Camera&)
|
||||||
{
|
{
|
||||||
for(TextRender& render : passData.texts)
|
for(TextRender& render : passData.texts)
|
||||||
{
|
{
|
||||||
@@ -59,9 +59,10 @@ void TextPass::beginFrame(const Component::Camera& cam)
|
|||||||
.scale = render.scale,
|
.scale = render.scale,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
auto proj = viewport->getProjectionMatrix();
|
||||||
BulkResourceData projectionUpdate = {
|
BulkResourceData projectionUpdate = {
|
||||||
.size = sizeof(Math::Matrix4),
|
.size = sizeof(Math::Matrix4),
|
||||||
.data = (uint8*)&cam.projectionMatrix,
|
.data = (uint8*)&proj,
|
||||||
};
|
};
|
||||||
projectionBuffer->updateContents(projectionUpdate);
|
projectionBuffer->updateContents(projectionUpdate);
|
||||||
generalSet->updateBuffer(1, projectionBuffer);
|
generalSet->updateBuffer(1, projectionBuffer);
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
using namespace Seele;
|
using namespace Seele;
|
||||||
using namespace Seele::Vulkan;
|
using namespace Seele::Vulkan;
|
||||||
|
|
||||||
void glfwKeyCallback(GLFWwindow* handle, int key, int action, int, int modifier)
|
void glfwKeyCallback(GLFWwindow* handle, int key, int, int action, int modifier)
|
||||||
{
|
{
|
||||||
Window* window = (Window*)glfwGetWindowUserPointer(handle);
|
Window* window = (Window*)glfwGetWindowUserPointer(handle);
|
||||||
window->keyCallback((KeyCode)key, (InputAction)action, (KeyModifier)modifier);
|
window->keyCallback((KeyCode)key, (InputAction)action, (KeyModifier)modifier);
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ void MaterialAsset::load()
|
|||||||
layout = WindowManager::getGraphics()->createDescriptorLayout(materialName + "Layout");
|
layout = WindowManager::getGraphics()->createDescriptorLayout(materialName + "Layout");
|
||||||
//Shader file needs to conform to the slang standard, which prohibits _
|
//Shader file needs to conform to the slang standard, which prohibits _
|
||||||
materialName.erase(std::remove(materialName.begin(), materialName.end(), '_'), materialName.end());
|
materialName.erase(std::remove(materialName.begin(), materialName.end(), '_'), materialName.end());
|
||||||
|
materialName.erase(std::remove(materialName.begin(), materialName.end(), '.'), materialName.end());
|
||||||
std::ofstream codeStream("./shaders/generated/"+materialName+".slang");
|
std::ofstream codeStream("./shaders/generated/"+materialName+".slang");
|
||||||
std::string profile = j["profile"].get<std::string>();
|
std::string profile = j["profile"].get<std::string>();
|
||||||
|
|
||||||
|
|||||||
+24
-19
@@ -1,6 +1,7 @@
|
|||||||
#include "Scene.h"
|
#include "Scene.h"
|
||||||
#include "Material/MaterialAsset.h"
|
#include "Material/MaterialAsset.h"
|
||||||
#include "Graphics/Graphics.h"
|
#include "Graphics/Graphics.h"
|
||||||
|
#include "Graphics/Mesh.h"
|
||||||
#include "Component/StaticMesh.h"
|
#include "Component/StaticMesh.h"
|
||||||
#include "Component/Transform.h"
|
#include "Component/Transform.h"
|
||||||
|
|
||||||
@@ -82,25 +83,29 @@ Array<StaticMeshBatch> Scene::getStaticMeshes()
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
Gfx::PUniformBuffer transformBuf = graphics->createUniformBuffer(info);
|
Gfx::PUniformBuffer transformBuf = graphics->createUniformBuffer(info);
|
||||||
auto& batch = result.add();
|
// TODO
|
||||||
batch.material = mesh.material;
|
for(auto& m : mesh.mesh->meshes)
|
||||||
batch.isBackfaceCullingDisabled = false;
|
{
|
||||||
batch.isCastingShadow = true;
|
auto& batch = result.add();
|
||||||
batch.topology = Gfx::SE_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST;
|
batch.material = m->referencedMaterial;
|
||||||
batch.useReverseCulling = false;
|
batch.isBackfaceCullingDisabled = false;
|
||||||
batch.useWireframe = false;
|
batch.isCastingShadow = true;
|
||||||
batch.vertexInput = mesh.vertexBuffer;
|
batch.topology = Gfx::SE_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST;
|
||||||
MeshBatchElement batchElement;
|
batch.useReverseCulling = false;
|
||||||
batchElement.baseVertexIndex = 0;
|
batch.useWireframe = false;
|
||||||
batchElement.firstIndex = 0;
|
batch.vertexInput = m->vertexInput;
|
||||||
batchElement.indexBuffer = mesh.indexBuffer;
|
MeshBatchElement batchElement;
|
||||||
batchElement.indirectArgsBuffer = nullptr;
|
batchElement.baseVertexIndex = 0;
|
||||||
batchElement.instanceRuns = nullptr;
|
batchElement.firstIndex = 0;
|
||||||
batchElement.isInstanced = false;
|
batchElement.indexBuffer = m->indexBuffer;
|
||||||
batchElement.numInstances = 1;
|
batchElement.indirectArgsBuffer = nullptr;
|
||||||
batchElement.uniformBuffer = transformBuf;
|
batchElement.instanceRuns = nullptr;
|
||||||
batchElement.numPrimitives = static_cast<uint32>(mesh.indexBuffer->getNumIndices() / 3); //TODO: hardcoded
|
batchElement.isInstanced = false;
|
||||||
batch.elements.add(batchElement);
|
batchElement.numInstances = 1;
|
||||||
|
batchElement.uniformBuffer = transformBuf;
|
||||||
|
batchElement.numPrimitives = static_cast<uint32>(m->indexBuffer->getNumIndices() / 3); //TODO: hardcoded
|
||||||
|
batch.elements.add(batchElement);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ void System::update()
|
|||||||
|
|
||||||
void System::updateViewport(Gfx::PViewport viewport)
|
void System::updateViewport(Gfx::PViewport viewport)
|
||||||
{
|
{
|
||||||
virtualCamera.projectionMatrix = glm::ortho<float>(0.0f, static_cast<float>(viewport->getSizeX()), 0.0f, static_cast<float>(viewport->getSizeY()));
|
//TODO set viewport FoV to 0
|
||||||
}
|
}
|
||||||
|
|
||||||
UIPassData System::getUIPassData()
|
UIPassData System::getUIPassData()
|
||||||
|
|||||||
Reference in New Issue
Block a user