MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / setLightTranslate

Method setLightTranslate

Engine/source/T3D/guiMaterialPreview.cpp:110–129  ·  view source on GitHub ↗

This function is for moving the light in the scene. This needs to be adjusted to keep the light from getting all out of whack. For now, we'll just rely on the reset function if we need it fixed.

Source from the content-addressed store, hash-verified

108// from getting all out of whack. For now, we'll just rely on the reset function if we need it
109// fixed.
110void GuiMaterialPreview::setLightTranslate(S32 modifier, F32 xstep, F32 ystep)
111{
112 F32 _lighttransstep = (modifier & SI_SHIFT ? mLightTransStep : (mLightTransStep*mLightTranMult));
113
114 Point3F relativeLightDirection = GuiMaterialPreview::mFakeSun->getDirection();
115 // May be able to get rid of this. For now, it helps to fix the position of the light if i gets messed up.
116 if (modifier & SI_PRIMARY_CTRL)
117 {
118 relativeLightDirection.x += ( xstep * _lighttransstep * -1 );//need to invert this for some reason. Otherwise, it's backwards.
119 relativeLightDirection.y += ( ystep * _lighttransstep );
120 GuiMaterialPreview::mFakeSun->setDirection(relativeLightDirection);
121 }
122 // Default action taken by mouse wheel clicking.
123 else
124 {
125 relativeLightDirection.x += ( xstep * _lighttransstep * -1 ); //need to invert this for some reason. Otherwise, it's backwards.
126 relativeLightDirection.z += ( ystep * _lighttransstep );
127 GuiMaterialPreview::mFakeSun->setDirection(relativeLightDirection);
128 }
129}
130
131// This is for panning the viewport camera.
132void GuiMaterialPreview::setTranslate(S32 modifier, F32 xstep, F32 ystep)

Callers

nothing calls this directly

Calls 2

getDirectionMethod · 0.45
setDirectionMethod · 0.45

Tested by

no test coverage detected