|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
<whine>
Studying mesh.h, Parse_Mesh() and Parse_Mesh2() it's clear that there
are almost no functions available to help creating a triangle mesh.
The only functions are related to the hash table and bounding box tree.
If someone wants to create a new object which internally generates a
triangle mesh, he has to do almost everything that Parse_Mesh() does
(eg. a dynamic array etc).
Shouldn't mesh.h contain mesh creation functions? Something very simple,
like eg. StartCreatingMesh(...), AddTriangle(...), AddSmoothTriangle(...),
DoneCreatingMesh(...) or whatever.
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...
</whine>
<extrawhine>
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.
I thought that the POV-Ray source code was well-done and very modular,
but it seems that I was mistaken.
Now I really understand the need for a complete rewrite. Studying the code
makes the reason very clear.
Well, it has happened to me several times, so I understand that it can
happen.
I make a very small program. Then I expand it over the time until it's about
100 times larger than the very first version. At that time the code is so
messed up that it's practically unreadable and unchangeable.
It happened to me with me mesh compressor (that's why I rewrote it
completely).
</extrawhine>
--
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):_;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Warp wrote:
> <extrawhine>
>
> 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.
You can find it if you know what you're looking for...
> I thought that the POV-Ray source code was well-done and very modular,
> but it seems that I was mistaken.
It is modular, at least for the objects. But the parser lakes this
modularity. It may have help modularity if the syntax of each object
had been specified with the object functions, but that would
have required a meta-parser from the very beginning...
That's not impossible, but remember that povray starts with
only a few objects (box, sphere, untruncated cone, cylinder, light,
camera, plane and maybe some CSG). And that was a long time ago.
On the side note, a description of each object syntax for a meta-parser
would probably have help to write an accurate documentation.
(Quick Quizz : does the lathe AND the sor both support the sturm keyword ?)
> 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 !
>
> </extrawhine>
>
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
>> 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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
|
|