trim spaces and use 4 space instead of 2
This commit is contained in:
parent
db59cc2a85
commit
0b62517c35
6 changed files with 894 additions and 893 deletions
|
@ -81,7 +81,8 @@ void transform_n_rasterize(surface_t * s, float * model_view_matrix, float * pro
|
||||||
if( s->t[i].state & PS_PARTIALLY_OUT &&
|
if( s->t[i].state & PS_PARTIALLY_OUT &&
|
||||||
( (s->t[i].v[0].state & PS_TOO_FAR) ||
|
( (s->t[i].v[0].state & PS_TOO_FAR) ||
|
||||||
(s->t[i].v[1].state & PS_TOO_FAR) ||
|
(s->t[i].v[1].state & PS_TOO_FAR) ||
|
||||||
(s->t[i].v[2].state & PS_TOO_FAR) ) )
|
(s->t[i].v[2].state & PS_TOO_FAR) )
|
||||||
|
)
|
||||||
continue;
|
continue;
|
||||||
fill_triangle(s, &(s->t[i]));
|
fill_triangle(s, &(s->t[i]));
|
||||||
}
|
}
|
||||||
|
|
112
rasterize.h
112
rasterize.h
|
@ -20,17 +20,17 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
typedef enum pstate_t pstate_t;
|
typedef enum pstate_t pstate_t;
|
||||||
typedef enum soptions_t soptions_t;
|
typedef enum soptions_t soptions_t;
|
||||||
typedef struct vec4 vec4;
|
typedef struct vec4 vec4;
|
||||||
typedef struct vec3 vec3;
|
typedef struct vec3 vec3;
|
||||||
typedef struct vec2 vec2;
|
typedef struct vec2 vec2;
|
||||||
typedef struct vertex_t vertex_t;
|
typedef struct vertex_t vertex_t;
|
||||||
typedef struct triangle_t triangle_t;
|
typedef struct triangle_t triangle_t;
|
||||||
typedef struct surface_t surface_t;
|
typedef struct surface_t surface_t;
|
||||||
|
|
||||||
/*!\brief états pour les sommets ou les triangles */
|
/*!\brief états pour les sommets ou les triangles */
|
||||||
enum pstate_t {
|
enum pstate_t {
|
||||||
PS_NONE = 0,
|
PS_NONE = 0,
|
||||||
PS_TOTALLY_OUT = 1,
|
PS_TOTALLY_OUT = 1,
|
||||||
PS_PARTIALLY_OUT = 2,
|
PS_PARTIALLY_OUT = 2,
|
||||||
|
@ -43,10 +43,10 @@ extern "C" {
|
||||||
PS_OUT_TOP = 128,
|
PS_OUT_TOP = 128,
|
||||||
PS_OUT_NEAR = 256,
|
PS_OUT_NEAR = 256,
|
||||||
PS_OUT_FAR = 512
|
PS_OUT_FAR = 512
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!\brief options pour les surfaces */
|
/*!\brief options pour les surfaces */
|
||||||
enum soptions_t {
|
enum soptions_t {
|
||||||
SO_NONE = 0, /* la surface n'a pas de rendu
|
SO_NONE = 0, /* la surface n'a pas de rendu
|
||||||
"couleur" */
|
"couleur" */
|
||||||
SO_USE_TEXTURE = 1, /* utiliser la texture pour
|
SO_USE_TEXTURE = 1, /* utiliser la texture pour
|
||||||
|
@ -69,22 +69,22 @@ extern "C" {
|
||||||
SO_DEFAULT = SO_CULL_BACKFACES | SO_USE_COLOR /* comportement
|
SO_DEFAULT = SO_CULL_BACKFACES | SO_USE_COLOR /* comportement
|
||||||
par
|
par
|
||||||
défaut */
|
défaut */
|
||||||
};
|
};
|
||||||
|
|
||||||
struct vec4 {
|
struct vec4 {
|
||||||
float x /* r */, y/* g */, z /* b */, w /* a */;
|
float x /* r */, y/* g */, z /* b */, w /* a */;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct vec2 {
|
struct vec2 {
|
||||||
float x /* s */, y /* t */;
|
float x /* s */, y /* t */;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct vec3 {
|
struct vec3 {
|
||||||
float x /* r */, y/* g */, z/* b */;
|
float x /* r */, y/* g */, z/* b */;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!\brief le sommet et l'ensemble de ses attributs */
|
/*!\brief le sommet et l'ensemble de ses attributs */
|
||||||
struct vertex_t {
|
struct vertex_t {
|
||||||
vec4 position;
|
vec4 position;
|
||||||
vec4 color0;
|
vec4 color0;
|
||||||
/* début des données à partir desquelles on peut interpoler en masse */
|
/* début des données à partir desquelles on peut interpoler en masse */
|
||||||
|
@ -99,19 +99,19 @@ extern "C" {
|
||||||
vec3 normal; /* interpolez les normales si vous implémentez Phong */
|
vec3 normal; /* interpolez les normales si vous implémentez Phong */
|
||||||
int x, y;
|
int x, y;
|
||||||
enum pstate_t state;
|
enum pstate_t state;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!\brief le triangle */
|
/*!\brief le triangle */
|
||||||
struct triangle_t {
|
struct triangle_t {
|
||||||
vertex_t v[3];
|
vertex_t v[3];
|
||||||
vec3 normal;
|
vec3 normal;
|
||||||
enum pstate_t state;
|
enum pstate_t state;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!\brief la surface englobe plusieurs triangles et des options
|
/*!\brief la surface englobe plusieurs triangles et des options
|
||||||
* telles que le type de rendu, la couleur diffuse ou la texture.
|
* telles que le type de rendu, la couleur diffuse ou la texture.
|
||||||
*/
|
*/
|
||||||
struct surface_t {
|
struct surface_t {
|
||||||
int n;
|
int n;
|
||||||
triangle_t * t;
|
triangle_t * t;
|
||||||
GLuint tex_id;
|
GLuint tex_id;
|
||||||
|
@ -123,37 +123,37 @@ extern "C" {
|
||||||
void (*shadingfunc)(surface_t *, GLuint *, vertex_t *);
|
void (*shadingfunc)(surface_t *, GLuint *, vertex_t *);
|
||||||
};
|
};
|
||||||
|
|
||||||
/* dans rasterize.c */
|
/* dans rasterize.c */
|
||||||
extern void transform_n_rasterize(surface_t * s, float * model_view_matrix, float * projection_matrix);
|
extern void transform_n_rasterize(surface_t * s, float * model_view_matrix, float * projection_matrix);
|
||||||
extern void clear_depth_map(void);
|
extern void clear_depth_map(void);
|
||||||
extern void set_texture(GLuint screen);
|
extern void set_texture(GLuint screen);
|
||||||
extern void updatesfuncs(surface_t * s);
|
extern void updatesfuncs(surface_t * s);
|
||||||
|
|
||||||
/* dans vtranform.c */
|
/* dans vtranform.c */
|
||||||
extern vertex_t vtransform(surface_t * s, vertex_t v, float * model_view_matrix, float * ti_model_view_matrix, float * projection_matrix, float * viewport);
|
extern vertex_t vtransform(surface_t * s, vertex_t v, float * model_view_matrix, float * ti_model_view_matrix, float * projection_matrix, float * viewport);
|
||||||
extern void stransform(surface_t * s, float * model_view_matrix, float * projection_matrix, float * viewport);
|
extern void stransform(surface_t * s, float * model_view_matrix, float * projection_matrix, float * viewport);
|
||||||
extern void mult_matrix(float * res, float * m);
|
extern void mult_matrix(float * res, float * m);
|
||||||
extern void translate(float * m, float tx, float ty, float tz);
|
extern void translate(float * m, float tx, float ty, float tz);
|
||||||
extern void rotate(float * m, float angle, float x, float y, float z);
|
extern void rotate(float * m, float angle, float x, float y, float z);
|
||||||
extern void scale(float * m, float sx, float sy, float sz);
|
extern void scale(float * m, float sx, float sy, float sz);
|
||||||
extern void lookAt(float * m, float eyeX, float eyeY, float eyeZ, float centerX, float centerY, float centerZ, float upX, float upY, float upZ);
|
extern void lookAt(float * m, float eyeX, float eyeY, float eyeZ, float centerX, float centerY, float centerZ, float upX, float upY, float upZ);
|
||||||
|
|
||||||
/* dans surface.c */
|
/* dans surface.c */
|
||||||
extern void tnormal(triangle_t * t);
|
extern void tnormal(triangle_t * t);
|
||||||
extern void snormals(surface_t * s);
|
extern void snormals(surface_t * s);
|
||||||
extern void tnormals2vertices(surface_t * s);
|
extern void tnormals2vertices(surface_t * s);
|
||||||
extern void set_texture_id(surface_t * s, GLuint tex_id);
|
extern void set_texture_id(surface_t * s, GLuint tex_id);
|
||||||
extern void set_diffuse_color(surface_t * s, vec4 dcolor);
|
extern void set_diffuse_color(surface_t * s, vec4 dcolor);
|
||||||
extern void enable_surface_option(surface_t * s, soptions_t option);
|
extern void enable_surface_option(surface_t * s, soptions_t option);
|
||||||
extern void disable_surface_option(surface_t * s, soptions_t option);
|
extern void disable_surface_option(surface_t * s, soptions_t option);
|
||||||
extern surface_t * new_surface(triangle_t * t, int n, int duplicateTriangles, int hasNormals);
|
extern surface_t * new_surface(triangle_t * t, int n, int duplicateTriangles, int hasNormals);
|
||||||
extern void free_surface(surface_t * s);
|
extern void free_surface(surface_t * s);
|
||||||
extern GLuint get_texture_from_BMP(const char * filename);
|
extern GLuint get_texture_from_BMP(const char * filename);
|
||||||
|
|
||||||
/* dans geometry.c */
|
/* dans geometry.c */
|
||||||
extern surface_t * mk_quad(void);
|
extern surface_t * mk_quad(void);
|
||||||
extern surface_t * mk_cube(void);
|
extern surface_t * mk_cube(void);
|
||||||
extern surface_t * mk_sphere(int longitudes, int latitudes);
|
extern surface_t * mk_sphere(int longitudes, int latitudes);
|
||||||
# ifdef __cplusplus
|
# ifdef __cplusplus
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
Reference in a new issue