/** * @file renderer.h * @brief Advanced rendering engine for ASCII 3D Renderer * @author ASCII3D Project * @version 2.0.0 */ #ifndef ASCII3D_RENDERER_H #define ASCII3D_RENDERER_H #include "config.h" #include "lighting.h" #include #ifdef __cplusplus extern "C" { #endif /** * @brief Rotation state for animation */ typedef struct RotationState { float angle_x; float angle_y; float angle_z; bool enable_x; bool enable_y; bool enable_z; float speed; } RotationState; /** * @brief Render settings structure */ typedef struct RenderSettings { RenderMode mode; /* Rendering mode */ ColorMode color_mode; /* Color output mode */ bool anti_aliasing; /* Enable AA */ bool show_fps; /* Display FPS counter */ bool auto_rotate; /* Auto rotation enabled */ float quality; /* Quality multiplier (0.5 - 2.0) */ int palette_index; /* Shading palette selection */ Color base_color; /* Base color for colored modes */ Color highlight_color; /* Highlight/specular color */ } RenderSettings; /** * @brief Frame statistics */ typedef struct FrameStats { double frame_time; /* Last frame time in ms */ double fps; /* Current FPS */ double avg_fps; /* Average FPS */ int frame_count; /* Total frames rendered */ int triangles; /* Triangles/voxels rendered */ } FrameStats; /** * @brief Initialize the renderer * @return 0 on success, -1 on failure */ int renderer_init(void); /** * @brief Cleanup renderer resources */ void renderer_cleanup(void); /** * @brief Clear the screen and depth buffers */ void renderer_clear(void); /** * @brief Render a 3D text string * @param text Text to render (A-Z, 0-9) * @param rotation Current rotation state */ void renderer_draw_text(const char *text, const RotationState *rotation); /** * @brief Render with full settings control * @param text Text to render * @param rotation Rotation state * @param settings Render settings */ void renderer_draw_text_ex(const char *text, const RotationState *rotation, const RenderSettings *settings); /** * @brief Display the rendered frame to terminal */ void renderer_present(void); /** * @brief Present with color support * @param settings Render settings for color mode */ void renderer_present_color(const RenderSettings *settings); /** * @brief Update rotation angles based on time delta * @param rotation Rotation state to update * @param delta_time Time since last update in seconds */ void renderer_update_rotation(RotationState *rotation, double delta_time); /** * @brief Create default rotation state * @return Default rotation state with Y-axis rotation enabled */ RotationState renderer_default_rotation(void); /** * @brief Create default render settings * @return Default settings */ RenderSettings renderer_default_settings(void); /** * @brief Set the render mode * @param mode New render mode */ void renderer_set_mode(RenderMode mode); /** * @brief Set the color mode * @param mode New color mode */ void renderer_set_color_mode(ColorMode mode); /** * @brief Get current frame statistics * @return Frame stats structure */ FrameStats renderer_get_stats(void); /** * @brief Set the shading palette * @param palette_index 0=standard, 1=extended, 2=block, 3=minimal */ void renderer_set_palette(int palette_index); /** * @brief Get the lighting system for modification * @return Pointer to lighting system */ LightingSystem *renderer_get_lighting(void); /** * @brief Hide terminal cursor */ void renderer_hide_cursor(void); /** * @brief Show terminal cursor */ void renderer_show_cursor(void); /** * @brief Clear terminal screen */ void renderer_clear_terminal(void); /** * @brief Set terminal to alternate screen buffer */ void renderer_enter_alternate_screen(void); /** * @brief Restore terminal to main screen buffer */ void renderer_exit_alternate_screen(void); #ifdef __cplusplus } #endif #endif /* ASCII3D_RENDERER_H */