mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-19 20:24:49 +00:00
Fixes the debug netevent packing error by keeping the mStart value as it's proper 0-1 range until it gets to the client, using a temporary world-space var for finding strike target objects in the radius.
Also add a checker for if there is a texture or not set for the lighting bolt. If it use, set the stateblock description to support it and set the texture, if not, only utilize the color blend.
This commit is contained in:
parent
0aea1d5c33
commit
c7b041f545
|
|
@ -478,11 +478,15 @@ void Lightning::renderObject(ObjectRenderInst *ri, SceneRenderState *state, Base
|
||||||
desc.setBlend( true, GFXBlendSrcAlpha, GFXBlendOne);
|
desc.setBlend( true, GFXBlendSrcAlpha, GFXBlendOne);
|
||||||
desc.setCullMode(GFXCullNone);
|
desc.setCullMode(GFXCullNone);
|
||||||
desc.zWriteEnable = false;
|
desc.zWriteEnable = false;
|
||||||
desc.samplersDefined = true;
|
|
||||||
desc.samplers[0].magFilter = GFXTextureFilterLinear;
|
if (mDataBlock->strikeTextures[0].isValid())
|
||||||
desc.samplers[0].minFilter = GFXTextureFilterLinear;
|
{
|
||||||
desc.samplers[0].addressModeU = GFXAddressWrap;
|
desc.samplersDefined = true;
|
||||||
desc.samplers[0].addressModeV = GFXAddressWrap;
|
desc.samplers[0].magFilter = GFXTextureFilterLinear;
|
||||||
|
desc.samplers[0].minFilter = GFXTextureFilterLinear;
|
||||||
|
desc.samplers[0].addressModeU = GFXAddressWrap;
|
||||||
|
desc.samplers[0].addressModeV = GFXAddressWrap;
|
||||||
|
}
|
||||||
|
|
||||||
mLightningSB = GFX->createStateBlock(desc);
|
mLightningSB = GFX->createStateBlock(desc);
|
||||||
|
|
||||||
|
|
@ -494,7 +498,8 @@ void Lightning::renderObject(ObjectRenderInst *ri, SceneRenderState *state, Base
|
||||||
Strike* walk = mStrikeListHead;
|
Strike* walk = mStrikeListHead;
|
||||||
while (walk != NULL)
|
while (walk != NULL)
|
||||||
{
|
{
|
||||||
GFX->setTexture(0, mDataBlock->strikeTextures[0]);
|
if (mDataBlock->strikeTextures[0].isValid())
|
||||||
|
GFX->setTexture(0, mDataBlock->strikeTextures[0]);
|
||||||
|
|
||||||
for( U32 i=0; i<3; i++ )
|
for( U32 i=0; i<3; i++ )
|
||||||
{
|
{
|
||||||
|
|
@ -731,18 +736,19 @@ void Lightning::strikeRandomPoint()
|
||||||
Point3F strikePoint( gRandGen.randF( 0.0f, 1.0f ), gRandGen.randF( 0.0f, 1.0f ), 0.0f );
|
Point3F strikePoint( gRandGen.randF( 0.0f, 1.0f ), gRandGen.randF( 0.0f, 1.0f ), 0.0f );
|
||||||
|
|
||||||
// check if an object is within target range
|
// check if an object is within target range
|
||||||
|
Point3F worldPosStrikePoint = strikePoint;
|
||||||
|
|
||||||
strikePoint *= mObjScale;
|
worldPosStrikePoint *= mObjScale;
|
||||||
strikePoint += getPosition();
|
worldPosStrikePoint += getPosition();
|
||||||
strikePoint += Point3F( -mObjScale.x * 0.5f, -mObjScale.y * 0.5f, 0.0f );
|
worldPosStrikePoint += Point3F( -mObjScale.x * 0.5f, -mObjScale.y * 0.5f, 0.0f );
|
||||||
|
|
||||||
Box3F queryBox;
|
Box3F queryBox;
|
||||||
F32 boxWidth = strikeRadius * 2.0f;
|
F32 boxWidth = strikeRadius * 2.0f;
|
||||||
|
|
||||||
queryBox.minExtents.set( -boxWidth * 0.5f, -boxWidth * 0.5f, -mObjScale.z * 0.5f );
|
queryBox.minExtents.set( -boxWidth * 0.5f, -boxWidth * 0.5f, -mObjScale.z * 0.5f );
|
||||||
queryBox.maxExtents.set( boxWidth * 0.5f, boxWidth * 0.5f, mObjScale.z * 0.5f );
|
queryBox.maxExtents.set( boxWidth * 0.5f, boxWidth * 0.5f, mObjScale.z * 0.5f );
|
||||||
queryBox.minExtents += strikePoint;
|
queryBox.minExtents += worldPosStrikePoint;
|
||||||
queryBox.maxExtents += strikePoint;
|
queryBox.maxExtents += worldPosStrikePoint;
|
||||||
|
|
||||||
SimpleQueryList sql;
|
SimpleQueryList sql;
|
||||||
getContainer()->findObjects(queryBox, DAMAGEABLE_TYPEMASK,
|
getContainer()->findObjects(queryBox, DAMAGEABLE_TYPEMASK,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue