|
|
Le 18-04-21 à 22:19, dick balaska a écrit :
> On 04/21/2018 08:12 PM, Sven Littkowski wrote:
>> Thus,
>> there must be somewhere an error within the main scene file. It has
>> thousands of code lines...
>>
>
> Thousands of lines in one file is really not a best practice. Surely,
> there must be a way you can break that up. Put objects and/or textures
> in their own files, etc.
>
>
> (
> My movie is 80,000 lines of hand crafted SDL [1] (plus god knows how
> much java-generated foo [2]). I have 270 files with an average of 309
> lines of code per file.
>
> Plus, to take that a step further, I organize subprojects by directory.
> ttlo - the launch scene
> ttvo - the cave scene
> ttCommon - globals
>
> My main scene file contains just the directives to get things started.
> Now I'm working on my space scene, ttso.
> #declare TTSODIR="./";
> #declare TTLODIR="../ttlo";
> #declare TTCOMMONDIR="../ttCommon/";
>
>
> Those are specific for rendering from *that* directory.
> Then I have a pile of includes
>
> #include concat(TTCOMMONDIR, "ttGlobals.inc") // global positions
> #include concat(TTSODIR, "direct.inc") // timings for this scene
> #include concat(TTLODIR, "spaceLoco.inc") // I built him over there
> #include concat(TTSODIR, "world.inc") // put objects in the scene
>
> This list of includes can be pasted anywhere because I've abstracted out
> the actual directory.
>
> I can comment out spaceLoco.inc and it still renders because in
> world.inc is this construct:
>
> #ifdef (SpaceLoco)
> object {
> SpaceLoco
> rotate SpaceLocoRot
> translate SpaceLocoVec
> }
> #end
>
> With 1000s of lines, you *will* get lost, and it helps immensely to have
> some organization.
>
> Another trick I do is, near the top of each object include I have
> #ifndef (HausDoorOpen)
> #declare HausDoorOpen=0; // normally closed
> #end
>
> Then if I don't bother to define a needed symbol, the object takes care
> of that himself.
>
> *Plus* :) HausDoorOpen runs from 0 to 1. All of my public symbols do.
> Then, in the object file I deal with it as needed.
> #local doorClosed = 90;
> #local doorOpen = 210;
> #local doorRot = HausDoorOpen*(doorOpen-doorClosed)+doorClosed;
> rotate y*doorRot
>
> Then if I decide doorOpen looks better at 200, I don't have to change
> everybody that uses it. I only have to change it in that one place.
> Everybody else just cares that it's open or not.
>
> )
>
> [1] http://git.buckosoft.com/gitstats/tteoac/files.html
> [2] ex:
>
http://www.buckosoft.com/tteoac/tteoac/service?scene=ttlo!fps=23.976!type=Thrust!frame=346
>
What if you get an error in file 153 that is caused by a flaw in file 73?
Having smaller files won't help in this case, and it's a case that can
happen very easily.
Post a reply to this message
|
|