mirror of
https://github.com/MapMakersAndProgrammers/Alternativa3D.git
synced 2025-10-26 09:59:10 -07:00
Fixes extreme slowness of Geometry.rayIntersection.
You are all going to love this pull request! It fixes an extreme inefficiency in 'Geometry.rayIntersection' caused by using the 'indices' property rather than the '_indices' member. This was making three copies of the entire index array for EVERY triangle. Ray intersections with complex models is now actually usable. Enjoy! Chris.
This commit is contained in:
@@ -832,13 +832,13 @@ package alternativa.engine3d.resources {
|
||||
uvStride = uvStream.attributes.length*4;
|
||||
}
|
||||
|
||||
if (numTriangles*3 > indices.length) {
|
||||
if (numTriangles*3 > _indices.length) {
|
||||
throw new ArgumentError("index is out of bounds");
|
||||
}
|
||||
for (var i:int = indexBegin, count:int = indexBegin + numTriangles*3; i < count; i += 3) {
|
||||
var indexA:uint = indices[i];
|
||||
var indexB:uint = indices[int(i + 1)];
|
||||
var indexC:uint = indices[int(i + 2)];
|
||||
var indexA:uint = _indices[i];
|
||||
var indexB:uint = _indices[int(i + 1)];
|
||||
var indexC:uint = _indices[int(i + 2)];
|
||||
positionBuffer.position = indexA*stride + positionOffset;
|
||||
var ax:Number = positionBuffer.readFloat();
|
||||
var ay:Number = positionBuffer.readFloat();
|
||||
|
||||
Reference in New Issue
Block a user