Added fixes to STK to work with current irrlicht SVN. All changes

are in #ifdef IRR_SVN - and at this stage linking fails for atm unknown
reasons. No changes to irrlicht 1.5 compilation.


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@3811 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk
2009-08-05 12:45:11 +00:00
parent d46558fff4
commit c64608eec7
12 changed files with 96 additions and 2 deletions

View File

@@ -62,7 +62,7 @@ void IrrDriver::initDevice()
// ---- the first time, get a list of available video modes
if(firstTime)
{
m_device = createDevice(EDT_NULL);
m_device = createDevice(video::EDT_NULL);
video::IVideoModeList* modes = m_device->getVideoModeList();
const int count = modes->getVideoModeCount();
@@ -105,8 +105,13 @@ void IrrDriver::initDevice()
for(int bits=32; bits>15; bits -=8)
{
m_device = createDevice(type,
#ifdef IRR_SVN
core::dimension2d<u32>(UserConfigParams::m_width,
UserConfigParams::m_height ),
#else
core::dimension2d<s32>(UserConfigParams::m_width,
UserConfigParams::m_height ),
#endif
bits, //bits per pixel
UserConfigParams::m_fullscreen,
false, // stencil buffers
@@ -279,8 +284,13 @@ scene::ISceneNode *IrrDriver::addMesh(scene::IMesh *mesh)
* \param dimension The size of the texture.
* \param name Name of the texture.
*/
#ifdef IRR_SVN
void IrrDriver::beginRenderToTexture(const core::dimension2du &dimension,
const std::string &name)
#else
void IrrDriver::beginRenderToTexture(const core::dimension2di &dimension,
const std::string &name)
#endif
{
m_render_target_texture = m_video_driver->addRenderTargetTexture(dimension,
name.c_str());

View File

@@ -64,8 +64,13 @@ public:
/** Returns a list of all video modes supports by the graphics card. */
const std::vector<VideoMode>& getVideoModes() const { return m_modes; }
/** Returns the frame size. */
#ifdef IRR_SVN
const core::dimension2d<u32> getFrameSize() const
{ return m_video_driver->getCurrentRenderTargetSize(); }
#else
const core::dimension2d<s32> getFrameSize() const
{ return m_video_driver->getCurrentRenderTargetSize(); }
#endif
/** Returns the irrlicht device. */
IrrlichtDevice *getDevice() const { return m_device; }
/** Returns the irrlicht video driver. */
@@ -108,8 +113,13 @@ public:
void renderToTexture(ptr_vector<scene::IMesh, REF>& mesh,
std::vector<Vec3>& mesh_location,
video::ITexture* target, float angle);
#ifdef IRR_SVN
void beginRenderToTexture(const core::dimension2du &dimension,
const std::string &name);
#else
void beginRenderToTexture(const core::dimension2di &dimension,
const std::string &name);
#endif
video::ITexture *endRenderToTexture();
void draw2dTriangle(const core::vector2df &a, const core::vector2df &b,
const core::vector2df &c,

View File

@@ -27,7 +27,11 @@ static ModalDialog* modalWindow = NULL;
ModalDialog::ModalDialog(const float percentWidth, const float percentHeight)
{
#ifdef IRR_SVN
const core::dimension2d<u32>& frame_size = GUIEngine::getDriver()->getCurrentRenderTargetSize();
#else
const core::dimension2d<s32>& frame_size = GUIEngine::getDriver()->getCurrentRenderTargetSize();
#endif
const int w = (int)(frame_size.Width*percentWidth);
const int h = (int)(frame_size.Height*percentHeight);
m_area = core::rect< s32 >( position2d< s32 >(frame_size.Width/2 - w/2, frame_size.Height/2 - h/2),

View File

@@ -288,7 +288,11 @@ void Skin::drawBgImage()
source_area = core::rect<s32>(0, 0, texture_w, texture_h);
#ifdef IRR_SVN
core::dimension2d<u32> frame_size = GUIEngine::getDriver()->getCurrentRenderTargetSize();
#else
core::dimension2d<s32> frame_size = GUIEngine::getDriver()->getCurrentRenderTargetSize();
#endif
const int screen_w = frame_size.Width;
const int screen_h = frame_size.Height;
@@ -585,7 +589,11 @@ void Skin::drawRibbonChild(const core::rect< s32 > &rect, Widget* widget, const
// automatically guess from position on-screen if tabs go up or down
#ifdef IRR_SVN
const bool vertical_flip = (unsigned int)rect.UpperLeftCorner.Y < GUIEngine::getDriver()->getCurrentRenderTargetSize().Height/2;
#else
const bool vertical_flip = rect.UpperLeftCorner.Y < GUIEngine::getDriver()->getCurrentRenderTargetSize().Height/2;
#endif
params->vertical_flip = vertical_flip;
core::rect< s32 > rect2 = rect;

View File

@@ -136,7 +136,11 @@ void Widget::readCoords(Widget* parent)
unsigned int parent_w, parent_h, parent_x, parent_y;
if(parent == NULL)
{
#ifdef IRR_SVN
core::dimension2d<u32> frame_size = GUIEngine::getDriver()->getCurrentRenderTargetSize();
#else
core::dimension2d<s32> frame_size = GUIEngine::getDriver()->getCurrentRenderTargetSize();
#endif
parent_w = frame_size.Width;
parent_h = frame_size.Height;
parent_x = 0;
@@ -193,7 +197,11 @@ void Widget::readCoords(Widget* parent)
if(m_properties[PROP_TEXT].size() > 0)
{
IGUIFont* font = GUIEngine::getFont();
#ifdef IRR_SVN
core::dimension2d< u32 > dim = font->getDimension( stringw(m_properties[PROP_TEXT].c_str()).c_str() );
#else
core::dimension2d< s32 > dim = font->getDimension( stringw(m_properties[PROP_TEXT].c_str()).c_str() );
#endif
label_w = dim.Width;
// FIXME - won't work with multiline labels. thus, for now, when multiple
// lines are required, we need to specify a height explicitely

View File

@@ -53,8 +53,13 @@ void ModelViewWidget::add()
m_element->setTabStop(false);
std::string name = "model view "; name += m_properties[PROP_ID].c_str();
#ifdef IRR_SVN
m_texture = GUIEngine::getDriver()->addRenderTargetTexture( core::dimension2d< u32 >(512, 512), name.c_str() );
#else
m_texture = GUIEngine::getDriver()->addRenderTargetTexture( core::dimension2d< s32 >(512, 512), name.c_str() );
}
#endif
} // add
// -----------------------------------------------------------------------------
void ModelViewWidget::clearModels()
{

View File

@@ -410,7 +410,11 @@ void FileManager::listFiles(std::set<std::string>& result, const std::string& di
{
result.clear();
#ifdef IRR_SVN
std::string previous_cwd1 = std::string(m_file_system->getWorkingDirectory().c_str());
#else
std::string previous_cwd1 = m_file_system->getWorkingDirectory();
#endif
#ifdef WIN32
std::string path = is_full_path ? dir : m_root_dir+"/"+dir;
#else
@@ -423,7 +427,11 @@ void FileManager::listFiles(std::set<std::string>& result, const std::string& di
if(stat(path.c_str(), &mystat) < 0) return;
if(! S_ISDIR(mystat.st_mode)) return;
#ifdef IRR_SVN
std::string previous_cwd = std::string(m_file_system->getWorkingDirectory().c_str());
#else
std::string previous_cwd = m_file_system->getWorkingDirectory();
#endif
if(!m_file_system->changeWorkingDirectoryTo( path.c_str() ))
{
@@ -435,7 +443,11 @@ void FileManager::listFiles(std::set<std::string>& result, const std::string& di
for(int n=0; n<(int)files->getFileCount(); n++)
{
//printf("---- Entry : %s \n", (make_full_path ? path+"/"+ files->getFileName(n) : files->getFileName(n)).c_str());
#ifdef IRR_SVN
result.insert(make_full_path ? path+"/"+ files->getFileName(n).c_str() : files->getFileName(n).c_str());
#else
result.insert(make_full_path ? path+"/"+ files->getFileName(n) : files->getFileName(n));
#endif
}
m_file_system->changeWorkingDirectoryTo( previous_cwd.c_str() );

View File

@@ -77,9 +77,15 @@ void RaceGUI::createMarkerTexture()
while(npower2<n) npower2*=2;
int radius = (m_marker_rendered_size>>1)-1;
#ifdef IRR_SVN
irr_driver->beginRenderToTexture(core::dimension2du(m_marker_rendered_size * npower2,
m_marker_rendered_size),
"RaceGUI::markers");
#else
irr_driver->beginRenderToTexture(core::dimension2di(m_marker_rendered_size * npower2,
m_marker_rendered_size),
"RaceGUI::markers");
#endif
for(unsigned int i=0; i<race_manager->getNumKarts(); i++)
{
const std::string& kart_name = race_manager->getKartName(i);
@@ -179,6 +185,11 @@ void RaceGUI::drawMiniMap()
{
const Kart *kart = RaceManager::getKart(i);
if(kart->isEliminated()) continue; // don't draw eliminated kart
video::SMaterial m;
m.Thickness = 5;
irr_driver->getVideoDriver()->draw3DLine(kart->getXYZ().toIrrVector(),
core::vector3df(10, 10, 10));
const Vec3& xyz = kart->getXYZ();
Vec3 draw_at;
RaceManager::getTrack()->mapPoint2MiniMap(xyz, &draw_at);
@@ -382,7 +393,11 @@ void RaceGUI::drawSpeed(Kart* kart, int offset_x, int offset_y,
if(speed_ratio>1) speed_ratio = 1;
video::ITexture *bar_texture = m_speed_bar_icon->getTexture();
#ifdef IRR_SVN
core::dimension2du bar_size = bar_texture->getOriginalSize();
#else
core::dimension2di bar_size = bar_texture->getOriginalSize();
#endif
core::array<core::vector2di> tex_coords; // texture coordinates
core::array<core::vector2df> bar_vertices; // screen coordinates

View File

@@ -162,8 +162,13 @@ public:
const video::SColor &color=video::SColor(255, 255, 0, 255));
/** Returns the size of the texture on which to render the minimap to. */
#ifdef IRR_SVN
const core::dimension2du getMiniMapSize() const
{ return core::dimension2du(m_map_width, m_map_height); }
#else
const core::dimension2di getMiniMapSize() const
{ return core::dimension2di(m_map_width, m_map_height); }
#endif
};
#endif

View File

@@ -411,9 +411,15 @@ int QuadGraph::findOutOfRoadSector(const Vec3& xyz,
/** Draws the mini map on the screen.
* \param where the top left and lower right corner for the mini map.
*/
#ifdef IRR_SVN
video::ITexture *QuadGraph::makeMiniMap(const core::dimension2du &dimension,
const std::string &name,
const video::SColor &fill_color)
#else
video::ITexture *QuadGraph::makeMiniMap(const core::dimension2di &dimension,
const std::string &name,
const video::SColor &fill_color)
#endif
{
irr_driver->beginRenderToTexture(dimension, name);
createMesh();

View File

@@ -71,10 +71,17 @@ public:
const int curr_sector=UNKNOWN_SECTOR,
std::vector<int> *all_sectors=NULL
) const;
#ifdef IRR_SVN
video::ITexture *makeMiniMap(const core::dimension2du &where,
const std::string &name,
const video::SColor &fill_color
=video::SColor(127, 255, 255, 255) );
#else
video::ITexture *makeMiniMap(const core::dimension2di &where,
const std::string &name,
const video::SColor &fill_color
=video::SColor(127, 255, 255, 255) );
#endif
void mapPoint2MiniMap(const Vec3 &xyz, Vec3 *out) const;
/** Returns the number of nodes in the graph. */

View File

@@ -766,7 +766,11 @@ void Track::loadTrackModel()
if(m_use_fog)
{
#ifdef IRR_SVN
irr_driver->getVideoDriver()->setFog(m_fog_color, video::EFT_FOG_LINEAR, m_fog_start, m_fog_end, m_fog_density);
#else
irr_driver->getVideoDriver()->setFog(m_fog_color, true, m_fog_start, m_fog_end, m_fog_density);
#endif
}
// Note: the physics world for irrlicht is created in loadMainTrack