o3de / o3de-atom-sampleviewer

Atom sample viewer project for the Open 3D Engine
https://o3de.org
Other
32 stars 37 forks source link

GeomtryView: Updated AtomSampleViewer to work with new GeometryView changes #690

Closed antonmic closed 2 months ago

antonmic commented 2 months ago

Updated AtomSampleViewer to work with new GeometryView changes See: https://github.com/o3de/o3de/pull/18285 For that review

Helpful tip for reviewing: Most example components changed in this review have two changes The Geometry View Setup:

        m_geometryView.SetDrawArguments(RHI::DrawIndexed(0, 6, 0));

        m_geometryView.SetIndexBufferView({
            *m_rectangleInputAssemblyBuffer,
            offsetof(RectangleBufferData, m_indices),
            sizeof(RectangleBufferData::m_indices),
            RHI::IndexFormat::Uint16
        });

        m_geometryView.AddStreamBufferView({
            *m_rectangleInputAssemblyBuffer,
            offsetof(RectangleBufferData, m_positions),
            sizeof(RectangleBufferData::m_positions),
            sizeof(VertexPosition)
        });

        m_geometryView.AddStreamBufferView({
            *m_rectangleInputAssemblyBuffer,
            offsetof(RectangleBufferData, m_uvs),
            sizeof(RectangleBufferData::m_uvs),
            sizeof(VertexUV)
        });

        RHI::ValidateStreamBufferViews(m_rectangleInputStreamLayout, m_geometryView, m_geometryView.GetFullStreamBufferIndices());

And setting the GeometryView on the DrawItem:

                drawItem.m_geometryView = m_geometryView.GetDeviceGeometryView(context.GetDeviceIndex());
                drawItem.m_streamIndices = m_geometryView.GetFullStreamBufferIndices();

Once you've seen and understood these changes in one example component, you'll have understood 80-90% of the changes in this PR.