POV-Ray : Newsgroups : povray.programming : Why there are no mesh creation functions? Server Time
28 Jul 2024 18:22:27 EDT (-0400)
  Why there are no mesh creation functions? (Message 3 to 12 of 12)  
<<< Previous 2 Messages Goto Initial 10 Messages
From: Ron Parker
Subject: Re: Why parse.c so big
Date: 8 Dec 2000 10:27:49
Message: <slrn931vfn.shn.ron.parker@fwi.com>

>>   Now I really understand the need for a complete rewrite. Studying the code
>> makes the reason very clear.
>
>At least the parser (parse.c and parstxtr.c are far too big & complex),
>and there is too much things kept for compatibility with older versions too !

You missed express.c and tokenize.c.

-- 
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: Why there are no mesh creation functions?
Date: 8 Dec 2000 11:18:44
Message: <chrishuff-F51A60.11193308122000@news.povray.org>
In article <3a30e92a@news.povray.org>, Warp <war### [at] tagpovrayorg> 
wrote:

>   It's very tedious to have to code again most of the Parse_Mesh() code.
> And that's not very modular either.
> 
>   I'm making a test object which creates a triangle mesh, but I'm really
> discouraged due to the amount of work it apparently needs...

I agree, it would be very nice if there were mesh management 
functions...there have been a couple times I wished something like that 
existed.


>   Why parse.c is so long?
>   11970 lines of code in one C-file is just a bit too much. Trying to 
>   find something there is like trying to find a needle in a haystack.

If you think that's bad, look at lighting.c in MegaPOV...

-- 
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: Lutz Kretzschmar
Subject: Re: Why there are no mesh creation functions?
Date: 8 Dec 2000 11:24:16
Message: <vm223t4ugc2otg5nj3e1pue1na6uan70m2@4ax.com>
Hi Warp, you recently wrote in povray.programming:

>   Shouldn't mesh.h contain mesh creation functions? Something very simple,
> like eg. StartCreatingMesh(...), AddTriangle(...), AddSmoothTriangle(...),
> DoneCreatingMesh(...) or whatever.
You could always write a Moray plugin. The SDK offers exactly these
functions and will export a mesh2() object or smooth triangles. And
you could you see it in real-time OpenGL shortly after....

I know, "Windows" and all that. Nevermind, I'll go back under my rock
now<g>.

- Lutz
  email : lut### [at] stmuccom
  Web   : http://www.stmuc.com/moray


Post a reply to this message

From: Chris Huff
Subject: Re: Why there are no mesh creation functions?
Date: 8 Dec 2000 11:47:24
Message: <chrishuff-CFF987.11481408122000@news.povray.org>
In article <vm223t4ugc2otg5nj3e1pue1na6uan70m2@4ax.com>, Lutz 
Kretzschmar <lut### [at] stmuccom> wrote:


> You could always write a Moray plugin.

No, you can't. You can only do that on one platform, and they can't be 
used from within POV, which limits things and kind of nullifies the 
"always".


> I know, "Windows" and all that.

Yep. That and the "separate piece of software" bit.


> Nevermind, I'll go back under my rock now<g>.

You live under a rock, and have an internet connection? :-)

-- 
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: Lutz Kretzschmar
Subject: Re: Why there are no mesh creation functions?
Date: 8 Dec 2000 15:04:30
Message: <igf23tglvb4154td8ovc81hok830bc2kt3@4ax.com>
Hi Chris Huff, you recently wrote in povray.programming:

> No, you can't. You can only do that on one platform, and they can't be 
> used from within POV, which limits things and kind of nullifies the 
> "always".
Yup, I need to be more careful with my wording, especially when using
colloquial meanings. 

OK: if you have a PC with a Windows OS and have Moray installed and
have the Moray Plugin SDK and have a C++ compiler and can program in
C++, you can *probably* make a plugin for Moray that will allow you to
create a mesh in Moray that you can that render in POV-Ray. 

Better<g>?

> You live under a rock, and have an internet connection? :-)
By what I've read recently in some threads, I think a few people might
think that I do :-)

- Lutz
  email : lut### [at] stmuccom
  Web   : http://www.stmuc.com/moray


Post a reply to this message

From: Nicolas Calimet
Subject: Re: Why there are no mesh creation functions?
Date: 8 Dec 2000 15:14:17
Message: <3A31520D.D69CA600@free.fr>
>   I'm making a test object which creates a triangle mesh, but I'm really
> discouraged due to the amount of work it apparently needs...

	Yes, I exactly experienced that when creating my patch based moslty
on meshes. That was a "little" pain in the *** especially since I was inves-
tigating the POV code for the first time. If you get rid off hash tables
(because creating a mesh internally) it's not *that* hard. Also there is
some redondant code when testing degenerate triangles. Exactly some kinda
garbage due to the lack of clear-and-easy functions.

	Actually, in this case (internal mesh construction), the code
is about the following - there is no garanty to work since it's only
part of my code. Hope it's useful for you... but as such it does not
solve the need of mesh creation functions.


/*---------------------------------------------------------------------*/
long          i, vertices, triangles, normals;
VECTOR        P1, P2, P3, N1, N2, N3, N;
MESH          *m;
MESH_TRIANGLE *Triangle;

/* initialize the mesh structure first */

/* mem alloc */
m->Data->Vertices = (SNGL_VECT *)POV_MALLOC(vertices * sizeof(SNGL_VECT),
    "mesh data");
m->Data->Triangles = (MESH_TRIANGLE *)POV_MALLOC(triangles *
    sizeof(MESH_TRIANGLE), "mesh data");
