示例#1
0
LightScene::LightScene(vector<Particle*>* people, vector<Particle*>* hands)
: IScene(people, hands)
{
	const ofVec2f fogVerts[] = {
		ofVec2f(0.f, 0.f),
		ofVec2f(ofGetWidth(), 0.f),
		ofVec2f(ofGetWidth(), ofGetHeight()),
		ofVec2f(0.0f, ofGetHeight())
	};

	pPeople = people;
	pHandPositions = hands;

	//load all images 
	m_hexImgBorder.loadImage("LightScene/hex-02.png");
	m_hexImgInner.loadImage("LightScene/hex-03.png");
	m_lightImg.loadImage("LightScene/light.png");
	m_fogImg.loadImage("LightScene/fog.png");

	m_lights = vector<Light>();


	for(int i = 0; i < ofGetWidth(); i += m_lightImg.width){
		Light l = Light();
		l.isOn = false;
		l.x = i;
		m_lights.push_back(l);	
	}

	//create an image that holds is the length of the amount of lights. set pixel to white if light is on
	m_lightsOnTexture.allocate(m_lights.size(), 1, GL_LUMINANCE);
	m_lightsOnTexture.clear();
	m_lightsOnTexture.readToPixels(m_lightsOnPixels);

	//setting up shader for fog
	m_fogShader = ofShader();
	m_fogShader.load("LightScene/fog");
	m_fogVbo = ofVbo();
	m_fogVbo.setVertexData( &fogVerts[0], 4, GL_STATIC_DRAW);
	m_fogVbo.setTexCoordData(&s_fogTexCoords[0], 4, GL_STATIC_DRAW);
	m_fogInt = 0;

}
示例#2
0
//--------------------------------------------------------------
ofVboMesh::ofVboMesh(){
	vbo = ofVbo();
	meshElement = NULL;
	drawType = GL_STATIC_DRAW_ARB;
	bUseIndices = true;
}