Initial scene to svg conversion.
This commit is contained in:
parent
65ac927929
commit
1fc730d413
15 changed files with 164 additions and 28 deletions
|
@ -0,0 +1,42 @@
|
|||
#include "SvgConverter.h"
|
||||
|
||||
#include "SvgDocument.h"
|
||||
#include "Scene.h"
|
||||
|
||||
#include "SceneItem.h"
|
||||
#include "SceneModel.h"
|
||||
|
||||
#include "AbstractMesh.h"
|
||||
#include "TriMesh.h"
|
||||
|
||||
#include "SvgShapeElements.h"
|
||||
|
||||
std::unique_ptr<SvgDocument> SvgConverter::convert(Scene* scene)
|
||||
{
|
||||
auto doc = std::make_unique<SvgDocument>();
|
||||
|
||||
scene->update();
|
||||
for(auto item : scene->getItems())
|
||||
{
|
||||
if (item->getType() == SceneItem::Type::MODEL)
|
||||
{
|
||||
auto mesh = dynamic_cast<SceneModel*>(item)->getMesh();
|
||||
|
||||
if (mesh->getType() == AbstractMesh::MeshType::TRI)
|
||||
{
|
||||
for(const auto& face : dynamic_cast<TriMesh*>(mesh)->getFaces())
|
||||
{
|
||||
auto svg_tri = std::make_unique<SvgPolygon>();
|
||||
// Get node locs for face
|
||||
|
||||
// Convert to pixel
|
||||
|
||||
// add polygon to doc
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return std::move(doc);
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
|
||||
class SvgDocument;
|
||||
class Scene;
|
||||
|
||||
class SvgConverter
|
||||
{
|
||||
public:
|
||||
std::unique_ptr<SvgDocument> convert(Scene* scene);
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue