MCPcopy Create free account
hub / github.com/RenderKit/embree / parseCommandLine

Function parseCommandLine

tutorials/convert/convert.cpp:129–299  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

127 Ref<HeightField> g_height_field = nullptr;
128
129 static void parseCommandLine(Ref<ParseStream> cin, const FileName& path)
130 {
131 while (true)
132 {
133 std::string tag = cin->getString();
134 if (tag == "") return;
135
136 /* parse command line parameters from a file */
137 else if (tag == "-c") {
138 FileName file = path + cin->getFileName();
139 parseCommandLine(new ParseStream(new LineCommentFilter(file, "#")), file.path());
140 }
141
142 /* load model */
143 else if (tag == "-i") {
144 Ref<SceneGraph::Node> object = SceneGraph::load(path + cin->getFileName());
145 if (centerScale != 0.0f)
146 {
147 BBox3fa bb = object->bounds();
148 Vec3fa center = bb.center();
149 const AffineSpace3fa space = AffineSpace3fa::translate(centerTranslate)*AffineSpace3fa::scale(Vec3fa(centerScale))*AffineSpace3fa::translate(-center);
150 g_scene->add(new SceneGraph::TransformNode(space,object));
151 }
152 else
153 g_scene->add(object);
154 }
155
156 /* used to generate some test scene automatically */
157 else if (tag == "-special-barbarian-instantiate") {
158 for (int x=0; x<10; x++) {
159 for (int y=0; y<10; y++) {
160 const char* model = "barbarian_mblur.xml";
161 if (random<int>()%4 == 0) model = "barbarian_msmblur_translate.xml";
162 else if (random<int>()%32 == 0) model = "barbarian_msmblur_rotate0_5.xml";
163 else if (random<int>()%32 == 0) model = "barbarian_msmblur.xml";
164 printf("<Transform><AffineSpace translate=\"%7.2f %7.2f %7.2f\"/><extern src=\"%s\"/></Transform>\n",float(x*400)+200.0f*drand48(),0.0f,float(y*400)+200.0f*drand48(),model);
165 }
166 }
167 }
168
169 /* convert triangles to quads */
170 else if (tag == "-convert-triangles-to-quads") {
171 g_scene->triangles_to_quads();
172 }
173
174 /* convert to subdivs */
175 else if (tag == "-convert-to-subdivs") {
176 g_scene->triangles_to_quads();
177 g_scene->quads_to_subdivs();
178 }
179
180 /* convert bezier to lines */
181 else if (tag == "-convert-bezier-to-lines") {
182 g_scene->bezier_to_lines();
183 }
184
185 /* convert bezier to bspline curves */
186 else if (tag == "-convert-bezier-to-bspline") {

Callers 10

mainFunction · 0.70
postParseCommandLineMethod · 0.50
mainMethod · 0.50
postParseCommandLineMethod · 0.50
postParseCommandLineMethod · 0.50
postParseCommandLineMethod · 0.50
TutorialApplicationMethod · 0.50
mainMethod · 0.50
parseCommandLineMethod · 0.50
postParseCommandLineMethod · 0.50

Calls 15

drand48Function · 0.85
loadImageFunction · 0.85
rotateFunction · 0.85
storeFunction · 0.85
getFileNameMethod · 0.80
pathMethod · 0.80
triangles_to_quadsMethod · 0.80
quads_to_subdivsMethod · 0.80
bezier_to_linesMethod · 0.80
bezier_to_bsplineMethod · 0.80
bspline_to_bezierMethod · 0.80
geometryMethod · 0.80

Tested by

no test coverage detected