Skip to content

Commit

Permalink
Merge Dev/0.5 (galacean#474)
Browse files Browse the repository at this point in the history
* refactor: opt code

* refactor: opt code

* refactor: opt code

* refactor: opt code

* refactor: opt code

* refactor: opt code

* refactor: use new addChannel api

* style: format code

* feat: opt code

* feat: merge gltf animation parser

* feat: opt code

* fix:opt code

* refator: opt code

* refactor: opt code

* refactor: clear imports

* refactor:fix bug

* refactor: opt code

* refactor: opt code

* feat: fix tsc

* feat: opt code

* feat: opt crossfade performance

* feat: opt crossfade performance

* feat: opt crossfade

* feat: opt crossfade

* refactor: opt code

* refactor: opt code

* refactor: opt code

* refactor: opt code

* feat: opt mergedCurveIndexList

* feat: opt mergedCurveIndexList

* feat: add revert

* refactor: opt code

* refactor: opt code

* refactor: opt code

* refactor: opt code

* feat: opt corssfade from pose

* feat: resolve conflict from cm

* refactor: opt code

* feat: fix type

* fix: fix additive

* refactor: opt code

* refactor: opt struct of Animation Node data

* feat: fix comment

* feat: clear import

* refactor: add CM

* refactor: opt code

* refactor:  opt crossFade code

* refactor: opt code

* refactor: opt code

* refactor: opt Animator code

* refactor: opt code

* Delete package-lock.json

delete package-lock

* Merge main (galacean#349)

* refactor: opt code

* refactor: opt code

* refactor: improve play API

* refactor: opt code

* refactor: opt code

* refactor: fix code

* refactor: opt code

* refactor: move internal class to internal folder

* refactor: remove generic

* refactor: save code

* refactor: opt code

* refactor: opt Layer update

* refactor: opt code

* refactor: reduce GC

* refactor: opt code

* refactor: opt code

* refactor: opt code

* refactor: opt code

* refactor: opt code

* refactor: opt code

* refactor: opt code

* refactor: opt code

* refactor: remove playState

* refactor: solve CM

* refactor: opt code

* refactor: opt code

* refactor: opt code

* refactor: opt code

* refactor: opt code

* refactor: opt code

* refactor: add layer opt

* refactor: opt code

* refactor: opt code

* refactor: opt code

* refactor: opt code

* refactor: opt interface design

* refactor: opt code

* refactor: opt code

* refactor: clear imports

* Animator (galacean#337)

* refactor: refactor animator #35

* refactor: sprite material add define USE_MODEL_MATRIX (galacean#359)

* refactor(2d): sprite material add define USE_MODEL_MATRIX

* feat: add animator-event

* feat: add animator-event

* feat: opt event code

* feat: add animator-event

* feat: opt code

* feat: merge oasis dev/0,5

* feat: opt code

* refactor: opt code

* refactor: opt code

* refactor: opt code

* refactor: clear imports

* feat: add some commonly used methods for `Color`(galacean#385)

* test: add color test (galacean#391)

Co-authored-by: shensi.zxd <[email protected]>

* feat: opt code

* feat: opt code

* feat: opt code

* feat: opt code

* feat: opt code

* feat: opt code

* feat: opt code

* feat: opt code

* refactor: opt code

* refactor: opt code

* Animator event (galacean#372)

* feat: add AnimatorEvent system #35

* Dev/0.5 (galacean#397)

* fix: fix Animator bug

* Dev/0.5 (galacean#399)

* fix: fix Animator bug

* Blend shape animation (galacean#374)

* feat: add BlendShape Animation

* feat: add ObjectKeyframe for  AnimationCurve (galacean#403)

* Refactor physics Ray-cast and Collision detection (galacean#404)

* feat: add trigger methods into Script and rewrite CollisionDetection

* Update README.md

* Fix Typos (galacean#409)

* fix: typos fixed

* Add sprite atlas region offset (galacean#407)

* feat: add ObjectKeyframe

* refactor: opt code

* refactor: opt code

* refactor: improve  comments

* Fix Typos (galacean#410)

* fix: fix typos

* feat:Support atlas galacean#197 (galacean#402)

* feat:Support atlas galacean#197

Co-authored-by: azhan <[email protected]>
Co-authored-by: GuoLei1990 <[email protected]>

* refactor: add tips for developers when use draco and BlendShape at the same time (galacean#414)

* refactor: new pbr interface (galacean#418)

* refactor: new pbr interface

* Feat: support spherical harmonic (galacean#392)

* feat: support spherical harmonics

* fix:opt atlas code. (galacean#420)

* fix:opt atlas code

* fix: glTF vertexData parser error (galacean#423)

* fix: set interpolation with `linear` by default (galacean#424)

* fix: set interpolation with `linear` by default
Co-authored-by: shensi.zxd <[email protected]>

* Fix material clone (galacean#426)

* fix: fix material clone bug

* fix:atlas support rotation (galacean#428)

* fix:atlas support rotation

* ci: compile error (galacean#429)

Co-authored-by: shensi.zxd <[email protected]>

* fix: `ModleMesh` destroy bug (galacean#430)

* Fix the comments of RenderState (galacean#431)

* fix: the comments of `RasterState`

* feat: add sh in editor (galacean#433)

* Add Scene Background Texture (galacean#427)

* feat: add scene background texture

* Background texture (galacean#434)

* refactor: opt code

* Test/material (galacean#422)

* feat: add material test

* v0.5.0-alpha.0

* Test: test for math (galacean#437)

* test: add test for math library

* fix:Fixed sprite’s rect display error when packaged into an atlas and trimmed (galacean#435)

* fix:Fixed sprite’s rect display error when packaged into an atlas and trimmed

* Fix BlendShape bug (galacean#441)

* fix: `ModleMesh` memory access bug

* Add blendshape test  (galacean#442)

* refactor: add `Blendshape` test

* Fix blend shape add frame (galacean#445)

* refactor: fix  addFrame() of BlendShape

* Test for Background (galacean#438)

* test: test for background

* Fix Background Texture Error (galacean#446)

* refactor: fix background texture bug

* v0.5.1-alpha.0

* v0.5.2-alpha.0

* v0.5.3-alpha.0

* fix: temp fix type convert function (galacean#449)

* v0.5.3-0.5.0-alpha.1.0

* v0.5.3-alpha.0

* v0.5.3-alpha.1

* feat: support vertex color for Blinnphone (galacean#450)

* feat: support vertex color for Blinnphone

* fix: BlendShape  access bug (galacean#451)

* feat:Add the function of relative path loading. (galacean#439)

* feat:Add the function of relative path loading

* fix: fix 2d renderer order error (galacean#452)

* fix: 2d renderer order error opt code

* feat: adapt to editor

* feat: adapt to editor

* feat: adapt to editor

* feat: adapt to editor

* feat: adapt to editor

* feat: adapt to editor

* refactor: opt animator

* v0.5.3-alpha.2

* refactor: opt code

* feat: update

* refactor: opt code

* fix: gltf no animation bug

* refactor: opt code

* refactor: oopt code

* refactor: opt code

* refactor: opt code

* feat: opt animator editor

* feat: opt animator editor

* fix: revert PHYSICALLY_CORRECT_LIGHTS

* fix: revert PHYSICALLY_CORRECT_LIGHTS (galacean#455)

* v0.5.3-alpha.3

* refactor: revert gamma space

* refactor: revert gamma space (galacean#457)

* v0.5.3-alpha.4

* Fix Caluculation Error in Background Size (galacean#458)


* refactor: fix background calculation

* feat: opt animator editor

* fix: bugfix

* Animator editor (galacean#454)

* fix: bugfix

* v0.5.3-alpha.5

* v0.5.3-alpha.6

* feat: remove log

* feat: remove log

* Animator editor (galacean#463)

* refactor: remove log

* fix: check valid if sh is null (galacean#464)

Co-authored-by: shensi.zxd <[email protected]>

* v0.5.3-alpha.7

* feat: add more interface for raycast (galacean#462)

* feat: add more interface for raycast

* feat:SpriteAtlas Adaptation Editor Workflow (galacean#461)

* feat:SpriteAtlas Adaptation Editor Workflow

* feat: 上传编辑器clip数据改为引用

* fix: bugfix

* v0.5.3-alpha.8

* fix: code err (galacean#467)

* fix: ccompile err

* v0.5.3-y.0

* v0.5.3-alpha.8

* v0.5.3-alpha.9

* fix(2d): spine texture uniform (galacean#468)

* v0.5.3-alpha.10

* fix(2d): fix mask uniform (galacean#471)

* fix: bugfix (galacean#470)

* v0.5.3-alpha.11

* Merge main to dev/0.5 (galacean#472)

* fix: ModelMesh destroy bug (galacean#473)

* fix: `ModelMesh` destroy() bug

* v0.5.3-alpha.12

* v0.5.0

Co-authored-by: luzhuang <[email protected]>
Co-authored-by: shensi.zxd <[email protected]>
Co-authored-by: singlecoder <[email protected]>
Co-authored-by: zhuxudong <[email protected]>
Co-authored-by: yangfengzzz <[email protected]>
Co-authored-by: AZhan <[email protected]>
Co-authored-by: azhan <[email protected]>
Co-authored-by: Hu Song <[email protected]>
Co-authored-by: Izzy Chen <[email protected]>
Co-authored-by: singlecoder <[email protected]>
  • Loading branch information
11 people authored Sep 2, 2021
1 parent 9385da8 commit ebf41d6
Show file tree
Hide file tree
Showing 231 changed files with 6,493 additions and 3,227 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ Oasis is a **web-first** and **mobile-first** high-performance real-time develop
const engine = new WebGLEngine("canvas-id");
engine.canvas.resizeByClientSize();

// Create root entity.
const rootEntity = engine.sceneManager.activeScene.createRootEntity("Root");
// Get scene and create root entity.
const scene = engine.sceneManager.activeScene;
const rootEntity = scene.createRootEntity("Root");

// Create light.
const lightEntity = rootEntity.createChild("Light");
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"npmClient": "npm",
"version": "0.4.12",
"version": "0.5.0",
"bootstrap": {
"hoist": true
},
Expand Down
4 changes: 2 additions & 2 deletions packages/controls/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@oasis-engine/controls",
"version": "0.4.12",
"version": "0.5.0",
"license": "MIT",
"scripts": {
"b:types": "tsc",
Expand All @@ -15,6 +15,6 @@
"types/**/*"
],
"dependencies": {
"oasis-engine": "0.4.12"
"oasis-engine": "0.5.0"
}
}
4 changes: 2 additions & 2 deletions packages/controls/src/OrbitControl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ export class OrbitControl extends Script {
}

/**
* Rotate to the left by a certain randian.
* Rotate to the left by a certain radian.
* @param radian - Radian value of rotation
*/
rotateLeft(radian: number) {
Expand All @@ -361,7 +361,7 @@ export class OrbitControl extends Script {
}

/**
* Rotate to the right by a certain randian.
* Rotate to the right by a certain radian.
* @param radian - Radian value of rotation
*/
rotateUp(radian: number) {
Expand Down
6 changes: 3 additions & 3 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@oasis-engine/core",
"version": "0.4.12",
"version": "0.5.0",
"license": "MIT",
"main": "dist/main.js",
"module": "dist/module.js",
Expand All @@ -14,9 +14,9 @@
"types/**/*"
],
"dependencies": {
"@oasis-engine/math": "0.4.12"
"@oasis-engine/math": "0.5.0"
},
"devDependencies": {
"@oasis-engine/design": "0.4.12"
"@oasis-engine/design": "0.5.0"
}
}
75 changes: 75 additions & 0 deletions packages/core/src/2d/atlas/SpriteAtlas.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import { RefObject } from "../../asset/RefObject";
import { Engine } from "../../Engine";
import { Sprite } from "../sprite/Sprite";

/**
* Sprite Atlas.
*/
export class SpriteAtlas extends RefObject {
private _sprites: Sprite[] = new Array<Sprite>();
private _spriteNamesToIndex: Record<string, number> = {};

/**
* All the sprites in the atlas.
*/
get sprites(): Readonly<Sprite[]> {
return this._sprites;
}

/**
* Get the last sprite named 'name' from the atlas.
* @param name - The name of the sprite you want to find
* @returns The sprite you want to find
*/
getSprite(name: string): Sprite {
const sprite = this._sprites[this._spriteNamesToIndex[name]];
if (!sprite) {
console.warn("There is no sprite named " + name + " in the atlas.");
}
return sprite;
}

/**
* Get all the sprite named 'name' from the atlas.
* @param name - The name of the sprites you want to find
* @param outSprites - This array holds the sprites found
* @returns The sprites you want to find
*/
getSprites(name: string, outSprites: Sprite[]): Sprite[] {
outSprites.length = 0;
let i = this._spriteNamesToIndex[name];
if (i !== undefined) {
const { _sprites } = this;
for (; i >= 0; i--) {
const sprite = _sprites[i];
sprite.name === name && outSprites.push(sprite);
}
} else {
console.warn("The name of the sprite you want to find is not exit in SpriteAtlas.");
}
return outSprites;
}

/**
* Constructor a SpriteAtlas.
* @param engine - Engine to which the SpriteAtlas belongs
*/
constructor(engine: Engine) {
super(engine);
}

/**
* @internal
*/
_addSprite(sprite: Sprite): void {
this._spriteNamesToIndex[sprite.name] = this._sprites.push(sprite) - 1;
}

/**
* @override
*/
_onDestroy(): void {
this._sprites = null;
this._spriteNamesToIndex = null;
}
}
37 changes: 37 additions & 0 deletions packages/core/src/2d/atlas/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { TextureFormat } from "../../texture";

/**
* The original data type of the atlas.
*/
export interface AtlasConfig {
/** Version of Atlas. */
version: number;
/** Texture format. */
format: TextureFormat;
/** The sub atlas array, each sub atlas contains multiple sprites. */
atlasItems: {
/** The url of the sub atlas. */
img: string;
/** Sprites contained in the sub atlas. */
sprites: AtlasSprite[];
}[];
}

/**
* The original data type of each sprite.
*/
export interface AtlasSprite {
/** Temp solution. */
id: number;
/** The name the sprite. */
name: string;
/** Whether to rotate 90 degrees clockwise. */
atlasRotated: boolean;
/** The range of the sprites on the big picture. */
atlasRegion: { x: number; y: number; w: number; h: number };
/** If there is trimming, the size of the blank area on the four sides. */
atlasRegionOffset: { x: number; y: number; z: number; w: number };
region: { x: number; y: number; w: number; h: number };
pivot: { x: number; y: number };
pixelsPerUnit: number;
}
1 change: 1 addition & 0 deletions packages/core/src/2d/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export { SpriteMaskInteraction } from "./enums/SpriteMaskInteraction";
export { SpriteMaskLayer } from "./enums/SpriteMaskLayer";
export { SpriteAtlas } from "./atlas/SpriteAtlas";
export * from "./sprite/index";
Loading

0 comments on commit ebf41d6

Please sign in to comment.