Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -2514,6 +2514,7 @@ export namespace PBAvatarShape {
// @public (undocumented)
export interface PBBillboard {
billboardMode?: BillboardMode | undefined;
lookAtEntity?: number | undefined;
}

// @public (undocumented)
Expand Down
21 changes: 20 additions & 1 deletion test/ecs/components/Billboard.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Engine, components, BillboardMode } from '../../../packages/@dcl/ecs/src'
import { Engine, components, BillboardMode } from '../../../packages/@dcl/ecs/src'
import { testComponentSerialization } from './assertion'

describe('Generated Billboard ProtoBuf', () => {
Expand All @@ -10,4 +10,23 @@ describe('Generated Billboard ProtoBuf', () => {
billboardMode: BillboardMode.BM_Y
})
})

it('should serialize/deserialize Billboard with lookAtEntity', () => {
const newEngine = Engine()
const Billboard = components.Billboard(newEngine)

testComponentSerialization(Billboard, {
billboardMode: BillboardMode.BM_Y,
lookAtEntity: 512
})
})

it('should serialize/deserialize Billboard with only lookAtEntity (no explicit mode)', () => {
const newEngine = Engine()
const Billboard = components.Billboard(newEngine)

testComponentSerialization(Billboard, {
lookAtEntity: 1024
})
})
})
11 changes: 11 additions & 0 deletions test/snapshots/production-bundles/billboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ function createBillboards() {
const plane4 = createPlaneTexture(12, 3, 8)
createPlaneTexture(4, 3, 8)

// Target entity for look_at_entity demonstration
const targetEntity = engine.addEntity()
Transform.create(targetEntity, { position: { x: 8, y: 3, z: 4 } })

Billboard.create(plane1, {
billboardMode: BillboardMode.BM_Y
})
Expand All @@ -62,6 +66,13 @@ function createBillboards() {
Billboard.create(plane5, {
billboardMode: BillboardMode.BM_Y
})

// Billboard that faces a specific entity instead of the camera
const plane6 = createPlaneTexture(4, 3, 4)
Billboard.create(plane6, {
billboardMode: BillboardMode.BM_Y,
lookAtEntity: targetEntity
})
}

function createTextShape(text: string, position: Vector3, textColor: Color4) {
Expand Down
Loading