File: bezier_triangle_patch_python.cpp

package info (click to toggle)
k3d 0.8.0.6-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 46,148 kB
  • ctags: 27,246
  • sloc: cpp: 166,490; xml: 6,995; python: 5,997; ansic: 4,978; makefile: 32; sh: 21
file content (132 lines) | stat: -rw-r--r-- 6,180 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
// K-3D
// Copyright (c) 1995-2008, Timothy M. Shead
//
// Contact: tshead@k-3d.com
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public
// License along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

#include <boost/python.hpp>

#include <k3dsdk/python/mesh_python.h>
#include <k3dsdk/python/owned_instance_wrapper_python.h>
#include <k3dsdk/python/bezier_triangle_patch_python.h>

#include <k3dsdk/bezier_triangle_patch.h>

#include <boost/python/detail/api_placeholder.hpp>
using namespace boost::python;
#include <boost/scoped_ptr.hpp>

namespace k3d
{

namespace python
{

class bezier_triangle_patch
{
public:
	class const_primitive
	{
	public:
		typedef owned_instance_wrapper<k3d::bezier_triangle_patch::const_primitive> wrapper;

		static object patch_first_points(wrapper& Self) { return wrap(Self.wrapped().patch_first_points); }
		static object patch_orders(wrapper& Self) { return wrap(Self.wrapped().patch_orders); }
		static object patch_selections(wrapper& Self) { return wrap(Self.wrapped().patch_selections); }
		static object patch_materials(wrapper& Self) { return wrap(Self.wrapped().patch_materials); }
		static object patch_points(wrapper& Self) { return wrap(Self.wrapped().patch_points); }
		static object patch_point_weights(wrapper& Self) { return wrap(Self.wrapped().patch_point_weights); }
		static object constant_attributes(wrapper& Self) { return wrap(Self.wrapped().constant_attributes); }
		static object patch_attributes(wrapper& Self) { return wrap(Self.wrapped().patch_attributes); }
		static object parameter_attributes(wrapper& Self) { return wrap(Self.wrapped().parameter_attributes); }
		static object vertex_attributes(wrapper& Self) { return wrap(Self.wrapped().vertex_attributes); }
	};

	class primitive
	{
	public:
		typedef owned_instance_wrapper<k3d::bezier_triangle_patch::primitive> wrapper;

		static object patch_first_points(wrapper& Self) { return wrap(Self.wrapped().patch_first_points); }
		static object patch_orders(wrapper& Self) { return wrap(Self.wrapped().patch_orders); }
		static object patch_selections(wrapper& Self) { return wrap(Self.wrapped().patch_selections); }
		static object patch_materials(wrapper& Self) { return wrap(Self.wrapped().patch_materials); }
		static object patch_points(wrapper& Self) { return wrap(Self.wrapped().patch_points); }
		static object patch_point_weights(wrapper& Self) { return wrap(Self.wrapped().patch_point_weights); }
		static object constant_attributes(wrapper& Self) { return wrap(Self.wrapped().constant_attributes); }
		static object patch_attributes(wrapper& Self) { return wrap(Self.wrapped().patch_attributes); }
		static object parameter_attributes(wrapper& Self) { return wrap(Self.wrapped().parameter_attributes); }
		static object vertex_attributes(wrapper& Self) { return wrap(Self.wrapped().vertex_attributes); }
	};


	static object create(mesh_wrapper& Mesh)
	{
		return wrap_owned(k3d::bezier_triangle_patch::create(Mesh.wrapped()));
	}

	static object validate(mesh_wrapper& Mesh, mesh_primitive_wrapper& Primitive)
	{
		return wrap_owned(k3d::bezier_triangle_patch::validate(Mesh.wrapped(), Primitive.wrapped()));
	}

	static object validate_const(const_mesh_wrapper& Mesh, const_mesh_primitive_wrapper& Primitive)
	{
		return wrap_owned(k3d::bezier_triangle_patch::validate(Mesh.wrapped(), Primitive.wrapped()));
	}
};

void define_namespace_bezier_triangle_patch()
{
	scope outer = class_<bezier_triangle_patch>("bezier_triangle_patch", no_init)
		.def("create", &bezier_triangle_patch::create)
		.staticmethod("create")
		.def("validate", &bezier_triangle_patch::validate)
		.def("validate", &bezier_triangle_patch::validate_const)
		.staticmethod("validate")
		;

	class_<bezier_triangle_patch::const_primitive::wrapper>("const_primitive", no_init)
		.def("patch_first_points", &bezier_triangle_patch::const_primitive::patch_first_points)
		.def("patch_orders", &bezier_triangle_patch::const_primitive::patch_orders)
		.def("patch_selections", &bezier_triangle_patch::const_primitive::patch_selections)
		.def("patch_materials", &bezier_triangle_patch::const_primitive::patch_materials)
		.def("patch_points", &bezier_triangle_patch::const_primitive::patch_points)
		.def("patch_point_weights", &bezier_triangle_patch::const_primitive::patch_point_weights)
		.def("constant_attributes", &bezier_triangle_patch::const_primitive::constant_attributes)
		.def("patch_attributes", &bezier_triangle_patch::const_primitive::patch_attributes)
		.def("parameter_attributes", &bezier_triangle_patch::const_primitive::parameter_attributes)
		.def("vertex_attributes", &bezier_triangle_patch::const_primitive::vertex_attributes)
		;

	class_<bezier_triangle_patch::primitive::wrapper>("primitive", no_init)
		.def("patch_first_points", &bezier_triangle_patch::primitive::patch_first_points)
		.def("patch_orders", &bezier_triangle_patch::primitive::patch_orders)
		.def("patch_selections", &bezier_triangle_patch::primitive::patch_selections)
		.def("patch_materials", &bezier_triangle_patch::primitive::patch_materials)
		.def("patch_points", &bezier_triangle_patch::primitive::patch_points)
		.def("patch_point_weights", &bezier_triangle_patch::primitive::patch_point_weights)
		.def("constant_attributes", &bezier_triangle_patch::primitive::constant_attributes)
		.def("patch_attributes", &bezier_triangle_patch::primitive::patch_attributes)
		.def("parameter_attributes", &bezier_triangle_patch::primitive::parameter_attributes)
		.def("vertex_attributes", &bezier_triangle_patch::primitive::vertex_attributes)
		;
}

} // namespace python

} // namespace k3d