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

Add constructor to sub primitive and export #2155

Merged
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
23 changes: 2 additions & 21 deletions packages/core/src/graphic/SubMesh.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,9 @@
import { IPoolElement } from "../utils/ObjectPool";
import { MeshTopology } from "./enums/MeshTopology";
import { SubPrimitive } from "./SubPrimitive";

/**
* Sub-mesh, mainly contains drawing information.
*/
export class SubMesh implements IPoolElement {
/** Start drawing offset. */
start: number;
/** Drawing count. */
count: number;
/** Drawing topology. */
topology: MeshTopology;

/**
* Create a sub-mesh.
* @param start - Start drawing offset
* @param count - Drawing count
* @param topology - Drawing topology
*/
constructor(start: number = 0, count: number = 0, topology: MeshTopology = MeshTopology.Triangles) {
this.start = start;
this.count = count;
this.topology = topology;
}

export class SubMesh extends SubPrimitive implements IPoolElement {
dispose?(): void {}
}
14 changes: 14 additions & 0 deletions packages/core/src/graphic/SubPrimitive.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,24 @@
import { MeshTopology } from "./enums/MeshTopology";

/**
* Sub-primitive, mainly contains drawing information.
*/
export class SubPrimitive {
/** Start drawing offset. */
start: number;
/** Drawing count. */
count: number;
/** Drawing topology. */
topology: MeshTopology;
/**
* Create a sub-primitive.
* @param start - Start drawing offset
* @param count - Drawing count
* @param topology - Drawing topology
*/
constructor(start: number = 0, count: number = 0, topology: MeshTopology = MeshTopology.Triangles) {
this.start = start;
this.count = count;
this.topology = topology;
}
}
1 change: 1 addition & 0 deletions packages/core/src/graphic/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ export { SubMesh } from "./SubMesh";
export { VertexBufferBinding } from "./VertexBufferBinding";
export { VertexElement } from "./VertexElement";
export { Primitive } from "./Primitive";
export { SubPrimitive } from "./SubPrimitive";
Loading