Esempio n. 1
0
osg::Camera* OculusDevice::createRTTCamera(osg::Texture* texture, OculusDevice::Eye eye, osg::Transform::ReferenceFrame referenceFrame, osg::GraphicsContext* gc) const
{
	osg::ref_ptr<osg::Camera> camera = new osg::Camera;
	camera->setClearColor(osg::Vec4(0.2f, 0.2f, 0.4f, 1.0f));
	camera->setClearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	camera->setDrawBuffer(GL_FRONT);
	camera->setReadBuffer(GL_FRONT);
	camera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);
	camera->setRenderOrder(osg::Camera::PRE_RENDER, renderOrder(eye));
	camera->setAllowEventFocus(false);
	camera->setReferenceFrame(referenceFrame);

	if (gc) {
		camera->setGraphicsContext(gc);
	}

	if (texture) {
		texture->setFilter(osg::Texture2D::MIN_FILTER, osg::Texture2D::LINEAR);
		texture->setFilter(osg::Texture2D::MAG_FILTER, osg::Texture2D::LINEAR);
		camera->setViewport(0, 0, texture->getTextureWidth(), texture->getTextureHeight());
		camera->attach(osg::Camera::COLOR_BUFFER, texture, 0, 0, false, 4, 4);
	}

	return camera.release();
}
Esempio n. 2
0
int j1Map::LoadMapInfo()
{
	//Set consistency later
		map.height = map_file.child("map").attribute("height").as_int();
		map.width = map_file.child("map").attribute("width").as_int();
		map.tileWidth = map_file.child("map").attribute("tilewidth").as_int();
		map.tileHeigth = map_file.child("map").attribute("tileheight").as_int();
		map.nextObjectId = map_file.child("map").attribute("nextObjectId").as_int();
		map.widthPx = map_file.child("map").child("tileset").child("image").attribute("width").as_int();
		map.heightPx = map_file.child("map").child("tileset").child("image").attribute("height").as_int();
		
		LOG("Orientation: %s",map_file.child("map").attribute("orientation").as_string());

		p2SString orientation(map_file.child("map").attribute("orientation").as_string());
		p2SString renderOrder(map_file.child("map").attribute("renderorder").as_string());


		if (orientation == "orthogonal")
		{
			map.orient = ORTHOGONAL;
		}
		else if (orientation == "isometric")
		{
			map.orient = ISOMETRIC;
		}

		if (renderOrder == "right-down")
		{
			map.render = RIGHTDOWN;
		}

		map.numTileSets = map_file.child("map").attribute("numTileSets").as_int();
		map.numLayers = map_file.child("map").attribute("numLayers").as_int();

	return map.numTileSets;
}