-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPrimitive.cs
More file actions
60 lines (49 loc) · 1.39 KB
/
Copy pathPrimitive.cs
File metadata and controls
60 lines (49 loc) · 1.39 KB
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
51
52
53
54
55
56
57
58
59
60
using OpenTK.Graphics.OpenGL;
using System;
using System.Collections.Generic;
using System.Numerics;
using System.Text;
using Template;
namespace INFOGRTemplate
{
enum Materials
{
Diffuse,
Plastic,
Metallic,
Reflective,
Refractive,
}
enum PrimitiveTypes
{
Sphere,
Plane,
Triangle
}
internal class Primitive
{
public Color3 color;
public Vector3 position;
public PrimitiveTypes type;
public Materials material;
public bool checkers;
public float refraction_index = 1.52f; //An objects default refractiveness is that of glass (thus making the default refractive material glass)
public Primitive(Color3 _color, Vector3 _position, PrimitiveTypes _type, Materials _material, bool checkers)
{
this.color = _color;
this.position = _position;
this.type = _type;
material = _material;
this.checkers = checkers;
}
public Intersection Intersect(Ray ray)
{
return new Intersection(this, ray);
}
//overridable method to prevent some checks in another part of the code
public virtual Color3 checkerBoards(Vector3 hitPoint, Vector3 normalVector, float distance)
{
return new Color3(0, 0, 0); //default
}
}
}