-bool DaeLoader::Load(SceneMain& scene, const std::string& filename)
+GeomObject* DaeLoader::LoadGeom(SceneMain& scene, const std::string& filename)
{
AssimpReader reader(geom::GeomFileFormat::Collada);
- geom::GeomObject* geom = reader.LoadGeom(scene, filename);
+ return reader.LoadGeom(scene, filename);
+}
+
+bool DaeLoader::Load(SceneMain& scene, const std::string& filename)
+{
+ GeomObject* geom = LoadGeom(scene, filename);
if (geom == NULL)
return false;
#include "GeomFileReader.h"
+
+namespace geom
+{
+
+class GeomObject;
+
+}
+
+
class DaeLoader : public GeomFileReader
{
public:
bool Load(SceneMain& scene, const std::string& filename);
+ virtual geom::GeomObject* LoadGeom(SceneMain& scene, const std::string& filename);
};
-bool MqoLoader::Load(SceneMain& scene, const std::string& filename)
+GeomObject* MqoLoader::LoadGeom(SceneMain& scene, const std::string& filename)
{
lib_geo::MqoObject mqo_obj;
lib_geo::MqoLoader loader;
loader.Load( mqo_obj , filename );
- GeomObject* geom = scene.CreateNewGeometry();
+ GeomObject* geom = new GeomObject();
MeshBuf* mbuf = geom->CreateNewMeshBuf();
mqo_obj.ConvertToBaseMesh(mbuf->m_Mesh);
geom->m_FilePath = filename;
geom->InitializeBufferCommon();
+ return geom;
+}
+
+bool MqoLoader::Load(SceneMain& scene, const std::string& filename)
+{
+ GeomObject* geom = LoadGeom(scene, filename);
+ if (geom == NULL)
+ return false;
+
+ scene.m_Objects.push_back(geom);
+
scene.RefreshObjectIndex();
scene.UpdateTransform();
scene.ReportDoneEditGeometry();
#include "..\GeomFileReader.h"
+
+namespace geom
+{
+
+class GeomObject;
+
+}
+
+
class MqoLoader : public GeomFileReader
{
public:
bool Load(SceneMain& scene, const std::string& filename);
+ virtual geom::GeomObject* LoadGeom(SceneMain& scene, const std::string& filename);
};
-bool ObjLoader::Load(SceneMain& scene, const std::string& filename)
+GeomObject* ObjLoader::LoadGeom(SceneMain& scene, const std::string& filename)
{
lib_geo::ObjMesh obj_mesh;
if (!obj_mesh.Load(filename))
- return false;
+ return NULL;
- GeomObject* geom = NULL;
+ GeomObject* geom = new GeomObject();
ObjSplitMode splitMode = ObjSplitMode::None;
if (scene.m_IOConfig.ObjSplit)
if (splitMode == ObjSplitMode::None)
{
- geom = scene.CreateNewGeometry();
-
MeshBuf* mbuf = geom->CreateNewMeshBuf();
obj_mesh.ConvertToBaseMesh(mbuf->m_Mesh);
std::vector<lib_geo::BaseMesh> mesh_ary;
obj_mesh.ConvertToBaseMeshSeparated(splitMode, mesh_ary);
if (mesh_ary.empty())
- return true;
-
- geom = scene.CreateNewGeometry();
+ return geom;
for (size_t i = 0; i < mesh_ary.size(); ++i)
{
geom->InitializeBufferCommon();
+ return geom;
+}
+
+bool ObjLoader::Load(SceneMain& scene, const std::string& filename)
+{
+ GeomObject* geom = LoadGeom(scene, filename);
+ if (geom == NULL)
+ return false;
+
+ scene.m_Objects.push_back(geom);
+
scene.RefreshObjectIndex();
scene.UpdateTransform();
scene.ReportDoneEditGeometry();
{
public:
bool Load(SceneMain& scene, const std::string& filename);
+ virtual geom::GeomObject* LoadGeom(SceneMain& scene, const std::string& filename);
private:
void InitTextureFromObjMeshBuf(SceneMain& scene, geom::MeshBuf& mbuf, const lib_geo::ObjMesh& obj_mesh);
-bool PlyLoader::Load(SceneMain& scene, const std::string& filename)
+GeomObject* PlyLoader::LoadGeom(SceneMain& scene, const std::string& filename)
{
lib_geo::ply::PlyMesh ply_mesh;
if (!ply_mesh.Load(filename))
- return false;
+ return NULL;
- GeomObject* geom = scene.CreateNewGeometry();
+ GeomObject* geom = new GeomObject();
MeshBuf* mbuf = geom->CreateNewMeshBuf();
lib_geo::BaseMesh& mesh_dst = mbuf->m_Mesh;
geom->m_FilePath = filename;
geom->InitializeBufferCommon();
+ return geom;
+}
+
+bool PlyLoader::Load(SceneMain& scene, const std::string& filename)
+{
+ GeomObject* geom = LoadGeom(scene, filename);
+ if (geom == NULL)
+ return false;
+
+ scene.m_Objects.push_back(geom);
+
scene.RefreshObjectIndex();
scene.UpdateTransform();
scene.ReportDoneEditGeometry();
#include "..\GeomFileReader.h"
+
+namespace geom
+{
+
+class GeomObject;
+
+}
+
+
class PlyLoader : public GeomFileReader
{
public:
bool Load(SceneMain& scene, const std::string& filename);
+ virtual geom::GeomObject* LoadGeom(SceneMain& scene, const std::string& filename);
};
-bool PmdLoader::Load(SceneMain& scene, const std::string& filename)
+GeomObject* PmdLoader::LoadGeom(SceneMain& scene, const std::string& filename)
{
meshio::pmd::IO pm;
if (!pm.read(filename.c_str()))
- return false;
+ return NULL;
- GeomObject* geom = scene.CreateNewGeometry();
+ GeomObject* geom = new GeomObject();
MeshBuf* mbuf = geom->CreateNewMeshBuf();
lib_geo::BaseMesh& m = mbuf->m_Mesh;
geom->m_FilePath = filename;
geom->InitializeBufferCommon();
+ return geom;
+}
+
+bool PmdLoader::Load(SceneMain& scene, const std::string& filename)
+{
+ GeomObject* geom = LoadGeom(scene, filename);
+ if (geom == NULL)
+ return false;
+
+ scene.m_Objects.push_back(geom);
+
scene.RefreshObjectIndex();
scene.UpdateTransform();
scene.ReportDoneEditGeometry();
#include "..\GeomFileReader.h"
+
+namespace geom
+{
+
+class GeomObject;
+
+}
+
+
class PmdLoader : public GeomFileReader
{
public:
bool Load(SceneMain& scene, const std::string& filename);
+ virtual geom::GeomObject* LoadGeom(SceneMain& scene, const std::string& filename);
};
-bool StlLoader::Load(SceneMain& scene, const std::string& filename)
+GeomObject* StlLoader::LoadGeom(SceneMain& scene, const std::string& filename)
{
- GeomObject* geom = scene.CreateNewGeometry();
+ GeomObject* geom = new GeomObject();
MeshBuf* mbuf = geom->CreateNewMeshBuf();
lib_geo::BaseMesh& mesh_dst = mbuf->m_Mesh;
geom->m_FilePath = filename;
geom->InitializeBufferCommon();
+ return geom;
+}
+
+bool StlLoader::Load(SceneMain& scene, const std::string& filename)
+{
+ GeomObject* geom = LoadGeom(scene, filename);
+ if (geom == NULL)
+ return false;
+
+ scene.m_Objects.push_back(geom);
+
scene.RefreshObjectIndex();
scene.UpdateTransform();
scene.ReportDoneEditGeometry();
#include "..\GeomFileReader.h"
+
+namespace geom
+{
+
+class GeomObject;
+
+}
+
+
class StlLoader : public GeomFileReader
{
public:
bool Load(SceneMain& scene, const std::string& filename);
+ virtual geom::GeomObject* LoadGeom(SceneMain& scene, const std::string& filename);
};
+GeomObject* XFileLoader::LoadGeom(SceneMain& scene, const std::string& filename)
+{
+ AssimpReader reader(geom::GeomFileFormat::Collada);
+ return reader.LoadGeom(scene, filename);
+}
+
bool XFileLoader::Load(SceneMain& scene, const std::string& filename)
{
- AssimpReader reader(geom::GeomFileFormat::XFile);
- geom::GeomObject* geom = reader.LoadGeom(scene, filename);
+ GeomObject* geom = LoadGeom(scene, filename);
if (geom == NULL)
return false;
#include "..\GeomFileReader.h"
+
+namespace geom
+{
+
+class GeomObject;
+
+}
+
+
class XFileLoader : public GeomFileReader
{
public:
bool Load(SceneMain& scene, const std::string& filename);
+ virtual geom::GeomObject* LoadGeom(SceneMain& scene, const std::string& filename);
};