Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SpotLight to bitecs #5931

Merged
merged 2 commits into from
Mar 15, 2023
Merged

Add SpotLight to bitecs #5931

merged 2 commits into from
Mar 15, 2023

Conversation

takahirox
Copy link
Contributor

@takahirox takahirox commented Feb 6, 2023

This PR adds SpotLight to bitecs, similar to #5918.

We may want to deprecate light components at some point and encourage to use glTF lights extension, but we don't need to drop the support right now.

Copy link
Contributor

@netpro2k netpro2k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Some minor thoughts around typescript stuff but I wouldn't even necessarily change them.

shadowRadius: number;
};

const DEFAULTS = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if I like it better but I notice we have to duplicate a lot of information with these defaults...

We could use typeof: example

innerConeAngle: number;
outerConeAngle: number;
castShadow: boolean;
shadowMapResolution: [number, number];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not particularly important, but you can name the elements of a "tuple". Gives you slightly nicer type hinting:

  shadowMapResolution: [width: number, height: number];

shadowRadius: 1.0
};

export function inflateSpotLight(world: HubsWorld, eid: number, params: SpotLightParams) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was discussed in anotehr PR, so whatever we decide there should apply here too... Since we provide default values the properties passed to the inflator (and exposed to JSX) should be optional, but then the type after applying defaults should have all fields be required. We can do that with typescript Partial/Required utility types.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants