First render
This commit is contained in:
@@ -73,5 +73,5 @@ float4 fragmentMain(
|
||||
}
|
||||
|
||||
|
||||
return float4(result, 1);
|
||||
return float4(0, 1, 0, 1);
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#pragma pack_matrix(column_major)
|
||||
const static float PI = 3.1415926535897932f;
|
||||
const static uint MAX_PARTICLES = 65536;
|
||||
const static uint BLOCK_SIZE = 8;
|
||||
|
||||
@@ -2,6 +2,7 @@ struct PrimitiveSceneData
|
||||
{
|
||||
float4x4 localToWorld;
|
||||
float4x4 worldToLocal;
|
||||
float4 actorLocation;
|
||||
};
|
||||
|
||||
layout(set = 3, binding = 0, std430)
|
||||
|
||||
@@ -106,14 +106,6 @@ void findMeshRoots(aiNode *node, List<aiNode *> &meshNodes)
|
||||
findMeshRoots(node->mChildren[i], meshNodes);
|
||||
}
|
||||
}
|
||||
void loadToBuffer(Array<Vector>& buffer, const aiVector3D* sourceData, uint32 size)
|
||||
{
|
||||
buffer.resize(size);
|
||||
for(uint32 i = 0; i < size; ++i)
|
||||
{
|
||||
buffer[i] = Vector(sourceData[i].x, sourceData[i].y, sourceData[i].z);
|
||||
}
|
||||
}
|
||||
VertexStreamComponent createVertexStream(uint32 size, aiVector3D* sourceData, Gfx::PGraphics graphics)
|
||||
{
|
||||
Array<Vector> buffer(size);
|
||||
@@ -126,9 +118,8 @@ VertexStreamComponent createVertexStream(uint32 size, aiVector3D* sourceData, Gf
|
||||
vbInfo.vertexSize = sizeof(Vector);
|
||||
vbInfo.resourceData.data = (uint8 *)buffer.data();
|
||||
vbInfo.resourceData.owner = Gfx::QueueType::DEDICATED_TRANSFER;
|
||||
vbInfo.resourceData.size = buffer.size();
|
||||
const Gfx::PVertexBuffer vertexBuffer = graphics->createVertexBuffer(vbInfo);
|
||||
return VertexStreamComponent(vertexBuffer, 0, vbInfo.vertexSize, Gfx::SE_FORMAT_R32G32B32_SFLOAT);
|
||||
vbInfo.resourceData.size = sizeof(Vector) * buffer.size();
|
||||
return VertexStreamComponent(graphics->createVertexBuffer(vbInfo), 0, vbInfo.vertexSize, Gfx::SE_FORMAT_R32G32B32_SFLOAT);
|
||||
}
|
||||
VertexStreamComponent createVertexStream(uint32 size, aiVector2D* sourceData, Gfx::PGraphics graphics)
|
||||
{
|
||||
@@ -142,9 +133,8 @@ VertexStreamComponent createVertexStream(uint32 size, aiVector2D* sourceData, Gf
|
||||
vbInfo.vertexSize = sizeof(Vector2);
|
||||
vbInfo.resourceData.data = (uint8 *)buffer.data();
|
||||
vbInfo.resourceData.owner = Gfx::QueueType::DEDICATED_TRANSFER;
|
||||
vbInfo.resourceData.size = buffer.size();
|
||||
Gfx::PVertexBuffer vertexBuffer = graphics->createVertexBuffer(vbInfo);
|
||||
return VertexStreamComponent(vertexBuffer, 0, vbInfo.vertexSize, Gfx::SE_FORMAT_R32G32_SFLOAT);
|
||||
vbInfo.resourceData.size = sizeof(Vector2) * buffer.size();
|
||||
return VertexStreamComponent(graphics->createVertexBuffer(vbInfo), 0, vbInfo.vertexSize, Gfx::SE_FORMAT_R32G32_SFLOAT);
|
||||
}
|
||||
void MeshLoader::loadGlobalMeshes(const aiScene* scene, Array<PMesh>& globalMeshes, const Array<PMaterialAsset>& materials, Gfx::PGraphics graphics)
|
||||
{
|
||||
@@ -190,7 +180,7 @@ void MeshLoader::loadGlobalMeshes(const aiScene* scene, Array<PMesh>& globalMesh
|
||||
idxInfo.indexType = Gfx::SE_INDEX_TYPE_UINT32;
|
||||
idxInfo.resourceData.data = (uint8 *)indices.data();
|
||||
idxInfo.resourceData.owner = Gfx::QueueType::DEDICATED_TRANSFER;
|
||||
idxInfo.resourceData.size = indices.size();
|
||||
idxInfo.resourceData.size = sizeof(uint32) * indices.size();
|
||||
Gfx::PIndexBuffer indexBuffer = graphics->createIndexBuffer(idxInfo);
|
||||
indexBuffer->transferOwnership(Gfx::QueueType::GRAPHICS);
|
||||
|
||||
@@ -239,15 +229,11 @@ void MeshLoader::import(const std::filesystem::path &path)
|
||||
Assimp::Importer importer;
|
||||
importer.ReadFile(path.string().c_str(),
|
||||
aiProcess_FlipUVs |
|
||||
aiProcess_ImproveCacheLocality |
|
||||
aiProcess_OptimizeMeshes |
|
||||
aiProcess_GenBoundingBoxes |
|
||||
aiProcess_Triangulate |
|
||||
aiProcess_SortByPType |
|
||||
aiProcess_GenSmoothNormals |
|
||||
aiProcess_GenUVCoords |
|
||||
aiProcess_FindDegenerates |
|
||||
aiProcess_EmbedTextures);
|
||||
aiProcess_FindDegenerates);
|
||||
const aiScene *scene = importer.ApplyPostProcessing(aiProcess_CalcTangentSpace);
|
||||
|
||||
Array<PMaterialAsset> globalMaterials(scene->mNumMaterials);
|
||||
|
||||
@@ -1868,6 +1868,23 @@ typedef enum SeStencilFaceFlagBits
|
||||
SE_STENCIL_FACE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
|
||||
} SeStencilFaceFlagBits;
|
||||
typedef SeFlags SeStencilFaceFlags;
|
||||
|
||||
typedef union SeClearColorValue {
|
||||
float float32[4];
|
||||
int32_t int32[4];
|
||||
uint32_t uint32[4];
|
||||
} SeClearColorValue;
|
||||
|
||||
typedef struct SeClearDepthStencilValue {
|
||||
float depth;
|
||||
uint32_t stencil;
|
||||
} SeClearDepthStencilValue;
|
||||
|
||||
typedef union SeClearValue {
|
||||
SeClearColorValue color;
|
||||
SeClearDepthStencilValue depthStencil;
|
||||
} SeClearValue;
|
||||
|
||||
enum class QueueType
|
||||
{
|
||||
GRAPHICS = 1,
|
||||
|
||||
@@ -210,10 +210,10 @@ IndexBuffer::IndexBuffer(QueueFamilyMapping mapping, uint32 size, Gfx::SeIndexTy
|
||||
switch (indexType)
|
||||
{
|
||||
case SE_INDEX_TYPE_UINT16:
|
||||
numIndices = size / 16;
|
||||
numIndices = size / sizeof(uint16);
|
||||
break;
|
||||
case SE_INDEX_TYPE_UINT32:
|
||||
numIndices = size / 32;
|
||||
numIndices = size / sizeof(uint32);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -569,7 +569,8 @@ public:
|
||||
inline SeAttachmentStoreOp getStoreOp() const { return storeOp; }
|
||||
inline SeAttachmentLoadOp getStencilLoadOp() const { return stencilLoadOp; }
|
||||
inline SeAttachmentStoreOp getStencilStoreOp() const { return stencilStoreOp; }
|
||||
|
||||
SeClearValue clear;
|
||||
SeColorComponentFlags componentFlags;
|
||||
protected:
|
||||
PTexture2D texture;
|
||||
SeAttachmentLoadOp loadOp;
|
||||
@@ -589,6 +590,11 @@ public:
|
||||
SeAttachmentStoreOp stencilStoreOp = SE_ATTACHMENT_STORE_OP_DONT_CARE)
|
||||
: RenderTargetAttachment(nullptr, loadOp, storeOp, stencilLoadOp, stencilStoreOp), owner(owner)
|
||||
{
|
||||
clear.color.float32[0] = 0.0f;
|
||||
clear.color.float32[1] = 0.0f;
|
||||
clear.color.float32[2] = 0.0f;
|
||||
clear.color.float32[3] = 0.0f;
|
||||
componentFlags = SE_COLOR_COMPONENT_R_BIT | SE_COLOR_COMPONENT_G_BIT | SE_COLOR_COMPONENT_B_BIT | SE_COLOR_COMPONENT_A_BIT;
|
||||
}
|
||||
virtual PTexture2D getTexture() override
|
||||
{
|
||||
|
||||
@@ -93,7 +93,8 @@ BasePass::BasePass(const PScene scene, Gfx::PGraphics graphics, Gfx::PViewport v
|
||||
depthBufferInfo.usage = Gfx::SE_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT;
|
||||
depthBuffer = graphics->createTexture2D(depthBufferInfo);
|
||||
Gfx::PRenderTargetAttachment depthAttachment =
|
||||
new Gfx::RenderTargetAttachment(depthBuffer, Gfx::SE_ATTACHMENT_LOAD_OP_DONT_CARE, Gfx::SE_ATTACHMENT_STORE_OP_STORE);
|
||||
new Gfx::RenderTargetAttachment(depthBuffer, Gfx::SE_ATTACHMENT_LOAD_OP_CLEAR, Gfx::SE_ATTACHMENT_STORE_OP_STORE);
|
||||
depthAttachment->clear.depthStencil.depth = 1.0f;
|
||||
Gfx::PRenderTargetLayout layout = new Gfx::RenderTargetLayout(colorAttachment, depthAttachment);
|
||||
renderPass = graphics->createRenderPass(layout);
|
||||
|
||||
|
||||
@@ -36,6 +36,10 @@ ShaderBuffer::ShaderBuffer(PGraphics graphics, uint32 size, VkBufferUsageFlags u
|
||||
init::BufferCreateInfo(
|
||||
usage,
|
||||
size);
|
||||
info.sharingMode = VK_SHARING_MODE_EXCLUSIVE;
|
||||
uint32 queueFamilyIndex = graphics->getFamilyMapping().getQueueTypeFamilyIndex(queueType);
|
||||
info.pQueueFamilyIndices = &queueFamilyIndex;
|
||||
info.queueFamilyIndexCount = 0;
|
||||
VkBufferMemoryRequirementsInfo2 bufferReqInfo;
|
||||
bufferReqInfo.sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_REQUIREMENTS_INFO_2;
|
||||
bufferReqInfo.pNext = nullptr;
|
||||
@@ -53,7 +57,6 @@ ShaderBuffer::ShaderBuffer(PGraphics graphics, uint32 size, VkBufferUsageFlags u
|
||||
buffers[i].allocation = graphics->getAllocator()->allocate(memRequirements, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, buffers[i].buffer);
|
||||
vkBindBufferMemory(graphics->getDevice(), buffers[i].buffer, buffers[i].allocation->getHandle(), buffers[i].allocation->getOffset());
|
||||
}
|
||||
info.sharingMode = VK_SHARING_MODE_EXCLUSIVE;
|
||||
}
|
||||
|
||||
ShaderBuffer::~ShaderBuffer()
|
||||
|
||||
@@ -203,7 +203,7 @@ void SecondaryCmdBuffer::bindVertexBuffer(const Array<VertexInputStream>& stream
|
||||
void SecondaryCmdBuffer::bindIndexBuffer(Gfx::PIndexBuffer indexBuffer)
|
||||
{
|
||||
PIndexBuffer buf = indexBuffer.cast<IndexBuffer>();
|
||||
vkCmdBindIndexBuffer(handle, buf->getHandle(), 0, VK_INDEX_TYPE_UINT16);
|
||||
vkCmdBindIndexBuffer(handle, buf->getHandle(), 0, cast(buf->getIndexType()));
|
||||
}
|
||||
void SecondaryCmdBuffer::draw(const MeshBatchElement& data)
|
||||
{
|
||||
|
||||
@@ -282,7 +282,6 @@ Array<const char *> Graphics::getRequiredExtensions()
|
||||
{
|
||||
extensions.add(glfwExtensions[i]);
|
||||
}
|
||||
std::cout << ENABLE_VALIDATION << std::endl;
|
||||
#if ENABLE_VALIDATION
|
||||
extensions.add(VK_EXT_DEBUG_REPORT_EXTENSION_NAME);
|
||||
#endif // ENABLE_VALIDATION
|
||||
|
||||
@@ -1307,4 +1307,40 @@ Gfx::SeCompareOp Seele::Vulkan::cast(const VkCompareOp &op)
|
||||
default:
|
||||
return SE_COMPARE_OP_MAX_ENUM;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
VkClearValue Seele::Vulkan::cast(const Gfx::SeClearValue& clear)
|
||||
{
|
||||
VkClearValue result;
|
||||
if(sizeof(clear) == sizeof(Gfx::SeClearColorValue))
|
||||
{
|
||||
result.color.float32[0] = clear.color.float32[0];
|
||||
result.color.float32[1] = clear.color.float32[1];
|
||||
result.color.float32[2] = clear.color.float32[2];
|
||||
result.color.float32[3] = clear.color.float32[3];
|
||||
}
|
||||
else
|
||||
{
|
||||
result.depthStencil.depth = clear.depthStencil.depth;
|
||||
result.depthStencil.stencil = clear.depthStencil.stencil;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
Gfx::SeClearValue Seele::Vulkan::cast(const VkClearValue& clear)
|
||||
{
|
||||
Gfx::SeClearValue result;
|
||||
if(sizeof(clear) == sizeof(VkClearColorValue))
|
||||
{
|
||||
result.color.float32[0] = clear.color.float32[0];
|
||||
result.color.float32[1] = clear.color.float32[1];
|
||||
result.color.float32[2] = clear.color.float32[2];
|
||||
result.color.float32[3] = clear.color.float32[3];
|
||||
}
|
||||
else
|
||||
{
|
||||
result.depthStencil.depth = clear.depthStencil.depth;
|
||||
result.depthStencil.stencil = clear.depthStencil.stencil;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -46,5 +46,7 @@ VkPolygonMode cast(const Gfx::SePolygonMode &mode);
|
||||
Gfx::SePolygonMode cast(const VkPolygonMode &mode);
|
||||
VkCompareOp cast(const Gfx::SeCompareOp &op);
|
||||
Gfx::SeCompareOp cast(const VkCompareOp &op);
|
||||
VkClearValue cast(const Gfx::SeClearValue &clear);
|
||||
Gfx::SeClearValue cast(const VkClearValue &clear);
|
||||
} // namespace Vulkan
|
||||
} // namespace Seele
|
||||
@@ -131,7 +131,7 @@ PGraphicsPipeline PipelineCache::createPipeline(const GraphicsPipelineCreateInfo
|
||||
{
|
||||
bindings.resize(element.streamIndex + 1); // This should not cause any actual allocations
|
||||
}
|
||||
VkVertexInputBindingDescription currBinding = bindings[element.streamIndex];
|
||||
VkVertexInputBindingDescription& currBinding = bindings[element.streamIndex];
|
||||
if((bindingsMask & (1 << element.streamIndex)) != 0)
|
||||
{
|
||||
assert(currBinding.binding == element.streamIndex);
|
||||
@@ -228,7 +228,7 @@ PGraphicsPipeline PipelineCache::createPipeline(const GraphicsPipelineCreateInfo
|
||||
cast(gfxInfo.depthStencilState.depthCompareOp)
|
||||
);
|
||||
|
||||
const auto colorAttachments = gfxInfo.renderPass->getLayout()->colorAttachments;
|
||||
const auto& colorAttachments = gfxInfo.renderPass->getLayout()->colorAttachments;
|
||||
Array<VkPipelineColorBlendAttachmentState> blendAttachments(colorAttachments.size());
|
||||
for(uint32 i = 0; i < colorAttachments.size(); ++i)
|
||||
{
|
||||
@@ -237,7 +237,7 @@ PGraphicsPipeline PipelineCache::createPipeline(const GraphicsPipelineCreateInfo
|
||||
blendAttachment.alphaBlendOp = (VkBlendOp)attachment.alphaBlendOp;
|
||||
blendAttachment.blendEnable = attachment.blendEnable;
|
||||
blendAttachment.colorBlendOp = (VkBlendOp)attachment.colorBlendOp;
|
||||
blendAttachment.colorWriteMask = attachment.colorWriteMask;
|
||||
blendAttachment.colorWriteMask = colorAttachments[i]->componentFlags;
|
||||
blendAttachment.dstAlphaBlendFactor = (VkBlendFactor)attachment.dstAlphaBlendFactor;
|
||||
blendAttachment.srcAlphaBlendFactor = (VkBlendFactor)attachment.srcAlphaBlendFactor;
|
||||
blendAttachment.dstColorBlendFactor = (VkBlendFactor)attachment.dstColorBlendFactor;
|
||||
|
||||
@@ -52,6 +52,12 @@ RenderPass::RenderPass(PGraphics graphics, Gfx::PRenderTargetLayout layout)
|
||||
desc.initialLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
||||
desc.finalLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
||||
|
||||
VkClearValue& clearValue = clearValues.add();
|
||||
if(desc.loadOp == VK_ATTACHMENT_LOAD_OP_CLEAR)
|
||||
{
|
||||
clearValue = cast(colorAttachment->clear);
|
||||
}
|
||||
|
||||
VkAttachmentReference &ref = colorRefs.add();
|
||||
ref.layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
||||
ref.attachment = attachmentCounter;
|
||||
@@ -71,6 +77,12 @@ RenderPass::RenderPass(PGraphics graphics, Gfx::PRenderTargetLayout layout)
|
||||
desc.initialLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
|
||||
desc.finalLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
|
||||
|
||||
VkClearValue& clearValue = clearValues.add();
|
||||
if(desc.loadOp == VK_ATTACHMENT_LOAD_OP_CLEAR)
|
||||
{
|
||||
clearValue = cast(layout->depthAttachment->clear);
|
||||
}
|
||||
|
||||
VkAttachmentReference &ref = depthRef;
|
||||
ref.layout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
|
||||
ref.attachment = attachmentCounter;
|
||||
|
||||
@@ -8,7 +8,7 @@ Transform::Transform()
|
||||
}
|
||||
|
||||
Transform::Transform(Transform &&other)
|
||||
: position(other.position), rotation(other.rotation), scale(scale)
|
||||
: position(other.position), rotation(other.rotation), scale(other.scale)
|
||||
{
|
||||
other.position = Vector4(0, 0, 0, 0);
|
||||
other.rotation = Quaternion(0, 0, 0, 0);
|
||||
@@ -16,7 +16,7 @@ Transform::Transform(Transform &&other)
|
||||
}
|
||||
|
||||
Transform::Transform(const Transform &other)
|
||||
: position(other.position), rotation(other.rotation), scale(scale)
|
||||
: position(other.position), rotation(other.rotation), scale(other.scale)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ Vector Transform::inverseTransformPosition(const Vector &v) const
|
||||
}
|
||||
Matrix4 Transform::toMatrix()
|
||||
{
|
||||
Matrix4 mat;
|
||||
Matrix4 mat(1.0f);
|
||||
|
||||
mat[3][0] = position.x;
|
||||
mat[3][1] = position.y;
|
||||
|
||||
@@ -51,7 +51,12 @@ void Actor::setWorldLocation(Vector location)
|
||||
{
|
||||
rootComponent->setWorldLocation(location);
|
||||
}
|
||||
void Actor::setWorldRotation(Vector4 rotation)
|
||||
|
||||
void Actor::setWorldRotation(Quaternion rotation)
|
||||
{
|
||||
rootComponent->setWorldRotation(rotation);
|
||||
}
|
||||
void Actor::setWorldRotation(Vector rotation)
|
||||
{
|
||||
rootComponent->setWorldRotation(rotation);
|
||||
}
|
||||
@@ -63,7 +68,11 @@ void Actor::setRelativeLocation(Vector location)
|
||||
{
|
||||
rootComponent->setRelativeLocation(location);
|
||||
}
|
||||
void Actor::setRelativeRotation(Vector4 rotation)
|
||||
void Actor::setRelativeRotation(Quaternion rotation)
|
||||
{
|
||||
rootComponent->setRelativeRotation(rotation);
|
||||
}
|
||||
void Actor::setRelativeRotation(Vector rotation)
|
||||
{
|
||||
rootComponent->setRelativeRotation(rotation);
|
||||
}
|
||||
@@ -75,7 +84,11 @@ void Actor::addWorldTranslation(Vector translation)
|
||||
{
|
||||
rootComponent->addWorldTranslation(translation);
|
||||
}
|
||||
void Actor::addWorldRotation(Vector4 rotation)
|
||||
void Actor::addWorldRotation(Quaternion rotation)
|
||||
{
|
||||
rootComponent->addWorldRotation(rotation);
|
||||
}
|
||||
void Actor::addWorldRotation(Vector rotation)
|
||||
{
|
||||
rootComponent->addWorldRotation(rotation);
|
||||
}
|
||||
|
||||
@@ -22,15 +22,18 @@ public:
|
||||
void detachChild(PActor child);
|
||||
Array<PActor> getChildren();
|
||||
void setWorldLocation(Vector location);
|
||||
void setWorldRotation(Vector4 rotation);
|
||||
void setWorldRotation(Quaternion rotation);
|
||||
void setWorldRotation(Vector rotation);
|
||||
void setWorldScale(Vector scale);
|
||||
|
||||
void setRelativeLocation(Vector location);
|
||||
void setRelativeRotation(Vector4 rotation);
|
||||
void setRelativeRotation(Quaternion rotation);
|
||||
void setRelativeRotation(Vector rotation);
|
||||
void setRelativeScale(Vector scale);
|
||||
|
||||
void addWorldTranslation(Vector translation);
|
||||
void addWorldRotation(Vector4 rotation);
|
||||
void addWorldRotation(Quaternion rotation);
|
||||
void addWorldRotation(Vector rotation);
|
||||
|
||||
PComponent getRootComponent();
|
||||
void setRootComponent(PComponent newRoot);
|
||||
|
||||
@@ -14,6 +14,8 @@ CameraActor::CameraActor()
|
||||
cameraComponent->aspectRatio = 1.777778f;
|
||||
cameraComponent->setParent(sceneComponent);
|
||||
cameraComponent->setOwner(this);
|
||||
addWorldTranslation(Vector(0, 0, 50));
|
||||
addWorldRotation(Vector(0, -1, 0));
|
||||
}
|
||||
|
||||
CameraActor::~CameraActor()
|
||||
|
||||
@@ -24,6 +24,7 @@ void CameraComponent::mouseMove(float deltaX, float deltaY)
|
||||
rotationX += deltaX/100.f;
|
||||
rotationY += deltaY/100.f;
|
||||
rotationY = std::clamp(rotationY, -1.5f, 1.5f);
|
||||
addWorldRotation(Vector(rotationX, rotationY, 0));
|
||||
bNeedsViewBuild = true;
|
||||
}
|
||||
|
||||
@@ -31,18 +32,20 @@ void CameraComponent::mouseScroll(double x)
|
||||
{
|
||||
distance += static_cast<float>(x);
|
||||
distance = std::max(distance, 1.f);
|
||||
addWorldTranslation(Vector(0, 0, x));
|
||||
bNeedsViewBuild = true;
|
||||
}
|
||||
|
||||
void CameraComponent::moveOrigin(float up)
|
||||
{
|
||||
originPoint.y += up;
|
||||
addWorldTranslation(Vector(0, up, 0));
|
||||
bNeedsViewBuild = true;
|
||||
}
|
||||
|
||||
void CameraComponent::buildViewMatrix()
|
||||
{
|
||||
Matrix4 rotation = glm::rotate(Matrix4(), rotationX, Vector(0, 1, 0));
|
||||
Matrix4 rotation = glm::rotate(Matrix4(1.0f), rotationX, Vector(0, 1, 0));
|
||||
rotation = glm::rotate(rotation, rotationY, Vector(1, 0, 0));
|
||||
Vector4 translation(0, 0, distance, 1);
|
||||
translation = rotation * translation;
|
||||
|
||||
@@ -203,7 +203,7 @@ void Component::setRelativeLocationAndRotation(Vector newLocation, Quaternion ne
|
||||
}
|
||||
|
||||
const Transform desiredRelTransform(newLocation, newRotation);
|
||||
const Transform desiredWorldTransform = parent->getTransform() * desiredRelTransform;
|
||||
const Transform desiredWorldTransform = desiredRelTransform; // Check for absolutes etc
|
||||
|
||||
internalSetTransform(desiredWorldTransform.getPosition(), desiredWorldTransform.getRotation());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user