Merge remote-tracking branch 'origin/master' into new_login

This commit is contained in:
hiker 2014-05-16 14:21:13 +10:00
commit 71603816fa
13 changed files with 126 additions and 72 deletions

View File

@ -16,7 +16,7 @@
<spacer height="4" width="10" />
-->
<div layout="horizontal-row" width="100%" height="fit">
<div layout="horizontal-row" width="100%" proportion="1">
<checkbox id="dynamiclight"/>
<spacer width="10" height="10"/>
<label text="Advanced pipeline (lights, etc.)" I18N="Video settings"/>
@ -24,7 +24,7 @@
<spacer height="4" width="10" />
<div layout="horizontal-row" width="100%" height="fit">
<div layout="horizontal-row" width="100%" proportion="1">
<spacer width="70" height="10" />
<label text="Shadows" I18N="Video settings"/>
<spacer width="10" height="10"/>
@ -33,7 +33,7 @@
<spacer height="4" width="10" />
<div layout="horizontal-row" width="100%" height="fit">
<div layout="horizontal-row" width="100%" proportion="1">
<spacer width="70" height="10"/>
<div layout="horizontal-row" proportion="1" height="fit">
@ -53,7 +53,7 @@
<spacer height="4" width="10" />
<div layout="horizontal-row" width="100%" height="fit">
<div layout="horizontal-row" width="100%" proportion="1">
<spacer width="70" height="10"/>
<checkbox id="ssao"/>
<spacer width="10" height="10"/>
@ -62,7 +62,7 @@
<spacer height="20" width="10" />
<div layout="horizontal-row" width="100%" height="fit">
<div layout="horizontal-row" width="100%" proportion="1">
<div layout="horizontal-row" proportion="1" height="fit">
<checkbox id="motionblur"/>
<spacer width="10" height="10"/>
@ -80,7 +80,7 @@
<spacer height="4" width="10" />
<div layout="horizontal-row" width="100%" height="fit">
<div layout="horizontal-row" width="100%" proportion="1">
<div layout="horizontal-row" proportion="1" height="fit">
<checkbox id="glow"/>
<spacer width="10" height="10"/>
@ -98,7 +98,7 @@
<spacer height="4" width="10" />
<div layout="horizontal-row" width="100%" height="fit">
<div layout="horizontal-row" width="100%" proportion="1">
<div layout="horizontal-row" proportion="1" height="fit">
<checkbox id="weather_gfx"/>
<spacer width="10" height="10"/>
@ -116,7 +116,7 @@
<spacer height="4" width="10" />
<div layout="horizontal-row" width="100%" height="fit">
<div layout="horizontal-row" width="100%" proportion="1">
<div layout="horizontal-row" proportion="1" height="fit">
<checkbox id="ubo"/>
<spacer width="10" height="10"/>
@ -134,7 +134,7 @@
<spacer height="4" width="10" />
<div layout="horizontal-row" width="100%" height="fit">
<div layout="horizontal-row" width="100%" proportion="1">
<div layout="horizontal-row" proportion="1" height="fit">
<checkbox id="hd-textures"/>
<spacer width="10" height="10"/>
@ -153,7 +153,7 @@
<spacer height="20" width="10" />
<div layout="horizontal-row" width="100%" height="fit">
<div layout="horizontal-row" width="100%" proportion="1">
<label text="Animated Characters" I18N="Video settings" width="40%"/>
<spacer width="10" height="10"/>
<gauge id="steering_animations" min_value="0" max_value="2" width="50%" />
@ -161,7 +161,7 @@
<spacer height="4" width="10" />
<div layout="horizontal-row" width="100%" height="fit">
<div layout="horizontal-row" width="100%" proportion="1">
<label text="Texture filtering" I18N="Video settings" width="40%"/>
<spacer width="10" height="10"/>
<gauge id="filtering" min_value="0" max_value="5" width="50%" />

View File

