From Till:
i started the project at the end of february with a simple idea: move all
3d-model loading to the DatabasePager-thread. my first attempts looked
promising, though they were a little too optimistic (or naive?). the patch
has evolved a lot since.
currently it does the following things:
1. revive SGModelLib, move functions for xml-model-loading there
2. replace all calls to sgLoad3dModel with calls to either
SGModelLib::loadModel() or SGModelLib::loadPagedModel()
almost all models will be loaded by the DatabasePager. the few exceptions are:
your own plane, shared models in scenery, random objects, AIBallistic models.
3. simplify mode-loading functions (avoid passing around fg_root)
4. avoid supurious MatrixTransform nodes in loaded models
5. fix some memory leaks
- if no <impact-reports> node is defined for a particular submodel, then
write the path to /ai/models/model-impact instead
- don't tie() properties that are only ever set a single time, if at all!
- better variable names
a report node in the submodels config:
<impact-reports>/sim/model/cow/impact</impact-reports>
When an impact happens, then the path of the submodel will be written to
this node. An attached listener function can evaluate the impact properties.
"""
"Flight plans" which can start at a given time (gmt)
WAITUNTIL tokens which pause the flight plans until a given time (gmt)
Submodels can now be attached to any AI objects (except submodels - it can
be done, but in my experimental code it's too expensive in frame rate atm)
"No-roll" attribute added to Ballistic objects - useful for wakes and the
like
"Random" attribute added to Ballistic objects (adds =- 5% to the Cd) -
useful for smoke, exhausts
If the <trigger> tag is not specified the Ballistic object/s will be
released at start-up (cannot be stopped)
Submodels are not released from AI Objects if the AI Object is more than 15
miles away.
"""
mf: minor code and formatting fixes; submodels.?xx were FUBAR and are thus
astyle formatted;
NOTE that <name> tags END, EOF, WAIT, WAITUNTIL are *depreciated*.
Don't get too used to them. This will have to be moved from the "name"
to regular engries.
and tgt_altitude -> tgt_altitude_ft. Also fix a comment in AIBase.hxx
indicating that the altitude is in meters, even though the usage throughout the
code was most definitely feet.
- In AIMultiplayer.cxx, update the altitude_ft variable so that the altitude
is reported correctly in the entity's property subtree.
- In AIMultiplayer.cxx, compute a velocity value in kts to fill in the speed
entry in the entity's property subtree. Note, this is not an earth centered
reference speed, not an indicated speed and not a speed relative to the local
airmass (that would be much harder to do.)
This patch removes some useless indirection when creating AIModels. It
obsolets AIScenario*.
AIEntities are just an intermediate copy of an other intermediate copy of an
xml file on the way from the ai scenario configuration file to the AIModels.
As such the AImodels can now be created directly from the property tree read
from the scenario file.
This reduces the amount of work needed to add an other AIModel and reduces the
amount of copy operations done during initialization.
It also moves internal knowledge of special AI models into these special AI
models class instead of spreading that into the whole AIModel subdirectory
which in turn enables to use carrier internal data structures for carrier
internal data ...
Also some unused variables are removed from the AIModel classes.
I believe that there are still more of them, but that is what I stumbled
accross ...
Tested, like the other splitouts these days in a seperate tree and using the
autopilot for some time, and in this case with a carrier start ...
As a result of recent requests, I've implemented the ability to switch off
aerodynamic stabilisation:
This has to be added to the submodel.xml files:
<aero-stabilised>false</aero-stabilised>
When false the submodel retains the pitch given at instantiation.
It defaults to true.
I've finished the variation of Cd with Mach number.
The calculations are only applicable to ballistic
objects, and then strictly one shape: non boat-tailed bullets/shells, so
I've put them in AIBallistic rather than AIBAase. For all inputs, Cd
should be the sub-sonic value, so bullets will need changing.
I've just posted a graphical analysis here:
http://myweb.tiscali.co.uk/vmeazza/FlightGear/cd_mach.pdf
The calculation of submodel mass from weight has been moved from AIBallistic
to Submodel so that it is calculated only once, rather than on every
iteration as a present. The parameter <contents> has been added, primarily
so that droptanks will have the proper mass. It is the path to an
appropriate property containing a weight in lbs.
Care has to be taken with the use of <contents> because after a reset there
appears to be a delay in submodel instantiation (dt not properly reset???)
and the weight property is not always picked up before it is set to zero in
the key bindings. Slightly hard to explain. It works fine if FGFS has not
been reset though. There is a partial solution which involves the rejigging
of the fuel and gui nasal scripts, but there is still the visible delay in
instantiation to be resolved. I've nearly done the nasal fixes, which will
form part of an update to the Hunter only. I'll probably complete those
later today.