BrushDrawer::BrushDrawer(const Ogre::String& name, Ogre::TerrainGroup* group) : ManualObject(name), m_group(group), m_marker(false) { begin("", Ogre::RenderOperation::OT_LINE_STRIP); for(size_t i=0; i<NUM_SEGMENTS; i++) { colour(0.2f, 1.0f, 0.2f, 1.0f); position(0.0f, 0.0f, 0.0f); } end(); begin("", Ogre::RenderOperation::OT_LINE_STRIP); for(size_t i=0; i<NUM_SEGMENTS; i++) { colour(0.2f, 1.0f, 0.2f, 1.0f); position(0.0f, 0.0f, 0.0f); } end(); begin("", Ogre::RenderOperation::OT_LINE_LIST); colour(0.2f, 1.0f, 0.2f, 1.0f); position(-0.5, 0.0, 0.0); colour(0.2f, 1.0f, 0.2f, 1.0f); position(0.5, 0.0, 0.0); colour(0.2f, 1.0f, 0.2f, 1.0f); position(0.0, 0.0, 0.5); colour(0.2f, 1.0f, 0.2f, 1.0f); position(0.0, 0.0, -0.5f); colour(0.2f, 1.0f, 0.2f, 1.0f); position(0.0, 0.0, 0.5); colour(0.2f, 1.0f, 0.2f, 1.0f); position(0.0, 0.0, -0.5f); end(); generateGeometry(); }
void init() { generateGeometry(); // Initialize camera. camera.rot.x = camera.rot.y = camera.rot.z = 0.0f; camera.pos.x = camera.pos.y = camera.pos.z = 0.0f; camera.zoom = 4.0f; camera.rotating = camera.zooming = false; camera.sensitivity = 0.4; camera.clipNear = 0.1; camera.clipFar = 10.0; blinnPhongPV = loadShader("blinn_phong_pv.vert", "blinn_phong_pv.frag"); blinnPhongPP = loadShader("blinn_phong_pp.vert", "blinn_phong_pp.frag"); phongPV = loadShader("phong_pv.vert", "phong_pv.frag"); phongPP = loadShader("phong_pp.vert", "phong_pp.frag"); bumpShader = loadShader("bump.vert", "bump.frag"); memset(options, 0, sizeof(bool) * OPTSIZE); options[OPT_LIGHTING] = true; options[OPT_SMOOTH_SHADE] = true; options[OPT_BLINN_PHONG] = true; options[OPT_OSD_FULL] = true; gMode = TORUS; updateRenderMethod(); updateShadingMethod(); }
void BrushDrawer::setBrushOptions(float size, float hardness, float height) { m_outerRadius = size/2.0f; m_innterRadius = size*hardness/2.0f; m_height = height; generateGeometry(); }
void DisplayList::draw() { if (usingDL) glCallList(dl); else generateGeometry(); }
OsmMapPtr AlphaShapeGenerator::generateMap(OsmMapPtr inputMap) { boost::shared_ptr<Geometry> cutterShape = generateGeometry(inputMap); if (cutterShape->getArea() == 0.0) { //would rather this be thrown than a warning logged, as the warning may go unoticed by web //clients who are expecting the alpha shape to be generated throw HootException("Alpha Shape area is zero. Try increasing the buffer size and/or alpha."); } OsmMapPtr result; result.reset(new OsmMap(inputMap->getProjection())); // add the resulting alpha shape for debugging. GeometryConverter(result).convertGeometryToElement(cutterShape.get(), Status::Invalid, -1); const RelationMap& rm = result->getRelations(); for (RelationMap::const_iterator it = rm.begin(); it != rm.end(); ++it) { Relation* r = result->getRelation(it->first).get(); r->setTag("area", "yes"); } return result; }
Cylinder::Cylinder(float radius, float height, uint count) : Spatial(unique(new AABB<float>(-radius, 0, -radius, radius, height, radius))), radius(radius), height(height), count(count) { generateGeometry(); }
void CIsoSurfaceBase::draw() { if ( !m_GLuint ) { generateGeometry(); } glCallList( m_GLuint ); }
void AGungrenagesGameMode::StartPlay() { Super::StartPlay(); FMath::RandInit(FPlatformTime::Cycles()); FMath::SRandInit(FPlatformTime::Cycles()); gameData.timeToNextWave = 1.0f; generateGeometry(); }
void Chunk::generate() { // Lighting must be done before geometry Perf::Profiler::get().begin("lupdate"); generateLighting(); Perf::Profiler::get().end("lupdate"); Perf::Profiler::get().begin("cgupdate"); generateGeometry(); Perf::Profiler::get().end("cgupdate"); Perf::Profiler::get().begin("pupdate"); // generate physics - geometry must already be generated generatePhysics(); Perf::Profiler::get().end("pupdate"); }
DRINK::DRINK(int _numBits, bool _color, int _ringSize, int _numRings, int _pairs, bool _allPairs) { numBits = _numBits; ringSize = _ringSize; numRings = _numRings; numPairs = _pairs; allPairs = _allPairs; color = _color; radiusStep = BIGGEST_RADIUS / numRings; firstRadius = radiusStep; int raw_pairs[] = { 1553, 1595, 1596, 344, 372, 627, 375, 467, 331, 47, 303, 415, 10, 666, 289, 373, 414, 247, 89, 5, 422, 426, 215, 665, 465, 258, 299, 582, 585, 623, 667, 718, 501, 677, 657, 90, 514, 593, 551, 133, 587, 333, 877, 82, 1085, 1715, 1128, 11, 1169, 846, 550, 43, 291, 762, 719, 835, 1013, 509, 1589, 1381, 1018, 1138, 1716, 1181 }; for (unsigned i = 0; i<sizeof (raw_pairs) / sizeof (int); ++i) { bestPairs.push_back(raw_pairs[i]); } geometryData.resize(ringSize * numRings); for (int i = 0; i < ringSize * numRings; ++i) geometryData[i].resize(SCALE_SAMPLES); for (int i = 0; i < ringSize * numRings; ++i) for (int j = 0; j < SCALE_SAMPLES; ++j) geometryData[i][j].resize(ROTATION_SAMPLES); generateGeometry(); generateAllPairs(); if (_allPairs) { pairs = allPairsVec; } else { for (int i = 0; i < numPairs; ++i) { pairs.push_back(allPairsVec[bestPairs[i]]); } } generateResults(); }
void keyDown(unsigned char key, int x, int y) { switch(key) { case 27: glutDestroyWindow(win); exit(0); case 'l': options[OPT_LIGHTING] = !options[OPT_LIGHTING]; break; case 'H': shininess++; break; case 'h': if(shininess - 1 >= 0) shininess--; break; case 'n': options[OPT_DRAW_NORMALS] = !options[OPT_DRAW_NORMALS]; break; case 'f': options[OPT_SMOOTH_SHADE] = !options[OPT_SMOOTH_SHADE]; break; case 'T': tesselation *= 2; generateGeometry(); break; case 't': tesselation /= 2; generateGeometry(); break; case 'o': gMode = (gMode + 1) % GMODES; generateGeometry(); break; case 'u': options[OPT_VBO] = !options[OPT_VBO]; updateRenderMethod(); break; case 's': options[OPT_SHADER] = !options[OPT_SHADER]; updateShadingMethod(); break; case 'm': if(!options[OPT_SHADER]) options[OPT_SHADER] = true; options[OPT_BLINN_PHONG] = !options[OPT_BLINN_PHONG]; updateShadingMethod(); break; case 'p': options[OPT_PER_PIXEL] = !options[OPT_PER_PIXEL]; updateShadingMethod(); break; case 'i': options[OPT_IMMEDIATE] = !options[OPT_IMMEDIATE]; updateRenderMethod(); break; case 'w': options[OPT_WIREFRAME] = !options[OPT_WIREFRAME]; break; case 'x': options[OPT_OSD_FULL] = false; break; case 'X': options[OPT_OSD_FULL] = true; break; case 'g': options[OPT_SHADER_GEN] = !options[OPT_SHADER_GEN]; options[OPT_SHADER] = true; updateShadingMethod(); break; case 'b': options[OPT_BUMP_MAP] = !options[OPT_BUMP_MAP]; break; case 'a': options[OPT_ANIM] = !options[OPT_ANIM]; break; default: break; } }
void BrushDrawer::setPosition(Ogre::Vector3 position) { m_position = position; generateGeometry(); }
void TerrainChunkRenderable::generateGeometry() { if (_dirty) { generateGeometry(_preRenderPolyReduction); _dirty = false; } }
void TerrainChunkRenderable::preRenderNotice() { // Call this to avoid mismatched call exist in the pre/post call safety code. Renderable::preRenderNotice(); generateGeometry(); }
void generatedGeometryShouldBeConsistent() { // GIVEN Qt3DExtras::QCuboidGeometry geometry; const QVector<Qt3DRender::QAttribute *> attributes = geometry.attributes(); Qt3DRender::QAttribute *positionAttribute = geometry.positionAttribute(); Qt3DRender::QAttribute *normalAttribute = geometry.normalAttribute(); Qt3DRender::QAttribute *texCoordAttribute = geometry.texCoordAttribute(); Qt3DRender::QAttribute *tangentAttribute = geometry.tangentAttribute(); Qt3DRender::QAttribute *indexAttribute = geometry.indexAttribute(); // WHEN QFETCH(float, xExtent); QFETCH(float, yExtent); QFETCH(float, zExtent); QFETCH(QSize, xyMeshResolution); QFETCH(QSize, yzMeshResolution); QFETCH(QSize, xzMeshResolution); geometry.setXExtent(xExtent); geometry.setYExtent(yExtent); geometry.setZExtent(zExtent); geometry.setXYMeshResolution(xyMeshResolution); geometry.setYZMeshResolution(yzMeshResolution); geometry.setXZMeshResolution(xzMeshResolution); generateGeometry(geometry); // THEN // Check buffer of each attribute is valid and actually has some data for (const auto &attribute : attributes) { Qt3DRender::QBuffer *buffer = attribute->buffer(); QVERIFY(buffer != nullptr); QVERIFY(buffer->data().size() != 0); } // Check some data in the buffers // Check specific indices and vertex attributes of triangle under test QFETCH(int, triangleIndex); QFETCH(QVector<quint16>, indices); QFETCH(QVector<QVector3D>, positions); QFETCH(QVector<QVector3D>, normals); QFETCH(QVector<QVector2D>, texCoords); QFETCH(QVector<QVector4D>, tangents); int i = 0; for (auto index : indices) { const auto testIndex = extractIndexData<quint16>(indexAttribute, 3 * triangleIndex + i); QCOMPARE(testIndex, indices.at(i)); const auto position = extractVertexData<QVector3D, quint32>(positionAttribute, index); QCOMPARE(position, positions.at(i)); const auto normal = extractVertexData<QVector3D, quint32>(normalAttribute, index); QCOMPARE(normal, normals.at(i)); const auto texCoord = extractVertexData<QVector2D, quint32>(texCoordAttribute, index); QCOMPARE(texCoord, texCoords.at(i)); const auto tangent = extractVertexData<QVector4D, quint32>(tangentAttribute, index); QCOMPARE(tangent, tangents.at(i)); ++i; } }
FullscreenQuad::FullscreenQuad() { drawMode = GL_TRIANGLE_STRIP; generateGeometry(); setShader("postProcessing"); }
FullscreenQuad::FullscreenQuad(const char* name) { drawMode = GL_TRIANGLE_STRIP; generateGeometry(); setShader(name); }
bool Cylinder::changeRadius(float radius) { this->radius = radius; generateGeometry(); return true; }