Portál AbcLinuxu, 7. listopadu 2025 11:37
valgrind --tool=callgrindVysledny soubor pak otevres v KCachegrind
.
Existuje docela slušný emulátor. A kdybys do toho šel, tak se hlásím jako tester 
car::car(input *i, std::vector<_edge_> e, const char* filename, bool automatic) {
dalsi "nepeknou konstrukci" je opetovne inicializovani jiz inicializovaneho objektu dynamicky alokovanym objektem. Ano zni to hrozne a hrozne to je:
std::vector<_btRaycastVehicle_*> m_vehicle = *(new std::vector<_btRaycastVehicle_*>); ///< Physical implementation of car transformationTato konstrukce je rozhazena po mrte mistech v kodu... Dalsi problem v implementaci je s pouzitim "interfacu"
/**
* @brief The model interface
*/
class model {
public:
/**
* @brief model destructor
*/
virtual ~model() {}
int cutX, cutY; ///< Size of SS Culling
std::vector<_edge_> *edges; ///< All standalone edges of model
std::vector<_model3d_> models; ///< All parts of model
float minx, miny, minz, maxx, maxy, maxz; ///< Extremes of current model
float width, aplitude, height, size; ///< Dimensions of current model
};
1. toto neni interface, nejsou tam zadne definice metod, coz bych u interfacu cekal 2. trida obsahuje dynamicky alokovanou promenou edges, ale v destruktoru neni dealokovana, ani potomek teto tridy (modelo4s) neprovadi dealokaci. 3. k zamysleni: Musi to byt opravdu dynamicky alokovana promena? :)Ostatni interfacy krome tohoto vypadaji lepe (ale i tak obsahuji porad nejake member attributy) Dalsi mega ulet je, ze konstruktor tridy inicializuje globalni promene... Tak toto me opravdu dostalo. rekl bych ze je to zoufaly pokus o vytvoreni Singletonu?
bulletConfig bcfg = *(new bulletConfig()); ///< Configuration of physical engine
btDynamicsWorld* m_dynamicsWorld; ///< Physical implementation of scene
btDefaultCollisionConfiguration* m_collisionConfiguration;
btCollisionDispatcher* m_dispatcher;
btBroadphaseInterface* m_overlappingPairCache;
btConstraintSolver* m_constraintSolver;
....
/**
* @brief Construct physical model
* @param m is 3D model for physical model
*/
bullet::bullet(model *m) {
/// Get configuration
std::vector<_char_*> atributes = getList("BULLETCFG");
bcfg.brakeAspect = getConfig("brakeAspect", atributes);
bcfg.engineMaxSpeed = getConfig("engineMaxSpeed", atributes);
bcfg.engineSpeedMultiply = getConfig("engineSpeedMultiply", atributes);
bcfg.gasAspect = getConfig("gasAspect", atributes);
bcfg.gravitation = getConfig("gravitation", atributes);
bcfg.overSpeedBraking = getConfig("overSpeedBraking", atributes);
bcfg.rollInfluence = getConfig("rollInfluence", atributes);
bcfg.skinFriction = getConfig("skinFriction", atributes);
bcfg.speedDecrease = getConfig("speedDecrease", atributes);
bcfg.steeringAspect = getConfig("steeringAspect", atributes);
bcfg.steeringSpeedDependency = getConfig("steeringSpeedDependency", atributes);
bcfg.suspensionCompression = getConfig("suspensionCompression", atributes);
bcfg.suspensionDamping = getConfig("suspensionDamping", atributes);
bcfg.suspensionStiffness = getConfig("suspensionStiffness", atributes);
bcfg.underSpeedBraking = getConfig("underSpeedBraking", atributes);
bcfg.vehicleMassAspect = getConfig("vehicleMassAspect", atributes);
bcfg.vehicleStep = getConfig("vehicleStep", atributes);
bcfg.wheelFriction = getConfig("wheelFriction", atributes);
bcfg.worldLimit = getConfig("worldLimit", atributes);
bcfg.worldStep = getConfig("worldStep", atributes);
bcfg.worldSubStep = getConfig("worldSubStep", atributes);
locked = true;
m_collisionConfiguration = new btDefaultCollisionConfiguration();
m_dispatcher = new btCollisionDispatcher(m_collisionConfiguration);
btVector3 worldMin(-bcfg.worldLimit,-bcfg.worldLimit,-bcfg.worldLimit);
btVector3 worldMax(bcfg.worldLimit,bcfg.worldLimit,bcfg.worldLimit);
m_overlappingPairCache = new btAxisSweep3(worldMin,worldMax);
m_constraintSolver = new btSequentialImpulseConstraintSolver();
m_dynamicsWorld = new btDiscreteDynamicsWorld(m_dispatcher,m_overlappingPairCache,m_constraintSolver,m_collisionConfiguration);
m_dynamicsWorld->setGravity(btVector3(0,-bcfg.gravitation,0));
/// Create scene
addModel(m);
}
Ale ted i neco pozitivniho. Autor si s aplikaci dal opravdu hodne prace a pozitivne hodnotim, ze i pres to mracno chyb se aplikaci podari spustit.
Doporucil bych:
void renderSubModel(model* mod, model3d m);
(geometrie celého 3D světa se během vykreslování každého snímku kopírovala).
Objahoba diplomky je naštěstí až za půl roku :D spíš teď do Vánoc chci stihnout upgrade, abych neprošvih vánoční nával stahování aplikací :)
Tiskni
Sdílej:
ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.