Difference between revisions of "Koordinatenbezugssysteme im Viewer"

From Second Life Wiki
Jump to navigation Jump to search
m (Translation started)
 
m
Line 1: Line 1:
{{multi-lang|1=Viewer_coordinate_frames|2=/de}}
{{multi-lang|1=Viewer_coordinate_frames|2=/de}}
{{ViewerArchNav}}


= Koordinaten Bezugssysteme =
= Koordinaten Bezugssysteme =
Es gibt derzeit vier verschiedene Bezugssysteme, die im Viewer verwendet werden.
Es gibt derzeit vier verschiedene Bezugssysteme, die im Viewer verwendet werden.
Beachten Sie bitte, dass es einige Fälle gibt, in denen der Programmcode im Viewer diesen Konventionen NICHT folgt:  Der Coder im Rendering verwendet "World" und "W" für den Agent und Teile des Character/Verbinden Codes haben kein Bezugssystem festgelegt, aber das wird im Agent definiert.
Beachten Sie bitte, dass es einige Fälle gibt, in denen der Programmcode im Viewer diesen Konventionen NICHT folgt:  Der Coder im Rendering verwendet "World" und "W" für den Agent und Teile des Character/Verbinden Codes haben kein Bezugssystem festgelegt, aber das wird im Agent definiert.
Auch allgemeine Bibliothken (LLCamera und LLPrimitive im speziellen) verwenden do NOT use this conventionBe particularly careful when pulling values directly out of these.
Auch allgemeine Bibliotheken (LLCamera und LLPrimitive im speziellen) verwenden die KOnventionen auch NICHTSeien Sie besonders vorsichtig, wenn Werte direkt aus diesen heraus verwenden.


=== Global ===
=== Global ===
Absolute global coordinate frame, expressed using F64'sThis is derived from the U32 x and y coords of the handles of regions, plus the region offset.  Precise enough for ~10<sup>9</sup> regions on an edge with same precision as region-local coordinates.
Absolutes globales Koordinatenbezugssystem, im F64 Format angegebenDas ist vom U32 Format der x und y Koordinaten der Angaben der Region plus dem Offset der Region abgeleitet ist.  Precise enough for ~10<sup>9</sup> regions on an edge with same precision as region-local coordinates.


=== Region ===
=== Region ===

Revision as of 05:52, 20 July 2010

Koordinaten Bezugssysteme

Es gibt derzeit vier verschiedene Bezugssysteme, die im Viewer verwendet werden. Beachten Sie bitte, dass es einige Fälle gibt, in denen der Programmcode im Viewer diesen Konventionen NICHT folgt: Der Coder im Rendering verwendet "World" und "W" für den Agent und Teile des Character/Verbinden Codes haben kein Bezugssystem festgelegt, aber das wird im Agent definiert. Auch allgemeine Bibliotheken (LLCamera und LLPrimitive im speziellen) verwenden die KOnventionen auch NICHT. Seien Sie besonders vorsichtig, wenn Werte direkt aus diesen heraus verwenden.

Global

Absolutes globales Koordinatenbezugssystem, im F64 Format angegeben. Das ist vom U32 Format der x und y Koordinaten der Angaben der Region plus dem Offset der Region abgeleitet ist. Precise enough for ~109 regions on an edge with same precision as region-local coordinates.

Region

Origin is the origin of the region which "owns" the object.

Agent

Currently, the origin is the origin of the agent's current region. THIS DOES NOT necessarily have to be the case in the future. This should be used only for code involving rendering (pipeline, visibility/frustum calculations)

Local

Currently a catch-all for coordinate frames which are not one of the ones above. Generally object-relative positioning.

The local frame is used in two ways in LSL:

Child Prims

Child prims (not root prims) are positioned local to the root prim; their global position and angle effected by both the root prims rotation and position.

Attachments

Objects that are attached are positioned local to the attach point; their global position and angle are affected by the position and rotation of the avatar and the playing animations.

Naming conventions

ALL variables/class members dealing with values in one of these coordinate frames should be post-fixed appended with the coordinate frame that it's being used in. PLEASE do this - it greatly reduces errors.

For example:

mPositionGlobal, pos_global
mPositionRegion, pos_region
mPositionAgent, pos_agent

Conversion functions

In LLAgent and LLViewerRegion there are conversion functions for converting from one coordinate frame to the other. They have syntax of the form getPos<target>From<source>() - i.e. getPosAgentFromGlobal() converts from the global coordinate frame to the agent coordinate frame.


Type conversion

In order to support the high-precision global coordinates, there is a new class LLVector3d, standing for LLVector3, double precision. It's somewhat inconsistent, but the only other alternative was renaming ALL of the math classes to use the GL style last-letter type convention, which I wasn't up to doing.

ALL math being done in global coordinates should be done using LLVector3ds. Currently, all functions which return global coordinates do so in LLVector3ds. The ONLY current exception to this is audio, which I am converting to regular LLVector3s before handing them off to the audio engine - I guess this will be the case until we convert the audio engine to use agent coords.


The LLVector3d class DELIBERATELY does not have ANY form of automatic type-conversion between it and the LLVector3 class. Since conversion back and forth isn't cheap (and potentially loses precision), you have to explicitly do a setVec() on the other class to convert back and forth.