Using arobase notation inside vectors in config

edited April 2013 in Help request
In the [ViewPortShader] below, I was trying to inherit the width and height from the camera, but this didn't work; only hard-coded values did. Is this supported, or is there a better way of doing this?

EP

[Display]
ScreenWidth = 1024
ScreenHeight = 768
Title = Project Pommelo

[Render]
ShowFPS = true


[Input]
SetList = MainInput

[MainInput]
KEY_F2 = Debug
KEY_F12 = Screenshot
KEY_F10 = ToggleDebug
KEY_ESCAPE = Quit
KEY_A = Rot_Left
KEY_S = Reverse
KEY_W = Forward
KEY_D = Rot_Right


[Camera]
; We use the same size for the camera than our display on screen so as to obtain a 1:1 ratio
FrustumWidth = @Display.ScreenWidth
FrustumHeight = @Display.ScreenHeight
FrustumFar = 5
Position = (0.0, 0.0, -2.0)

[MainViewport]
Camera = Camera
;BackgroundColor = (100,100,200)
BackgroundColor = (10,10,150)
ShaderList = ViewPortShader

[ViewPortShader]
ParamList = iResolution # iGlobalTime # iChannel0
;iResolution = (@Camera.FrustumWidth, @Camera.FrustumHeight, 0)
iResolution = (1024, 768, 0)

iGlobalTime = time

Comments

  • edited April 2013
    Unfortunately this syntax isn't supported.
    The config system is data type agnostic and it's the one responsible for inheritance.
    The actual parsing happens in the string module and doesn't have any knowledge of config's reserved keywords (such as @).
    When it gets (@Camera.FrustumWidth, @Camera.FrustumHeight, 0), it'll generate a #NaN and complain about that weirdly formatted string. :)

    I might try to find a non-ugly way of dealing with this in the future, but for now it can't be done. Supporting operators would be nice too and has been mentioned a few times in these forums.

    In your case, for a shader, I'd simply pass the values as separate floats:
    ParamList = iResolutionX # iResolutionY # iGlobalTime # iChannel0
    iResolutionX = @Camera.FrustumWidth
    iResolutionY = @Camera.FrustumHeight
    
Sign In or Register to comment.