Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
15 changes: 12 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,19 @@ install:
make node_modules/.bin/protobuf/bin/protoc

update-protocol:
npm i --save-exact @dcl/protocol@next
cd packages/@dcl/sdk-commands; npm i --save-exact @dcl/protocol@next
@PROTO_TAG=$(word 2,$(MAKECMDGOALS)); \
if [ -z "$$PROTO_TAG" ]; then PROTO_TAG=next; fi; \
if [ "$$PROTO_TAG" != "next" ] && [ "$$PROTO_TAG" != "experimental" ]; then \
echo "$$PROTO_TAG is not a valid argument" && exit 1; \
fi; \
echo "Using protocol tag: $$PROTO_TAG"; \
npm i --save-exact @dcl/protocol@$$PROTO_TAG; \
(cd packages/@dcl/sdk-commands && npm i --save-exact @dcl/protocol@$$PROTO_TAG); \
$(MAKE) sync-deps compile_apis

%:
Comment thread
gonpombo8 marked this conversation as resolved.
@:

update-renderer:
cd packages/@dcl/sdk; npm i --save-exact @dcl/explorer@latest

Expand Down Expand Up @@ -171,4 +180,4 @@ clean:

init-test-scene:
git clone https://github.com/decentraland/sdk7-scene-template test-scene
cd test-scene && npm i ./../packages/@dcl/sdk && npm i ./../packages/@dcl/sdk-commands && npm i ./../packages/@dcl/js-runtime
cd test-scene && npm i ./../packages/@dcl/sdk && npm i ./../packages/@dcl/sdk-commands && npm i ./../packages/@dcl/js-runtime
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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-12891435340.commit-b3fea33",
"@dcl/protocol": "1.0.0-13143749736.commit-5fbeb3c",
"@dcl/quickjs-emscripten": "^0.21.0-3680274614.commit-1808aa1",
"@dcl/ts-proto": "1.153.0",
"@types/fs-extra": "^9.0.12",
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
79 changes: 79 additions & 0 deletions packages/@dcl/playground-assets/etc/playground-assets.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,7 @@ export const componentDefinitionByName: {
"core::GltfContainer": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBGltfContainer>>;
"core::GltfContainerLoadingState": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBGltfContainerLoadingState>>;
"core::InputModifier": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBInputModifier>>;
"core::LightSource": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBLightSource>>;
"core::MainCamera": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBMainCamera>>;
"core::Material": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBMaterial>>;
"core::MeshCollider": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBMeshCollider>>;
Expand Down Expand Up @@ -1556,6 +1557,24 @@ export interface LastWriteWinElementSetComponentDefinition<T> extends BaseCompon
getOrNull(entity: Entity): DeepReadonly<T> | null;
}

// Warning: (ae-missing-release-tag) "LightSource" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const LightSource: LightSourceComponentDefinitionExtended;

// @public (undocumented)
export interface LightSourceComponentDefinitionExtended extends LastWriteWinElementSetComponentDefinition<PBLightSource> {
Type: LightSourceHelper;
}

// @public (undocumented)
export interface LightSourceHelper {
// (undocumented)
Point: (point: PBLightSource_Point) => PBLightSource['type'];
// (undocumented)
Spot: (spot: PBLightSource_Spot) => PBLightSource['type'];
}

// @public
export type Listeners = {
onMouseDown?: Callback;
Expand Down Expand Up @@ -2404,6 +2423,66 @@ export namespace PBInputModifier_StandardInput {
export function encode(message: PBInputModifier_StandardInput, writer?: _m0.Writer): _m0.Writer;
}

// @public (undocumented)
export interface PBLightSource {
active?: boolean | undefined;
brightness?: number | undefined;
color?: PBColor3 | undefined;
range?: number | undefined;
// (undocumented)
type?: {
$case: "point";
point: PBLightSource_Point;
} | {
$case: "spot";
spot: PBLightSource_Spot;
} | undefined;
}

// @public (undocumented)
export namespace PBLightSource {
// (undocumented)
export function decode(input: _m0.Reader | Uint8Array, length?: number): PBLightSource;
// (undocumented)
export function encode(message: PBLightSource, writer?: _m0.Writer): _m0.Writer;
}

// @public (undocumented)
export interface PBLightSource_Point {
shadow?: PBLightSource_ShadowType | undefined;
}

// @public (undocumented)
export namespace PBLightSource_Point {
// (undocumented)
export function decode(input: _m0.Reader | Uint8Array, length?: number): PBLightSource_Point;
// (undocumented)
export function encode(message: PBLightSource_Point, writer?: _m0.Writer): _m0.Writer;
}

// @public (undocumented)
export const enum PBLightSource_ShadowType {
ST_HARD = 2,
ST_NONE = 0,
ST_SOFT = 1
}

// @public (undocumented)
export interface PBLightSource_Spot {
innerAngle?: number | undefined;
outerAngle?: number | undefined;
shadow?: PBLightSource_ShadowType | undefined;
shadowMaskTexture?: TextureUnion | undefined;
}

// @public (undocumented)
export namespace PBLightSource_Spot {
// (undocumented)
export function decode(input: _m0.Reader | Uint8Array, length?: number): PBLightSource_Spot;
// (undocumented)
export function encode(message: PBLightSource_Spot, writer?: _m0.Writer): _m0.Writer;
}

// @public (undocumented)
export interface PBMainCamera {
virtualCameraEntity?: number | undefined;
Expand Down
16 changes: 9 additions & 7 deletions packages/@dcl/sdk-commands/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/@dcl/sdk-commands/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"@dcl/inspector": "file:../inspector",
"@dcl/linker-dapp": "^0.14.2",
"@dcl/mini-comms": "1.0.1-20230216163137.commit-a4c75be",
"@dcl/protocol": "1.0.0-12891435340.commit-b3fea33",
"@dcl/protocol": "1.0.0-13143749736.commit-5fbeb3c",
"@dcl/quests-client": "^1.0.3",
"@dcl/quests-manager": "^0.1.4",
"@dcl/rpc": "^1.1.1",
Expand Down
37 changes: 37 additions & 0 deletions test/ecs/components/LightSource.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { Engine, components } from '../../../packages/@dcl/ecs/src'
import { testComponentSerialization } from './assertion'

describe('Generated LightSource ProtoBuf', () => {
it('should serialize/deserialize Point LightSource', () => {
const newEngine = Engine()
const LightSource = components.LightSource(newEngine)

testComponentSerialization(LightSource, {
type: LightSource.Type.Point({
shadow: components.PBLightSource_ShadowType.ST_NONE
}),
active: true,
color: { r: 1, g: 1, b: 1 },
brightness: 1,
range: 10
})
})

it('should serialize/deserialize Spot LightSource', () => {
const newEngine = Engine()
const LightSource = components.LightSource(newEngine)

testComponentSerialization(LightSource, {
type: LightSource.Type.Spot({
innerAngle: 0,
outerAngle: 0,
shadowMaskTexture: undefined,
shadow: components.PBLightSource_ShadowType.ST_NONE
}),
active: true,
color: { r: 1, g: 1, b: 1 },
brightness: 1,
range: 10
})
})
})
8 changes: 4 additions & 4 deletions test/snapshots/development-bundles/static-scene.test.ts.crdt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
SCENE_COMPILED_JS_SIZE_PROD=456.5k bytes
SCENE_COMPILED_JS_SIZE_PROD=463.4k bytes
THE BUNDLE HAS SOURCEMAPS
(start empty vm 0.21.0-3680274614.commit-1808aa1)
OPCODES ~= 0k
Expand All @@ -11,8 +11,8 @@ EVAL test/snapshots/development-bundles/static-scene.test.js
REQUIRE: ~system/EngineApi
REQUIRE: ~system/EngineApi
OPCODES ~= 54k
MALLOC_COUNT = 13707
ALIVE_OBJS_DELTA ~= 2.70k
MALLOC_COUNT = 13848
ALIVE_OBJS_DELTA ~= 2.73k
CALL onStart()
main.crdt: PUT_COMPONENT e=0x200 c=1 t=0 data={"position":{"x":5.880000114440918,"y":2.7916901111602783,"z":7.380000114440918},"rotation":{"x":0,"y":0,"z":0,"w":1},"scale":{"x":1,"y":1,"z":1},"parent":0}
main.crdt: PUT_COMPONENT e=0x202 c=1 t=0 data={"position":{"x":4,"y":0.800000011920929,"z":8},"rotation":{"x":0,"y":0,"z":0,"w":1},"scale":{"x":1,"y":1,"z":1},"parent":0}
Expand Down Expand Up @@ -56,4 +56,4 @@ CALL onUpdate(0.1)
OPCODES ~= 3k
MALLOC_COUNT = -5
ALIVE_OBJS_DELTA ~= 0.00k
MEMORY_USAGE_COUNT ~= 1200.38k bytes
MEMORY_USAGE_COUNT ~= 1212.59k bytes
Loading