~ubuntu-branches/ubuntu/trusty/igraph/trusty-proposed

« back to all changes in this revision

Viewing changes to optional/simpleraytracer/RayTracer.h

  • Committer: Package Import Robot
  • Author(s): Mathieu Malaterre
  • Date: 2013-05-27 14:01:54 UTC
  • mfrom: (4.1.1 experimental)
  • Revision ID: package-import@ubuntu.com-20130527140154-oxwwmr0gj3kdy4ol
Tags: 0.6.5-2
Upload to sid

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/** RayTraceCanvas.h
 
2
 */
 
3
 
 
4
#ifndef RAY_TRACER_H
 
5
#define RAY_TRACER_H
 
6
 
 
7
 
 
8
#include<string>
 
9
#include "Point.h"
 
10
#include "Shape.h"
 
11
#include "Color.h"
 
12
#include "Light.h"
 
13
 
 
14
class Image
 
15
{
 
16
 public: 
 
17
  int width, height;
 
18
  double *red, *green, *blue, *trans;
 
19
};
 
20
 
 
21
class RayTracer
 
22
{
 
23
 
 
24
public:
 
25
        RayTracer();
 
26
        ~RayTracer();
 
27
 
 
28
        void RayTrace(Image &result);
 
29
 
 
30
        void AddShape(Shape* pShape);
 
31
        void AddLight(Light* pLight);
 
32
 
 
33
        void BackgroundColor(const Color& rBackgroundColor);
 
34
        void EyePoint(const Point& rEyePoint);
 
35
        void AmbientColor(const Color& rAmbient);
 
36
        void AmbientIntensity(double vAmbientIntensity);
 
37
 
 
38
private:
 
39
        
 
40
        Color Render(const Ray& rRay, bool vIsReflecting = false, const Shape* pReflectingFrom = 0 ); // vEyeRay should be true if the ray we are tracing is a ray from the eye, otherwise it should be false
 
41
        Shape* QueryScene(const Ray& rRay, Point& rIntersectionPoint, bool vIsReflecting = false, const Shape* pReflectingFrom = 0);
 
42
        double Shade(const Shape* pShapeToShade, const Point& rPointOnShapeToShade);
 
43
        double Specular(const Shape* pShapeToShade, const Point& rPointOnShapeToShade, const Light* pLight);    
 
44
                
 
45
        Color mBackgroundColor;
 
46
        Color mAmbientColor;
 
47
        Point mEyePoint;
 
48
        Color mSpecularColor;
 
49
        double mAmbientIntensity;       
 
50
 
 
51
        ShapeList* mpShapes;
 
52
        LightList* mpLights;
 
53
 
 
54
        int mRecursions;
 
55
        int mRecursionLimit;
 
56
        int mAntiAliasDetail;
 
57
};
 
58
 
 
59
#endif