本文整理汇总了C++中ShapeBuilder::Instructions方法的典型用法代码示例。如果您正苦于以下问题:C++ ShapeBuilder::Instructions方法的具体用法?C++ ShapeBuilder::Instructions怎么用?C++ ShapeBuilder::Instructions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ShapeBuilder
的用法示例。
在下文中一共展示了ShapeBuilder::Instructions方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: attr
Shape(const Program& prog, const ShapeBuilder& builder)
: make_shape(builder)
, shape_instr(make_shape.Instructions())
, shape_indices(make_shape.Indices())
, vbos(4) {
// bind the VAO for the shape
vao.Bind();
typename ShapeBuilder::VertexAttribs vert_attr_info;
const GLchar* vert_attr_name[] = {
"Position", "Normal", "Tangent", "TexCoord"};
for(int va = 0; va != 4; ++va) {
const GLchar* name = vert_attr_name[va];
std::vector<GLfloat> data;
auto getter = vert_attr_info.VertexAttribGetter(data, name);
if(getter != nullptr)
try {
// bind the VBO for the vertex attribute
vbos[va].Bind(Buffer::Target::Array);
GLuint npv = getter(make_shape, data);
// upload the data
Buffer::Data(Buffer::Target::Array, data);
// setup the vertex attribs array
VertexArrayAttrib attr(prog, name);
attr.Setup<GLfloat>(npv);
attr.Enable();
} catch(Error&) {
}
}
}
示例2:
ShapeAnalyzerGraphData(const ShapeBuilder& builder)
: _instr(builder.Instructions())
, _index(_adapt(builder.Indices()))
, _main_va()
, _main_vpv(builder.Positions(_main_va))
, _smooth_va()
, _smooth_vpv(builder.Normals(_smooth_va))
, _eps(1.0e-9)
{
_initialize();
}
示例3: attr
Shape(const Program& prog, const ShapeBuilder& builder)
: make_shape(builder)
, shape_instr(make_shape.Instructions(shapes::DrawMode::Default()))
, edge_instr(make_shape.Instructions(shapes::DrawMode::Edges()))
, shape_indices(make_shape.Indices(shapes::DrawMode::Default()))
, edge_indices(make_shape.Indices(shapes::DrawMode::Edges()))
, vbos(3)
{
// bind the VAO for the shape
vao.Bind();
typename ShapeBuilder::VertexAttribs vert_attr_info;
const GLuint nva = 3;
const GLchar* vert_attr_name[nva] = {
"Position",
"Normal",
"TexCoord"
};
for(GLuint va=0; va!=nva; ++va)
{
const GLchar* name = vert_attr_name[va];
std::vector<GLfloat> data;
auto getter = vert_attr_info.VertexAttribGetter(data, name);
if(getter != nullptr)
{
// bind the VBO for the vertex attribute
vbos[va].Bind(Buffer::Target::Array);
GLuint n_per_vertex = getter(make_shape, data);
// upload the data
Buffer::Data(Buffer::Target::Array, data);
// setup the vertex attribs array
VertexArrayAttrib attr(prog, name);
attr.Setup<GLfloat>(n_per_vertex);
attr.Enable();
}
}
}
示例4:
ShapeWrapperBase(
Iterator names_begin,
Iterator names_end,
const ShapeBuilder& builder
): _face_winding(builder.FaceWinding())
, _shape_instr(builder.Instructions())
, _index_info(builder)
, _vbos(std::distance(names_begin, names_end)+1)
, _npvs(std::distance(names_begin, names_end)+1, 0)
, _names(std::distance(names_begin, names_end))
{
this->_init(
builder,
builder.Indices(),
names_begin,
names_end
);
}