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: render to texture #1048

Merged
merged 8 commits into from
Jan 27, 2025
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
8 changes: 4 additions & 4 deletions package-lock.json

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

151 changes: 110 additions & 41 deletions packages/@dcl/playground-assets/etc/playground-assets.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,12 @@ export interface ByteBuffer {
// @public
export type Callback = () => void;

// @public (undocumented)
export const CameraLayer: LastWriteWinElementSetComponentDefinition<PBCameraLayer>;

// @public (undocumented)
export const CameraLayers: LastWriteWinElementSetComponentDefinition<PBCameraLayers>;

// @public (undocumented)
export const CameraMode: LastWriteWinElementSetComponentDefinition<PBCameraMode>;

Expand Down Expand Up @@ -673,6 +679,8 @@ export const componentDefinitionByName: {
"core::AvatarModifierArea": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBAvatarModifierArea>>;
"core::AvatarShape": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBAvatarShape>>;
"core::Billboard": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBBillboard>>;
"core::CameraLayer": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBCameraLayer>>;
"core::CameraLayers": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBCameraLayers>>;
"core::CameraMode": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBCameraMode>>;
"core::CameraModeArea": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBCameraModeArea>>;
"core::EngineInfo": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBEngineInfo>>;
Expand All @@ -692,12 +700,12 @@ export const componentDefinitionByName: {
"core::PointerEvents": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBPointerEvents>>;
"core::PointerEventsResult": GSetComponentGetter<GrowOnlyValueSetComponentDefinition<PBPointerEventsResult>>;
"core::PointerLock": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBPointerLock>>;
"core::PrimaryPointerInfo": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBPrimaryPointerInfo>>;
"core::Raycast": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBRaycast>>;
"core::RaycastResult": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBRaycastResult>>;
"core::RealmInfo": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBRealmInfo>>;
"core::Spotlight": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBSpotlight>>;
"core::TextShape": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBTextShape>>;
"core::TextureCamera": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBTextureCamera>>;
"core::Tween": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBTween>>;
"core::TweenSequence": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBTweenSequence>>;
"core::TweenState": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBTweenState>>;
Expand Down Expand Up @@ -2141,6 +2149,19 @@ export const onVideoEvent: Observable<{
totalVideoLength: number;
}>;

// @public (undocumented)
export interface Orthographic {
verticalRange?: number | undefined;
}

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

// @public
export type OverflowType = 'hidden' | 'scroll' | 'visible';

Expand Down Expand Up @@ -2347,6 +2368,42 @@ export namespace PBBillboard {
export function encode(message: PBBillboard, writer?: _m0.Writer): _m0.Writer;
}

// @public (undocumented)
export interface PBCameraLayer {
// (undocumented)
ambientBrightnessOverride?: number | undefined;
// Warning: (tsdoc-escape-greater-than) The ">" character should be escaped using a backslash to avoid confusion with an HTML tag
ambientColorOverride?: PBColor3 | undefined;
directionalLight?: boolean | undefined;
// Warning: (tsdoc-escape-greater-than) The ">" character should be escaped using a backslash to avoid confusion with an HTML tag
layer: number;
showAvatars?: boolean | undefined;
showFog?: boolean | undefined;
showSkybox?: boolean | undefined;
}

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

// @public (undocumented)
export interface PBCameraLayers {
// (undocumented)
layers: number[];
}

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

// @public (undocumented)
export interface PBCameraMode {
mode: CameraType;
Expand Down Expand Up @@ -2974,23 +3031,6 @@ export namespace PBPosition {
export function encode(message: PBPosition, writer?: _m0.Writer): _m0.Writer;
}

// @public (undocumented)
export interface PBPrimaryPointerInfo {
// (undocumented)
pointerType?: PointerType | undefined;
screenCoordinates?: PBVector2 | undefined;
screenDelta?: PBVector2 | undefined;
worldRayDirection?: PBVector3 | undefined;
}

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

// @public (undocumented)
export interface PBQuaternion {
// (undocumented)
Expand Down Expand Up @@ -3134,6 +3174,31 @@ export namespace PBTextShape {
export function encode(message: PBTextShape, writer?: _m0.Writer): _m0.Writer;
}

// @public (undocumented)
export interface PBTextureCamera {
clearColor?: PBColor4 | undefined;
farPlane?: number | undefined;
height?: number | undefined;
layer?: number | undefined;
// (undocumented)
mode?: {
$case: "perspective";
perspective: Perspective;
} | {
$case: "orthographic";
orthographic: Orthographic;
} | undefined;
width?: number | undefined;
}

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

// @public (undocumented)
export interface PBTween {
currentTime?: number | undefined;
Expand Down Expand Up @@ -3551,6 +3616,19 @@ export namespace PBVisibilityComponent {
export function encode(message: PBVisibilityComponent, writer?: _m0.Writer): _m0.Writer;
}

// @public (undocumented)
export interface Perspective {
fieldOfView?: number | undefined;
}

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

// @public
export namespace Plane {
// (undocumented)
Expand Down Expand Up @@ -3645,12 +3723,6 @@ export const enum PointerEventType {
// (undocumented)
PET_DOWN = 1,
// (undocumented)
PET_DRAG = 5,
// (undocumented)
PET_DRAG_END = 6,
// (undocumented)
PET_DRAG_LOCKED = 4,
// (undocumented)
PET_HOVER_ENTER = 2,
// (undocumented)
PET_HOVER_LEAVE = 3,
Expand All @@ -3672,20 +3744,6 @@ export type PointerFilterType = 'none' | 'block';
// @public (undocumented)
export const PointerLock: LastWriteWinElementSetComponentDefinition<PBPointerLock>;

// @public (undocumented)
export const enum PointerType {
// (undocumented)
POT_MOUSE = 1,
// (undocumented)
POT_NONE = 0,
// (undocumented)
POT_PAD = 2,
// (undocumented)
POT_TOUCH = 3,
// (undocumented)
POT_WAND = 4
}

// @public
export interface Position {
// (undocumented)
Expand All @@ -3707,9 +3765,6 @@ export type PositionType = 'absolute' | 'relative';
// @public
export type PositionUnit = `${number}px` | `${number}%` | number | `${number}` | ScaleUnit;

// @public (undocumented)
export const PrimaryPointerInfo: LastWriteWinElementSetComponentDefinition<PBPrimaryPointerInfo>;

// Warning: (ae-missing-release-tag) "ProcessMessageResultType" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
Expand Down Expand Up @@ -4296,6 +4351,9 @@ export namespace Texture {
export function encode(message: Texture, writer?: _m0.Writer): _m0.Writer;
}

// @public (undocumented)
export const TextureCamera: LastWriteWinElementSetComponentDefinition<PBTextureCamera>;

// @public (undocumented)
export const enum TextureFilterMode {
// (undocumented)
Expand Down Expand Up @@ -4531,6 +4589,7 @@ export interface UiBackgroundProps {
textureMode?: TextureMode;
textureSlices?: BorderRect | undefined;
uvs?: number[];
videoTexture?: UiVideoTexture;
}

// @public
Expand Down Expand Up @@ -4676,6 +4735,16 @@ export interface UiTransformProps {
zIndex?: number;
}

// @public
export interface UiVideoTexture {
// (undocumented)
filterMode?: TextureFilterType;
// (undocumented)
videoPlayerEntity: Entity;
// (undocumented)
wrapMode?: TextureWrapType;
}

// @public (undocumented)
export type Unpacked<T> = T extends (infer U)[] ? U : T;

Expand Down
14 changes: 13 additions & 1 deletion packages/@dcl/react-ecs/src/components/uiBackground/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BorderRect } from '@dcl/ecs'
import { BorderRect, Entity } from '@dcl/ecs'
import { Color4 } from '@dcl/ecs/dist/components/generated/pb/decentraland/common/colors.gen'

/**
Expand All @@ -16,6 +16,8 @@ export interface UiBackgroundProps {
uvs?: number[]
/** AvatarTexture for the background */
avatarTexture?: UiAvatarTexture
/** VideoTexture for the background */
videoTexture?: UiVideoTexture
/** Texture for the background */
texture?: UiTexture
}
Expand All @@ -29,6 +31,16 @@ export interface UiAvatarTexture {
filterMode?: TextureFilterType
}

/**
* Texture
* @public
*/
export interface UiVideoTexture {
videoPlayerEntity: Entity
wrapMode?: TextureWrapType
filterMode?: TextureFilterType
}

/**
* Texture
* @public
Expand Down
10 changes: 10 additions & 0 deletions packages/@dcl/react-ecs/src/components/uiBackground/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@ export function getTexture(props: UiBackgroundProps): PBUiBackground['texture']
}
}
}

if (props.videoTexture) {
return {
tex: {
$case: 'videoTexture',
videoTexture: parseTexture(props.videoTexture)
}
}
}

return undefined
}

Expand Down
18 changes: 9 additions & 9 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.

Loading
Loading