Triangle Intersection: Unterschied zwischen den Versionen
Aus Das Sopra Wiki
Die Seite wurde neu angelegt: „{{Stub}} Gerade für Picking kann es sehr interessant sein beim Raytracing direkt die Triangles eines Modells für den Schnittpunkttest zu verwenden um dsa P…“ |
Keine Bearbeitungszusammenfassung |
||
| Zeile 64: | Zeile 64: | ||
IntersectionHelper.RayTriangleIntersect(ref objectRay, ref this.vertices[this.indicesInt[i]], ref this.vertices[this.indicesInt[i + 1]], ref this.vertices[this.indicesInt[i + 2]], out result); | IntersectionHelper.RayTriangleIntersect(ref objectRay, ref this.vertices[this.indicesInt[i]], ref this.vertices[this.indicesInt[i + 1]], ref this.vertices[this.indicesInt[i + 2]], out result); | ||
if ((result.HasValue) && (result.Value < nearestResult)) | |||
{ | |||
nearestResult = result.Value; | |||
} | |||
} | |||
} | |||
else | |||
{ | |||
for (int i = 0; i < this.indicesShort.Length; i += 3) | |||
{ | { | ||
nearestResult = result.Value; | IntersectionHelper.RayTriangleIntersect(ref objectRay, ref this.vertices[this.indicesShort[i]], ref this.vertices[this.indicesShort[i + 1]], ref this.vertices[this.indicesShort[i + 2]], out result); | ||
if ((result.HasValue) && (result.Value < nearestResult)) | |||
{ | |||
nearestResult = result.Value; | |||
} | |||
} | } | ||
} | } | ||
if ( | if (!float.IsPositiveInfinity(nearestResult)) | ||
{ | { | ||
nearestResult | result = nearestResult; | ||
} | |||
} | |||
} | |||
</source> | |||
[[Kategorie:Code-Beispiele]] | |||
