POV-Ray : Newsgroups : povray.programming : mesh structure Server Time
22 Dec 2024 01:09:22 EST (-0500)
  mesh structure (Message 1 to 4 of 4)  
From: Lukas Winter
Subject: mesh structure
Date: 30 Apr 2007 15:29:03
Message: <pan.2007.04.30.19.28.56.734905@removeit.geloescht.net>
I'm trying to make a mesh from the data a library, that I found on
the net, generates, but I'm not exactly sure, what I should fill in each
field of the structures.
At the moment I do the following things:

I fill Object->Data->Vertices with a POV_MALLOCated array of SNGL_VECTs.

Object->Data->Normals holds a POV_MALLOCated array of SNGL_VECTs which
holds the smooth normals (one for each vertex) as well as the triangle
normals (one for each triangle). (size = num_of_vertices +
num_of_triangles)

Object->Data->Triangles holds a POV_MALLOCated array of
MESH_TRIANGLEs. Each of it has P1, P2, P3 set to a index of a vertex, N1,
N2, N3 set to the same values as the smooth normals have the same indices
as the vertices, Three_Tex is false, Texture2 and Texture3 are
unitialised, Texture is set to -1 (???), Normal_Ind is set to the index of
a normal, the normal corresponding to Normal_Ind was calculated using
Compute_Mesh_Triangle, which hopefully also fills in the rest of the
values.

I don't want to use UV mapping, is it safe to simply set
Object->Data->UVCoords to NULL? Is it safe to set Object->Textures to
NULL, if I want to texture the whole mesh with one texture? Will
Object->Data->Tree be fully created by Build_Mesh_BBox_Tree(Object)? Do I
have to fill in other values after Create_Mesh if I use Parse_Object_Mods()?
Thanks in advance,
Lukas

PS:
Code version is 3.6.1. If everything works I will post my result to
povray.binaries.images and the patch to povray.binaries.programming.


Post a reply to this message

From: Le Forgeron
Subject: Re: mesh structure
Date: 1 May 2007 03:43:22
Message: <4636ef9a$1@news.povray.org>
Le 30.04.2007 21:29, Lukas Winter nous fit lire :
> I'm trying to make a mesh from the data a library, that I found on
> the net, generates, but I'm not exactly sure, what I should fill in each
> field of the structures.

Been there, done that for GTS in 3.1...

> At the moment I do the following things:
[SNIP]
> 
> 
> PS:
> Code version is 3.6.1. If everything works I will post my result to
> povray.binaries.images and the patch to povray.binaries.programming.

Best approach is probably to look at the parsing code of mesh{} and
mesh2{} objects, and possibly mimics them.

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


Post a reply to this message

From: Lukas Winter
Subject: Re: mesh structure
Date: 1 May 2007 04:18:21
Message: <pan.2007.05.01.08.18.20.191414@removeit.geloescht.net>
Am Tue, 01 May 2007 09:43:20 +0200 schrieb Le Forgeron:

> Le 30.04.2007 21:29, Lukas Winter nous fit lire :
>> I'm trying to make a mesh from the data a library, that I found on the
>> net, generates, but I'm not exactly sure, what I should fill in each
>> field of the structures.
> 
> Been there, done that for GTS in 3.1...
> 
>> At the moment I do the following things:
> [SNIP]
>> 
>> 
>> PS:
>> Code version is 3.6.1. If everything works I will post my result to
>> povray.binaries.images and the patch to povray.binaries.programming.
> 
> Best approach is probably to look at the parsing code of mesh{} and
> mesh2{} objects, and possibly mimics them.

I have already done that, but all the parsing work obscures what is really
done with the mesh structure itself. I think povray 3.6.1 has a lot of
unreadable code and parse.cpp is one of the messiest files... However, I
think I have found a bug in my code and I'll see what will happen, if I
fix it ;)


Post a reply to this message

From: Lukas Winter
Subject: Re: mesh structure
Date: 1 May 2007 07:49:01
Message: <pan.2007.05.01.11.49.01.565963@removeit.geloescht.net>
I think now I found out how to do it correctly :)


Post a reply to this message

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