//--------------------------------------------------------------
void ofVboByteColor::clear(){
	clearVertices();
	clearNormals();
	clearColors();
	clearTexCoords();
	clearIndices();
}
示例#2
0
void ofVbo::clearAttribute(int attributePos_){

	if (!hasAttribute(attributePos_)) return;
	
	if (ofIsGLProgrammableRenderer()) {
		if(attributePos_>3){
			customAttributes.erase(attributePos_);
		}else{
			switch (attributePos_){
				case ofShader::POSITION_ATTRIBUTE:
					clearVertices();
					break;
				case ofShader::COLOR_ATTRIBUTE:
					clearColors();
					break;
				case ofShader::NORMAL_ATTRIBUTE:
					clearNormals();
					break;
				case ofShader::TEXCOORD_ATTRIBUTE:
					clearTexCoords();
					break;
				default:
					break;
			}
		}
	}else{
		customAttributes.erase(attributePos_);
	}
}
示例#3
0
void Cursor::onUpdateVertexCache()
{
	clearVertices();

	std::vector<sf::Vertex> vertices;

	// pos coords.
	sf::Vector2f tl(myCursorTransform.getTransform().transformPoint(sf::Vector2f(0,0)));
	sf::Vector2f tr(myCursorTransform.getTransform().transformPoint(sf::Vector2f(getTextureRect().width,0)));
	sf::Vector2f br(myCursorTransform.getTransform().transformPoint(sf::Vector2f(getTextureRect().width,getTextureRect().height)));
	sf::Vector2f bl(myCursorTransform.getTransform().transformPoint(sf::Vector2f(0,getTextureRect().height)));

	// tex coords.
	sf::Vector2f ttl(getTextureRect().left, getTextureRect().top);
	sf::Vector2f tbr(getTextureRect().left + getTextureRect().width, getTextureRect().top + getTextureRect().height);
	sf::Vector2f ttr(tbr.x, ttl.y);
	sf::Vector2f tbl(ttl.x, tbr.y);

	// add vertices.
	vertices.push_back(sf::Vertex(tl, sf::Color::White, ttl));
	vertices.push_back(sf::Vertex(tr, sf::Color::White, ttr));
	vertices.push_back(sf::Vertex(bl, sf::Color::White, tbl));
	vertices.push_back(sf::Vertex(tr, sf::Color::White, ttr));
	vertices.push_back(sf::Vertex(br, sf::Color::White, tbr));
	vertices.push_back(sf::Vertex(bl, sf::Color::White, tbl));

	vertexAddTextured(vertices);
}
示例#4
0
//--------------------------------------------------------------
void ofVbo::clear(){

	// clear all fixed function attributes
	
	clearVertices();
	clearColors();
	clearNormals();
	clearTexCoords();
	
	// we're not using any of these.
	bUsingVerts = false;
	bUsingColors = false;
	bUsingNormals = false;
	bUsingTexCoords = false;

	// clear all custom attributes.
	customAttributes.clear();
	
	clearIndices();
	if(vaoID!=0){
		releaseVAO(vaoID);
		vaoID=0;
	}
	#if defined(TARGET_ANDROID) || defined(TARGET_OF_IOS)
		unregisterVbo(this);
	#endif
}
示例#5
0
//--------------------------------------------------------------
void ofVbo::clear(){
	clearVertices();
	clearNormals();
	clearColors();
	clearTexCoords();
	clearIndices();
	if(supportVAOs && vaoID!=0){
		releaseVAO(vaoID);
		vaoID=0;
	}
	bAllocated		= false;
	#if defined(TARGET_ANDROID) || defined(TARGET_OF_IOS)
		unregisterVbo(this);
	#endif
}
示例#6
0
void OpenGLSPropRenderer::render(const Math::Vector3d position, float direction) {
	if (_faceVBO == -1) {
		// Update the OpenGL Buffer Objects if required
		clearVertices();
		uploadVertices();
	}

	_gfx->set3DMode();

	Math::Matrix4 model = getModelMatrix(position, direction);
	Math::Matrix4 view = StarkScene->getViewMatrix();
	Math::Matrix4 projection = StarkScene->getProjectionMatrix();

	Math::Matrix4 mvp = projection * view * model;
	mvp.transpose();

	_shader->use(true);
	_shader->setUniform("mvp", mvp);

	const Common::Array<Formats::BiffMesh::Face> &faces = _model->getFaces();
	const Common::Array<Formats::BiffMesh::Material> &materials = _model->getMaterials();

	for (Common::Array<Formats::BiffMesh::Face>::const_iterator face = faces.begin(); face != faces.end(); ++face) {
		const Formats::BiffMesh::Material &material = materials[face->materialId];

		// For each face draw its vertices from the VBO, indexed by the EBO
		const Gfx::Texture *tex = _texture->getTexture(material.texture);
		if (tex) {
			tex->bind();
		} else {
			glBindTexture(GL_TEXTURE_2D, 0);
		}

		GLuint ebo = _faceEBO[face];

		_shader->enableVertexAttribute("position", _faceVBO, 3, GL_FLOAT, GL_FALSE, 9 * sizeof(float), 0);
		_shader->enableVertexAttribute("normal", _faceVBO, 3, GL_FLOAT, GL_FALSE, 9 * sizeof(float), 12);
		_shader->enableVertexAttribute("texcoord", _faceVBO, 3, GL_FLOAT, GL_FALSE, 9 * sizeof(float), 24);
		_shader->use(true);
		_shader->setUniform("textured", tex != nullptr);
		_shader->setUniform("color", Math::Vector3d(material.r, material.g, material.b));

		glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ebo);
		glDrawElements(GL_TRIANGLES, face->vertexIndices.size(), GL_UNSIGNED_INT, 0);

		glUseProgram(0);
	}
}
示例#7
0
void Menu::onUpdateVertexCache()
{
	clearVertices();

	BoxStyle backgroundBox;
	backgroundBox.pressed = true;
	backgroundBox.focused = true;
	vertexAddBox(BoxTypeDark, backgroundBox);

	if (myMouseOverItem != -1 && myModel && myModel->isEnabled(myMouseOverItem) && !myModel->isSeparator(myMouseOverItem))
	{
		BoxStyle highlightBox;
		highlightBox.color = sf::Color(125, 175, 225);
		highlightBox.outlineColor = highlightBox.color * sf::Color(200,200,200);
		highlightBox.pressed = isMouseDown();
		vertexAddBox(sf::FloatRect(cvPadding, myTexts[myMouseOverItem]->getPosition().y - cvPadding, getSize().x - cvPadding * 2.f, cvItemHeight + cvPadding), BoxTypeBasic, highlightBox);
	}

	BoxStyle checkBox;
	checkBox.activated = true;

	for (std::size_t i = 0; i < myModel->getItemCount(); ++i)
	{
		if (myModel->isSeparator(i))
		{
			vertexAddRectVGradient(sf::FloatRect(cvPadding * 2.f, myTexts[i]->getPosition().y, getSize().x - cvPadding * 4.f, cvPadding), sf::Color(180,180,180), sf::Color(120,120,120));
		}
		else
		{
			if (myModel->isChecked(i))
			{
				float checkboxSize = 14.f;
				checkBox.hovered = (myMouseOverItem == (int)i);
				vertexAddBox(sf::FloatRect(3.f * cvPadding, myTexts[i]->getPosition().y + (cvItemHeight - checkboxSize - cvPadding) / 2.f, checkboxSize, checkboxSize), BoxTypeBasic, checkBox);
			}

			vertexAddTextured(myTexts[i]->getVertices());
		}
	}
}
示例#8
0
//--------------------------------------------------------------
void ofVbo::clear(){

	// clear all fixed function attributes
	
	clearVertices();
	clearColors();
	clearNormals();
	clearTexCoords();
	
	// we're not using any of these.
	bUsingVerts = false;
	bUsingColors = false;
	bUsingNormals = false;
	bUsingTexCoords = false;

	// clear all custom attributes.
	customAttributes.clear();
	
	clearIndices();
	if(vaoID!=0){
		releaseVAO(vaoID);
		vaoID=0;
	}
}
示例#9
0
OpenGLSPropRenderer::~OpenGLSPropRenderer() {
	clearVertices();

	delete _shader;
}
示例#10
0
 StreamVertexBuffer::~StreamVertexBuffer()
 {
     clearVertices();
     _destroy();
 }
示例#11
0
void Model::makeBall(float radius, size_t step, size_t rstep, const glm::vec3 &center) {
    clearVertices();
    clearIndices();
    setPrimitive(GLTriangles);
    addBall(radius, step, rstep, center);
}
示例#12
0
void Model::makeBox(const glm::vec3 &size, const glm::vec3 &center, const glm::vec4 &texRect) {
    clearVertices();
    clearIndices();
    setPrimitive(GLTriangles);
    addBox(size, center, texRect);
}
示例#13
0
void Model::makePlane(const glm::vec3 &a, const glm::vec3 &b, const glm::vec3 &c, const glm::vec4 &texRect) {
    clearVertices();
    clearIndices();
    setPrimitive(GLTriangles);
    addPlane(a, b, c, texRect);
}
示例#14
0
 void                clear               (void)                          { m_isInMemory = true; clearVertices(); clearSubmeshes(); }