m->Data->Normals = (SNGL_VECT *)POV_MALLOC((normals + triangles) *
    sizeof(SNGL_VECT), "mesh data");

/* create vertices */
for(i=0; i < vertices; i++) {
  m->Data->Vertices[i][0]= float_val;
  m->Data->Vertices[i][1]= float_val;
  m->Data->Vertices[i][2]= float_val;
}

/* vertex normals only, triangle normals will be further calculated */
for(i=0; i < normals; i++) {
  m->Data->Normals[i][0]= float_val;
  m->Data->Normals[i][1]= float_val;
  m->Data->Normals[i][2]= float_val;
}

/* compute triangles */
for(i=0; i < triangles; i++) {
  Triangle = &(m->Data->Triangles[i]);
  Init_Mesh_Triangle(Triangle);

  /* get triangle indices */
  Triangle->N1 = Triangle->P1 = long_value;  /* zero-based index */
  Triangle->N2 = Triangle->P2 = long_value;
  Triangle->N3 = Triangle->P3 = long_value;

  /* get vertex coordinates and normals */
  Assign_SNGL_Vect(P1, m->Data->Vertices[Triangle->P1]);
  Assign_SNGL_Vect(P2, m->Data->Vertices[Triangle->P2]);
  Assign_SNGL_Vect(P3, m->Data->Vertices[Triangle->P3]);
  Assign_SNGL_Vect(N1, m->Data->Normals[Triangle->N1]);
  Assign_SNGL_Vect(N2, m->Data->Normals[Triangle->N2]);
  Assign_SNGL_Vect(N3, m->Data->Normals[Triangle->N3]);

  /* compute triangle normal and add it to vertex normals */
  if( Compute_Mesh_Triangle(Triangle, (smooth) ? 1:0, P1, P2, P3, N) ) {
    Assign_SNGL_Vect(m->Data->Normals[normals+i], N);
    Triangle->Normal_Ind = normals + i;
  }
}

/* now we have vertex normals + triangle normals */
m->Data->Number_Of_Normals += triangles;

/* create a global texture, should be a function */
m->Texture = Create_Texture();
m->Texture->Pigment = Create_Pigment();
m->Texture->Pigment->Type = PLAIN_PATTERN;
Assign_Colour(m->Texture->Pigment->Colour, thecolour); /* e.g. black */
m->Texture->Finish = Create_Finish();

/* bounding box */
Compute_Mesh_BBox(m);

/* parse object modifiers ... */
/*---------------------------------------------------------------------*/


*** Nicolas Calimet
*** http://pov4grasp.free.fr


Post a reply to this message

From: Ron Parker
Subject: Re: Why there are no mesh creation functions?
Date: 8 Dec 2000 15:27:32
Message: <slrn932h1n.slr.ron.parker@fwi.com>
On Fri, 08 Dec 2000 21:06:23 +0100, Lutz Kretzschmar wrote:
>> You live under a rock, and have an internet connection? :-)
>By what I've read recently in some threads, I think a few people might
>think that I do :-)

I know some people I wish would crawl back under theirs, but I must have
missed the ones about you.  Probably in moray.*, eh?

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


Post a reply to this message

From: Nicolas Calimet
Subject: Re: Why there are no mesh creation functions?
Date: 8 Dec 2000 15:28:17
Message: <3A315555.F8E9AFF3@free.fr>
> /* now we have vertex normals + triangle normals */
> m->Data->Number_Of_Normals += triangles;

	Of course this variable must be assigned first to:

m->Data->Number_Of_Normals = normals;

	and others as well:

m->Data->Number_Of_Vertices = vertices;
m->Data->Number_Of_Triangles = triangles;


	BTW, I didn't checked again, but I guess the code I provided
is almost the same than that of MegaPOV's mesh2. I don't know who was
first (mine was in march 1998) but I don't care about competition ;-)
Also my tiny-winny patch is simply nothing compared to MegaPOV and its
derivatives (including the next POV-Ray 3.5).


*** Nicolas Calimet
*** http://pov4grasp.free.fr


Post a reply to this message

From: Chris Huff
Subject: Re: Why there are no mesh creation functions?
Date: 11 Dec 2000 18:22:19
Message: <chrishuff-61ECA9.18231211122000@news.povray.org>
In article <igf23tglvb4154td8ovc81hok830bc2kt3@4ax.com>, Lutz 
Kretzschmar <lut### [at] stmuccom> wrote:

> OK: if you have a PC with a Windows OS and have Moray installed and
> have the Moray Plugin SDK and have a C++ compiler and can program in
> C++, you can *probably* make a plugin for Moray that will allow you to
> create a mesh in Moray that you can that render in POV-Ray. 
> Better<g>?

A little... ;-)
Ok, nothing wrong with your explanation, it just won't do what I was 
thinking of, and probably won't do what Warp wanted either.


> > You live under a rock, and have an internet connection? :-)
> By what I've read recently in some threads, I think a few people might
> think that I do :-)

Hmm, in the Moray groups? I haven't ready any posts about Moray or you 
for a while, but I don't read those groups, so...

-- 
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: Martin Magnusson
Subject: Re: Why there are no mesh creation functions?
Date: 14 Feb 2001 14:56:44
Message: <3a8ae2fc@news.povray.org>
Check out

http://www.cs.cmu.edu/~quake/triangle.html

for a very powerful piece of triangulation software in C. You can compile it
either as a library or a stand-alone program.


Post a reply to this message

<<< Previous 2 Messages Goto Initial 10 Messages

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