Skip to content

Commit

Permalink
Plane #38
Browse files Browse the repository at this point in the history
  • Loading branch information
Paracetamol56 committed Aug 16, 2023
1 parent 4292dd2 commit 5ff5ab9
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
12 changes: 10 additions & 2 deletions Aminophenol/Mesh/PrimitiveMesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,19 @@ namespace Aminophenol
return mesh;
}

std::shared_ptr<Mesh> PrimitiveMesh::createPlane(const LogicalDevice& logicalDevice, const std::shared_ptr<CommandPool> commandPool, float width, float height)
std::shared_ptr<Mesh> PrimitiveMesh::createPlane(const LogicalDevice& logicalDevice, const std::shared_ptr<CommandPool> commandPool)
{
std::shared_ptr<Mesh> mesh = std::make_shared<Mesh>(logicalDevice, commandPool);

// TODO: Implement plane mesh creation
mesh->vertices = {
{ { -0.5f, 0.0f, 0.5f }, { 1.0f, 1.0f, 1.0f }, { 0.0f, 1.0f, 0.0f } },
{ { 0.5f, 0.0f, 0.5f }, { 1.0f, 1.0f, 1.0f }, { 0.0f, 1.0f, 0.0f } },
{ { 0.5f, 0.0f,-0.5f }, { 1.0f, 1.0f, 1.0f }, { 0.0f, 1.0f, 0.0f } },
{ { -0.5f, 0.0f,-0.5f }, { 1.0f, 1.0f, 1.0f }, { 0.0f, 1.0f, 0.0f } }
};
mesh->indices = {
2, 1, 0, 0, 3, 2
};

mesh->create();

Expand Down
2 changes: 1 addition & 1 deletion Aminophenol/Mesh/PrimitiveMesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace Aminophenol

static std::shared_ptr<Mesh> createCube(const LogicalDevice& logicalDevice, const std::shared_ptr<CommandPool> commandPool);
static std::shared_ptr<Mesh> createSphere(const LogicalDevice& logicalDevice, const std::shared_ptr<CommandPool> commandPool, uint32_t rings = 32, uint32_t sectors = 32);
static std::shared_ptr<Mesh> createPlane(const LogicalDevice& logicalDevice, const std::shared_ptr<CommandPool> commandPool, float width = 1.0f, float height = 1.0f);
static std::shared_ptr<Mesh> createPlane(const LogicalDevice& logicalDevice, const std::shared_ptr<CommandPool> commandPool);
static std::shared_ptr<Mesh> createCylinder(const LogicalDevice& logicalDevice, const std::shared_ptr<CommandPool> commandPool, float radius = 1.0f, float height = 1.0f, uint32_t sectors = 32);
static std::shared_ptr<Mesh> createCone(const LogicalDevice& logicalDevice, const std::shared_ptr<CommandPool> commandPool, float radius = 1.0f, float height = 1.0f, uint32_t sectors = 32);
static std::shared_ptr<Mesh> createTorus(const LogicalDevice& logicalDevice, const std::shared_ptr<CommandPool> commandPool, float innerRadius = 0.5f, float outerRadius = 1.0f, uint32_t rings = 32, uint32_t sectors = 32);
Expand Down
2 changes: 1 addition & 1 deletion Application/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ int main(int argc, char* argv[])
engine.setActiveScene(scene);

Node* object = scene->addChild("object");
MeshRenderer* objectMeshRenderer = object->addComponent<MeshRenderer>(PrimitiveMesh::createCube(
MeshRenderer* objectMeshRenderer = object->addComponent<MeshRenderer>(PrimitiveMesh::createPlane(
engine.getRenderingEngine().getLogicalDevice(),
engine.getRenderingEngine().getCommandPool()
));
Expand Down
2 changes: 1 addition & 1 deletion Application/CustomComponents/ObjectRotationController.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class ObjectRotationController :
std::shared_ptr<InputAxis> m_xAxis;
std::shared_ptr<InputAxis> m_yAxis;
std::shared_ptr<InputButton> m_autoRotateButton;
bool m_autoRotate = true;
bool m_autoRotate = false;

};

Expand Down

0 comments on commit 5ff5ab9

Please sign in to comment.