PeriDyno 1.2.1
Loading...
Searching...
No Matches
initializeModeling.cpp
Go to the documentation of this file.
2
3#include "NodeFactory.h"
4
11
12#include "Commands/Turning.h"
13#include "Commands/Merge.h"
14#include "Commands/Turning.h"
15
17
18#include "StaticMeshLoader.h"
19
22
24
25#include "GltfLoader.h"
26
27namespace dyno
28{
29 std::atomic<ModelingInitializer*> ModelingInitializer::gInstance;
31
33 {
34 ModelingInitializer* ins = gInstance.load(std::memory_order_acquire);
35 if (!ins) {
36 std::lock_guard<std::mutex> tLock(gMutex);
37 ins = gInstance.load(std::memory_order_relaxed);
38 if (!ins) {
39 ins = new ModelingInitializer();
40 ins->setName("Modeling");
41 ins->setVersion("1.0");
42 ins->setDescription("A modeling library");
43
44 gInstance.store(ins, std::memory_order_release);
45 }
46 }
47
48 return ins;
49 }
50
52 {
54
55 factory->addContentAction(std::string("gltf"),
56 [=](const std::string& path)->std::shared_ptr<Node>
57 {
58 auto node = std::make_shared<GltfLoader<DataType3f>>();
59 node->varFileName()->setValue(path);
60 return node;
61 });
62
63 factory->addContentAction(std::string("glb"),
64 [=](const std::string& path)->std::shared_ptr<Node>
65 {
66 auto node = std::make_shared<GltfLoader<DataType3f>>();
67 node->varFileName()->setValue(path);
68 return node;
69 });
70
71
72 auto page = factory->addPage(
73 "Modeling",
74 "ToolBarIco/Modeling/Modeling.png");
75
76 auto basic = page->addGroup("Basic");
77
78 basic->addAction(
79 "Plane",
80 "ToolBarIco/Modeling/Plane.png",
81 [=]()->std::shared_ptr<Node> {
82 return std::make_shared<PlaneModel<DataType3f>>();
83 });
84
85 basic->addAction(
86 "Cube",
87 "ToolBarIco/Modeling/Cube.png",
88 [=]()->std::shared_ptr<Node> {
89 return std::make_shared<CubeModel<DataType3f>>();
90 });
91
92 basic->addAction(
93 "Sphere",
94 "ToolBarIco/Modeling/Sphere.png",
95 [=]()->std::shared_ptr<Node> {
96 return std::make_shared<SphereModel<DataType3f>>();
97 });
98
99 basic->addAction(
100 "Cylinder",
101 "ToolBarIco/Modeling/Cylinder.png",
102 [=]()->std::shared_ptr<Node> {
103 return std::make_shared<CylinderModel<DataType3f>>();
104 });
105 basic->addAction(
106 "Cone",
107 "ToolBarIco/Modeling/Cone.png",
108 [=]()->std::shared_ptr<Node> {
109 return std::make_shared<ConeModel<DataType3f>>();
110 });
111
112 basic->addAction(
113 "Capsule",
114 "ToolBarIco/Modeling/Capsule.png",
115 [=]()->std::shared_ptr<Node> {
116 return std::make_shared<CapsuleModel<DataType3f>>();
117 });
118
119 auto op = page->addGroup("Operation");
120
121 op->addAction(
122 "Turning Model",
123 "ToolBarIco/Modeling/Turn.png",
124 [=]()->std::shared_ptr<Node> {
125 return std::make_shared<TurningModel<DataType3f>>();
126 });
127
128
129 op->addAction(
130 "Merge",
131 "ToolBarIco/Modeling/CubeCombo.png",
132 [=]()->std::shared_ptr<Node> {
133 return std::make_shared<MergeTriangleSet<DataType3f>>();
134 });
135
136 auto samplers = page->addGroup("Samplers");
137
138// samplers->addAction(
139// "Sphere Sampler",
140// "ToolBarIco/Modeling/SphereSampler_v3.png",
141// [=]()->std::shared_ptr<Node> {
142// return std::make_shared<Shape<DataType3f>>();
143// });
144
145 samplers->addAction(
146 "Sampler",
147 "ToolBarIco/Modeling/CubeSampler.png",
148 [=]()->std::shared_ptr<Node> {
149 return std::make_shared<ShapeSampler<DataType3f>>();
150 });
151 }
152}
153
155{
156 if (dyno::ModelingInitializer::instance()->initialize())
158
159 return nullptr;
160}
161
163{
164 if (dyno::ModelingInitializer::instance()->initialize())
166
167 return nullptr;
168}
static PluginEntry * instance()
static std::atomic< ModelingInitializer * > gInstance
static NodeFactory * instance()
std::shared_ptr< NodePage > addPage(std::string name, std::string icon)
void addContentAction(std::string fileType, std::function< std::shared_ptr< Node >(std::string)> act)
dyno::PluginEntry * initStaticPlugin()
PERIDYNO_API dyno::PluginEntry * initDynoPlugin()
This is an implementation of AdditiveCCD based on peridyno.
Definition Array.h:25
Definition PluginEntry.h:14
void setDescription(std::string desc)
PluginEntry()
void setVersion(std::string pluginVersion)
void setName(std::string pluginName)