im basically trying to provide diffrent shape informations about objects to a ray tracer written in glsl.
shapes like
sphere: vec3 center; float radius;
box: vec3 center; vec3 halfSize;
etc.
the problem are the following requirements:
- in fragment shader have access to all shapes
- do not send them every frame using uniform variables, cache them somehow for longer time until manually removed.
- be able to update data from the application
- data is of variable length each type (count of spheres, boxes, ...)
the data is not interleaved.
- so uniform variables send too much data.
- attributes do not seem to be ment for very many objects (attribute arrays use a location each element)
- textures change the data unwantedly and are ugly to access shape information
so how can one do that?
preferably also having a struct represent the data. like struct Sphere { vec3 p; float r; }; ...