This commit is contained in:
2025-09-21 00:05:28 +03:00
parent fea7c71788
commit a62d781aa0
5 changed files with 1334 additions and 4 deletions

BIN
assets/blender/edited-normal-female.blend (Stored with Git LFS)

Binary file not shown.

BIN
assets/blender/edited-normal-male.blend (Stored with Git LFS)

Binary file not shown.

View File

@@ -0,0 +1,6 @@
project(sceneloader)
add_library(sceneloader loader.cpp)
target_include_directories(sceneloader PUBLIC .)
target_link_libraries(sceneloader PUBLIC OgreMain PRIVATE pugixml)
target_link_libraries(sceneloader PUBLIC OgreTerrain)

1245
src/sceneloader/loader.cpp Normal file

File diff suppressed because it is too large Load Diff

79
src/sceneloader/loader.h Normal file
View File

@@ -0,0 +1,79 @@
#ifndef LOADER_H_
#define LOADER_H_
#include <OgreColourValue.h>
#include <OgreQuaternion.h>
#include <OgreResourceGroupManager.h>
#include <OgreString.h>
#include <OgrePlugin.h>
#include <OgreCodec.h>
class SceneLoader {
public:
SceneLoader();
virtual ~SceneLoader();
void load(Ogre::DataStreamPtr &stream, const Ogre::String &groupName,
Ogre::SceneNode *rootNode, int counter);
void exportScene(Ogre::SceneNode *rootNode,
const Ogre::String &outFileName);
const Ogre::ColourValue &getBackgroundColour()
{
return mBackgroundColour;
}
protected:
void writeNode(pugi::xml_node &parentXML, const Ogre::SceneNode *node);
void processScene(pugi::xml_node &XMLRoot);
void processNodes(pugi::xml_node &XMLNode);
void processExternals(pugi::xml_node &XMLNode);
void processEnvironment(pugi::xml_node &XMLNode);
void processTerrainGroup(pugi::xml_node &XMLNode);
void processBlendmaps(pugi::xml_node &XMLNode);
void processUserData(pugi::xml_node &XMLNode,
Ogre::UserObjectBindings &userData);
void processLight(pugi::xml_node &XMLNode,
Ogre::SceneNode *pParent = 0);
void processCamera(pugi::xml_node &XMLNode,
Ogre::SceneNode *pParent = 0);
void processNode(pugi::xml_node &XMLNode, Ogre::SceneNode *pParent = 0);
void processLookTarget(pugi::xml_node &XMLNode,
Ogre::SceneNode *pParent);
void processTrackTarget(pugi::xml_node &XMLNode,
Ogre::SceneNode *pParent);
void processEntity(pugi::xml_node &XMLNode, Ogre::SceneNode *pParent);
void processParticleSystem(pugi::xml_node &XMLNode,
Ogre::SceneNode *pParent);
void processBillboardSet(pugi::xml_node &XMLNode,
Ogre::SceneNode *pParent);
void processPlane(pugi::xml_node &XMLNode, Ogre::SceneNode *pParent);
void processNodeAnimations(pugi::xml_node &XMLNode,
Ogre::SceneNode *pParent);
void processNodeAnimation(pugi::xml_node &XMLNode,
Ogre::SceneNode *pParent);
void processKeyframe(pugi::xml_node &XMLNode,
Ogre::NodeAnimationTrack *pTrack);
void processFog(pugi::xml_node &XMLNode);
void processSkyBox(pugi::xml_node &XMLNode);
void processSkyDome(pugi::xml_node &XMLNode);
void processSkyPlane(pugi::xml_node &XMLNode);
void processLightRange(pugi::xml_node &XMLNode, Ogre::Light *pLight);
void processLightAttenuation(pugi::xml_node &XMLNode,
Ogre::Light *pLight);
void processLightSourceSize(pugi::xml_node &XMLNode,
Ogre::Light *pLight);
Ogre::SceneManager *mSceneMgr;
Ogre::SceneNode *mAttachNode;
Ogre::String m_sGroupName;
Ogre::ColourValue mBackgroundColour;
Ogre::String mNamePrefix;
int counter;
};
#endif