#ifndef RENDER_TRANSLATE_H #define RENDER_TRANSLATE_H #include #include /** * @brief this struct is a point in 3d, which has coords save as uint32_t * this is the recommended type for high performance rendering, because the sh3eb-elf architecture is 32 bits */ struct render_integer_position { int32_t x, y, z; }; typedef struct render_integer_position render_integer_position; /** * @brief this struct is a point in 3d, which has coords save as double * it is not recommended to use it for high performances rendering, because of the sh3eb-elf architecture, which does not support natively floating calculation */ struct render_floating_position { double x, y, z; }; typedef struct render_floating_position render_floating_position; /** * @brief This is a point which is used for 3d translations and rendering * integer mode is the best solution to increase perfs, and that's why I didn't have implemented te floating_points yet. */ struct render_integer_point { render_integer_position real; render_integer_position translated; }; typedef struct render_integer_point render_integer_point; // applique la matrice de rotation et les deltas sur les coordonnées d'un point /** * @brief This function rotates and applies perspective on an integer point * * @param point The point which needs to be translated */ void render_translate(render_integer_point * point); /** * @brief Sets up the translation matrices for a new rendering cycle * There is no need to call this function if you have already called render_update() * * @param[in] dh Camera's horizontal direction (rad) * @param[in] dv Camera's vertical direction (rad) * @param[in] roulis Optionnal rotation around the middle of the screen * @param[in] camera The camera's coordinates, as an integer position */ void render_set(const double dh, const double dv, const double roulis, const render_integer_position * camera); /** * mathematics constants */ extern const double pi, pi2, pi_sur_2; /** * @brief Sets up an angle mesure between -pi and +pi * * @param[in] a the angle (rad) * * @return angle mesure which respect the following contraint : * -pi <= angle <= pi */ double modulo_2pi(double a); /** * @brief Homemade cosinus implementation, which is faster than casio provided cosinus function * * @param[in] angle The angle (rad) * * @return cos angle */ double cos(double angle); /** * @brief Homemade sinus implementation, which is faster than casio provided sinus function * * @param[in] angle The angle (rad) * * @return sin angle */ double sin(const double angle); #endif