POV-Ray : Newsgroups : povray.programming : OBJECT* vs Povray Objects Server Time
23 Apr 2024 08:44:51 EDT (-0400)
  OBJECT* vs Povray Objects (Message 1 to 3 of 3)  
From: Antonio Ferrari
Subject: OBJECT* vs Povray Objects
Date: 16 Oct 2007 08:00:01
Message: <web.4714a6f19145725a4e64f15d0@news.povray.org>
Hi,
I have two questions:

- 1 - Objects stored into OBJECT struct are the same declared in POV files?
Suppose you write:

union {
  sphere { .......... }
  sphere { .......... }
}

In memory the sphere will be indipendent and referenced by two different
pointers or in memory I'll find only an OBJECT reference to the union?

I expect only one pointer to union, since Parse_Inside receives a generic
OBJECT*; is it true?

- 2 - Let's suppose we are parsing a density inside a media. When
Evaluate_TPat is called it receives a pointer to INTERSECTION struct. Is
there the possibility to have this pointer not NULL for such a kind of
density? I ask this question because I need that INTERSECTION->OBJECT is a
pointer to the OBJECT that contains the density that Evaluate_TPat is
evaluating.

Bye,
A.


Post a reply to this message

From: Le Forgeron
Subject: Re: OBJECT* vs Povray Objects
Date: 16 Oct 2007 12:31:32
Message: <4714e764@news.povray.org>
Le 16.10.2007 13:56, Antonio Ferrari nous fit lire :
> Hi,
> I have two questions:
> 
> - 1 - Objects stored into OBJECT struct are the same declared in POV files?
> Suppose you write:
> 
> union {
>   sphere { .......... }
>   sphere { .......... }
> }
> 
> In memory the sphere will be indipendent and referenced by two different
> pointers or in memory I'll find only an OBJECT reference to the union?

I do not know for 3.7 (no source yet), but in previous version, that
code part would have been a CSG objects mother of two spheres
objects (these two being linked in a sibling list).
At each level, you would have found a transformation matrix and a
pointer to the method of the object.
And each object/structure might have additional data

> 
> I expect only one pointer to union, since Parse_Inside receives a generic
> OBJECT*; is it true?

The three objects are presents, and linked. Therefore, the top-level
pointer is enough to keep track of these objects (and therefore the
return of the function...).

> 
> - 2 - Let's suppose we are parsing a density inside a media. When
> Evaluate_TPat is called it receives a pointer to INTERSECTION struct. Is
> there the possibility to have this pointer not NULL for such a kind of
> density? I ask this question because I need that INTERSECTION->OBJECT is a
> pointer to the OBJECT that contains the density that Evaluate_TPat is
> evaluating.


I do not get it. Are you parsing, or rendering ?
in 3.6, only f_pattern (in fnintern.cpp) call Evaluate_TPat with
null as intersection.

-- 
The superior man understands what is right;
the inferior man understands what will sell.
-- Confucius


Post a reply to this message

From: Antonio Ferrari
Subject: Re: OBJECT* vs Povray Objects
Date: 20 Oct 2007 10:15:01
Message: <web.471a0c756bd8f8a6fd3e70c30@news.povray.org>
> > union {
> >   sphere { .......... }
> >   sphere { .......... }
> > }
> >
> > In memory the sphere will be indipendent and referenced by two different
> > pointers or in memory I'll find only an OBJECT reference to the union?
>
> I do not know for 3.7 (no source yet), but in previous version, that
> code part would have been a CSG objects mother of two spheres
> objects (these two being linked in a sibling list).
> At each level, you would have found a transformation matrix and a
> pointer to the method of the object.
> And each object/structure might have additional data
>
> >
> > I expect only one pointer to union, since Parse_Inside receives a generic
> > OBJECT*; is it true?
>
> The three objects are presents, and linked. Therefore, the top-level
> pointer is enough to keep track of these objects (and therefore the
> return of the function...).
>
> >
> > - 2 - Let's suppose we are parsing a density inside a media. When
> > Evaluate_TPat is called it receives a pointer to INTERSECTION struct. Is
> > there the possibility to have this pointer not NULL for such a kind of
> > density? I ask this question because I need that INTERSECTION->OBJECT is a
> > pointer to the OBJECT that contains the density that Evaluate_TPat is
> > evaluating.
>
>
> I do not get it. Are you parsing, or rendering ?
> in 3.6, only f_pattern (in fnintern.cpp) call Evaluate_TPat with
> null as intersection.
>

Hi, very useful answers. I haven't resolved the last point because code
arrives still with value NULL sometimes. But I know how to jump this
problem. I scan Frame.Objects finding the object that contains ghe point.
This works for simple objects, but I don't know how to find the
containing-object for CSGs or for objects inside other hollow objects. I
have to improve the search algorithm.

Anyway for simple isolated object I've already been able to implement mi
idea of having a density proportional to the distance of a point from the
surface (it works with merge-CSGs but not with union-CSGs).

ANOTHER QUESTIION - In Evaluate_TPat the functions return values (for
example agate_pattern return values from 0 to 1). The value can be used
with color_map. This value MUST be between 0 and 1 or can be greater than
1?


Post a reply to this message

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