diff --git a/lib/renderer/src/renderer/scene/AbstractRenderer.h b/lib/renderer/src/renderer/scene/AbstractRenderer.h index 87bbad27..07cfb5c6 100644 --- a/lib/renderer/src/renderer/scene/AbstractRenderer.h +++ b/lib/renderer/src/renderer/scene/AbstractRenderer.h @@ -6,26 +6,46 @@ namespace renderer::scene { struct MapDescription { - int32_t width; - int32_t height; - uint8_t* material_begin_offsets; + int32_t width; // H_SIZE + int32_t height; // V_SIZE + uint8_t* material_begin_offsets; // Material offsets in the palette uint8_t* material_end_offsets; - int32_t material_count; + int32_t material_count; // 8 for }; + // TODO: ugly definition + // HeightMap is basically struct { int32_t id; }; enum class _HeightMapT; typedef ResourceId<_HeightMapT> HeightMap; static_assert (sizeof (HeightMap) == sizeof (int32_t), "invalid HeightMap RID size"); - + // TODO: Rename it to the AbstractSceneRenderer? class AbstractRenderer { public: + // Creates HeightMap from description virtual HeightMap map_create(const MapDescription& map_description) = 0; + + // Destroys the HeightMap virtual void map_destroy(HeightMap map) = 0; + + // Gets width and height of the HeightMap + // nullptr-s are valid virtual void map_query(HeightMap map, int32_t* width, int32_t* height) = 0; + + // Updates a rectangular area the selected HeightMap with height data from *height* and meta data from *meta* + // The renderer must not keep the height and meta pointers since they will be deleted after the call + // TODO: the *height* parameter name is confusing + // TODO: virtual void map_update_data(HeightMap map, const Rect& rect, uint8_t* height, uint8_t* meta) = 0; + + // Updates a 256-color palette for the HeightMap. + // The renderer must not keep the palette pointer since if will be deleted after the call virtual void map_update_palette(HeightMap map, uint32_t* palette, int32_t palette_size) = 0; + + // Renders the scene into the viewport with size viewport_width*viewport_height and with camera position *camera_pos_XXX* + // TODO: need to discuss and refactor this function signature virtual void render(int32_t viewport_width, int32_t viewport_height, int32_t camera_pos_x, int32_t camera_pos_y, int32_t camera_pos_z) = 0; + virtual ~AbstractRenderer() = default; }; }