src/3D/InstancedRenderer.cpp
// create VAO for the normals shader
create VAO for the normals shader
create VAO for the normals shader
gl::VertexArray createNormalsVAO(
            MeshData const& mesh,
            gl::ArrayBuffer<GLubyte>& vbo,
            gl::ElementArrayBuffer<uint32_t>& ebo) {
        static_assert(offsetof(GPUUntexturedMeshdata, pos) == offsetof(GPUTexturedMeshdata, pos));
        static_assert(offsetof(GPUUntexturedMeshdata, norm) == offsetof(GPUTexturedMeshdata, norm));
        static constexpr size_t offset_pos = offsetof(GPUUntexturedMeshdata, pos);
        static constexpr size_t offset_norm = offsetof(GPUUntexturedMeshdata, norm);
        using NS = NormalsShader;
        size_t stride = mesh.texcoords.empty() ? sizeof(GPUUntexturedMeshdata) : sizeof(GPUTexturedMeshdata);
        gl::VertexArray vao;
        gl::BindVertexArray(vao);
        gl::BindBuffer(vbo);
        gl::BindBuffer(ebo);
        gl::VertexAttribPointer(NS::aPos, false, stride, offset_pos);
        gl::EnableVertexAttribArray(NS::aPos);
        gl::VertexAttribPointer(NS::aNormal, false, stride, offset_norm);
        gl::EnableVertexAttribArray(NS::aNormal);
        gl::BindVertexArray();
        return vao;
    }
gl :: VertexArray createNormalsVAO ( MeshData const & mesh , gl :: ArrayBuffer < GLubyte > & vbo , gl :: ElementArrayBuffer < uint32_t > & ebo ) { static_assert ( offsetof ( GPUUntexturedMeshdata , pos ) == offsetof ( GPUTexturedMeshdata , pos ) ) ; static_assert ( offsetof ( GPUUntexturedMeshdata , norm ) == offsetof ( GPUTexturedMeshdata , norm ) ) ; static constexpr size_t offset_pos = offsetof ( GPUUntexturedMeshdata , pos ) ; static constexpr size_t offset_norm = offsetof ( GPUUntexturedMeshdata , norm ) ; using NS = NormalsShader ; size_t stride = mesh . texcoords . empty ( ) ? sizeof ( GPUUntexturedMeshdata ) : sizeof ( GPUTexturedMeshdata ) ; gl :: VertexArray vao ; gl :: BindVertexArray ( vao ) ; gl :: BindBuffer ( vbo ) ; gl :: BindBuffer ( ebo ) ; gl :: VertexAttribPointer ( NS :: aPos , false , stride , offset_pos ) ; gl :: EnableVertexAttribArray ( NS :: aPos ) ; gl :: VertexAttribPointer ( NS :: aNormal , false , stride , offset_norm ) ; gl :: EnableVertexAttribArray ( NS :: aNormal ) ; gl :: BindVertexArray ( ) ; return vao ; }
create VAO for the normals shader
create VAO for the normals shader