CircleShape::CircleShape(std::string command, std::string name) { _type = SimpleShape::CIRCLE; BasicShape::setName(name); _numFaces = 20; _vertices = new osg::Vec3Array(_numFaces + 2); _colors = new osg::Vec4Array(_numFaces + 2); setPosition(osg::Vec3(0.0, 0.0, 0.0), 1.0); setColor(osg::Vec4(1.0, 0.0, 0.0, 1.0),osg::Vec4(0.0, 1.0, 0.0, 1.0)); update(command); setVertexArray(_vertices); setColorArray(_colors); setColorBinding(osg::Geometry::BIND_PER_VERTEX); addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::TRIANGLE_FAN,0,_numFaces + 2)); osg::StateSet* state = getOrCreateStateSet(); state->setMode(GL_BLEND, osg::StateAttribute::ON); state->setMode(GL_LIGHTING, osg::StateAttribute::OFF); //osg::Material* mat = new osg::Material(); //mat->setColorMode(osg::Material::AMBIENT_AND_DIFFUSE); //state->setAttributeAndModes(mat, osg::StateAttribute::ON); }
//============================================================================== void LineSegmentShapeDrawable::refresh(bool firstTime) { if(mLineSegmentShape->getDataVariance() == dart::dynamics::Shape::STATIC) setDataVariance(osg::Object::STATIC); else setDataVariance(osg::Object::DYNAMIC); const std::vector<Eigen::Vector3d>& vertices = mLineSegmentShape->getVertices(); const Eigen::aligned_vector<Eigen::Vector2i>& connections = mLineSegmentShape->getConnections(); if( mLineSegmentShape->checkDataVariance(dart::dynamics::Shape::DYNAMIC_ELEMENTS) || firstTime) { osg::ref_ptr<osg::DrawElementsUInt> elements = new osg::DrawElementsUInt(GL_LINES); elements->reserve(2*connections.size()); for(size_t i=0; i < connections.size(); ++i) { const Eigen::Vector2i& c = connections[i]; elements->push_back(c[0]); elements->push_back(c[1]); } addPrimitiveSet(elements); } if( mLineSegmentShape->checkDataVariance(dart::dynamics::Shape::DYNAMIC_VERTICES) || mLineSegmentShape->checkDataVariance(dart::dynamics::Shape::DYNAMIC_ELEMENTS) || firstTime) { if(mVertices->size() != vertices.size()) mVertices->resize(vertices.size()); for(size_t i=0; i<vertices.size(); ++i) (*mVertices)[i] = eigToOsgVec3(vertices[i]); setVertexArray(mVertices); } if( mLineSegmentShape->checkDataVariance(dart::dynamics::Shape::DYNAMIC_COLOR) || firstTime) { if(mColors->size() != 1) mColors->resize(1); (*mColors)[0] = eigToOsgVec4(mLineSegmentShape->getRGBA()); setColorArray(mColors, osg::Array::BIND_OVERALL); } }
LaserScanLine::LaserScanLine(URGCPPWrapper &urg) : urg(urg), vertices(new osg::Vec3Array(urg.getNumberOfPoints())), color(new osg::Vec4Array(1)) { setDataVariance(osg::Object::DYNAMIC); getOrCreateStateSet()->setAttribute(new osg::Point(3), osg::StateAttribute::ON); addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::POINTS, 0, urg.getNumberOfPoints())); setColorBinding(osg::Geometry::BIND_OVERALL); (*color)[0] = osg::Vec4(1.0f, 0.0f, 0.0f, 1.0f); setColorArray(color); }
//! Fills the color array with the given color void setColorArray(const fvec4& color) { u32 vert_count = (u32)(vertexArray() ? vertexArray()->size() : vertexAttribArray(VA_Position) ? vertexAttribArray(VA_Position)->data()->size() : 0); VL_CHECK( vert_count ) ref<ArrayFloat4> color_array = new ArrayFloat4; color_array->resize(vert_count); for(u32 i=0; i<color_array->size(); ++i) color_array->at(i) = color; #if defined(VL_OPENGL_ES2) setVertexAttribArray(VA_Color, color_array.get()); #else setColorArray(color_array.get()); #endif }
//------------------------------------------------------------------------------ void HudTextureElement::init() { Texture * tex_object = s_texturemanager.getResource(texture_name_); if (!tex_object) return; osg::ref_ptr<osg::Texture2D> tex = tex_object->getOsgTexture(); osg::ref_ptr<osg::Image> image = tex->getImage(); aspect_ratio_ = (float)image->s() / image->t(); tex->setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::LINEAR); tex->setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::LINEAR); tex->setBorderColor(osg::Vec4(0,0,0,0)); tex->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_BORDER); tex->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_BORDER); getOrCreateStateSet()->setTextureAttributeAndModes(0,tex.get(),osg::StateAttribute::ON); setUseDisplayList(false); setUseVertexBufferObjects(true); addPrimitiveSet(new osg::DrawArrays(GL_QUADS,0,4)); Color color = s_params.get<Color> ("hud." + section_ + ".color"); osg::Vec2Array* texcoord = new osg::Vec2Array(4); setTexCoordArray(0,texcoord); osg::Vec4Array * osg_color = new osg::Vec4Array(1); (*osg_color)[0].set(color.r_, color.g_, color.b_, color.a_); setColorArray(osg_color); setColorBinding(osg::Geometry::BIND_OVERALL); (*texcoord)[0].set(0,0); (*texcoord)[1].set(1,0); (*texcoord)[2].set(1,1); (*texcoord)[3].set(0,1); s_scene_manager.addObserver(ObserverCallbackFun0(this, &HudTextureElement::onResolutionChanged), SOE_RESOLUTION_CHANGED, &fp_group_); onResolutionChanged(); }
Widget::Widget(const std::string& name, point_type w, point_type h): _parent (0), _index (0), _layer (LAYER_LOW), _padLeft (0.0f), _padRight (0.0f), _padTop (0.0f), _padBottom (0.0f), _valign (VA_CENTER), _halign (HA_CENTER), _coordMode (CM_ABSOLUTE), _canFill (false), _canClone (true), _isManaged (false), _isStyled (false), _minWidth (0.0f), _minHeight (0.0f) { _name = name.size() ? name : generateRandomName("Widget"); if(!_norms.valid()) { _norms = new PointArray(1); (*_norms)[0].set(0.0f, 0.0f, 1.0f); (*_norms)[0].normalize(); } TexCoordArray* texs = new TexCoordArray(4); // Fill our texture coordinates with null stuff for now, since we aren't using them // until an Image is set at some later point. std::fill(texs->begin(), texs->end(), osg::Vec2(0.0f, 0.0f)); setUseDisplayList(false); setDataVariance(osg::Object::DYNAMIC); setVertexArray(new PointArray(4)); setColorArray(new ColorArray(4)); setNormalArray(_norms.get()); setTexCoordArray(0, texs); setNormalBinding(osg::Geometry::BIND_OVERALL); setColorBinding(osg::Geometry::BIND_PER_VERTEX); addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUADS, 0, 4)); setDimensions(0.0f, 0.0f, w, h); setColor(1.0f, 1.0f, 1.0f, 1.0f); }
WidgetBorder::WidgetBorder(const Widget & widget) : widget(widget) { if (osg::Vec3Array * data = new osg::Vec3Array(4)) { const Rect & rect = widget.getRect(); const int padding = widget.getBorderPadding(); const float z = widget.getZ(); spdlog::get("log")->info("initializing WidgetBorder with rect {}, {}, {}, {}", rect.x1, rect.y1, rect.x2, rect.y2); (*data)[0].set(rect.x1 - padding, rect.y2 + padding, z); (*data)[1].set(rect.x1 - padding, rect.y1 - padding, z); (*data)[2].set(rect.x2 + padding, rect.y1 - padding, z); (*data)[3].set(rect.x2 + padding, rect.y2 + padding, z); setVertexArray(data); } if (osg::Vec3Array * data = new osg::Vec3Array(1)) { (*data)[0].set(0.f, 0.f, 1.f); setNormalArray(data, osg::Array::BIND_OVERALL); } if (osg::Vec4Array * data = new osg::Vec4Array(1)) { /* const osg::Color & color = widget.getBorderColor(); (*data)[0].set(widget.getBorderColor().r, widget.getBorderColor().g, widget.getBorderColor().b, widget.getBorderColor().a); */ (*data)[0].set(1.f, 1.f, 1.f, 1.f); setColorArray(data, osg::Array::BIND_OVERALL); } addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINE_LOOP, 0, 4)); // TODO: getOrCreateStateSet()->setAttribute(new osg::LineWidth(widget.getBorderPadding())); }
void HeightmapShapeDrawable<S>::refresh(bool /*firstTime*/) { if (mHeightmapShape->getDataVariance() == dynamics::Shape::STATIC) setDataVariance(::osg::Object::STATIC); else setDataVariance(::osg::Object::DYNAMIC); // Row major matrix where top left corner is the height at (0, 0), and bottom // right corner is the height at (rows, -cols) in (x, y) coordinates. const auto& heightmap = mHeightmapShape->getHeightField(); // This function is called whenever the heightmap version is increased, and // the heightmap could be updated in the version up. So we always update the // heightmap. { assert(mElements); assert(mNormals); setVertices<S>( heightmap, *mVertices, *mElements, *mNormals, mHeightmapShape->getScale()); addPrimitiveSet(mElements); setVertexArray(mVertices); setNormalArray(mNormals, ::osg::Array::BIND_PER_VERTEX); } // This function is called whenever the heightmap version is increased, and // the color could be updated in the version up. So we always update the // color. { if (mColors->size() != 1) mColors->resize(1); (*mColors)[0] = eigToOsgVec4d(mVisualAspect->getRGBA()); setColorArray(mColors, ::osg::Array::BIND_OVERALL); } }
SomePoints() { osg::Vec4Array* cAry = new osg::Vec4Array; setColorArray( cAry, osg::Array::BIND_OVERALL ); cAry->push_back( osg::Vec4(1,1,1,1) ); osg::Vec3Array* vAry = new osg::Vec3Array; setVertexArray( vAry ); vAry->push_back( osg::Vec3(0,0,0) ); vAry->push_back( osg::Vec3(0,1,0) ); vAry->push_back( osg::Vec3(1,0,0) ); vAry->push_back( osg::Vec3(1,1,0) ); vAry->push_back( osg::Vec3(0,0,1) ); vAry->push_back( osg::Vec3(0,1,1) ); vAry->push_back( osg::Vec3(1,0,1) ); vAry->push_back( osg::Vec3(1,1,1) ); addPrimitiveSet( new osg::DrawArrays( GL_POINTS, 0, vAry->size() ) ); osg::StateSet* sset = getOrCreateStateSet(); sset->setMode( GL_LIGHTING, osg::StateAttribute::OFF ); // if things go wrong, fall back to big points osg::Point* p = new osg::Point; p->setSize(6); sset->setAttribute( p ); #ifdef ENABLE_GLSL sset->setAttribute( createShader() ); // a generic cyclic animation value osg::Uniform* u_anim1( new osg::Uniform( "u_anim1", 0.0f ) ); u_anim1->setUpdateCallback( new SineAnimation( 4, 0.5, 0.5 ) ); sset->addUniform( u_anim1 ); #endif }
void Ellipsoid::subDraw() { computeAssistVar(); getPrimitiveSetList().clear(); osg::ref_ptr<osg::Vec3Array> vertexArr = new osg::Vec3Array; osg::ref_ptr<osg::Vec3Array> normalArr = new osg::Vec3Array; setVertexArray(vertexArr); setNormalArray(normalArr, osg::Array::BIND_PER_VERTEX); osg::ref_ptr<osg::Vec4Array> colArr = new osg::Vec4Array(); colArr->push_back(m_color); setColorArray(colArr, osg::Array::BIND_OVERALL); bool isFull = osg::equivalent(m_angle, 2 * M_PI, GetEpsilon()); if (isFull) { m_angle = 2 * M_PI; } osg::Vec3 bottomNormal = -m_aLen; bottomNormal.normalize(); osg::Quat localToWold; localToWold.makeRotate(osg::Z_AXIS, -bottomNormal); osg::Vec3 xVec = localToWold * osg::X_AXIS; osg::Vec3 yVec = xVec ^ bottomNormal; int hCount = m_bDivision; double hIncAng = 2 * M_PI / hCount; osg::Quat hQuat(hIncAng, bottomNormal); int vCount = (int)ceil(m_angle / (2 * M_PI / m_aDivision)); if (vCount & 1) // 如果是奇数,则变成偶数 ++vCount; double vIncAng = m_angle / vCount; double currAngle = m_angle / 2.0; double b = m_bRadius; double a = m_aLen.length(); osg::Vec3 vec1(b * sin(currAngle), 0, a * cos(currAngle)); vec1 = localToWold * vec1; osg::Vec3 normal1(sin(currAngle) / b, 0, cos(currAngle) / a); normal1 = localToWold * normal1; normal1.normalize(); currAngle -= vIncAng; osg::Vec3 vec2(b * sin(currAngle), 0, a * cos(currAngle)); vec2 = localToWold * vec2; osg::Vec3 normal2(sin(currAngle) / b, 0, cos(currAngle) / a); normal2 = localToWold * normal2; normal2.normalize(); const GLint first = vertexArr->size(); for (int i = 0; i < vCount / 2; ++i) { osg::Vec3 hVec1 = vec1; osg::Vec3 hVec2 = vec2; osg::Vec3 hNormal1 = normal1; osg::Vec3 hNormal2 = normal2; const size_t hFirst = vertexArr->size(); for (int j = 0; j < hCount; ++j) { vertexArr->push_back(m_center + hVec1); vertexArr->push_back(m_center + hVec2); normalArr->push_back(hNormal1); normalArr->push_back(hNormal2); hVec1 = hQuat * hVec1; hVec2 = hQuat * hVec2; hNormal1 = hQuat * hNormal1; hNormal2 = hQuat * hNormal2; } vertexArr->push_back((*vertexArr)[hFirst]); vertexArr->push_back((*vertexArr)[hFirst + 1]); normalArr->push_back((*normalArr)[hFirst]); normalArr->push_back((*normalArr)[hFirst + 1]); vec1 = vec2; currAngle -= vIncAng; vec2.set(b * sin(currAngle), 0, a * cos(currAngle)); vec2 = localToWold * vec2; normal1 = normal2; normal2.set(sin(currAngle) / b, 0, cos(currAngle) / a); normal2 = localToWold * normal2; normal2.normalize(); } addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUAD_STRIP, first, vertexArr->size() - first)); if (!isFull && m_bottomVis) { const GLint first = vertexArr->size(); currAngle = m_angle / 2.0; osg::Vec3 vec1(b * sin(currAngle), 0, a * cos(currAngle)); vec1 = localToWold * vec1; osg::Vec3 vec2(0, 0, a * cos(currAngle)); vec2 = localToWold * vec2; vertexArr->push_back(m_center + vec2); normalArr->push_back(bottomNormal); for (int i = 0; i < hCount; ++i) { vertexArr->push_back(m_center + vec1); normalArr->push_back(bottomNormal); vec1 = hQuat * vec1; } vertexArr->push_back((*vertexArr)[first + 1]); normalArr->push_back(bottomNormal); addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::TRIANGLE_FAN, first, vertexArr->size() - first)); } }
void SCylinder::subDraw() { getPrimitiveSetList().clear(); osg::ref_ptr<osg::Vec3Array> vertexArr = new osg::Vec3Array; osg::ref_ptr<osg::Vec3Array> normalArr = new osg::Vec3Array; setVertexArray(vertexArr); setNormalArray(normalArr, osg::Array::BIND_PER_VERTEX); osg::ref_ptr<osg::Vec4Array> colArr = new osg::Vec4Array(); colArr->push_back(m_color); setColorArray(colArr, osg::Array::BIND_OVERALL); int count = (int)getDivision(); double incAng = 2 * M_PI / count; osg::Vec3 topNormal = m_height; topNormal.normalize(); double angleCos = m_bottomNormal * (-topNormal) / m_bottomNormal.length() / topNormal.length(); double angle = acos(angleCos); double a = m_radius; double b = m_radius / sin(M_PI_2 - angle); osg::Vec3 vec = m_bottomNormal ^ topNormal; vec.normalize(); osg::Quat bottomQuat(incAng, m_bottomNormal); double currAngle = 0; osg::Quat localToWorldQuat; localToWorldQuat.makeRotate(osg::Z_AXIS, m_bottomNormal); osg::Vec3 yAxis = localToWorldQuat * osg::Y_AXIS; osg::Quat localToWorldQuat2; localToWorldQuat2.makeRotate(yAxis, vec); localToWorldQuat *= localToWorldQuat2; osg::Vec3 bottomVec(b * sin(currAngle), a * cos(currAngle), 0); bottomVec = localToWorldQuat * bottomVec; //bottomVec = localToWorldQuat2 * bottomVec; osg::Quat topQuat(incAng, topNormal); osg::Vec3 topVec = vec * m_radius; osg::Vec3 topCenter = m_org + m_height; size_t first = vertexArr->size(); for (int i = 0; i < count; ++i) { vertexArr->push_back(topCenter + topVec); vertexArr->push_back(m_org + bottomVec); normalArr->push_back(topVec); normalArr->back().normalize(); normalArr->push_back(normalArr->back()); currAngle += incAng; bottomVec.set(b * sin(currAngle), a * cos(currAngle), 0); bottomVec = localToWorldQuat * bottomVec; //bottomVec = localToWorldQuat2 * bottomVec; topVec = topQuat * topVec; } vertexArr->push_back((*vertexArr)[first]); vertexArr->push_back((*vertexArr)[first + 1]); normalArr->push_back((*normalArr)[first]); normalArr->push_back((*normalArr)[first + 1]); addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::TRIANGLE_STRIP, first, vertexArr->size() - first)); if (m_bottomVis) { first = vertexArr->size(); vertexArr->push_back(m_org); normalArr->push_back(m_bottomNormal); for (int i = count; i >= 0; --i) { vertexArr->push_back((*vertexArr)[i * 2 + 1]); normalArr->push_back(m_bottomNormal); } addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::TRIANGLE_FAN, first, vertexArr->size() - first)); } if (m_topVis) { first = vertexArr->size(); vertexArr->push_back(topCenter); normalArr->push_back(topNormal); for (int i = 0; i < count + 1; ++i) { vertexArr->push_back((*vertexArr)[i * 2]); normalArr->push_back(topNormal); } addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::TRIANGLE_FAN, first, vertexArr->size() - first)); } }
void SuperShape3D::generate(void) { const float lon_step = 2 * osg::PI / _resolution; const float lat_step = osg::PI / _resolution; const float epsilon = std::numeric_limits<float>::epsilon(); osg::Vec3Array* vAry = new osg::Vec3Array; vAry->reserve( _resolution * _resolution * 6 ); setVertexArray( vAry ); osg::Vec4Array* cAry = new osg::Vec4Array; setColorArray( cAry ); setColorBinding( osg::Geometry::BIND_OVERALL ); cAry->push_back( osg::Vec4(1,1,1,1) ); for( int lat_count = 0; lat_count <_resolution; ++lat_count ) { float phi1 = static_cast<float>(lat_count * lat_step - osg::PI_2); float phi2 = phi1 + lat_step; for( int lon_count = 0; lon_count < _resolution; ++lon_count ) { float theta1 = static_cast<float>(lon_count * lon_step - osg::PI); float theta2 = theta1 + lon_step; bool tooSmall = false; float r1_1 = SS1(theta1); if(fabs(r1_1) < epsilon) tooSmall = true; float r2_1 = SS2(phi1); if(fabs(r2_1) < epsilon) tooSmall = true; float r1_2 = SS1(theta2); if(fabs(r1_2) < epsilon) tooSmall = true; float r2_2 = SS2(phi2); if(fabs(r2_2) < epsilon) tooSmall = true; if( !tooSmall ) { r1_1 = 1.0f / r1_1; r1_2 = 1.0f / r1_2; r2_1 = 1.0f / r2_1; r2_2 = 1.0f / r2_2; osg::Vec3 pa = osg::Vec3(r1_1*cosf(theta1)*r2_1*cosf(phi1), r1_1*sinf(theta1)*r2_1*cosf(phi1), r2_1*sinf(phi1)); osg::Vec3 pb = osg::Vec3(r1_2*cosf(theta2)*r2_1*cosf(phi1), r1_2*sinf(theta2)*r2_1*cosf(phi1), r2_1*sinf(phi1)); osg::Vec3 pc = osg::Vec3(r1_2*cosf(theta2)*r2_2*cosf(phi2), r1_2*sinf(theta2)*r2_2*cosf(phi2), r2_2*sinf(phi2)); osg::Vec3 pd = osg::Vec3(r1_1*cosf(theta1)*r2_2*cosf(phi2), r1_1*sinf(theta1)*r2_2*cosf(phi2), r2_2*sinf(phi2)); if((pa - pb).length() > epsilon && (pa - pc).length() > epsilon) { vAry->push_back( pa ); vAry->push_back( pb ); vAry->push_back( pc ); } if((pc - pd).length() > epsilon && (pc - pa).length() > epsilon) { vAry->push_back( pc ); vAry->push_back( pd ); vAry->push_back( pa ); } } } } addPrimitiveSet( new osg::DrawArrays( GL_TRIANGLES, 0, vAry->size() ) ); FacetingVisitor::facet( *this ); }
/*! Draw the Wheel's background gradient \param painter Painter \param r Bounding rectangle */ void QwtWheel::drawWheelBackground(QPainter *painter, const QRect &r ) { painter->save(); // // initialize pens // #if QT_VERSION < 0x040000 const QColor light = colorGroup().light(); const QColor dark = colorGroup().dark(); #else const QColor light = palette().color(QPalette::Light); const QColor dark = palette().color(QPalette::Dark); #endif QPen lightPen; lightPen.setColor(light); lightPen.setWidth(d_data->intBorder); QPen darkPen; darkPen.setColor(dark); darkPen.setWidth(d_data->intBorder); setColorArray(); // // initialize auxiliary variables // const int nFields = NUM_COLORS * 13 / 10; const int hiPos = nFields - NUM_COLORS + 1; if ( orientation() == Qt::Horizontal ) { const int rx = r.x(); int ry = r.y() + d_data->intBorder; const int rh = r.height() - 2* d_data->intBorder; const int rw = r.width(); // // draw shaded background // int x1 = rx; for (int i = 1; i < nFields; i++ ) { const int x2 = rx + (rw * i) / nFields; painter->fillRect(x1, ry, x2-x1 + 1 ,rh, d_data->colors[qwtAbs(i-hiPos)]); x1 = x2 + 1; } painter->fillRect(x1, ry, rw - (x1 - rx), rh, d_data->colors[NUM_COLORS - 1]); // // draw internal border // painter->setPen(lightPen); ry = r.y() + d_data->intBorder / 2; painter->drawLine(r.x(), ry, r.x() + r.width() , ry); painter->setPen(darkPen); ry = r.y() + r.height() - (d_data->intBorder - d_data->intBorder / 2); painter->drawLine(r.x(), ry , r.x() + r.width(), ry); } else // Qt::Vertical { int rx = r.x() + d_data->intBorder; const int ry = r.y(); const int rh = r.height(); const int rw = r.width() - 2 * d_data->intBorder; // // draw shaded background // int y1 = ry; for ( int i = 1; i < nFields; i++ ) { const int y2 = ry + (rh * i) / nFields; painter->fillRect(rx, y1, rw, y2-y1 + 1, d_data->colors[qwtAbs(i-hiPos)]); y1 = y2 + 1; } painter->fillRect(rx, y1, rw, rh - (y1 - ry), d_data->colors[NUM_COLORS - 1]); // // draw internal borders // painter->setPen(lightPen); rx = r.x() + d_data->intBorder / 2; painter->drawLine(rx, r.y(), rx, r.y() + r.height()); painter->setPen(darkPen); rx = r.x() + r.width() - (d_data->intBorder - d_data->intBorder / 2); painter->drawLine(rx, r.y(), rx , r.y() + r.height()); } painter->restore(); }
osgToy::Polyhedron::Polyhedron() { setVertexArray( new osg::Vec3Array ); setNormalArray( new osg::Vec3Array ); setColorArray( new osg::Vec4Array ); }