POV-Ray : Newsgroups : povray.programming : Parsing an object Server Time
28 Jul 2024 16:24:26 EDT (-0400)
  Parsing an object (Message 4 to 13 of 13)  
<<< Previous 3 Messages Goto Initial 10 Messages
From: Chris Huff
Subject: Re: Parsing an object
Date: 17 Jan 2001 09:49:08
Message: <chrishuff-8D3D07.09501117012001@news.povray.org>
In article <3a65a971@news.povray.org>, Warp <war### [at] tagpovrayorg> 
wrote:

>       CASE (OBJECT_ID_TOKEN)
>         Object = Token.Data;
>       END_CASE

I don't have the source code open right now, but if the object data 
sticks around past the parse stage, this will be a problem. You should 
probably use Parse_Object(), as Ron said...then just delete it when you 
aren't using it any more.

-- 
Christopher James Huff
Personal: chr### [at] maccom, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tagpovrayorg, http://tag.povray.org/

<><


Post a reply to this message

From: Warp
Subject: Re: Parsing an object
Date: 17 Jan 2001 10:07:50
Message: <3a65b545@news.povray.org>
Ron Parker <ron### [at] povrayorg> wrote:
: Call Parse_Object, which will return a pointer to an OBJECT or NULL if 
: one wasn't found.

  Ok, thanks. That's exactly it.

: Remember to free up the object when you're done with it (even if it was
: an object ID; Parse_Object makes a copy.)

  Hmm... How is it freed? Just POV_FREE(Object)?

-- 
char*i="b[7FK@`3NB6>B:b3O6>:B:b3O6><`3:;8:6f733:>::b?7B>:>^B>C73;S1";
main(_,c,m){for(m=32;c=*i++-49;c&m?puts(""):m)for(_=(
c/4)&7;putchar(m),_--?m:(_=(1<<(c&3))-1,(m^=3)&3););}    /*- Warp -*/


Post a reply to this message

From: Warp
Subject: Re: Parsing an object
Date: 17 Jan 2001 10:08:58
Message: <3a65b58a@news.povray.org>
Wlodzimierz ABX Skiba <abx### [at] abxartpl> wrote:
: btw: is there automatic inheriting of parameters such like texture, no_shadow,
: etc.?
: I mean in tesselation patch.

  The tesselation patch makes a Parse_Object_Mods((OBJECT*)tesselationMesh)
after creating the mesh.
  I don't know if that's what you mean.

-- 
char*i="b[7FK@`3NB6>B:b3O6>:B:b3O6><`3:;8:6f733:>::b?7B>:>^B>C73;S1";
main(_,c,m){for(m=32;c=*i++-49;c&m?puts(""):m)for(_=(
c/4)&7;putchar(m),_--?m:(_=(1<<(c&3))-1,(m^=3)&3););}    /*- Warp -*/


Post a reply to this message

From: Ron Parker
Subject: Re: Parsing an object
Date: 17 Jan 2001 10:20:34
Message: <slrn96be24.eus.ron.parker@fwi.com>
On 17 Jan 2001 10:07:50 -0500, Warp wrote:
>Ron Parker <ron### [at] povrayorg> wrote:
>: Remember to free up the object when you're done with it (even if it was
>: an object ID; Parse_Object makes a copy.)
>
>  Hmm... How is it freed? Just POV_FREE(Object)?

Destroy_Object.  See objects.c for parameters.

-- 
Ron Parker   http://www2.fwi.com/~parkerr/traces.html
My opinions.  Mine.  Not anyone else's.


Post a reply to this message

From: Warp
Subject: Re: Parsing an object
Date: 17 Jan 2001 10:30:28
Message: <3a65ba93@news.povray.org>
I have run into one problem. I get a:

error: Attempt to malloc zero size block (File: parse.c Line: 4385).

  This line is inside the Parse_Mesh() function and is the following:

  Object->Data->UVCoords = (UV_VECT *)POV_MALLOC(number_of_uvcoords*sizeof(UV_VECT),
"triangle mesh data");

  It unconditionally allocates space for uv-coordinates even if
number_of_uvcoords is 0 (as it is in my case where I only create triangles
with the tesselation function).

  Shouldn't it be enclosed in an if(number_of_uvcoords)?
  Will I break something if I add that condition?

  Why it doesn't crash with regular meshes (without uv-coordinates)?

