Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (475)
Games in Android Showcase (106)
games submitted by our members
Games in WIP (530)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  BUG: NodeUpdater/View  (Read 826 times)
0 Members and 1 Guest are viewing this topic.
Offline Goliat

Junior Member





« Posted 2005-09-18 13:41:51 »

ok ... this is not really a bug ... but if you use NodeUpdater and the node you try to update doesn't own a transformgroup child the call to NodeUpdater.preRender() crashes...
this can be solved easily in two ways:

in View line 999: check if there is a TransformGroup and a Transform3D and call preRender depending on the result:
1  
2  
3  
4  
5  
6  
7  
if ( node instanceof NodeUpdater [color=Red]&& node.getTransformGroup() != null && node.getTransformGroup().getTransform() != null[/color] ) {
  if (!((NodeUpdater)node).preRender(
                                  getTransform(),
                                  frustum,
                                  node.getTransformGroup().getTransform(),
                                  currentFrameStartTime)) return;
}


or ( in my opinon the preferable way ): always call preRender even if there is no transform stuff
1  
2  
3  
4  
5  
6  
7  
if ( node instanceof NodeUpdater ) {
                            if (!((NodeUpdater)node).preRender(
                                  getTransform(),
                                  frustum,
                                  ( node.getTransformGroup() != null ? node.getTransformGroup().getTransform() : null ),
                                  currentFrameStartTime)) return;
                        }

this of course assumes that everybody who uses TransformGroupS has Transform3Ds in them

just my 50 cent ... Florian
Offline arne

Senior Member




money is the worst drug- we should not let it rule


« Reply #1 - Posted 2005-09-18 14:40:56 »

what does NodeUpdater do? sorry, this is OT, but I haven't used it (or better haven't known something like this exist), so I'm curios if I could use it someway... Or is this something internal? maybe it will also help me to clear this issue here up (even as it seems, that you've already fixed it Wink )

Arne

:: JOODE :: Xith3d :: OdeJava ::
Offline Goliat

Junior Member





« Reply #2 - Posted 2005-09-18 15:13:22 »

NodeUpdater ( it's an interface ) gives you the possibility to do prerendering calculations as it seems
NodeUpdater.preRender() takes some very interessting attribues ( including the camera location, frustum and the time ) and the result decides if the implementing Shape3D renderes

i've just had another look at the code ... the check if the current node is an instance of NodeUpdater is only done if it is an Shape3D ... so far ... what does a TransformGroup do that is added to a Shape3D? ... is it even necessary to give the transform group through preRender() ?
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline arne

Senior Member




money is the worst drug- we should not let it rule


« Reply #3 - Posted 2005-09-18 15:29:13 »

Haeh? How can one add TransformGroupS to Shape3DS ? You can do it the other way round, if this is what you wanted to say.
From your explanation I think prerender goes the full tree from the shape to the root, so trying to test a TransformGroup would be senseless, because a Shape can't be a parent of a TransformGroup and a TransformGroup itself doesn't contain Geometry that could be tested.

:: JOODE :: Xith3d :: OdeJava ::
Offline Goliat

Junior Member





« Reply #4 - Posted 2005-09-18 17:57:12 »

eh ... right ... so the transformgroup thingy in the second preRender call ( line 999 ) can be always be null

but i just saw there is another call in line 841 (proggy crashed Wink ... i think the test if the node has an transformgroup can be applied there too
Offline arne

Senior Member




money is the worst drug- we should not let it rule


« Reply #5 - Posted 2005-09-18 20:41:03 »

Ok I don't understand all this, but try if the test fixes this, then we can discuss. It actually looks to me that in line 841 it get's called, when it's not a Shape3D, if you want to add that it doesn't get called, when it's a TransformGroup, when does this get called then? Are you sure, you're using NodeUpdater correctly?

:: JOODE :: Xith3d :: OdeJava ::
Offline Goliat

Junior Member





« Reply #6 - Posted 2005-09-22 16:35:33 »

the first call can be left unchanged ... or the test can be added cause not every node there does have a transformgroup
but the second call is a shape3d ... but shapes doesn't have attached transformgroups like someone said before ... so i suggest to change the second call to give a null pointer instead of having a nullpointer exception

but maybe i'm using the whole thingy wrong Wink
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

ctomni231 (35 views)
2014-07-18 06:55:21

Zero Volt (31 views)
2014-07-17 23:47:54

danieldean (26 views)
2014-07-17 23:41:23

MustardPeter (28 views)
2014-07-16 23:30:00

Cero (43 views)
2014-07-16 00:42:17

Riven (45 views)
2014-07-14 18:02:53

OpenGLShaders (34 views)
2014-07-14 16:23:47

Riven (35 views)
2014-07-14 11:51:35

quew8 (31 views)
2014-07-13 13:57:52

SHC (67 views)
2014-07-12 17:50:04
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!