MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / g3_StartInstanceMatrix

Function g3_StartInstanceMatrix

renderer/HardwareInstance.cpp:35–63  ·  view source on GitHub ↗

instance at specified point with specified orientation

Source from the content-addressed store, hash-verified

33
34// instance at specified point with specified orientation
35void g3_StartInstanceMatrix(vector *pos, matrix *orient) {
36 ASSERT(orient != NULL);
37 ASSERT(sInstanceDepth < MAX_INSTANCE_DEPTH);
38
39 sInstanceStack[sInstanceDepth].m_viewMatrix = View_matrix;
40 sInstanceStack[sInstanceDepth].m_viewPosition = View_position;
41 sInstanceStack[sInstanceDepth].m_unscaledMatrix = Unscaled_matrix;
42 memcpy(sInstanceStack[sInstanceDepth].m_modelView, gTransformModelView, sizeof(gTransformModelView));
43 ++sInstanceDepth;
44
45 // step 1: subtract object position from view position
46 vector tempv = View_position - *pos;
47
48 // step 2: rotate view vector through object matrix
49 View_position = tempv * *orient;
50
51 // step 3: rotate object matrix through view_matrix (vm = ob * vm)
52 matrix tempm, tempm2 = ~*orient;
53
54 tempm = tempm2 * View_matrix;
55 View_matrix = tempm;
56
57 tempm = tempm2 * Unscaled_matrix;
58 Unscaled_matrix = tempm;
59
60 // transform the model/view matrix
61 g3_GetModelViewMatrix(&View_position, &Unscaled_matrix, (float *)gTransformModelView);
62 g3_UpdateFullTransform();
63}
64
65// instance at specified point with specified orientation
66void g3_StartInstanceAngles(vector *pos, angvec *angles) {

Callers 3

g3_StartInstanceAnglesFunction · 0.85
DrawPolygonModelFunction · 0.85
DrawShardObjectFunction · 0.85

Calls 2

g3_GetModelViewMatrixFunction · 0.85
g3_UpdateFullTransformFunction · 0.85

Tested by

no test coverage detected