-- 
char*i="b[7FK@`3NB6>B:b3O6>:B:b3O6><`3:;8:6f733:>::b?7B>:>^B>C73;S1";
main(_,c,m){for(m=32;c=*i++-49;c&m?puts(""):m)for(_=(
c/4)&7;putchar(m),_--?m:(_=(1<<(c&3))-1,(m^=3)&3););}    /*- Warp -*/


Post a reply to this message

From: Warp
Subject: Re: Parsing an object
Date: 17 Jan 2001 10:39:04
Message: <3a65bc97@news.povray.org>
Warp <war### [at] tagpovrayorg> wrote:
:   Will I break something if I add that condition?

  Probably. I get a bus error, core dumped when I try to render a
tesselated mesh created this way (povray crashes when the rendering
process reaches the mesh).

  There's probably something with that uv-coord info that I don't take
into account. What is it?

-- 
char*i="b[7FK@`3NB6>B:b3O6>:B:b3O6><`3:;8:6f733:>::b?7B>:>^B>C73;S1";
main(_,c,m){for(m=32;c=*i++-49;c&m?puts(""):m)for(_=(
c/4)&7;putchar(m),_--?m:(_=(1<<(c&3))-1,(m^=3)&3););}    /*- Warp -*/


Post a reply to this message

From: Ron Parker
Subject: Re: Parsing an object
Date: 17 Jan 2001 10:41:50
Message: <slrn96bfa0.eus.ron.parker@fwi.com>
On 17 Jan 2001 10:30:28 -0500, Warp wrote:
>  Shouldn't it be enclosed in an if(number_of_uvcoords)?
>  Will I break something if I add that condition?

This sounds like a question for p.u.p.

-- 
Ron Parker   http://www2.fwi.com/~parkerr/traces.html
My opinions.  Mine.  Not anyone else's.


Post a reply to this message

From: Chris Huff
Subject: Re: Parsing an object
Date: 17 Jan 2001 11:14:00
Message: <chrishuff-99590C.11150317012001@news.povray.org>
In article <3a65b58a@news.povray.org>, Warp <war### [at] tagpovrayorg> 
wrote:

>   The tesselation patch makes a 
>   Parse_Object_Mods((OBJECT*)tesselationMesh)
> after creating the mesh.
>   I don't know if that's what you mean.

I think he is asking if the tesselated mesh will "inherit" the texture 
and other attributes of the original object. Something to think about, 
but I think it is sufficient to only do the geometry.

-- 
Christopher James Huff
Personal: chr### [at] maccom, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tagpovrayorg, http://tag.povray.org/

<><


Post a reply to this message

From: Wlodzimierz ABX Skiba
Subject: Re: Parsing an object
Date: 17 Jan 2001 11:34:25
Message: <3a65c991@news.povray.org>
Warp wrote in message <3a65b58a@news.povray.org>...
>Wlodzimierz ABX Skiba <abx### [at] abxartpl> wrote:
>: btw: is there automatic inheriting of parameters such like texture,
no_shadow,
>: etc.?
>: I mean in tesselation patch.
>
>  The tesselation patch makes a Parse_Object_Mods((OBJECT*)tesselationMesh)
>after creating the mesh.
>  I don't know if that's what you mean.


I mean that when you generate complicated csg with texturing for every component
and want tesselate it you must rebuild complicated texturing, right ? What about
calculating all parameters of texture at vertex and generate textured triangles
?

ABX


Post a reply to this message

From: Wlodzimierz ABX Skiba
Subject: Re: Parsing an object
Date: 17 Jan 2001 11:41:54
Message: <3a65cb52$1@news.povray.org>
Warp wrote in message <3a65ba93@news.povray.org>...
>  I have run into one problem. I get a:
>
>error: Attempt to malloc zero size block (File: parse.c Line: 4385).
>
>  Shouldn't it be enclosed in an if(number_of_uvcoords)?
>  Will I break something if I add that condition?


probaly you should write something like

if (number_of_uvcoords>0)
{
  Object->Data->UVCoords = (UV_VECT
*)POV_MALLOC(number_of_uvcoords*sizeof(UV_VECT), "triangle mesh data");
}
else
{
Object->Data->UVCoords = NULL;
}

and check all places where Object->Data->UVCoords is used
to avoid refferencing arrays at NULL pointer
for example at POV_FREE for this pointer

ABX


Post a reply to this message

<<< Previous 3 Messages Goto Initial 10 Messages

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