POV-Ray : Newsgroups : povray.programming : test if all contained objects are hollow : test if all contained objects are hollow Server Time
28 Sep 2024 11:02:05 EDT (-0400)
  test if all contained objects are hollow  
From: Daniel Hulme
Date: 10 Nov 2004 10:20:52
Message: <20041110152051.2f5e77a1@dh286.pem.cam.ac.uk>
In Trace() in render.cpp (around line 1913, probably a bit higher up as
I have added code) there is a section to test if all contained objects
are hollow by looping around Ray->Interiors thus:
>>>
  if (Ray->Index > -1)
  {
    for (i = 0; i <= Ray->Index; i++)
    {
      if (!Ray->Interiors[i]->hollow)
      {
        all_hollow = false;

        break;
      }
    }
  }
<<<
Would it be OK to move this code a bit further up in the function
(specifically, above Determine_Apparent_Colour())? From what I can see,
it should be fine as all the functions that call Ray_Enter() and
Ray_Exit() in Determine_Apparent_Colour() do so on the spawned ray, not
the original ray, so the data in Interiors should already be valid for
the segment between Ray->Initial and the intersection point. I am not
very confident in this assessment, though, so it would be nice to have
someone who already knows the code confirm or refute my hunch.

On the subject of Ray->Interiors, would this not be better as a linked
list than an array? It seems a bit wasteful to have
MAX_CONTAINED_OBJECTS pointers in every ray, and to move array entries
down when removing an interior from the list (in Ray_Exit()).

Daniel

-- 
A church is more than just timber and stone   .oO( surreal.istic.org )
And freedom is a dark road when you're walking it alone   -Paul Simon,
But the future is now, and it's time to take a stand       'A Church 
So the lost bells of freedom can ring out in my land.      is Burning'


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.