Files |  Tutorials |  Articles |  Links |  Home |  Team |  Forum |  Wiki |  Impressum

Aktuelle Zeit: Mi Mai 15, 2024 03:07

Foren-Übersicht » English » English Programming Forum
Unbeantwortete Themen | Aktive Themen



Ein neues Thema erstellen Auf das Thema antworten  [ 3 Beiträge ] 
Autor Nachricht
BeitragVerfasst: Mo Mai 28, 2007 18:21 
Offline
DGL Member
Benutzeravatar

Registriert: Di Jul 01, 2003 18:59
Beiträge: 887
Wohnort: (The Netherlands)
Programmiersprache: fpc/delphi/java/c#
On rewriting the Mesh Object in gl3ds i come to a question that i do not know to answer:

Should i use a TFace Structure in it or not (In the latest released version of gl3ds i have both and that is bad!):

TFace
--VertexIdx 1..3
--NormalIdx 1..3

array of TFace

vs

array of VertexIndices
array of normalIndices

So the real question is: is there a one on one relation between normalindices and vertexindices?
Second: Does TFace make things more complicated or easier?
Third question: how can the texture coords u and v be implemented into TFace or should i leave them outsite and use vertexidx to get the right ones.

Do let me know so i can improve that part (for now i commented out TFace and rewrote a few lines that used it).

_________________
http://3das.noeska.com - create adventure games without programming


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Mo Mai 28, 2007 20:55 
Offline
DGL Member

Registriert: Sa Okt 22, 2005 20:24
Beiträge: 291
Wohnort: Frauenfeld/CH
In my opinion:

PVertex = ^TVertex;
TVertex = record
Position: PVector3f //the vectors are defined in a separate array. So it is easy to delete them.
Normal: PVector3f; //..
TexCoord: PVector2f; //..
end;

TPolygon = record
Vertexes: array[0..2] of TVertex;
end;

and then you have an array of TPolygon.

My structure, which is in a way similar to your Face structure, would make the hole thing much easier to understand.
It has the advantage that you have all the information of a Vertex in one record.

_________________
bester uo-shard: www.uosigena.de


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Di Mai 29, 2007 00:25 
Offline
DGL Member
Benutzeravatar

Registriert: Di Mai 18, 2004 16:45
Beiträge: 2621
Wohnort: Berlin
Programmiersprache: Go, C/C++
Code:
  1. TFace=packed record
  2.   Material:TMaterial;
  3.   idices:array of pTIndex;
  4.   normals:array of TNormal;
  5.   userdata:pointer;//pointer to special objectdata
  6. end;
  7.  
  8. TMesh=packed record
  9.   vertice:array of TVertex;
  10.   colors:array of TColors;
  11.   normals:array of TNormal;
  12.   uvs:array of TUV;
  13.   indices:array of TIndex;
  14.   count:cardinal;
  15.   Faces:array of  TFace;
  16. end;


This structure i prefer, because its optimised for vbo.
The each array in TMesh get a own VBO and the Mesh is sorted by Materials, so you can call the Materialscript and can handle Face specific rendering(alpha, shader variables,...).
The TFace get a extra Normal array for stuff like Physic. This normal is not smoothed.
A simular structure you will find in Blender.
I hope it will help you.

_________________
"Wer die Freiheit aufgibt um Sicherheit zu gewinnen, der wird am Ende beides verlieren"
Benjamin Franklin

Projekte: https://github.com/tak2004


Nach oben
 Profil  
Mit Zitat antworten  
Beiträge der letzten Zeit anzeigen:  Sortiere nach  
Ein neues Thema erstellen Auf das Thema antworten  [ 3 Beiträge ] 
Foren-Übersicht » English » English Programming Forum


Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 3 Gäste


Du darfst keine neuen Themen in diesem Forum erstellen.
Du darfst keine Antworten zu Themen in diesem Forum erstellen.
Du darfst deine Beiträge in diesem Forum nicht ändern.
Du darfst deine Beiträge in diesem Forum nicht löschen.
Du darfst keine Dateianhänge in diesem Forum erstellen.

Suche nach:
Gehe zu:  
  Powered by phpBB® Forum Software © phpBB Group
Deutsche Übersetzung durch phpBB.de
[ Time : 0.035s | 17 Queries | GZIP : On ]