gpuray_glsl

changeset 2:6e3a4daf3159

adding cones
author John Tsiombikas <nuclear@mutantstargoat.com>
date Sun, 09 Nov 2014 14:39:01 +0200
parents 92695e89164b
children 297dbc5080c4
files src/cone.cc src/cone.h
diffstat 2 files changed, 38 insertions(+), 0 deletions(-) [+]
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/cone.cc	Sun Nov 09 14:39:01 2014 +0200
     1.3 @@ -0,0 +1,20 @@
     1.4 +#include "cone.h"
     1.5 +
     1.6 +Cone::Cone()
     1.7 +{
     1.8 +	angle = M_PI / 4.0;
     1.9 +	ymin = 0.0f;
    1.10 +	ymax = 1.0f;
    1.11 +}
    1.12 +
    1.13 +Cone::Cone(float angle, float ymin, float ymax)
    1.14 +{
    1.15 +	this->angle = angle;
    1.16 +	this->ymin = ymin;
    1.17 +	this->ymax = ymax;
    1.18 +}
    1.19 +
    1.20 +bool Cone::intersect(const Ray &ray, HitPoint *pt) const
    1.21 +{
    1.22 +	return false;	// TODO
    1.23 +}
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/src/cone.h	Sun Nov 09 14:39:01 2014 +0200
     2.3 @@ -0,0 +1,18 @@
     2.4 +#ifndef CONE_H_
     2.5 +#define CONE_H_
     2.6 +
     2.7 +#include "vmath/vmath.h"
     2.8 +#include "object.h"
     2.9 +
    2.10 +class Cone : public Object {
    2.11 +public:
    2.12 +	float angle;
    2.13 +	float ymin, ymax;	/* in local space */
    2.14 +
    2.15 +	Cone();
    2.16 +	explicit Cone(float angle, float ymin = 0.0f, float ymax = 1.0f);
    2.17 +
    2.18 +	bool intersect(const Ray &ray, HitPoint *pt) const;
    2.19 +};
    2.20 +
    2.21 +#endif	/* CONE_H_ */