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

Function StartLightingInstance

Descent3/lighting.cpp:565–586  ·  view source on GitHub ↗

instance at specified point with specified orientation

Source from the content-addressed store, hash-verified

563
564// instance at specified point with specified orientation
565void StartLightingInstance(vector *pos, matrix *orient) {
566 vector tempv;
567
568 ASSERT(Light_instance_depth < MAX_SUBOBJECTS);
569
570 Light_instance_stack[Light_instance_depth].p = Light_position;
571 if (Use_light_direction)
572 Light_instance_stack[Light_instance_depth].dir = Light_direction;
573 Light_instance_depth++;
574
575 // Step 1: subtract position from light position
576 tempv = Light_position - *pos;
577 // step 2: rotate view vector through object matrix
578
579 Light_position = tempv * *orient;
580
581 // Rotate the light direction through this matrix
582 if (Use_light_direction) {
583 tempv = Light_direction;
584 Light_direction = tempv * *orient;
585 }
586}
587
588// pops the old context
589void DoneLightingInstance() {

Callers 2

ApplyLightingToSubmodelFunction · 0.85
ApplyLightingToObjectsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected