Files
Juliet/Romeo/docs/Juliet_include_Graphics_MeshRenderer.md
T

2.9 KiB

Juliet\include\Graphics\MeshRenderer

Source Files

  • Header: Juliet\include\Graphics\MeshRenderer.h
  • Source: Juliet\src\Graphics\MeshRenderer.cpp

AI Description

It looks like you're trying to create a simple cube and a quad using vertex data in a graphics programming context. The code snippet provided is incomplete and contains some errors that need to be addressed for it to work correctly. Here's a revised version of the code with corrections:

#include ?vector?

struct Vertex {
    float Position[3];
    float Color[4];
};

class MeshRenderer {
public:
    std::vector?Vertex? Vertices;
    std::vector?uint16_t? Indices;
    std::vector?MeshID? Meshes;

    MeshID AddCube()
    {
        // Define the vertices of a cube
        constexpr Vertex vertexData[] = {
            { { -0.5f, -0.5f, -0.5f }, { 1.0f, 0.0f, 0.0f, 1.0f } }, // Front bottom left
            { { 0.5f, -0.5f, -0.5f }, { 0.0f, 1.0f, 0.0f, 1.0f } },   // Front bottom right
            { { 0.5f, 0.5f, -0.5f }, { 0.0f, 0.0f, 1.0f, 1.0f } },  // Front top right
            { { -0.5f, 0.5f, -0.5f }, { 0.0f, 1.0f, 0.0f, 1.0f } },   // Front top left

            { { -0.5f, -0.5f, 0.5f }, { 1.0f, 0.0f, 0.0f, 1.0f } }, // Back bottom left
            { { 0.5f, -0.5f, 0.5f }, { 0.0f, 1.0f, 0.0f, 1.0f } },   // Back bottom right
            { { 0.5f, 0.5f, 0.5f }, { 0.0f, 0.0f, 1.0f, 1.0f } },  // Back top right
            { { -0.5f, 0.5f, 0.5f }, { 0.0f, 1.0f, 0.0f, 1.0f } },   // Back top left

            { { -0.5f, -0.5f, 0.5f }, { 1.0f, 0.0f, 0.0f

## Symbols

### Namespace `Juliet`

#### Classes, Structs & Unions
- `struct MeshRenderer`

#### Functions & Methods
- `constexpr size_t kGeometryPage       = Megabytes(64)`
- `constexpr size_t kIndexPage          = Megabytes(32)`
- `JULIET_API void InitializeMeshRenderer(NonNullPtr<Arena> arena)`
- `[[nodiscard]] JULIET_API bool InitializeMeshRendererGraphics(NonNullPtr<GraphicsDevice> device, NonNullPtr<Window> window)`
- `JULIET_API void ShutdownMeshRendererGraphics()`
- `JULIET_API void ShutdownMeshRenderer()`
- `JULIET_API void LoadMeshesOnGPU(NonNullPtr<CommandList> cmdList)`
- `JULIET_API void RenderMeshes(NonNullPtr<RenderPass> pass, NonNullPtr<CommandList> cmdList, PushData& pushData)`
- `// Lights
    [[nodiscard]] JULIET_API LightID AddPointLight(const PointLight& light)`
- `JULIET_API void SetPointLightPosition(LightID id, const Vector3& position)`
- `JULIET_API void SetPointLightColor(LightID id, const Vector3& color)`
- `JULIET_API void SetPointLightRadius(LightID id, float radius)`
- `JULIET_API void SetPointLightIntensity(LightID id, float intensity)`
- `JULIET_API void ClearPointLights()`
- `// Utils
    [[nodiscard]] JULIET_API MeshID AddCube()`
- `[[nodiscard]] JULIET_API MeshID AddQuad()`
- `JULIET_API void SetMeshTransform(MeshID id, const Matrix& transform)`
- `#if ALLOW_SHADER_HOT_RELOAD
    JULIET_API void ReloadMeshRendererShaders()`