Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
hyazinthh committed Nov 24, 2022
2 parents a6d3d98 + cdb222f commit 8c96c8c
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/Aardvark.SceneGraph/Semantics/Flags.fs
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,25 @@ module ActiveSemantics =
type ActiveSemantics() =

let trueConstant = AVal.constant true
let falseConstant = AVal.constant false
let andCache = Caching.BinaryOpCache (AVal.map2 (&&))

let (<&>) (a : aval<bool>) (b : aval<bool>) =
if a = trueConstant then b
elif b = trueConstant then a
else andCache.Invoke a b
match a.IsConstant, b.IsConstant with
| true, true ->
if a.GetValue() && b.GetValue() then trueConstant
else falseConstant

| true, false ->
if a.GetValue() then b
else falseConstant

| false, true ->
if b.GetValue() then a
else falseConstant

| _ ->
andCache.Invoke a b

member x.IsActive(r : Root<ISg>, scope : Ag.Scope) =
r.Child?IsActive <- trueConstant
Expand Down

0 comments on commit 8c96c8c

Please sign in to comment.