104 lines
2.3 KiB
C
104 lines
2.3 KiB
C
#ifndef FE_SPACE
|
|
#define FE_SPACE
|
|
|
|
// Diverses representations de points dans l'espace
|
|
|
|
#include <stdint.h>
|
|
#include <fxengine/parameters.h>
|
|
|
|
|
|
/**
|
|
* @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
|
|
* This is also the type used by the rendering triangles.
|
|
*/
|
|
struct fe_ipoint
|
|
{
|
|
int32_t x,
|
|
y,
|
|
z;
|
|
};
|
|
typedef struct fe_ipoint fe_ipoint;
|
|
|
|
/**
|
|
* @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 fe_fpoint
|
|
{
|
|
double x,
|
|
y,
|
|
z;
|
|
};
|
|
typedef struct fe_fpoint fe_fpoint;
|
|
|
|
|
|
/**
|
|
* @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
|
|
* the floating_points yet. (Maybe I will never add them)
|
|
* To render a triangle, you have to set &point.translated as s1, s2 or even s3
|
|
*/
|
|
struct fe_ivertex
|
|
{
|
|
fe_ipoint real,
|
|
translated;
|
|
};
|
|
typedef struct fe_ivertex fe_ivertex;
|
|
|
|
|
|
/**
|
|
* @brief Translate a point with camera settings
|
|
*
|
|
* @param point The point to translate
|
|
*/
|
|
void fe_vertex_translate(fe_ivertex * v);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
* @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 fe_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 fe_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 fe_sin(const double angle);
|
|
|
|
/**
|
|
* mathematics constants
|
|
* TODO déplacer dans caméra
|
|
*/
|
|
#define pi 3.14159265358
|
|
#define pi2 6.28318530718
|
|
#define pi_sur_2 1.57079632679
|
|
|
|
// translate matrix
|
|
extern double fe_matrix[3][3];
|
|
extern fe_ipoint fe_translate_delta;
|
|
|
|
#endif
|