record TManifoldEdge

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type TManifoldEdge = record

Description

Scene edge that is between exactly two triangles. It's used by TCastleSceneCore.ManifoldEdges, and this is crucial for rendering silhouette shadow volumes in OpenGL.

Overview

Fields

VertexIndex: Cardinal;
Triangles: array [0..1] of Cardinal;
V0: TVector3Single;
V1: TVector3Single;

Description

Fields

VertexIndex: Cardinal;

Index to get vertexes of this edge. The actual edge's vertexes are not recorded here (this would prevent using TCastleSceneCore.ShareManifoldAndBorderEdges with various scenes from the same animation). You should get them as the VertexIndex and (VertexIndex+1) mod 3 vertexes of the first triangle (i.e. Triangles[0]).

Triangles: array [0..1] of Cardinal;

Indexes to TCastleSceneCore.TrianglesListShadowCasters array

V0: TVector3Single;

These are vertexes at VertexIndex and (VertexIndex+1)mod 3 positions, but only at generation of manifold edges time. Like said in VertexIndex, keeping here actual vertex info would prevent TCastleSceneCore.ShareManifoldAndBorderEdges. However, using these when generating makes a great speed-up when generating manifold edges.

Memory cost is acceptable: assume we have model with 10 000 faces, so 15 000 edges (assuming it's correctly closed manifold), so we waste 15 000 * 2 * SizeOf(TVector3Single) = 360 000 bytes... that's really nothing to worry (we waste much more on other things).

Checked with "The Castle": indeed, this costs about 1 MB memory (out of 218 MB...), with really lot of creatures... On the other hand, this causes small speed-up when loading: loading creatures is about 5 seconds faster (18 with, 23 without this).

So memory loss is small, speed gain is noticeable (but still small), implementation code is a little simplified, so I'm keeping this. Also, in the future, maybe it will be sensible to use this for actual shadow quad rendering, in cases when we know that TCastleSceneCore.ShareManifoldAndBorderEdges was not used to make it.

V1: TVector3Single;

These are vertexes at VertexIndex and (VertexIndex+1)mod 3 positions, but only at generation of manifold edges time. Like said in VertexIndex, keeping here actual vertex info would prevent TCastleSceneCore.ShareManifoldAndBorderEdges. However, using these when generating makes a great speed-up when generating manifold edges.

Memory cost is acceptable: assume we have model with 10 000 faces, so 15 000 edges (assuming it's correctly closed manifold), so we waste 15 000 * 2 * SizeOf(TVector3Single) = 360 000 bytes... that's really nothing to worry (we waste much more on other things).

Checked with "The Castle": indeed, this costs about 1 MB memory (out of 218 MB...), with really lot of creatures... On the other hand, this causes small speed-up when loading: loading creatures is about 5 seconds faster (18 with, 23 without this).

So memory loss is small, speed gain is noticeable (but still small), implementation code is a little simplified, so I'm keeping this. Also, in the future, maybe it will be sensible to use this for actual shadow quad rendering, in cases when we know that TCastleSceneCore.ShareManifoldAndBorderEdges was not used to make it.


Generated by PasDoc 0.13.0 on 2014-08-30 12:10:39