-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: change wgsl shader to raw js string
- Loading branch information
Showing
112 changed files
with
1,259 additions
and
204 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { Entity, System } from '@lastolivegames/becsy'; | ||
import { | ||
App, | ||
Children, | ||
Commands, | ||
HierarchyPlugin, | ||
Parent, | ||
StartUp, | ||
} from '../../src'; | ||
|
||
describe('Hierarchy', () => { | ||
it('test parent children relationship', async () => { | ||
const app = new App({}); | ||
let parent_entity: Entity | undefined; | ||
let child_entity: Entity | undefined; | ||
|
||
class StartUpSystem extends System { | ||
commands = new Commands(this); | ||
|
||
q = this.query((q) => q.using(Parent, Children).write); | ||
q2 = this.query((q) => q.current.with(Parent).read); | ||
|
||
initialize(): void { | ||
const parent = this.commands.spawn(); | ||
const child = this.commands.spawn(); | ||
parent.add_child(child.id()); | ||
|
||
parent_entity = parent.id().hold(); | ||
child_entity = child.id().hold(); | ||
|
||
this.commands.execute(); | ||
} | ||
|
||
execute(): void { | ||
expect(parent_entity?.read(Parent).children).toBe([child_entity]); | ||
} | ||
} | ||
|
||
app.add_plugins(HierarchyPlugin); | ||
app.add_systems(StartUp, StartUpSystem); | ||
await app.run(); | ||
|
||
expect(parent_entity?.has(Parent)).toBeTruthy(); | ||
expect(child_entity?.has(Children)).toBeTruthy(); | ||
|
||
await app.exit(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { to_radians } from '../../src/components/render/utils'; | ||
import { Vec3 } from '../../src/math/Vec3'; | ||
import { Mat4 } from '../../src/math/Mat4'; | ||
import { toBeDeepCloseTo, toMatchCloseTo } from 'jest-matcher-deep-close-to'; | ||
expect.extend({ toBeDeepCloseTo, toMatchCloseTo }); | ||
|
||
describe('Mat4', () => { | ||
it('inverse', () => { | ||
const inv = Mat4.IDENTITY.inverse(); | ||
expect(inv).toMatchCloseTo(Mat4.IDENTITY); | ||
|
||
const rotz = Mat4.from_rotation_z(to_radians(90.0)); | ||
let rotz_inv = rotz.inverse(); | ||
expect(Mat4.IDENTITY).toMatchCloseTo(rotz.mul(rotz_inv)); | ||
expect(Mat4.IDENTITY).toMatchCloseTo(rotz_inv.mul(rotz)); | ||
|
||
let trans = Mat4.from_translation(new Vec3(1.0, 2.0, 3.0)); | ||
let trans_inv = trans.inverse(); | ||
// assert_ne!(None, trans_inv); | ||
// let trans_inv = trans_inv.unwrap(); | ||
expect(Mat4.IDENTITY).toMatchCloseTo(trans.mul(trans_inv)); | ||
expect(Mat4.IDENTITY).toMatchCloseTo(trans_inv.mul(trans)); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
import { Entity, field } from '@lastolivegames/becsy'; | ||
|
||
/** | ||
* @see bevy_hierarchy Children | ||
*/ | ||
export class Children { | ||
@field.ref declare parent: Entity; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
import { Entity, field } from '@lastolivegames/becsy'; | ||
import { Frustum } from './Frustum'; | ||
|
||
export class CascadesFrusta { | ||
frusta: Record<number, Frustum[]>; | ||
@field.object declare frusta: Map<Entity, Frustum[]>; | ||
} |
Oops, something went wrong.