Hi !
I have been looking for a code snipet on how to make a minimap that displays the terrain and the position of the player on it, but all in vain
So if you have any idea or anything that could help me, I would be very grateful
Minimap !!
Re: Minimap !!
i typed mipmap into the search and it came up with pages of stuff....
Live long and phosphor!
-- https://github.com/netpipe/Luna Game Engine Status 95%
-- https://github.com/netpipe/Luna Game Engine Status 95%
Re: Minimap !!
Here was asked about minimap not mipmap
st0ph,
obvious and most slow method would be create render target texture, add camera above the player, attach it to the player, make it look strait down and render every frame additional frame into that texture from that camera and display that texture as minimap.
st0ph,
obvious and most slow method would be create render target texture, add camera above the player, attach it to the player, make it look strait down and render every frame additional frame into that texture from that camera and display that texture as minimap.
-
- Posts: 26
- Joined: Wed Oct 10, 2012 1:28 am
Re: Minimap !!
While rendering the full scene twice per frame to get a minimap may be prohibitive, what about rendering a proxy scene? Slap your ground texture, or a prerendered image of all static geometry, or an image created with a single render-to-texture call when the map cell the player is in changes, onto a simple 2 poly square in a separate render space. Then use some kind of marker pips (single polygon acute triangles could work fine, showing direction as well) and move them according to the things tracked.
Re: Minimap !!
Using the this example :http://irrlicht.sourceforge.net/docu/example013.html I created this class
and the implementation :
but when I run the app, it renders very slowly why ?
Code: Select all
#pragma once
#include <iostream>
namespace irr
{
class IrrlichtDevice;
namespace scene
{
class ICameraSceneNode;
class IAnimatedMeshSceneNode;
}
namespace video
{
class ITexture;
}
}
class Minimap
{
public:
Minimap(irr::IrrlichtDevice *device);
~Minimap(void);
void setCamera(irr::scene::ICameraSceneNode* camera);
void createMap();
void displayMap();
private:
irr::IrrlichtDevice* device;
irr::video::ITexture* tMap;
irr::scene::ICameraSceneNode* camera1;
irr::scene::ICameraSceneNode* camera2;
};
and the implementation :
Code: Select all
#include "Minimap.h"
#include <IrrlichtDevice.h>
#include <ITexture.h>
#include <ISceneManager.h>
Minimap::Minimap(irr::IrrlichtDevice *device)
{
this->device = device;
camera1 = device->getSceneManager()->getActiveCamera();
if (device->getVideoDriver()->queryFeature(irr::video::EVDF_RENDER_TO_TARGET))
{
tMap = device->getVideoDriver()->addRenderTargetTexture(irr::core::dimension2d<irr::u32>(200,200), "RTT1");
// add fixed camera
camera2 = device->getSceneManager()->addCameraSceneNode(0, irr::core::vector3df(10,10,-80),
irr::core::vector3df(-10,10,-100));
//device->getSceneManager()->setActiveCamera(camera1);
}
else
{
}
}
Minimap::~Minimap(void)
{
}
void Minimap::setCamera(irr::scene::ICameraSceneNode* camera)
{
camera2 = camera;
}
void Minimap::createMap()
{
// draw scene into render target
// set render target texture
device->getVideoDriver()->setRenderTarget(tMap);
device->getSceneManager()->setActiveCamera(camera2);
// draw whole scene into render buffer
device->getSceneManager()->drawAll();
// set back old render target
// The buffer might have been distorted, so clear it
device->getVideoDriver()->setRenderTarget(0, true, true, 0);
device->getSceneManager()->setActiveCamera(camera1);
}
void Minimap::displayMap()
{
device->getVideoDriver()->draw2DImage(tMap, irr::core::position2d<irr::s32>(50,50), //position to draw the minimap on screen
irr::core::rect<irr::s32>(0,0,200,200), 0,
irr::video::SColor(255,255,255,255), true);
}
Re: Minimap !!
have you seen my thread about minimap with Render to Texture?
http://irrlicht.sourceforge.net/forum/v ... =9&t=46759
http://irrlicht.sourceforge.net/forum/v ... =9&t=46759
Re: Minimap !!
@zprg that exactly what I've used, but as I said it's realy slow