Clearing up some memory to prevent stupid issues

Preparing for some optimisations. (absolutely need to reduce the ammount of allocations done.)
This commit is contained in:
Godzil
2020-03-02 08:24:09 +00:00
parent 0ac44c3539
commit ace7d53571
5 changed files with 24 additions and 4 deletions

View File

@@ -30,14 +30,15 @@ Computation Intersection::prepareComputation(Ray r, Intersect *xs)
Tuple underHitP = hitP - normalV * getEpsilon();
Tuple reflectV = r.direction.reflect(normalV);
if (xs != nullptr)
/* If the hit object is not transparent, there is no need to do that. I think .*/
if ((xs != nullptr) && (xs->hit().object->material.transparency > 0))
{
List containers;
int j, k;
for(j = 0; j < xs->count(); j++)
for (j = 0 ; j < xs->count() ; j++)
{
Intersection i = (*xs)[j];
Intersection i = ( *xs )[j];
if (*this == i)
{
if (!containers.isEmpty())