playing with sphere size
This commit is contained in:
parent
944c019589
commit
305a814484
@ -102,7 +102,7 @@ surface_t * mkCube(void) {
|
||||
/*!\brief fabrique et renvoie une surface représentant une sphère
|
||||
* centrée en zéro et de rayon 1. Elle est découpée en \a longitudes
|
||||
* longitudes et \a latitudes latitudes. */
|
||||
surface_t * mkSphere(int longitudes, int latitudes) {
|
||||
surface_t * mkSphere(int longitudes, int latitudes, double s) {
|
||||
triangle_t * t;
|
||||
vertex_t * data;
|
||||
double phi, theta, r, y;
|
||||
@ -118,8 +118,8 @@ surface_t * mkSphere(int longitudes, int latitudes) {
|
||||
assert(t);
|
||||
for(z = 0, k = 0; z <= latitudes; ++z) {
|
||||
theta = -M_PI_2 + z * cMPI_Lat;
|
||||
y = sin(theta);
|
||||
r = cos(theta);
|
||||
y = sin(theta) * s;
|
||||
r = cos(theta) * s;
|
||||
for(x = 0; x <= longitudes; ++x, ++k) {
|
||||
phi = x * c2MPI_Long;
|
||||
data[k].position.x = r * cos(phi);
|
||||
|
2
moteur.h
2
moteur.h
@ -155,7 +155,7 @@ extern "C" {
|
||||
/* dans geometry.c */
|
||||
extern surface_t * mkQuad(void);
|
||||
extern surface_t * mkCube(void);
|
||||
extern surface_t * mkSphere(int longitudes, int latitudes);
|
||||
extern surface_t * mkSphere(int longitudes, int latitudes, double s);
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
|
4
window.c
4
window.c
@ -91,10 +91,10 @@ void init(void) {
|
||||
GLuint id, id2;
|
||||
/*vec4 g = {0, 1, 0, 1};*/
|
||||
/* on créé nos trois type de surfaces */
|
||||
_sun = mkSphere(12, 12); /* ça fait 12x12x2 trianles ! */
|
||||
_sun = mkSphere(12, 12, 2); /* ça fait 12x12x2 trianles ! */
|
||||
/* on change les couleurs de surfaces */
|
||||
/*_sun->dcolor = g; */
|
||||
_mercury = mkSphere(12,12);
|
||||
_mercury = mkSphere(12,12, 0.3);
|
||||
id = getTexFromBMP("images/2k-sun.bmp");
|
||||
id2 = getTexFromBMP("images/2k-mercury.bmp");
|
||||
setTexId(_sun, id);
|
||||
|
Loading…
Reference in New Issue
Block a user