Page 2 of 5

Posted: Mon Jan 07, 2008 3:05 pm
by MasterGod
I think you shouldn't switch, its good enough as it is now.

So is there any progress ? clone() method and the warning I posted above (u32 and s32 checks)

Posted: Mon Jan 07, 2008 10:47 pm
by Dark_Kilauea
Yes, I've figured out how the clone() is supposed to work, so expect an update soon (ie. whenever I get a chance to update the code)

As for the s32 and u32 issues, I don't expect much of a problem either...

Posted: Tue Jan 08, 2008 12:31 am
by Dark_Kilauea
Ok, new version is up.

I fixed issues with variables being cast as signed integers as well as adding a working clone() method.

As always, you can get the new version on the first post. (same link)

Posted: Tue Jan 08, 2008 4:27 pm
by MasterGod
Thanks! great timing btw..

P.S
Edit:
Subject wrote:Editor style Grid SceneNode [Updated: Jan. 04, 2008]

Posted: Tue Jan 08, 2008 5:08 pm
by MasterGod
Now that I updated my code with your new version I see there's another warning regarding u32-f32 issues.

Code: Select all

	if(m_AxisLineState == true)
	{
		driver->draw3DLine(vector3df(m_size,0,0),vector3df(-m_size,0,0),m_XLineColor);
		driver->draw3DLine(vector3df(0,0,m_size),vector3df(0,0,-m_size),m_ZLineColor);
	}
1>------ Build started: Project: <My project's name>, Configuration: Debug Win32 ------
1>Compiling...
1>CGridSceneNode.cpp
3 times both of this warnings:
conversion from 'irr::u32' to 'irr::f32', possible loss of data
unary minus operator applied to unsigned type, result still unsigned
1><My project's name> - 0 error(s), 6 warning(s)
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
Should be something like this:

Code: Select all

	if(m_AxisLineState == true)
	{
		driver->draw3DLine(vector3df((f32)m_size,0,0),vector3df(-(f32)m_size,0,0),m_XLineColor);
		driver->draw3DLine(vector3df(0,0,(f32)m_size),vector3df(0,0,-(f32)m_size),m_ZLineColor);
	}
1. Why does the clone method returns a ISceneNode* and not CGridSceneNode* ?
2. What "AutomaticCullingState = EAC_BOX;" does?

EDIT:
3. You say "//Axis Lines are a default Red and Blue for the X and Z axis respectively." but they aren't.

Posted: Tue Jan 08, 2008 7:01 pm
by Dark_Kilauea
Seems like I forgot a place where m_size was still being used; I'll fix that soon. I'll also see about changing the return type of the clone() method for ya :)

AutomaticCullingState = EAC_BOX; tells irrlicht to default to using the Box method for culling this node. Not the most efficient for actually getting rid of the node if it can't be seen, but it is a cheap calculation. This flag is normally changed via the setAutomaticCulling() function. Frustrum would be better, but I'm not sure how much more it would cost per frame. I could set it to none, but that would mean that the grid would never stop rendering itself.

The colors aren't red and blue? Hmm... I might have messed that up while testing. I'll be sure to fix that as well.

Posted: Tue Jan 08, 2008 7:45 pm
by MasterGod
I've fixed that x-red z-blue thing, warnings, clone thing and made it more doxygen friendly, check it out, maybe continue work on this version?

http://rapidshare.com/files/82286299/CGridSceneNode.zip

Posted: Tue Jan 08, 2008 10:18 pm
by Dark_Kilauea
Thanks a lot man. I changed the code a little bit to add back the default values to the constructor, as well as setting the default culling mode to frustum box. I want people to be able to set this node up quickly and easily, without having to type 50 some characters into the constructor :)

Again thanks. I've uploaded the newest copy.

If anyone would like to see something else added to this node, please ask. I'm really surprised how much it's grown.

[edit] Typo attack!

Posted: Wed Jan 09, 2008 9:40 am
by MasterGod
Dark_Kilauea wrote:I changed the code a little bit...
I looked it up and I don't see any changes from what I sent except the frustum thing.. Care to mention Where you changed?
Dark_Kilauea wrote:If anyone would like to see something else added to this node, please ask. I'm really surprised how much it's grown
Well, I use it in my project so I might think of more things later on..

1. Its a great scene node, thank You for making it out of Mohaps's code.
2. Thanks for adding my nick in the .h file.
3. Update again the subject :wink:
4. If you want I can generate a .chm file using the doxygen comments (yes, for evey release of it) and send it to you so it can be added to the zip file.

Posted: Wed Jan 09, 2008 9:47 pm
by Dark_Kilauea
1. Look in the constructor parameters. You'll see I added the defaults back.

2. You're welcome, I pay my minions well :P

3. Subject should be fine, the last update was Jan. 08

4. I don't think a chm help file will be necessary. Anyone should be able to figure out the node from the comments, and besides, it works just fine without most of the parameters.

Posted: Fri Jan 11, 2008 1:40 pm
by MasterGod
K thanks.
I have no problems with this latest version now, :P
Oh and yup I checked again now and I see the changes, good ones if I might add.
lol, this time I only changed some whitespaces and added a credit comment :lol:
I'll be sure to note if I need something else :)

P.S
Oh and btw I sent you a pm :wink:

Posted: Fri Jan 11, 2008 5:04 pm
by Dark_Kilauea
PM read :)

Thanks for hosting a copy of this scenenode for me. To others: Check out the primary mirror. Please try to use the primary first to save me bandwidth on my webhost. I've provided the second one in case rapidshare doesn't work for you.

Thanks.

Posted: Sat Feb 02, 2008 11:50 am
by MasterGod
A little fix to the clone method:

Code: Select all

//! Creates a clone of this scene node and its children.
	virtual CGridSceneNode* clone(ISceneNode* newParent = 0, ISceneManager* newSceneManager = 0);

Code: Select all

CGridSceneNode* CGridSceneNode::clone(ISceneNode *newParent, ISceneManager *newSceneManager)
{
	if (!newParent) newParent = Parent;
	if (!newSceneManager) newSceneManager = SceneManager;

	CGridSceneNode* cloner = new CGridSceneNode(
		newParent, // this line
		newSceneManager, // and this line
		ID,
		m_spacing,
		m_size*2,
		m_gridcolor,
		m_accentlineoffset,
		m_accentgridcolor,
		m_AxisLineState);

	cloner->SetAxisLineXColor(m_XLineColor);
	cloner->SetAxisLineZColor(m_ZLineColor);
	cloner->SetMaterial(Material);

	cloner->drop();
	return cloner;
}
Oh and it should be clone not Clone but I was the one who changed it to be Clone so it's my bad..

Posted: Sat Feb 02, 2008 5:04 pm
by christianclavet
That's perfect! Thank Dark_Kilauea

I'll surely check that code to put for creating my grid in my viewer!

Posted: Sun Feb 03, 2008 11:05 pm
by MasterGod
Another thing to add to the clone method:
After new CGrid...

Code: Select all

if(!cloner)
		return 0;