Skip to content
This repository has been archived by the owner on Feb 10, 2023. It is now read-only.

Need help declaring fog settings #70

Closed
IRobot1 opened this issue Mar 16, 2022 · 2 comments
Closed

Need help declaring fog settings #70

IRobot1 opened this issue Mar 16, 2022 · 2 comments

Comments

@IRobot1
Copy link
Contributor

IRobot1 commented Mar 16, 2022

I'm using the following to declare fog settings

  <ngt-canvas [camera]="{ position: [0, 400, 700], fov: 45, near: 1, far:1500 }"
              [scene]="{ background: 'black' | color, fog: { color: 'black'| color, near: 250, far: 1400} | fog }">

However, I'm getting the following build error

Argument of type 
'{ color: Color; near: number; far: number; }' is not assignable to parameter of type 
'[color: ColorRepresentation, near?: number | undefined, far?: number | undefined]'.

Object literal may only specify known properties, and '"color"' does not exist in type '[color: ColorRepresentation, near?: number | undefined, far?: number | undefined]'.

3               [scene]="{ background: 'black' | color, fog: { color: 'black'| color, near: 250, far: 1400} | fog }">
                                                                      ~~~~~~~~~~~~~~

For now, I can work-around by declaring a Fog() variable

  <ngt-canvas [camera]="{ position: [0, 400, 700], fov: 45, near: 1, far:1500 }"
              [scene]="{ background: 'black' | color, fog: fogsettings }">
  fogsettings = new Fog(new Color(), 250, 1400);
@manhnd98
Copy link

I think you can use like this

[scene]="{
                background: 'black' | color,
                fog: ['black' | color, 250, 1400] | fog
            }"

@nartc
Copy link
Owner

nartc commented Apr 1, 2022

You can do: fog: ['black', 250, 1400] | fog since Fog accepts a ColorRepresentation instead of Color.

@nartc nartc closed this as completed Apr 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants