moin,
example 2.Quake3Map .. without splitscreen have on start of this map 234fps .. with splitscreen 150fps .. gives a better way?
ok, my problem .. i want use a "radar-camera" which static camera to look at from above
picture1
.. user move an radar too .. user turn left or right and radar too. but it not correctly work
the radar follow the player but not display only form top (->picture1) and
have clipping errors ..
declare 2 cameras:
scene::ICameraSceneNode* camera[2] = {0,0};
define cameras:
//User-controlled
camera[1] = smgr->addCameraSceneNodeFPS();
//radar
camera[0] = smgr->addCameraSceneNode(
camera[1],
vector3df(0,50,0),
vector3df(0,0,0));
display 2 cameras:
driver->beginScene(true, true, video::SColor(0,100,100,100));
//Activate camera1
smgr->setActiveCamera(camera[0]);
//Set viewpoint to the second quarter (right top)
driver->setViewPort(rect<s32>(30,30,150,150));
//Draw scene
smgr->drawAll();
driver->setViewPort(rect<s32>(0,0,ResX,ResY));
//Activate camera2
smgr->setActiveCamera(camera[1]);
//Draw scene
smgr->drawAll();
driver->endScene();
additional: can i make a round radar camera? momentary it's a rectangle...
Splitscreen
Re: Splitscreen
i posted a wonderful solution to this, but the irrlicht forums ate my posting and then went down! what a waste..Ayanami wrote:additional: can i make a round radar camera? momentary it's a rectangle...
basically i said that instead of using a camera to make a radar you should just use 2d images like this
Code: Select all
//blt the circle background image of the radar
device->getVideoDriver()->draw2DImage(radar_background,radar_pos,radar_frame_size,NULL,irr::video::SColor(255,255,255,255),true);
// get a forward vector from the player model (or camera.. whatever)
vector3df forward( sin( player->getRotation().Y*PI/180.0f ), 0, cos( player->getRotation().Y*PI/180.0f ) );
forward.normalize(); // make it a unit vector
float scale = 0.1f; // convert from world to radar scale
//loop through all objects in the game world
curr = list.begin(); EOL = list.end();
while (curr != EOL) {
node = (*curr)->node; //get a pointer to the node (however you store it)
vector3df distance = (node->getPosition - player->getPosition); //this might be backwards
if (distance.magnitude() > 200) {
//object is too far away to be seen on the radar
curr++;
continue;
}
int x_dist = distance.dot(forward); // get the distance between the objects in the 'forward' direction
int y_dist = sqrt(distance.magnitude() - x_dist*x_dist);
posistion2d obj_pos(radar_pos.X - x_dist*scale,radar_pos.Y - y_dist*scale);
//blt obj
device->getVideoDriver()->draw2DImage(radar_obj,obj_pos,obj_frame_size,NULL,irr::video::SColor(255,255,255,255),true);
curr++
}
if you dont do something similar to RT's way, you're likely going to have problems with any level that has a ceiling.
if you take Natural Selection for instance, when you get in the commander's chair you see the level and people from top down-- this is possible because they actually keep TWO copies of the level-- one normal one, and one without ceilings. (actually, if they're smart its one level where all the 'ceiling' brushes are labeled with a special brush so they are not drawn from this view-- but you get the point)
also, the frame rate drop when using multiple viewports is to be expected: because its rendering the scene MULTIPLE TIMEs.. as many times as you have viewports. It even says so in the tutorial.
if you take Natural Selection for instance, when you get in the commander's chair you see the level and people from top down-- this is possible because they actually keep TWO copies of the level-- one normal one, and one without ceilings. (actually, if they're smart its one level where all the 'ceiling' brushes are labeled with a special brush so they are not drawn from this view-- but you get the point)
also, the frame rate drop when using multiple viewports is to be expected: because its rendering the scene MULTIPLE TIMEs.. as many times as you have viewports. It even says so in the tutorial.
a screen cap is worth 0x100000 DWORDS
you could use the difference in y values as an alpha fade so that nodes which are above or below the player will be faded out on the radar based on their distance away. or just clamp the radar to only show object which are within a specified delta y.keless wrote:if you dont do something similar to RT's way, you're likely going to have problems with any level that has a ceiling.