@@ -78,124 +78,6 @@ struct Comprehensive
7878
7979 return objectID;
8080 }
81-
82- // note for future consideration: still need to encode to IntersectData?
83- // obsolete?
84- // static ObjectID traceProcedural(NBL_REF_ARG(ray_type) ray, NBL_CONST_REF_ARG(IntersectData) intersect)
85- // {
86- // const bool anyHit = ray.intersectionT != numeric_limits<scalar_type>::max;
87- // const uint32_t objCount = intersect.data[0];
88- // const ProceduralShapeType type = (ProceduralShapeType)intersect.data[1];
89-
90- // ObjectID objectID = ray.objectID;
91- // objectID.mode = IM_PROCEDURAL;
92- // objectID.shapeType = type;
93- // for (int i = 0; i < objCount; i++)
94- // {
95- // float t;
96- // switch (type)
97- // {
98- // case PST_SPHERE:
99- // {
100- // vector3_type position = vector3_type(asfloat(intersect.data[2 + i * Shape<PST_SPHERE>::ObjSize]), asfloat(intersect.data[2 + i * Shape<PST_SPHERE>::ObjSize + 1]), asfloat(intersect.data[2 + i * Shape<PST_SPHERE>::ObjSize + 2]));
101- // Shape<PST_SPHERE> sphere = Shape<PST_SPHERE>::create(position, asfloat(intersect.data[2 + i * Shape<PST_SPHERE>::ObjSize + 3]), intersect.data[2 + i * Shape<PST_SPHERE>::ObjSize + 4]);
102- // t = sphere.intersect(ray.origin, ray.direction);
103- // }
104- // break;
105- // case PST_TRIANGLE:
106- // {
107- // vector3_type vertex0 = vector3_type(asfloat(intersect.data[2 + i * Shape<PST_TRIANGLE>::ObjSize]), asfloat(intersect.data[2 + i * Shape<PST_SPHERE>::ObjSize + 1]), asfloat(intersect.data[2 + i * Shape<PST_TRIANGLE>::ObjSize + 2]));
108- // vector3_type vertex1 = vector3_type(asfloat(intersect.data[2 + i * Shape<PST_TRIANGLE>::ObjSize + 3]), asfloat(intersect.data[2 + i * Shape<PST_SPHERE>::ObjSize + 4]), asfloat(intersect.data[2 + i * Shape<PST_TRIANGLE>::ObjSize + 5]));
109- // vector3_type vertex2 = vector3_type(asfloat(intersect.data[2 + i * Shape<PST_TRIANGLE>::ObjSize + 6]), asfloat(intersect.data[2 + i * Shape<PST_SPHERE>::ObjSize + 7]), asfloat(intersect.data[2 + i * Shape<PST_TRIANGLE>::ObjSize + 8]));
110- // Shape<PST_TRIANGLE> tri = Shape<PST_TRIANGLE>::create(vertex0, vertex1, vertex2, intersect.data[2 + i * Shape<PST_TRIANGLE>::ObjSize + 9]);
111- // t = tri.intersect(ray.origin, ray.direction);
112- // }
113- // break;
114- // case PST_RECTANGLE:
115- // {
116- // vector3_type offset = vector3_type(asfloat(intersect.data[2 + i * Shape<PST_RECTANGLE>::ObjSize]), asfloat(intersect.data[2 + i * Shape<PST_RECTANGLE>::ObjSize + 1]), asfloat(intersect.data[2 + i * Shape<PST_RECTANGLE>::ObjSize + 2]));
117- // vector3_type edge0 = vector3_type(asfloat(intersect.data[2 + i * Shape<PST_RECTANGLE>::ObjSize + 3]), asfloat(intersect.data[2 + i * Shape<PST_RECTANGLE>::ObjSize + 4]), asfloat(intersect.data[2 + i * Shape<PST_RECTANGLE>::ObjSize + 5]));
118- // vector3_type edge1 = vector3_type(asfloat(intersect.data[2 + i * Shape<PST_RECTANGLE>::ObjSize + 6]), asfloat(intersect.data[2 + i * Shape<PST_RECTANGLE>::ObjSize + 7]), asfloat(intersect.data[2 + i * Shape<PST_RECTANGLE>::ObjSize + 8]));
119- // Shape<PST_RECTANGLE> rect = Shape<PST_RECTANGLE>::create(offset, edge0, edge1, intersect.data[2 + i * Shape<PST_RECTANGLE>::ObjSize + 9]);
120- // t = rect.intersect(ray.origin, ray.direction);
121- // }
122- // break;
123- // default:
124- // t = numeric_limits<float>::infinity;
125- // break;
126- // }
127-
128- // bool closerIntersection = t > 0.0 && t < ray.intersectionT;
129-
130- // ray.intersectionT = closerIntersection ? t : ray.intersectionT;
131- // objectID.id = closerIntersection ? i : objectID.id;
132-
133- // // allowing early out results in a performance regression, WTF!?
134- // //if (anyHit && closerIntersection)
135- // //break;
136- // }
137- // return objectID;
138- // }
139-
140- // obsolete?
141- // static ObjectID traceRay(NBL_REF_ARG(ray_type) ray, NBL_CONST_REF_ARG(IntersectData) intersect)
142- // {
143- // const uint32_t mode = intersect.mode;
144- // switch (mode)
145- // {
146- // case IM_RAY_QUERY:
147- // {
148- // // TODO: do ray query stuff
149- // }
150- // break;
151- // case IM_RAY_TRACING:
152- // {
153- // // TODO: do ray tracing stuff
154- // }
155- // break;
156- // case IM_PROCEDURAL:
157- // {
158- // return traceProcedural(ray, intersect);
159- // }
160- // break;
161- // default:
162- // {
163- // return ObjectID::create(-1, 0, PST_SPHERE);
164- // }
165- // }
166- // return ObjectID::create(-1, 0, PST_SPHERE);
167- // }
168-
169- // static ObjectID traceRay(NBL_REF_ARG(ray_type) ray, NBL_CONST_REF_ARG(scene_type) scene)
170- // {
171- // IntersectData data;
172-
173- // ObjectID objectID;
174- // objectID.id = -1; // start with no intersect
175-
176- // // prodedural shapes
177- // if (scene.sphereCount > 0)
178- // {
179- // data = scene.toIntersectData(ext::Intersector::IntersectData::Mode::PROCEDURAL, PST_SPHERE);
180- // objectID = traceRay(ray, data);
181- // }
182-
183- // if (scene.triangleCount > 0)
184- // {
185- // data = scene.toIntersectData(ext::Intersector::IntersectData::Mode::PROCEDURAL, PST_TRIANGLE);
186- // objectID = traceRay(ray, data);
187- // }
188-
189- // if (scene.rectangleCount > 0)
190- // {
191- // data = scene.toIntersectData(ext::Intersector::IntersectData::Mode::PROCEDURAL, PST_RECTANGLE);
192- // objectID = traceRay(ray, data);
193- // }
194-
195- // // TODO: trace AS
196-
197- // return objectID;
198- // }
19981};
20082
20183}
0 commit comments