|
[ Still discussing http://www.geocities.com/partsref/bfcspec.txt ]
Steve:
> On Wed, 10 Nov 1999 00:44:17 GMT, "Lars C. Hassing"
> <lch@ccieurope.com> wrote:
[...]
> > 0 INVERT
> > (or maybe "0 INVERTNEXT" to stress that it is only the
> > following line, which must be of type 1, that is turned
> > inside-out)
>
> Hmm. Interesting thought. I like it. Anyone else want
> to ( yay | nay ) this?
"INVERTNEXT" is good. It makes the effect much more clear.
> > The CERTIFY section:
> > > operational command-line in the file. No other
> > > statements are required for backface culling to be
> > > applied to a file.
> >
> > Then please add:
> > 0 CERTIFY BFC implies 0 CLIPPING ON and 0 WINDING CCW.
>
> CERTIFY BFC doesn't imply CLIPPING ON -- the clipping
> mode/setting comes from the superfile (for the main
> model-file, clipping is set by the rendering engine or an
> explicit CLIPPING ON statement).
It gets much too messy when you mix the states of a
parameter and the setting of that parameter.
CERTIFY BFC does imply CLIPPING ON, but it will not
necessarily mean that any clipping will be done, because
that depends on the super-file as well.
When processing a LDraw file you have three _local_
variables:
- "bfc-certified" is initialised to false and should at
most be changed once by a LDraw file.
- "winding" is initialised to "ccw".
- "clipping" is initialised to "on".
The statement "0 CERTIFIED ( BFC | NOBFC )" will modify the
variable "bfc-certified", the statement "0 WINDING ( CW |
CCW | UNKNOWN )" will modify the variable "winding", and the
statement "0 CLIPPING ( ON | OFF )" will modify the variable
"clipping".
Two parameters are passed to the processing routine:
- "accumulated_clipping" is true when processing the root
file, and will otherwise only be true if both
"accumulated_clipping" and "clipping" were true in the
super file at the calling point.
- "inverted" is false when processing the root file, and
will otherwise depend on whether the calling statement
was preceded by a "0 INVERTNEXT" line. If it was, the
value of "inverted" will be the opposite of that in the
super file. If it wasn't tha value will be the same as
that in the super file.
Back-face-culling will only be applied if all of the
following apply:
- "bfc-certified" is true
- "accumulated_clipping" is true
- "clipping" is true
- "winding" is "cw" or "ccw"
The winding used for back-face-culling will be that of the
variable "winding", if "inverted" is false. Otherwise it
will be the opposite ("unknown" being neutral).
> 0 WINDING CW
> 0 CERTIFY BFC
>
> ... the winding should be CW, right?
Maybe. It depends on the definition of "operational
command-line".
I understand why you sometimes use specialised "programming"
languages for writing specifications.
> If the CERTIFY statement 'implied' the winding, then this
> example would not be clear (at least to the human reader)
> if the winding for this file is CW or CCW.
> Does CERTIFY override the earlier WINDING or not?
If "0 WINDING CW" is an operational command-line, it doesn't
matter. Otherwise the result is somewhat unclear. I would
prefer that that sequence wasn't allowed.
There isn't much point in allowing the use of BFC
meta-commands before you have notified the renderer that you
intend to follow the rules for BFC meta-commands.
> That's why the WINDING setting has a default value, and
> CERTIFY doesn't affect the WINDING setting in any way.
>
> BUT, I'll see what I can do with the verbiage, to make
> things more clear.
> > The WINDING section:
> > > 0 WINDING [ CW | CCW | UNKNOWN ]
> > > default: CCW
The default value is not for the WINDING _statement_, but
for the "winding" variable.
> CLIPPING doesn't need a default, because it is passed down
> from the superfile. It is up to the rendering engine to
> provide the initial value of CLIPPING.
The "clipping" variable does need to have a default value.
Otherwise you would be unable to distinguish between the
local setting and the clipping _status_ passed from the
super file (or you would break the clipping rules).
> Maybe it would be better to drop WINDING UNKNOWN and
> specify that the default value for CLIPPING is ON.
I don't think so. If you could translate my explanation
above to proper English, then the problem should be solved,
with the effect I understand you intended.
Play well,
Jacob
------------------------------------------------
-- E-mail: sparre@cats.nbi.dk --
-- Web...: <URL:http://www.ldraw.org/FAQ/> --
------------------------------------------------
|
|
|
In lugnet.cad.dev, Jacob Sparre Andersen wrote:
> [ Still discussing http://www.geocities.com/partsref/bfcspec.txt ]
>
> Steve:
>
> > On Wed, 10 Nov 1999 00:44:17 GMT, "Lars C. Hassing"
> > <lch@ccieurope.com> wrote:
> > > 0 INVERT
> > > (or maybe "0 INVERTNEXT" to stress that it is only the
> > > following line, which must be of type 1, that is turned
> > > inside-out)
> >
> > Hmm. Interesting thought. I like it. Anyone else want
> > to ( yay | nay ) this?
>
> "INVERTNEXT" is good. It makes the effect much more clear.
OK, I'll change this in the document. Changes from the last few days will be
uploaded to GeoCities in the next hour or so.
Steve
|
|
|
In lugnet.cad.dev, Jacob Sparre Andersen wrote:
> [ Still discussing http://www.geocities.com/partsref/bfcspec.txt ]
> > 0 WINDING CW
> > 0 CERTIFY BFC
> >
> > ... the winding should be CW, right?
>
> Maybe. It depends on the definition of "operational
> command-line".
>
> I understand why you sometimes use specialised "programming"
> languages for writing specifications.
Did you mean you=Steve or you=anyone?
> > If the CERTIFY statement 'implied' the winding, then this
> > example would not be clear (at least to the human reader)
> > if the winding for this file is CW or CCW.
> > Does CERTIFY override the earlier WINDING or not?
>
> If "0 WINDING CW" is an operational command-line, it doesn't
> matter. Otherwise the result is somewhat unclear. I would
> prefer that that sequence wasn't allowed.
I agree, the sequence should be illegal.
My point was, does CERTIFY BFC change the value of the internal local_clipping
variable, or not? My intention was that it does not. From a practical
viewpoint, it might as well, but it is not necessary for it to do so.
> The default value is not for the WINDING _statement_, but
> for the "winding" variable.
Good point. I will incorporate this into the document.
> I don't think so. If you could translate my explanation
> above to proper English, then the problem should be solved,
> with the effect I understand you intended.
How about some pseudo-code? Skipping a few beside-the-point details:
Recursive Procedure RenderFile
Parameters:
ModelFile string // File to render
AccumClip boolean // global clipping value yes/no
AccumInvert boolean // current inversion odd/even or normal/inverted
Declare
LocalClip boolean = TRUE
Winding trivalue(CCW, CW, UNKNOWN) = CCW
Certified boolean = FALSE
InvertNext boolean = FALSE
OpenFile(ModelFile)
Do Until EOF(ModelFile)
Get Next Command
Case Command.LineType
CERTIFY
Certified = (Command.Option = "BFC")
CLIPPING
LocalClip = (Command.Option = "ON")
WINDING_CCW
If AccumInvert Then
Winding = CW
Else
Winding = CCW
WINDING_CW
If AccumInvert Then
Winding = CCW
Else
Winding = CW
WINDING_UNKNOWN
Winding = UNKNOWN
INVERTNEXT
InvertNext = True
SUBFILE
RenderFile Command.Subfile,
(AccumClip and LocalClip),
(AccumInvert xor InvertNext)
LINE, CONDITIONAL_LINE
Deal with primitive command
TRIANGLE, QUAD
If AccumClip and LocalClip Then
If BFC(Command, TransformMatrix, Winding) Then
Render Command
Else
Don't render Command
Else
Render Command
End If
End Case
If Command.LineType != INVERTNEXT Then
InvertNext = FALSE
End If
Loop
End Procedure
Ick. Longer than I thought. Maybe I'll go back to plain English.
Steve
|
|
|
[ Still discussing http://www.geocities.com/partsref/bfcspec.txt ]
Steve:
> In lugnet.cad.dev, Jacob Sparre Andersen wrote:
> > I understand why you sometimes use specialised "programming"
> > languages for writing specifications.
>
> Did you mean you=Steve or you=anyone?
You=anyone (kind of - English is a very imprecise language - "on"
in French, "man" in Danish, ...)
> My point was, does CERTIFY BFC change the value of the
> internal local_clipping variable, or not? My intention
> was that it does not. From a practical viewpoint, it
> might as well, but it is not necessary for it to do so.
That depends on how the program is written. You could
imagine that the variable "local_clipping" isn't defined
until it is verified that it is relevant.
> > I don't think so. If you could translate my explanation
> > above to proper English, then the problem should be solved,
> > with the effect I understand you intended.
>
> How about some pseudo-code? Skipping a few beside-the-point details:
[...]
Good. I think this clarifies a lot.
> Ick. Longer than I thought. Maybe I'll go back to plain English.
I don't think you can make it shorter as plain English, but
I will not complain if you attempt.
Play well,
Jacob
------------------------------------------------
-- E-mail: sparre@cats.nbi.dk --
-- Web...: <URL:http://www.ldraw.org/FAQ/> --
------------------------------------------------
|
|
|
Steve Bliss wrote ...
> How about some pseudo-code
I think your pseudo-code delivers a fine evidence why the CERTIFY
is unnecessary ;-)
/Lars
|
|
|
Oops! Forget a few important details in the psuedo-code!
In lugnet.cad.dev, Steve Bliss writes:
> ModelFile string // File to render
> AccumClip boolean // global clipping value yes/no
> AccumInvert boolean // current inversion odd/even or normal/inverted
>
> Declare
> LocalClip boolean = TRUE
> Winding trivalue(CCW, CW, UNKNOWN) = CCW
> Certified boolean = FALSE
> InvertNext boolean = FALSE
>
> SUBFILE
> RenderFile Command.Subfile,
> (AccumClip and LocalClip),
The last line above should be:
(AccumClip and LocalClip and
(Winding != UNKNOWN) and Certified),
> (AccumInvert xor InvertNext)
> LINE, CONDITIONAL_LINE
> Deal with primitive command
> TRIANGLE, QUAD
> If AccumClip and LocalClip Then
And the line above should be:
If AccumClip and LocalClip
And Certified Then
> If BFC(Command, TransformMatrix, Winding) Then
> Render Command
> Else
> Don't render Command
> Else
> Render Command
> End If
|
|
|
Steve Bliss wrote in message ...
> Oops! Forget a few important details in the psuedo-code!
>
> In lugnet.cad.dev, Steve Bliss writes:
>
> > ModelFile string // File to render
> > AccumClip boolean // global clipping value yes/no
> > AccumInvert boolean // current inversion odd/even or normal/inverted
> >
> > Declare
> > LocalClip boolean = TRUE
> > Winding trivalue(CCW, CW, UNKNOWN) = CCW
> > Certified boolean = FALSE
> > InvertNext boolean = FALSE
> >
> > SUBFILE
> > RenderFile Command.Subfile,
> > (AccumClip and LocalClip),
>
> The last line above should be:
> (AccumClip and LocalClip and
> (Winding != UNKNOWN) and Certified),
No, WINDING is local! It does not affect subfiles, this is the very reason
why we have invented the CLIPPING command.
/Lars
|
|
|
In lugnet.cad.dev, Lars C. Hassing wrote:
> No, WINDING is local! It does not affect subfiles, this is the very reason
> why we have invented the CLIPPING command.
Argh. You are correct, sir. Serves me right, trying to post quickly.
Here's a correction:
> > > SUBFILE
> > > RenderFile Command.Subfile,
> > > (AccumClip and LocalClip),
> >
> > The last line above should be:
> > (AccumClip and LocalClip and Certified),
Steve
|
|
|