本文整理汇总了C++中LightSource::process方法的典型用法代码示例。如果您正苦于以下问题:C++ LightSource::process方法的具体用法?C++ LightSource::process怎么用?C++ LightSource::process使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LightSource
的用法示例。
在下文中一共展示了LightSource::process方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: lightsource_process
CAMLprim value lightsource_process(value record_lightsource,
value list_polygon_objects,
value polygon_view) {
CAMLparam3(record_lightsource, list_polygon_objects, polygon_view);
CAMLlocal5(polygon_prev_head, list_polygon_head, vector_prev_head,
list_vector_head, tmp_polygon);
CAMLlocal1(tmp_vector);
LightSource l = LightSource(Vector_val(Field(record_lightsource, 0)),
Double_val(Field(record_lightsource, 1)),
Double_val(Field(record_lightsource, 2)));
std::vector<Polygon> tmp_polygon_list = std::vector<Polygon>();
polygon_list_to_std_vector(list_polygon_objects, &tmp_polygon_list);
std::vector<Vector> tmp_vector_list = std::vector<Vector>();
vector_list_to_std_vector(Field(polygon_view, 0), &tmp_vector_list);
Polygon polygon = Polygon(tmp_vector_list);
// auto start = std::chrono::steady_clock::now();
std::vector<Polygon> list_polygon = l.process(tmp_polygon_list);
// auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(
// std::chrono::steady_clock::now() - start);
// printf("--> %lld\n", duration.count());
polygon_prev_head = Val_unit;
for (Polygon p : list_polygon) {
vector_prev_head = Val_unit;
for (Vector v : p.get_vertices()) {
tmp_vector = caml_alloc_small(2, Double_array_tag);
Double_field(tmp_vector, 0) = v.x;
Double_field(tmp_vector, 1) = v.y;
list_vector_head = caml_alloc_small(2, 0);
Field(list_vector_head, 0) = tmp_vector;
Field(list_vector_head, 1) = vector_prev_head;
vector_prev_head = list_vector_head;
}
tmp_polygon = caml_alloc_small(1, 0);
Field(tmp_polygon, 0) = list_vector_head;
list_polygon_head = caml_alloc_small(2, 0);
Field(list_polygon_head, 0) = tmp_polygon;
Field(list_polygon_head, 1) = polygon_prev_head;
polygon_prev_head = list_polygon_head;
}
CAMLreturn(list_polygon_head);
}