Browse Source

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.
Areloch 8 years ago
parent
commit
c7b041f545
1 changed files with 17 additions and 11 deletions
  1. 17 11
      Engine/source/T3D/fx/lightning.cpp

+ 17 - 11
Engine/source/T3D/fx/lightning.cpp

@@ -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;
-      desc.samplers[0].minFilter = GFXTextureFilterLinear;
-      desc.samplers[0].addressModeU = GFXAddressWrap;
-      desc.samplers[0].addressModeV = GFXAddressWrap;
+
+      if (mDataBlock->strikeTextures[0].isValid())
+      {
+         desc.samplersDefined = true;
+         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;
-   strikePoint += getPosition();
-   strikePoint += Point3F( -mObjScale.x * 0.5f, -mObjScale.y * 0.5f, 0.0f );
+   worldPosStrikePoint *= mObjScale;
+   worldPosStrikePoint += getPosition();
+   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.maxExtents += strikePoint;
+   queryBox.minExtents += worldPosStrikePoint;
+   queryBox.maxExtents += worldPosStrikePoint;
 
 
    SimpleQueryList sql;
    SimpleQueryList sql;
    getContainer()->findObjects(queryBox, DAMAGEABLE_TYPEMASK,
    getContainer()->findObjects(queryBox, DAMAGEABLE_TYPEMASK,