document = k3d.new_document() source = k3d.plugin.create("FrozenMesh", document) mesh = source.create_mesh() primitive_type.create(mesh) primitive = mesh.primitives()[0] article.write("""<tr>""") article.write("""<td>[[""" + primitive_name + """ Primitive]]</td>""") article.write("""<td>""" + ", ".join(primitive.structure().keys()) + """</td>""") article.write("""<td>""" + ", ".join(primitive.attributes().keys()) + """</td>""") article.write("""</tr>\n""") k3d.close_document(document) article.write("""</table>\n""") article.write("""<!-- Machine-generated file, do not edit by hand! -->\n""") # Create the main article for each primitive type ... for primitive_name in primitive_names: print """Creating main article for """ + primitive_name + """ Primitive ...""" article = file( "@CMAKE_CURRENT_BINARY_DIR@/wikitext/articles/" + primitive_name + " Primitive", "w") article.write("""{{""" + primitive_name + """ Primitive}}\n""") # Create the reference material for each primitive type ... for i in range(len(primitive_types)): primitive_type = primitive_types[i]
def bitmap_modifier_benchmark(BitmapModifier): sys.stdout.write( """<DartMeasurement name="Timing" type="text/html"><![CDATA[\n""") sys.stdout.write("""<table>\n""") sizes = [(640, 480), (800, 600), (1024, 768), (1280, 1024), (1600, 1200)] runs = 3 first_row = True for size in sizes: for run in range(runs): document = k3d.new_document() profiler = k3d.plugin.create("PipelineProfiler", document) image = k3d.plugin.create("BitmapSolid", document) image.width = size[0] image.height = size[1] modifier = k3d.plugin.create(BitmapModifier, document) k3d.property.connect(document, image.get_property("output_bitmap"), modifier.get_property("input_bitmap")) modifier.output_bitmap if first_row: first_row = False sys.stdout.write("""<tr>""") sys.stdout.write("""<th>Width</th>""") sys.stdout.write("""<th>Height</th>""") sys.stdout.write("""<th>Run</th>""") records = profiler.records for node in records: if node != modifier: continue measurements = records[node] for measurement in measurements: sys.stdout.write("""<th>""") sys.stdout.write(measurement) sys.stdout.write("""</th>""") sys.stdout.write("""</tr>\n""") sys.stdout.write("""<tr>""") sys.stdout.write("""<td>""" + str(size[0]) + """</td>""") sys.stdout.write("""<td>""" + str(size[1]) + """</td>""") sys.stdout.write("""<td>""" + str(run) + """</td>""") records = profiler.records for node in records: if node != modifier: continue measurements = records[node] for measurement in measurements: sys.stdout.write("""<td>""") sys.stdout.write(str(measurements[measurement])) sys.stdout.write("""</td>""") sys.stdout.write("""</tr>\n""") k3d.close_document(document) sys.stdout.write("""</table>\n""") sys.stdout.write("""]]></DartMeasurement>\n""")
# python import testing import k3d factories = k3d.plugin.factory.lookup() for factory in factories: if factory.is_application_plugin() and ("DocumentImporter" in factory.name()): print "\n\nTesting " + factory.name() + " with a file containing all zeroes ..." path = k3d.filesystem.generic_path(testing.source_path() + "/meshes/" + "zero_bytes") document = k3d.new_document() document_importer = k3d.plugin.create(factory.name()) document_importer.read_file(path, document) k3d.close_document(document) print "\n\nTesting " + factory.name() + " with a file containing random data ..." path = k3d.filesystem.generic_path(testing.source_path() + "/meshes/" + "random_bytes") document = k3d.new_document() document_importer = k3d.plugin.create(factory.name()) document_importer.read_file(path, document) k3d.close_document(document)
def bitmap_modifier_benchmark(BitmapModifier): sys.stdout.write("""<DartMeasurement name="Timing" type="text/html"><![CDATA[\n""") sys.stdout.write("""<table>\n""") sizes = [(640,480), (800,600), (1024,768), (1280,1024), (1600, 1200)] runs = 3 first_row = True for size in sizes: for run in range(runs): document = k3d.new_document() profiler = k3d.plugin.create("PipelineProfiler", document) image = k3d.plugin.create("BitmapSolid", document) image.width = size[0]; image.height = size[1]; modifier = k3d.plugin.create(BitmapModifier, document) k3d.property.connect(document, image.get_property("output_bitmap"), modifier.get_property("input_bitmap")) modifier.output_bitmap if first_row: first_row = False sys.stdout.write("""<tr>""") sys.stdout.write("""<th>Width</th>""") sys.stdout.write("""<th>Height</th>""") sys.stdout.write("""<th>Run</th>""") records = profiler.records for node in records: if node != modifier: continue measurements = records[node] for measurement in measurements: sys.stdout.write("""<th>""") sys.stdout.write(measurement) sys.stdout.write("""</th>""") sys.stdout.write("""</tr>\n""") sys.stdout.write("""<tr>""") sys.stdout.write("""<td>""" + str(size[0]) + """</td>""") sys.stdout.write("""<td>""" + str(size[1]) + """</td>""") sys.stdout.write("""<td>""" + str(run) + """</td>""") records = profiler.records for node in records: if node != modifier: continue measurements = records[node] for measurement in measurements: sys.stdout.write("""<td>""") sys.stdout.write(str(measurements[measurement])) sys.stdout.write("""</td>""") sys.stdout.write("""</tr>\n""") k3d.close_document(document) sys.stdout.write("""</table>\n""") sys.stdout.write("""]]></DartMeasurement>\n""")