Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

12045 Posts in 1593 Topics- by 593 Members - Latest Member: zhang

25. May 2013, 03:34:43 am
Xith3D CommunityXith3D InternalsDeveloper discussion (Moderators: Marvin Fröhlich, 'n ddrylliog)New methods in the Geometry class
Pages: [1]
Print
Author Topic: New methods in the Geometry class  (Read 1154 times)
lonesomeStranger
Becoming dependent
**
Offline Offline

Posts: 124

197432680
View Profile
« on: 18. October 2010, 10:52:37 am »

Hi Marvin,

I created two new methods in the Geometry class (setCoordinate0 and setNormal0) to use them in SkeletalKeyFrameController for performance reasons:
Code:
private void updateGeometry( Geometry geom )
    {
        ...
        for ( int i = 0; i < geom.getVertexCount(); i++ )
        {
            ...
            geom.setCoordinate0( i, vSumX, vSumY, vSumZ );
            if ( geom.hasNormals() )
            {
                geom.setNormal0( i, nSumX, nSumY, nSumZ );
            }
        }
        geom.setBoundsDirty();
        geom.getOpenGLReference_DL_GeomData().invalidateNames();
        geom.getOpenGLReference_DL().invalidateNames();

        shape.updateBounds( false );
    }

If you deem it's a bad idea I'll remove these methods.
Logged

Anton
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4403


May the 4th, be with you...


View Profile
« Reply #1 on: 18. October 2010, 04:38:30 pm »

I didn't know, what these methods are good for. Keep them and feel free to remove my comment from the code. But I suggest to rename them to something more meaningful than *0.

Theoretically these methods shouldn'T be in the public API. But there are a lot of methods, that currently spam the public API, which would all need to be revised and hidden somehow. But that would cost a lot of time. And in the end nobody will care about a method called setNormalButDontUseThisYouLazyBastard() Wink.

So just go ahead with your impressive and great work.. well if possible, deactivate your auto format trigger to preserve indentations Wink.

Marvin
Logged
lonesomeStranger
Becoming dependent
**
Offline Offline

Posts: 124

197432680
View Profile
« Reply #2 on: 19. October 2010, 10:15:23 am »

The methods are renamed and also the comments are added briefly explaining them usage.
Logged

Anton
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4403


May the 4th, be with you...


View Profile
« Reply #3 on: 19. October 2010, 12:52:51 pm »

Thanks
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic