Page 1 of 1

Switch weaponFireLight to muzzle point

Posted: Mon Mar 14, 2016 12:00 am
by Duion
I noticed the weaponFireLight does not appear at the muzzle point of the weapon as it should be, but on the mount0 point, I found a resource that fixes this, but it is based on old code and no longer works: ... /view/8394
Someone has an idea how to do it now?

Re: Switch weaponFireLight to muzzle point

Posted: Wed Mar 16, 2016 3:44 pm
by TorqueFan
I had a free moment and took a glance at it. I hadn't tested anything, but can lead you in the right direction.

The original resource you posted just changed a single function to use an overload. I found that same function, just shifted around to a new location.

° shapeBase.cpp - around Ln. 2625

Code: Select all

void ShapeBase::renderMountedImage( U32 imageSlot, TSRenderState &rstate, SceneRenderState *state ) { ... getRenderImageTransform(imageSlot, &mat, rstate.getSceneState()->isShadowPass()); ... }
So you should be able to just change that line to:

Code: Select all

Basically the registerLights() function from the older resource isn't used anymore. Instead the call to renderMountedImage() is now in ShapeBase::prepBatchRender().

The only problem I'm seeing right away is 'imageData->muzzleNode' doesn't exist so you'll need to find a way to get ahold of the muzzleNode. I hadn't been using this node and all my models have custom setups, so it could be possible as well that you need to create and add such a node. All references to the 'muzzle' I can find at a quick look atm refer to the 'muzzlePoint' which isn't a node but a Point3F position.

Let me know how you get along with it and if necessary I might be able to take a closer look. Happy Torque-ing!

Re: Switch weaponFireLight to muzzle point

Posted: Wed Mar 16, 2016 5:42 pm
by Duion
The muzzle point is in the weapon models, it is created manually when modelling the weapon to define where the puzzle point is. It is a node in the model called "muzzlePoint"