Skip to content

Commit

Permalink
feat: added preview projection type (#115)
Browse files Browse the repository at this point in the history
* feat: added support for orthogonal projection and camera position

* chore: fix linter warning
  • Loading branch information
cazala authored Aug 3, 2022
1 parent b27a0c4 commit e64ee99
Show file tree
Hide file tree
Showing 8 changed files with 80 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ dist/
node_modules/
temp/
.DS_Store
.vscode
.vscode
dcl-schemas-*.tgz
35 changes: 31 additions & 4 deletions report/schemas.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1195,11 +1195,15 @@ export type PreviewConfig = {
};
emote: PreviewEmote | null;
camera: PreviewCamera;
projection: PreviewProjection;
autoRotateSpeed: number;
centerBoundingBox: boolean;
offsetX: number;
offsetY: number;
offsetZ: number;
cameraX: number;
cameraY: number;
cameraZ: number;
wheelZoom: number;
wheelPrecision: number;
wheelStart: number;
Expand Down Expand Up @@ -1353,10 +1357,14 @@ export type PreviewOptions = {
zoom?: number | null;
emote?: PreviewEmote | null;
camera?: PreviewCamera | null;
projection?: PreviewProjection | null;
autoRotateSpeed?: number | null;
offsetX?: number | null;
offsetY?: number | null;
offsetZ?: number | null;
cameraX?: number | null;
cameraY?: number | null;
cameraZ?: number | null;
wheelZoom?: number | null;
wheelPrecision?: number | null;
wheelStart?: number | null;
Expand All @@ -1370,6 +1378,25 @@ export type PreviewOptions = {
env?: PreviewEnv | null;
};

// Warning: (ae-missing-release-tag) "PreviewProjection" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
// Warning: (ae-missing-release-tag) "PreviewProjection" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export enum PreviewProjection {
// (undocumented)
ORTHOGRAPHIC = "orthographic",
// (undocumented)
PERSPECTIVE = "perspective"
}

// @public (undocumented)
export namespace PreviewProjection {
const // (undocumented)
schema: JSONSchema<PreviewProjection>;
const // (undocumented)
validate: ValidateFunction<PreviewProjection>;
}

// @alpha (undocumented)
export enum PreviewType {
// (undocumented)
Expand Down Expand Up @@ -1967,10 +1994,10 @@ export namespace World {
// src/dapps/order.ts:23:3 - (ae-incompatible-release-tags) The symbol "chainId" is marked as @public, but its signature references "ChainId" which is marked as @alpha
// src/dapps/order.ts:36:3 - (ae-incompatible-release-tags) The symbol "network" is marked as @public, but its signature references "Network" which is marked as @alpha
// src/dapps/preview/emote-definition.ts:16:5 - (ae-incompatible-release-tags) The symbol "representations" is marked as @public, but its signature references "EmoteRepresentationDefinition" which is marked as @alpha
// src/dapps/preview/preview-config.ts:9:3 - (ae-incompatible-release-tags) The symbol "wearable" is marked as @public, but its signature references "WearableDefinition" which is marked as @alpha
// src/dapps/preview/preview-config.ts:10:3 - (ae-incompatible-release-tags) The symbol "wearables" is marked as @public, but its signature references "WearableDefinition" which is marked as @alpha
// src/dapps/preview/preview-config.ts:11:3 - (ae-incompatible-release-tags) The symbol "bodyShape" is marked as @public, but its signature references "BodyShape" which is marked as @alpha
// src/dapps/preview/preview-config.ts:16:3 - (ae-incompatible-release-tags) The symbol "type" is marked as @public, but its signature references "PreviewType" which is marked as @alpha
// src/dapps/preview/preview-config.ts:10:3 - (ae-incompatible-release-tags) The symbol "wearable" is marked as @public, but its signature references "WearableDefinition" which is marked as @alpha
// src/dapps/preview/preview-config.ts:11:3 - (ae-incompatible-release-tags) The symbol "wearables" is marked as @public, but its signature references "WearableDefinition" which is marked as @alpha
// src/dapps/preview/preview-config.ts:12:3 - (ae-incompatible-release-tags) The symbol "bodyShape" is marked as @public, but its signature references "BodyShape" which is marked as @alpha
// src/dapps/preview/preview-config.ts:17:3 - (ae-incompatible-release-tags) The symbol "type" is marked as @public, but its signature references "PreviewType" which is marked as @alpha
// src/dapps/preview/preview-message.ts:38:9 - (ae-incompatible-release-tags) The symbol "options" is marked as @public, but its signature references "PreviewOptions" which is marked as @alpha
// src/dapps/sale.ts:22:3 - (ae-incompatible-release-tags) The symbol "network" is marked as @public, but its signature references "Network" which is marked as @alpha
// src/dapps/sale.ts:23:3 - (ae-incompatible-release-tags) The symbol "chainId" is marked as @public, but its signature references "ChainId" which is marked as @alpha
Expand Down
1 change: 1 addition & 0 deletions src/dapps/preview/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export * from './preview-emote'
export * from './preview-env'
export * from './preview-message'
export * from './preview-options'
export * from './preview-projection'
export * from './preview-type'
export * from './representation-definition'
export * from './representation-with-blobs'
Expand Down
5 changes: 5 additions & 0 deletions src/dapps/preview/preview-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { BodyShape } from '../../platform/item'
import { EmoteDefinition } from './emote-definition'
import { PreviewCamera } from './preview-camera'
import { PreviewEmote } from './preview-emote'
import { PreviewProjection } from './preview-projection'
import { PreviewType } from './preview-type'
import { WearableDefinition } from './wearable-definition'

Expand All @@ -22,11 +23,15 @@ export type PreviewConfig = {
}
emote: PreviewEmote | null
camera: PreviewCamera
projection: PreviewProjection
autoRotateSpeed: number
centerBoundingBox: boolean
offsetX: number
offsetY: number
offsetZ: number
cameraX: number
cameraY: number
cameraZ: number
wheelZoom: number
wheelPrecision: number
wheelStart: number
Expand Down
5 changes: 5 additions & 0 deletions src/dapps/preview/preview-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { BodyShape } from '../../platform/item'
import { PreviewCamera } from './preview-camera'
import { PreviewEmote } from './preview-emote'
import { PreviewEnv } from './preview-env'
import { PreviewProjection } from './preview-projection'
import { WearableWithBlobs } from './wearable-with-blobs'

/** @alpha */
Expand All @@ -21,10 +22,14 @@ export type PreviewOptions = {
zoom?: number | null
emote?: PreviewEmote | null
camera?: PreviewCamera | null
projection?: PreviewProjection | null
autoRotateSpeed?: number | null
offsetX?: number | null
offsetY?: number | null
offsetZ?: number | null
cameraX?: number | null
cameraY?: number | null
cameraZ?: number | null
wheelZoom?: number | null
wheelPrecision?: number | null
wheelStart?: number | null
Expand Down
20 changes: 20 additions & 0 deletions src/dapps/preview/preview-projection.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import {
JSONSchema,
generateLazyValidator,
ValidateFunction
} from '../../validation'

export enum PreviewProjection {
ORTHOGRAPHIC = 'orthographic',
PERSPECTIVE = 'perspective'
}

export namespace PreviewProjection {
export const schema: JSONSchema<PreviewProjection> = {
type: 'string',
enum: Object.values(PreviewProjection)
}

export const validate: ValidateFunction<PreviewProjection> =
generateLazyValidator(schema)
}
15 changes: 15 additions & 0 deletions test/dapps/preview/preview-projection.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import expect from 'expect'
import { PreviewProjection } from '../../../src'
import { testTypeSignature } from '../../test-utils'

describe('PreviewProjection tests', () => {
const previewProjection: PreviewProjection = PreviewProjection.PERSPECTIVE

testTypeSignature(PreviewProjection, previewProjection)

it('static tests must pass', () => {
expect(PreviewProjection.validate(previewProjection)).toEqual(true)
expect(PreviewProjection.validate(null)).toEqual(false)
expect(PreviewProjection.validate({})).toEqual(false)
})
})
1 change: 1 addition & 0 deletions test/platform/item/emote/emote.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ describe('Emote tests', () => {
'52c312f5e5524739388af971cddb526c3b49ba31ec77abc07ca01f5b113f1eba'
}
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { image, ...baseEmoteWithoutImage } = baseEmote
const notThirdPartyEmote = {
...baseEmoteWithoutImage,
Expand Down

0 comments on commit e64ee99

Please sign in to comment.