Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strange code fragments #980

Open
j-mattsson opened this issue Mar 4, 2023 · 1 comment
Open

Strange code fragments #980

j-mattsson opened this issue Mar 4, 2023 · 1 comment

Comments

@j-mattsson
Copy link
Contributor

  1. Identical expressions on both side of the && operator:
    return Contains(Sphere(lss.mP0, lss.mRadius)) && Contains(Sphere(lss.mP0, lss.mRadius));
  2. Strange use of comma operator in if-condition:
    if (mBRDFTexture.isValid(), probeShaderConsts->mBRDFTextureMap->getSamplerRegister() != -1)
  3. Same code is executed regardless of condition:
    if (datablock->hasFixedWeight())
    return new afxXM_Scale_weighted(datablock, fx);
    else
    return new afxXM_Scale_weighted(datablock, fx);
  4. Nothing is done inside for-loop:
    for (U32 i = 1; i < argc; i++)
    {
    argv[i];
    }
  5. Enum value zero is used in bitwise AND-operation:
    if (mPrimitives[i].matIndex & TSDrawPrimitive::Triangles)
  6. bufSize (used later in a for-loop) seems to be initialized to 0 but then never changed:

    for (int i = 0; i < bufsize; i++)
  7. Looks strange to use bit mask values with logical OR-operator, perhaps bitwise OR should be used instead?
    if (getTypeMask() & (PlayerObjectType || VehicleObjectType ))
@Azaezel
Copy link
Contributor

Azaezel commented Mar 4, 2023

  1. we don't generally tweak third party libraries, but the opcode libs not really being maintained, so should be ok to drill on that one for potential fixes
  2. a definite typo. should be &&
  3. seems like copypasta where the rest follow this pattern:
    class afxXM_LocalOffset_weighted : public afxXM_WeightedBase
    {
    typedef afxXM_WeightedBase Parent;
    Point3F local_offset;
    public:
    /*C*/ afxXM_LocalOffset_weighted(afxXM_LocalOffsetData*, afxEffectWrapper*);
    virtual void updateParams(F32 dt, F32 elapsed, afxXM_Params& params);
    };
    //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//
    // this fixed variation is used when
    // the weight factors are constant.
    class afxXM_LocalOffset_fixed : public afxXM_Base
    {
    typedef afxXM_Base Parent;
    Point3F local_offset;
    public:
    /*C*/ afxXM_LocalOffset_fixed(afxXM_LocalOffsetData*, afxEffectWrapper*);
    virtual void updateParams(F32 dt, F32 elapsed, afxXM_Params& params);
    };
    . could see either stripping the check, or cooking up a (edit: non) weighted variant. that one'll take a bit more study.
  4. can likely be chucked
  5. ... unsure to be honest
  6. I think should reference GFXGLDevice::getNumRenderTargets() given the todo-note and usage context?
  7. yeah, pretty clear that one's a stray |

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants