mirror of
https://git.coom.tech/drummyfish/raycastlib.git
synced 2024-11-21 20:29:59 +01:00
Optimize
This commit is contained in:
parent
1186440944
commit
3ef4c4fce9
1 changed files with 8 additions and 2 deletions
10
raycastlib.h
10
raycastlib.h
|
@ -819,14 +819,20 @@ void castRaysMultiHit(Camera cam, ArrayFunction arrayFunc,
|
|||
Ray r;
|
||||
r.start = cam.position;
|
||||
|
||||
Unit currentDX = 0;
|
||||
Unit currentDY = 0;
|
||||
|
||||
for (int16_t i = 0; i < cam.resolution.x; ++i)
|
||||
{
|
||||
r.direction.x = dir1.x + (dX * i) / cam.resolution.x;
|
||||
r.direction.y = dir1.y + (dY * i) / cam.resolution.x;
|
||||
r.direction.x = dir1.x + currentDX / cam.resolution.x;
|
||||
r.direction.y = dir1.y + currentDY / cam.resolution.x;
|
||||
|
||||
castRayMultiHit(r,arrayFunc,typeFunction,hits,&hitCount,constraints);
|
||||
|
||||
columnFunc(hits,hitCount,i,r);
|
||||
|
||||
currentDX += dX;
|
||||
currentDY += dY;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue