MWRender Refactoring

Everything about development and the OpenMW source code.
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: MWRender Refactoring

Post by Zini »

Well then we will need to add a Ogre::SceneNode* getBaseNode() function to refdata.
It should have gotten this function a while ago. Seems something went wrong during the RefData change. I noticed that you are also looking up the SceneNode in insertMesh instead of using the scene node from the RefData. That was really the whole point of the RefData changes. Please adjust insertMesh accordingly.
EDIT: Made some changes, if they are correct I will go ahead with changing the rest of the classes.
Very close. I have two minor corrections.

insertObjectRendering: do not always pass true for enabled. Get the enabled/disabled state from the RefData.

insertObject: You do not need to check for the existence of a base node. Please check for the existence of a mesh instead (see insertObjectRendering). No physical shape -> no physics.
I notice that for the special case of the lockpick no base node implies no mesh. But that may change at some point and it is certainly not true for all the classes. Better take the more robust and more explicit approach.
jhooks1
Posts: 780
Joined: 06 Aug 2011, 21:34

Re: MWRender Refactoring

Post by jhooks1 »

Ok, committed more changes.
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: MWRender Refactoring

Post by Zini »

Looks good.
jhooks1
Posts: 780
Joined: 06 Aug 2011, 21:34

Re: MWRender Refactoring

Post by jhooks1 »

It may be wise to check the scenenode too, because if we call the insertObject() function without calling insertObjectRendering() first there may be problems.

EDIT: Changed the rest of the classes in mwclass, it was easier than I thought it would be. We are getting close to actually running all of this. I hope we don't get an instant crash when trying to actually run this, usually happens with changes this big in nature :(.

EDIT2: Getting some compile errors related to the RenderingInterface 'MWRender::RenderingInterface' : 'class' type redefinition.

EDIT3: Eliminated those errors with some ifdef, define magic. Let me know if the latest commit is good.
New error:
Error 94 error C2039: 'insertObj' : is not a member of 'MWWorld::Class' C:\c\openmw\apps\openmw\mwrender\cellimp.cpp 30
Obviously related to the function change, we still have a few things to do to eliminate cellimp

Also fixed some mwclass light related errors
I think that we are eliminating insertCellRefList completely so once that is done that should get rid of the error
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: MWRender Refactoring

Post by Zini »

A small problem and a big one.

Small: Don't add Creatures and NPCs to Objects (in the rendering insert function). For Creatures it is wrong, because they will be managed by a different subsystem. For NPCs it is wrong for the same reason and it will also fail to compile.

Big: The "ifdef magic". Removed it please! This indicates a much more serious problem, that needs to be identified and fixed. Playing around with preprocessor magic like this is just asking for trouble. I am not sure yet what is going wrong, but that is not the way to fix it.
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: MWRender Refactoring

Post by Zini »

Okay, I see the problem. RenderingInterface.hpp doesn't have proper include guards. Also, please remove all the includes from this file and use forward declarations instead. And while you are at it, add a virtual destructor with an empty implementation (can be done in the hpp file).
jhooks1
Posts: 780
Joined: 06 Aug 2011, 21:34

Re: MWRender Refactoring

Post by jhooks1 »

Zini wrote:Okay, I see the problem. RenderingInterface.hpp doesn't have proper include guards. Also, please remove all the includes from this file and use forward declarations instead. And while you are at it, add a virtual destructor with an empty implementation (can be done in the hpp file).
I'm unfamiliar with include guards. Could you please explain how to implement them?
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: MWRender Refactoring

Post by Zini »

Um ... really? That got me by surprise. Include guards are a very elementary construct and unless you work with some non-portable constructs (#pragma once), they become absolutely essential as soon as you have more than one source file.

Well, look at any other hpp file (e.g. renderingmanager.hpp). The first two lines and the last line are the include guard.
jhooks1
Posts: 780
Joined: 06 Aug 2011, 21:34

Re: MWRender Refactoring

Post by jhooks1 »

Thanks, now I understand.
jhooks1
Posts: 780
Joined: 06 Aug 2011, 21:34

Re: MWRender Refactoring

Post by jhooks1 »

Can I include npcs, creatures, and objects in class.hpp? Or do they need to be included in each class in mwclass
Post Reply