File: RaytraceTriangle.h

package info (click to toggle)
structure-synth 1.5.0-2
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 2,268 kB
  • ctags: 1,966
  • sloc: cpp: 10,209; python: 164; makefile: 71; sh: 15
file content (50 lines) | stat: -rw-r--r-- 1,322 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#pragma once

#include "SyntopiaCore/Math/Vector3.h"
#include "Object3D.h"

namespace SyntopiaCore {
	namespace GLEngine {	

		using namespace SyntopiaCore::Math;

		// Helper class for tesselated objects
		class RaytraceTriangle {
		public:
			RaytraceTriangle(Vector3f p1, Vector3f p2, Vector3f p3, Vector3f n1, Vector3f n2, Vector3f n3);
			RaytraceTriangle() : cullBackFaces(false) {};
			~RaytraceTriangle(void);
			void expandBoundingBox(Vector3f& from,Vector3f& to);
			void setColor(float r, float g, float b, float a) { 
				color1[0] = r; color1[1] = g; color1[2] = b; color1[3] = a;
				color2[0] = r; color2[1] = g; color2[2] = b; color2[3] = a;
				color3[0] = r; color3[1] = g; color3[2] = b; color3[3] = a;
			}
			virtual bool intersectsRay(RayInfo* /*rayInfo*/);
				
			static void Vertex4(Vector3f p1,Vector3f p2,Vector3f p3,Vector3f p4,bool reverse, QVector<RaytraceTriangle>& list, float r, float b, float g, float a);
		
           	Vector3f p1;
			Vector3f p2;
			Vector3f p3;
			Vector3f n1;
			Vector3f n2;
			Vector3f n3;
			GLfloat color1[4];
			GLfloat color2[4];
			GLfloat color3[4];
			Vector3f npn1;
			Vector3f npn2;
			Vector3f npn3;
			
			Vector3f to;
			Vector3f from;
			Vector3f n;
			bool bad;
			bool cullBackFaces;
		
		};

	}
}