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

feat: dynamic lights #1049

Draft
wants to merge 35 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
e878aed
Updated protocol
AlejandroAlvarezMelucciDCL Nov 5, 2024
daf7d37
Updated playground-assets.api.md
AlejandroAlvarezMelucciDCL Nov 5, 2024
148ca71
Fixed Material tests
AlejandroAlvarezMelucciDCL Nov 5, 2024
e40e7b3
Fixed test in UiBackground.spec.ts
AlejandroAlvarezMelucciDCL Nov 5, 2024
9084402
Fix lint pass
AlejandroAlvarezMelucciDCL Nov 5, 2024
cdda5fd
Set protocol PR and updated the API
AlejandroAlvarezMelucciDCL Nov 6, 2024
7ba8627
Added TextureMove to the helper methods
AlejandroAlvarezMelucciDCL Nov 7, 2024
0aad934
Updated API
AlejandroAlvarezMelucciDCL Nov 7, 2024
b6f4cab
Updated protocol PR. Updated API. Added test to reach 100% coverage
AlejandroAlvarezMelucciDCL Nov 7, 2024
d4f7b22
Fixed Tween TextureMove test
AlejandroAlvarezMelucciDCL Nov 7, 2024
07d28b6
Updated protocol with branch PR. Added TextureMove mode for backwards…
AlejandroAlvarezMelucciDCL Nov 11, 2024
176d373
Merge branch 'main' into feat/texture-mapping-movement
AlejandroAlvarezMelucciDCL Nov 11, 2024
8217c0d
Lint pass
AlejandroAlvarezMelucciDCL Nov 11, 2024
53d0863
Merge branch 'main' into feat/texture-mapping-movement
AlejandroAlvarezMelucciDCL Nov 11, 2024
8e0e3b1
Updated protocol and rebuilt API
AlejandroAlvarezMelucciDCL Nov 11, 2024
97793b5
Removed properties from test
AlejandroAlvarezMelucciDCL Nov 12, 2024
c14cbab
Merge branch 'main' into feat/texture-mapping-movement
AlejandroAlvarezMelucciDCL Nov 12, 2024
c5c5d09
Merge branch 'main' into feat/texture-mapping-movement
AlejandroAlvarezMelucciDCL Nov 14, 2024
9cba16b
Updated protocol and API
AlejandroAlvarezMelucciDCL Nov 17, 2024
7ee4338
Merge branch 'main' into feat/texture-mapping-movement
AlejandroAlvarezMelucciDCL Nov 21, 2024
975055e
Updated protocol pointer
AlejandroAlvarezMelucciDCL Nov 21, 2024
8dc19a0
Properly updated protocol
AlejandroAlvarezMelucciDCL Nov 21, 2024
55fbb84
Updated snapshots
AlejandroAlvarezMelucciDCL Nov 21, 2024
689538c
Fix test
AlejandroAlvarezMelucciDCL Nov 21, 2024
bc7ecd2
Merge branch 'main' into feat/texture-mapping-movement
AlejandroAlvarezMelucciDCL Nov 26, 2024
a02ab07
Merge remote-tracking branch 'origin' into feat/texture-mapping-movement
gonpombo8 Jan 10, 2025
bff5721
update snapshots
gonpombo8 Jan 10, 2025
a498528
Set protocol package to feature branch
AlejandroAlvarezMelucciDCL Jan 13, 2025
0b61192
Merge branch 'main' into feat/dynamic-lights
AlejandroAlvarezMelucciDCL Jan 13, 2025
c5020b2
Updated protocol and generated classes
AlejandroAlvarezMelucciDCL Jan 13, 2025
1a3f9f8
Added helper function to improve usage of the new LightSource component
AlejandroAlvarezMelucciDCL Jan 15, 2025
bbc4c81
Added basic test
AlejandroAlvarezMelucciDCL Jan 16, 2025
0dedd2e
Updated snapshot
AlejandroAlvarezMelucciDCL Jan 16, 2025
259ad77
Merge branch 'main' into feat/dynamic-lights
AlejandroAlvarezMelucciDCL Jan 16, 2025
3e57d30
Added test
AlejandroAlvarezMelucciDCL Jan 16, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
461 changes: 348 additions & 113 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"bugs": "https://github.com/decentraland/js-sdk-toolchain/issues",
"dependencies": {
"@actions/core": "^1.10.0",
"@dcl/protocol": "1.0.0-11954515774.commit-3fb0262",
"@dcl/protocol": "https://sdk-team-cdn.decentraland.org/@dcl/protocol/branch//dcl-protocol-1.0.0-12754819535.commit-1b46539.tgz",
"@dcl/quickjs-emscripten": "^0.21.0-3680274614.commit-1808aa1",
"@dcl/ts-proto": "1.153.0",
"@types/fs-extra": "^9.0.12",
Expand Down
1 change: 1 addition & 0 deletions packages/@dcl/ecs/src/components/extended/InputModifier.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { LightSource } from '..'

Check warning on line 1 in packages/@dcl/ecs/src/components/extended/InputModifier.ts

View workflow job for this annotation

GitHub Actions / lint

'LightSource' is defined but never used. Allowed unused vars must match /^_|ReactEcs/u
import { IEngine, LastWriteWinElementSetComponentDefinition } from '../../engine'
import { InputModifier, PBInputModifier_StandardInput, PBInputModifier } from '../generated/index.gen'
import {} from '../generated/InputModifier.gen'
Expand Down
55 changes: 55 additions & 0 deletions packages/@dcl/ecs/src/components/extended/LightSource.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import { IEngine, LastWriteWinElementSetComponentDefinition } from '../../engine'
import { LightSource, PBLightSource_Point, PBLightSource_Spot, PBLightSource } from '../generated/index.gen'
import {} from '../generated/LightSource.gen'

/**
* @public
*/
export interface LightSourceHelper {
/**
* @returns a Light Source type
*/
Point: (point: PBLightSource_Point) => PBLightSource['type']

/**
* @returns a Light Source type
*/
Spot: (spot: PBLightSource_Spot) => PBLightSource['type']
}

/**
* @public
*/
export interface LightSourceComponentDefinitionExtended
extends LastWriteWinElementSetComponentDefinition<PBLightSource> {
/**
* LightSource helper with constructor
*/
Type: LightSourceHelper
}

const LightSourceHelper: LightSourceHelper = {
Point(point) {
return {
$case: 'point',
point
}
},
Spot(spot) {
return {
$case: 'spot',
spot
}
}
}

export function defineLightSourceComponent(
engine: Pick<IEngine, 'defineComponentFromSchema'>
): LightSourceComponentDefinitionExtended {
const theComponent = LightSource(engine)

return {
...theComponent,
Type: LightSourceHelper
}
}
5 changes: 5 additions & 0 deletions packages/@dcl/ecs/src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { AudioStreamComponentDefinitionExtended, defineAudioStreamComponent } fr
import { MediaState } from './generated/pb/decentraland/sdk/components/common/media_state.gen'
import { defineVirtualCameraComponent, VirtualCameraComponentDefinitionExtended } from './extended/VirtualCamera'
import { defineInputModifierComponent, InputModifierComponentDefinitionExtended } from './extended/InputModifier'
import { defineLightSourceComponent, LightSourceComponentDefinitionExtended } from './extended/LightSource'

export * from './generated/index.gen'

Expand Down Expand Up @@ -65,6 +66,10 @@ export const VirtualCamera: LwwComponentGetter<VirtualCameraComponentDefinitionE
export const InputModifier: LwwComponentGetter<InputModifierComponentDefinitionExtended> = (engine) =>
defineInputModifierComponent(engine)

/* @__PURE__*/
export const LightSource: LwwComponentGetter<LightSourceComponentDefinitionExtended> = (engine) =>
defineLightSourceComponent(engine)

/**
* @alpha
*/
Expand Down
1 change: 1 addition & 0 deletions packages/@dcl/ecs/src/components/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ export type { ISyncComponents, ISyncComponentsType } from './manual/SyncComponen
export type { INetowrkEntity, INetowrkEntityType } from './manual/NetworkEntity'
export type { INetowrkParent, INetowrkParentType } from './manual/NetworkParent'
export type { InputModifierHelper, InputModifierComponentDefinitionExtended } from './extended/InputModifier'
export type { LightSourceHelper, LightSourceComponentDefinitionExtended } from './extended/LightSource'
4 changes: 3 additions & 1 deletion packages/@dcl/ecs/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ import {
INetowrkEntity,
INetowrkParent,
VirtualCameraComponentDefinitionExtended,
InputModifierComponentDefinitionExtended
InputModifierComponentDefinitionExtended,
LightSourceComponentDefinitionExtended
} from './components/types'
import { NameComponent } from './components/manual/Name'

Expand All @@ -49,6 +50,7 @@ export const Name: NameComponent = components.Name(engine)
export const Tween: TweenComponentDefinitionExtended = /* @__PURE__*/ components.Tween(engine)
export const VirtualCamera: VirtualCameraComponentDefinitionExtended = /* @__PURE__*/ components.VirtualCamera(engine)
export const InputModifier: InputModifierComponentDefinitionExtended = /* @__PURE__*/ components.InputModifier(engine)
export const LightSource: LightSourceComponentDefinitionExtended = /* @__PURE__*/ components.LightSource(engine)

/**
* @alpha
Expand Down
Loading
Loading