POV-Ray : Newsgroups : povray.general : Feature Request: Line-by-Line Parsing (Error Tracking) : Re: Feature Request: Line-by-Line Parsing (Error Tracking) Server Time
26 Apr 2024 17:48:08 EDT (-0400)
  Re: Feature Request: Line-by-Line Parsing (Error Tracking)  
From: dick balaska
Date: 21 Apr 2018 22:19:33
Message: <5adbf135$1@news.povray.org>
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
-- 
dik
Rendered 328976 of 330000 (99%)


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.