rayzor

diff src/object.cc @ 1:a826bf0fb169

fixed line endings
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 05 Apr 2014 09:05:26 +0300
parents 2a5340a6eee4
children 5fcf72837b69
line diff
     1.1 --- a/src/object.cc	Sat Apr 05 08:46:27 2014 +0300
     1.2 +++ b/src/object.cc	Sat Apr 05 09:05:26 2014 +0300
     1.3 @@ -1,53 +1,53 @@
     1.4 -#include "object.h"
     1.5 -#include "vmath.h"
     1.6 -#include "min3d.h"
     1.7 -
     1.8 -Object::Object()
     1.9 -{
    1.10 -}
    1.11 -
    1.12 -Object::~Object()
    1.13 -{
    1.14 -}
    1.15 -
    1.16 -// ---- sphere ----
    1.17 -Sphere::Sphere()
    1.18 -{
    1.19 -}
    1.20 -
    1.21 -Sphere::~Sphere()
    1.22 -{
    1.23 -}
    1.24 -
    1.25 -#define USUB	16
    1.26 -#define VSUB	8
    1.27 -
    1.28 -void Sphere::draw() const
    1.29 -{
    1.30 -	static Vector3 *varr;
    1.31 -	static int num_verts;
    1.32 -	if(!varr) {
    1.33 -		int uverts = USUB;
    1.34 -		int vverts = VSUB + 1;
    1.35 -		num_verts = uverts * vverts;
    1.36 -		varr = new Vector3[num_verts];
    1.37 -
    1.38 -		Vector3 *vptr = varr;
    1.39 -		for(int i=0; i<uverts; i++) {
    1.40 -			float u = (float)i / (float)USUB;
    1.41 -			float theta = u * M_PI * 2.0;
    1.42 -			for(int j=0; j<vverts; j++) {
    1.43 -				float v = (float)j / (float)VSUB;
    1.44 -				float phi = (v - 0.5) * M_PI;
    1.45 -
    1.46 -				float x = sin(theta) * cos(phi);
    1.47 -				float y = sin(phi);
    1.48 -				float z = cos(theta) * cos(phi);
    1.49 -
    1.50 -				*vptr++ = Vector3(x, y, z);
    1.51 -			}
    1.52 -		}
    1.53 -	}
    1.54 -
    1.55 -	m3d_draw(M3D_POINTS, &varr->x, num_verts);
    1.56 -}
    1.57 +#include "object.h"
    1.58 +#include "vmath.h"
    1.59 +#include "min3d.h"
    1.60 +
    1.61 +Object::Object()
    1.62 +{
    1.63 +}
    1.64 +
    1.65 +Object::~Object()
    1.66 +{
    1.67 +}
    1.68 +
    1.69 +// ---- sphere ----
    1.70 +Sphere::Sphere()
    1.71 +{
    1.72 +}
    1.73 +
    1.74 +Sphere::~Sphere()
    1.75 +{
    1.76 +}
    1.77 +
    1.78 +#define USUB	16
    1.79 +#define VSUB	8
    1.80 +
    1.81 +void Sphere::draw() const
    1.82 +{
    1.83 +	static Vector3 *varr;
    1.84 +	static int num_verts;
    1.85 +	if(!varr) {
    1.86 +		int uverts = USUB;
    1.87 +		int vverts = VSUB + 1;
    1.88 +		num_verts = uverts * vverts;
    1.89 +		varr = new Vector3[num_verts];
    1.90 +
    1.91 +		Vector3 *vptr = varr;
    1.92 +		for(int i=0; i<uverts; i++) {
    1.93 +			float u = (float)i / (float)USUB;
    1.94 +			float theta = u * M_PI * 2.0;
    1.95 +			for(int j=0; j<vverts; j++) {
    1.96 +				float v = (float)j / (float)VSUB;
    1.97 +				float phi = (v - 0.5) * M_PI;
    1.98 +
    1.99 +				float x = sin(theta) * cos(phi);
   1.100 +				float y = sin(phi);
   1.101 +				float z = cos(theta) * cos(phi);
   1.102 +
   1.103 +				*vptr++ = Vector3(x, y, z);
   1.104 +			}
   1.105 +		}
   1.106 +	}
   1.107 +
   1.108 +	m3d_draw(M3D_POINTS, &varr->x, num_verts);
   1.109 +}