@ -195,7 +195,7 @@ void ParticleSystemProxy::generateParticlesFromBoxEmitter(scene::IParticleBoxEmi
memcpy(&(initialvalue[i].PositionX), &(particles[i].PositionX), 3 * sizeof(float));
generateLifetimeSizeDirection(emitter, initialvalue[i].Lifetime, initialvalue[i].Size,
initialvalue[i].DirectionX, initialvalue[i].DirectionY, initialvalue[i].DirectionZ);
memcpy(&(particles[i].DirectionX), &(initialvalue[i].DirectionZ), 4 * sizeof(float));
memcpy(&(particles[i].DirectionX), &(initialvalue[i].DirectionX), 4 * sizeof(float));
}
glBindBuffer(GL_ARRAY_BUFFER, initial_values_buffer);
glBufferData(GL_ARRAY_BUFFER, count * sizeof(ParticleData), initialvalue, GL_STREAM_DRAW);

View File

@ -112,6 +112,7 @@ IrrDriver::IrrDriver()
m_wind = new Wind();
m_mipviz = m_wireframe = m_normals = m_ssaoviz = \
m_lightviz = m_shadowviz = m_distortviz = 0;
SkyboxCubeMap = 0;
} // IrrDriver
// ----------------------------------------------------------------------------

View File

@ -50,8 +50,6 @@
#include <algorithm>
STKInstancedSceneNode *InstancedBox = 0;
#define MAX2(a, b) ((a) > (b) ? (a) : (b))
#define MIN2(a, b) ((a) > (b) ? (b) : (a))
@ -686,7 +684,7 @@ void IrrDriver::computeCameraMatrix(scene::ICameraSceneNode * const camnode)
glBindBuffer(GL_UNIFORM_BUFFER, SharedObject::ViewProjectionMatrixesUBO);
glBufferSubData(GL_UNIFORM_BUFFER, 0, 16 * 8 * sizeof(float), tmp);
delete tmp;
delete []tmp;
}
void IrrDriver::renderShadows()

View File

@ -8,6 +8,9 @@ STKInstancedSceneNode::STKInstancedSceneNode(irr::scene::IMesh* mesh, ISceneNode
const irr::core::vector3df& scale) :
CMeshSceneNode(mesh, parent, mgr, id, position, rotation, scale)
{
m_ref_count = 0;
irr_driver->grabAllTextures(mesh);
if (irr_driver->isGLSL())
{
createGLMeshes();
@ -42,6 +45,9 @@ void STKInstancedSceneNode::cleanGL()
STKInstancedSceneNode::~STKInstancedSceneNode()
{
irr_driver->dropAllTextures(getMesh());
irr_driver->removeMeshFromCache(getMesh());
if (irr_driver->isGLSL())
cleanGL();
}

View File

@ -2,10 +2,12 @@
#define STKINSTANCEDSCENENODE_HPP
#include "stkmesh.hpp"
#include "utils/leak_check.hpp"
class STKInstancedSceneNode : public irr::scene::CMeshSceneNode
{
protected:
int m_ref_count;
std::vector<GLMesh *> GeometricMesh[FPSM_COUNT];
std::vector<GLMesh *> ShadedMesh[SM_COUNT];
std::vector<GLMesh> GLmeshes;
@ -26,6 +28,18 @@ public:
~STKInstancedSceneNode();
virtual void render();
void addInstance(const core::vector3df &origin, const core::vector3df &orientation, const core::vector3df &scale);
void instanceGrab() { m_ref_count++; }
void instanceDrop()
{
m_ref_count--;
if (m_ref_count <= 0)
{
delete this;
}
}
LEAK_CHECK();
};
#endif

View File

@ -35,7 +35,7 @@ public:
const irr::core::vector3df& scale = irr::core::vector3df(1.0f, 1.0f, 1.0f));
virtual void render();
virtual void setMesh(irr::scene::IMesh* mesh);
~STKMeshSceneNode();
virtual ~STKMeshSceneNode();
};
#endif

View File

