Code Monkey home page Code Monkey logo

Comments (6)

DerSchmale avatar DerSchmale commented on July 28, 2024

mvpIndex is never supposed to be negative. If it is, it means something else is wrong somewhere which should not be covered up like this. Can you reproduce the error with a minimal-as-possible demo?

from away3d-core-fp11.

ragaes avatar ragaes commented on July 28, 2024

I'm sorry but I can't reproduce it by the momment, however, what about this?:
line 171:
return _mvpTransformStack[uint(uint(_mvpIndex > 0)*_mvpIndex)];

line 187
return _zIndices[uint(uint(_mvpIndex > 0)*_mvpIndex)];

It seems that you are trying to ensure that when accessing the array you won't use a negative index...

This check must be there for some good reason..., However isn't better to avoid to decrement the index to a negative number instead of forcing to zero at the momment of accessing the array?

Moreover, this check of forcing negative to zero is not been performed always, for instance in method:
public function pushModelViewProjection(camera : Camera3D) : void

By the way, I think my check is wrong, it should be if(_mvpIndex >= 0), instead of if(_mvpIndex > 0) ? Because when not matrix is in the stack the index must be -1

from away3d-core-fp11.

ragaes avatar ragaes commented on July 28, 2024

I think that I have just found the key.

In EntityNode, line 68:
override public function isInFrustum(camera : Camera3D) : Boolean
{
if (_entity.isVisible == false) return false;
_entity.pushModelViewProjection(camera);
return _entity.bounds.isInFrustum(_entity.modelViewProjection);
}

If !_entity.isVisible the function returns without calling pushModelViewProjection.

Are you taking this into account before performing a popModelViewProjection?
If not, you may have a negative _mvpIndex...

from away3d-core-fp11.

DerSchmale avatar DerSchmale commented on July 28, 2024

Hm, it actually seemed to be a bug deeper in the render loop (the pop method should never be called if the object in question hadn't been added to the render list). Can you update and see if the problem persists?

from away3d-core-fp11.

ragaes avatar ragaes commented on July 28, 2024

I think that now is working as expected. Good job!

from away3d-core-fp11.

DerSchmale avatar DerSchmale commented on July 28, 2024

Great to hear! Thx for helping track down the issue, it's been quite an old and vexing one ;)

from away3d-core-fp11.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.