@ -894,7 +894,7 @@ int handleCmdLine()
}
} // --laps
if(CommandLine::has("--profile-laps=", &n))
if(CommandLine::has("--profile-laps", &n))
{
if (n < 0)
{

View File

@ -27,6 +27,9 @@
#include <ISceneManager.h>
#include <iomanip>
#include <iostream>
ProfileWorld::ProfileType ProfileWorld::m_profile_mode=PROFILE_NONE;
int ProfileWorld::m_num_laps = 0;
float ProfileWorld::m_time = 0.0f;
@ -197,30 +200,30 @@ void ProfileWorld::enterRaceOverState()
// Print framerate statistics
float runtime = (irr_driver->getRealTime()-m_start_time)*0.001f;
printf("Number of frames: %d time %f, Average FPS: %f\n",
m_frame_count, runtime, (float)m_frame_count/runtime);
Log::verbose("profile", "Number of frames: %d time %f, Average FPS: %f",
m_frame_count, runtime, (float)m_frame_count/runtime);
// Print geometry statistics if we're not in no-graphics mode
if(!m_no_graphics)
{
printf("Average # drawn nodes %f k\n",
(float)m_num_triangles/m_frame_count);
printf("Average # culled nodes: %f k\n",
(float)m_num_culls/m_frame_count);
printf("Average # solid nodes: %f k\n",
(float)m_num_solid/m_frame_count);
printf("Average # transparent nodes: %f\n",
(float)m_num_transparent/m_frame_count);
printf("Average # transp. effect nodes: %f\n",
(float)m_num_trans_effect/m_frame_count);
Log::verbose("profile", "Average # drawn nodes %f k",
(float)m_num_triangles/m_frame_count);
Log::verbose("profile", "Average # culled nodes: %f k",
(float)m_num_culls/m_frame_count);
Log::verbose("profile", "Average # solid nodes: %f k",
(float)m_num_solid/m_frame_count);
Log::verbose("profile", "Average # transparent nodes: %f",
(float)m_num_transparent/m_frame_count);
Log::verbose("profile", "Average # transp. effect nodes: %f",
(float)m_num_trans_effect/m_frame_count);
}
// Print race statistics for each individual kart
float min_t=999999.9f, max_t=0.0, av_t=0.0;
printf("name,start_position,end_position,time,average_speed,top_speed,"
"skid_time,rescue_time,rescue_count,brake_count,"
"explosion_time,explosion_count,bonus_count,banana_count,"
"small_nitro_count,large_nitro_count,bubblegum_count\n");
Log::verbose("profile", "name start_position end_position time average_speed top_speed "
"skid_time rescue_time rescue_count brake_count "
"explosion_time explosion_count bonus_count banana_count "
"small_nitro_count large_nitro_count bubblegum_count");
std::set<std::string> all_groups;
@ -231,25 +234,29 @@ void ProfileWorld::enterRaceOverState()
max_t = std::max(max_t, kart->getFinishTime());
min_t = std::min(min_t, kart->getFinishTime());
av_t += kart->getFinishTime();
printf("%s %s,", kart->getIdent().c_str(),
kart->getController()->getControllerName().c_str());
std::ostringstream ss;
ss << kart->getIdent() << " "
<< kart->getController()->getControllerName() << " ";
ss << 1+(int)i << " " << kart->getPosition() << " "
<< kart->getFinishTime() << " ";
all_groups.insert(kart->getController()->getControllerName());
printf("%d,%d,%4.2f,", 1 + (int)i, kart->getPosition(), kart->getFinishTime());
float distance = (float)(m_profile_mode==PROFILE_LAPS
? race_manager->getNumLaps() : 1);
distance *= m_track->getTrackLength();
printf("%4.2f,%3.2f,%4.2f,%4.2f,%d,%d,%4.2f,%d,%d,%d,%d,%d,%d,%d\n",
distance/kart->getFinishTime(), kart->getTopSpeed(),
kart->getSkiddingTime(), kart->getRescueTime(),
kart->getRescueCount(), kart->getBrakeCount(),
kart->getExplosionTime(), kart->getExplosionCount(),
kart->getBonusCount(), kart->getBananaCount(),
kart->getSmallNitroCount(), kart->getLargeNitroCount(),
kart->getBubblegumCount(), kart->getOffTrackCount() );
ss << distance/kart->getFinishTime() << " " << kart->getTopSpeed() << " ";
ss << kart->getSkiddingTime() << " " << kart->getRescueTime() << " ";
ss << kart->getRescueCount() << " " << kart->getBrakeCount() << " ";
ss << kart->getExplosionTime() << " " << kart->getExplosionCount() << " ";
ss << kart->getBonusCount() << " " << kart->getBananaCount() << " ";
ss << kart->getSmallNitroCount() << " " << kart->getLargeNitroCount() << " ";
ss << kart->getBubblegumCount() << " " << kart->getOffTrackCount() << " ";
Log::verbose("profile", ss.str().c_str());
}
// Print group statistics of all karts
printf("min %f max %f av %f\n",min_t, max_t, av_t/m_karts.size());
Log::verbose("profile", "min %f max %f av %f\n",
min_t, max_t, av_t/m_karts.size());
// Determine maximum length of group name
unsigned int max_len=4; // for 'name' heading
@ -260,11 +267,11 @@ void ProfileWorld::enterRaceOverState()
}
max_len++; // increase by 1 for one additional space after the name
printf("\nname");
for(unsigned int j=4; j<max_len; j++)
printf(" ");
printf("Strt End Time AvSp Top Skid Resc Rsc Brake Expl Exp Itm Ban SNitLNit Bub Off\n");
std::ostringstream ss;
Log::verbose("profile", "");
ss << "name" << std::setw(max_len-4) << " "
<< "Strt End Time AvSp Top Skid Resc Rsc Brake Expl Exp Itm Ban SNitLNit Bub Off";
Log::verbose("profile", ss.str().c_str());
for(std::set<std::string>::iterator it = all_groups.begin();
it !=all_groups.end(); it++)
{
@ -281,19 +288,22 @@ void ProfileWorld::enterRaceOverState()
if(name!=*it)
continue;
count ++;
printf("%s", name.c_str());
for(unsigned int j=name.size(); j<max_len; j++)
printf(" ");
printf("%4d %3d %6.2f ", 1 + i, kart->getPosition(),
kart->getFinishTime());
std::ostringstream ss;
ss.setf(std::ios::fixed, std::ios::floatfield);
ss.precision(2);
ss << name << std::setw(max_len-name.size()) << " ";
ss << std::setw(4) << 1 + i
<< std::setw(4) << kart->getPosition()
<< std::setw(7) << kart->getFinishTime();
position_gain += 1+i - kart->getPosition();
float distance = (float)(m_profile_mode==PROFILE_LAPS
? race_manager->getNumLaps() : 1);
distance *= m_track->getTrackLength();
printf(" %4.2f %3.2f %6.2f %4.2f %3d %5d %4.2f %3d %3d %3d %3d %3d %3d %5d\n",
distance/kart->getFinishTime(),
Log::verbose("profile",
"%s %4.2f %3.2f %6.2f %4.2f %3d %5d %4.2f %3d %3d %3d %3d %3d %3d %5d",
ss.str().c_str(), distance/kart->getFinishTime(),
kart->getTopSpeed(),
kart->getSkiddingTime(), kart->getRescueTime(),
kart->getRescueCount(), kart->getBrakeCount(),
@ -302,7 +312,7 @@ void ProfileWorld::enterRaceOverState()
kart->getSmallNitroCount(), kart->getLargeNitroCount(),
kart->getBubblegumCount(), kart->getOffTrackCount()
);
printf("nitro %f\n", kart->getEnergy());
Log::verbose("profile", "nitro %f\n", kart->getEnergy());
av_time += kart->getFinishTime();
skidding_time += kart->getSkiddingTime();
rescue_time += kart->getRescueTime();
@ -317,18 +327,21 @@ void ProfileWorld::enterRaceOverState()
expl_count += kart->getExplosionCount();
off_track_count += kart->getOffTrackCount();
} // for i < m_karts.size
for(unsigned int j=0; j<max_len + 85; j++)
printf("-");
printf("\n%s", it->c_str());
for(unsigned int j=it->size(); j<max_len; j++)
printf(" ");
printf("%+4d %6.2f %13s", position_gain, av_time/count, "");
Log::verbose("profile", std::string(max_len+85, '-').c_str());
ss.clear();
ss.str("");
ss << *it << std::string(max_len-it->size(),' ');
ss << std::showpos << std::setw(4) << position_gain
<< std::noshowpos << std::setw(13) << av_time/count
<< std::string(11,' ');
printf("%6.2f %4.2f %3d %5d %4.2f %3d %3d %3d %3d %3d %3d %5d\n\n",
skidding_time/count, rescue_time/count, rescue_count,
brake_count, expl_time, expl_count, bonus_count,
Log::verbose("profile", "%s%6.2f %4.2f %3d %5d %4.2f %3d %3d %3d %3d %3d %3d %5d",
ss.str().c_str(), skidding_time/count, rescue_time/count,
rescue_count,brake_count, expl_time, expl_count, bonus_count,
banana_count, s_nitro_count, l_nitro_count, bubble_count,
off_track_count);
Log::verbose("profile", "");
} // for it !=all_groups.end
delete this;
main_loop->abort();

View File

@ -136,6 +136,7 @@ STKInstancedSceneNode* ModelDefinitionLoader::instanciate(const irr::core::vecto
}
m_instancing_nodes[name]->addInstance(position, rotation, scale);
m_instancing_nodes[name]->instanceGrab();
return m_instancing_nodes[name];
}

View File

@ -162,6 +162,7 @@ TrackObjectPresentationInstancing::TrackObjectPresentationInstancing(const XMLNo
ModelDefinitionLoader& model_def_loader) : TrackObjectPresentationSceneNode(xml_node)
{
m_instancing_group = NULL;
m_fallback_scene_node = NULL;
std::string instancing_model;
xml_node.get("instancing_model", &instancing_model);
@ -179,13 +180,32 @@ TrackObjectPresentationInstancing::TrackObjectPresentationInstancing(const XMLNo
}
else
{
m_instancing_group = new STKInstancedSceneNode(model_def_loader.getFirstMeshFor(instancing_model),
m_node, irr_driver->getSceneManager(), -1);
scene::IMesh* mesh = model_def_loader.getFirstMeshFor(instancing_model);
scene::IMeshSceneNode* node = irr_driver->addMesh(mesh, m_node);
node->grab();
irr_driver->grabAllTextures(mesh);
mesh->grab();
World::getWorld()->getTrack()->addNode(node);
m_fallback_scene_node = node;
}
}
TrackObjectPresentationInstancing::~TrackObjectPresentationInstancing()
{
if (m_instancing_group != NULL)
m_instancing_group->instanceDrop();
if (m_fallback_scene_node != NULL)
{
scene::IMesh* mesh = m_fallback_scene_node->getMesh();
irr_driver->dropAllTextures(mesh);
mesh->drop();
if (mesh->getReferenceCount() == 1)
irr_driver->removeMeshFromCache(mesh);
m_fallback_scene_node->drop();
}
}
// ----------------------------------------------------------------------------

View File

@ -24,7 +24,7 @@
#include <IAnimatedMeshSceneNode.h>
namespace irr
{
namespace scene { class IAnimatedMesh; class ISceneNode; }
namespace scene { class IAnimatedMesh; class IMeshSceneNode; class ISceneNode; }
}
using namespace irr;
@ -170,6 +170,7 @@ public:
class TrackObjectPresentationInstancing : public TrackObjectPresentationSceneNode
{
STKInstancedSceneNode* m_instancing_group;
scene::IMeshSceneNode* m_fallback_scene_node;
public:
TrackObjectPresentationInstancing(const XMLNode& xml_node,

View File

@ -20,7 +20,7 @@
#include "log.hpp"
#include <string.h>
#ifdef WIN32
#if defined(WIN32) && !defined(DEBUG)
// --------------------- Windows version -----------------
#include <Windows.h>
#include <DbgHelp.h>