Skip to content

Commit

Permalink
Add more files (#995)
Browse files Browse the repository at this point in the history
* Add examples

* Update patch

* Update patch

* Add Pipeline

* Update patch

* Delete examples

* Update more built declaration files
  • Loading branch information
Methuselah96 authored May 27, 2024
1 parent 35612df commit 9b284e6
Show file tree
Hide file tree
Showing 12 changed files with 640 additions and 49 deletions.
500 changes: 452 additions & 48 deletions examples-jsm/changes.patch

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples-jsm/create-examples.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const files = [
'renderers/common/DataMap',
'renderers/common/Geometries',
'renderers/common/Info',
'renderers/common/Pipeline',
'renderers/common/Pipelines',
'renderers/common/ProgrammableStage',
'renderers/common/RenderBundle',
Expand Down
7 changes: 7 additions & 0 deletions examples-jsm/declarations.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,25 @@ const files = [
'renderers/common/Animation',
'renderers/common/Background',
'renderers/common/Binding',
'renderers/common/Bindings',
'renderers/common/ChainMap',
'renderers/common/ClippingContext',
'renderers/common/Color4',
'renderers/common/ComputePipeline',
'renderers/common/Constants',
'renderers/common/DataMap',
'renderers/common/Geometries',
'renderers/common/Info',
'renderers/common/Pipeline',
'renderers/common/Pipelines',
'renderers/common/ProgrammableStage',
'renderers/common/RenderBundle',
'renderers/common/RenderBundles',
'renderers/common/RenderContext',
'renderers/common/RenderContexts',
'renderers/common/RenderList',
'renderers/common/RenderLists',
'renderers/common/RenderPipeline',
'renderers/common/Textures',
];

Expand Down
45 changes: 45 additions & 0 deletions types/three/examples/jsm/renderers/common/Bindings.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import ComputeNode from "../../nodes/gpgpu/ComputeNode.js";
import Attributes from "./Attributes.js";
import Backend from "./Backend.js";
import Binding from "./Binding.js";
import DataMap from "./DataMap.js";
import Info from "./Info.js";
import Nodes from "./nodes/Nodes.js";
import Pipelines from "./Pipelines.js";
import RenderObject from "./RenderObject.js";
import Textures from "./Textures.js";
interface Data {
bindings?: Binding[] | undefined;
}
declare class Bindings extends DataMap<{
renderObject: {
key: RenderObject;
value: Data;
};
computeNode: {
key: ComputeNode;
value: Data;
};
}> {
backend: Backend;
textures: Textures;
pipelines: Pipelines;
attributes: Attributes;
nodes: Nodes;
info: Info;
constructor(
backend: Backend,
nodes: Nodes,
textures: Textures,
attributes: Attributes,
pipelines: Pipelines,
info: Info,
);
getForRender(renderObject: RenderObject): Binding[];
getForCompute(computeNode: ComputeNode): Binding[];
updateForCompute(computeNode: ComputeNode): void;
updateForRender(renderObject: RenderObject): void;
_init(bindings: Binding[]): void;
_update(object: ComputeNode | RenderObject, bindings: Binding[]): void;
}
export default Bindings;
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import Pipeline from "./Pipeline.js";
import ProgrammableStage from "./ProgrammableStage.js";
declare class ComputePipeline extends Pipeline {
computeProgram: ProgrammableStage;
readonly isComputePipeline: true;
constructor(cacheKey: string, computeProgram: ProgrammableStage);
}
export default ComputePipeline;
1 change: 1 addition & 0 deletions types/three/examples/jsm/renderers/common/Constants.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export declare const AttributeType: {
readonly INDEX: 2;
readonly STORAGE: 4;
};
export type AttributeType = (typeof AttributeType)[keyof typeof AttributeType];
export declare const GPU_CHUNK_BYTES = 16;
export declare const BlendColorFactor = 211;
export declare const OneMinusBlendColorFactor = 212;
28 changes: 28 additions & 0 deletions types/three/examples/jsm/renderers/common/Geometries.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { BufferAttribute, BufferGeometry } from "three";
import Attributes from "./Attributes.js";
import { AttributeType } from "./Constants.js";
import DataMap from "./DataMap.js";
import Info from "./Info.js";
import RenderObject from "./RenderObject.js";
interface GeometryData {
initialized?: boolean | undefined;
}
declare class Geometries extends DataMap<{
geometry: {
key: BufferGeometry;
value: GeometryData;
};
}> {
attributes: Attributes;
info: Info;
wireframes: WeakMap<BufferGeometry, BufferAttribute>;
attributeCall: WeakMap<BufferAttribute, number>;
constructor(attributes: Attributes, info: Info);
has(renderObject: RenderObject | BufferGeometry): boolean;
updateForRender(renderObject: RenderObject): void;
initGeometry(renderObject: RenderObject): void;
updateAttributes(renderObject: RenderObject): void;
updateAttribute(attribute: BufferAttribute, type: AttributeType): void;
getIndex(renderObject: RenderObject): BufferAttribute | null;
}
export default Geometries;
6 changes: 6 additions & 0 deletions types/three/examples/jsm/renderers/common/Pipeline.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
declare class Pipeline {
cacheKey: string;
usedTimes: number;
constructor(cacheKey: string);
}
export default Pipeline;
68 changes: 68 additions & 0 deletions types/three/examples/jsm/renderers/common/Pipelines.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import ComputeNode from "../../nodes/gpgpu/ComputeNode.js";
import Backend from "./Backend.js";
import Binding from "./Binding.js";
import Bindings from "./Bindings.js";
import ComputePipeline from "./ComputePipeline.js";
import DataMap from "./DataMap.js";
import Nodes from "./nodes/Nodes.js";
import Pipeline from "./Pipeline.js";
import ProgrammableStage from "./ProgrammableStage.js";
import RenderObject from "./RenderObject.js";
import RenderPipeline from "./RenderPipeline.js";
interface ComputeNodeData {
version: number;
pipeline: ComputePipeline;
}
interface RenderObjectData {
pipeline: RenderPipeline;
}
declare class Pipelines extends DataMap<{
computeNode: {
key: ComputeNode;
value: ComputeNodeData;
};
renderObject: {
key: RenderObject;
value: RenderObjectData;
};
}> {
backend: Backend;
nodes: Nodes;
bindings: Bindings | null;
caches: Map<string, Pipeline>;
programs: {
vertex: Map<string, ProgrammableStage>;
fragment: Map<string, ProgrammableStage>;
compute: Map<string, ProgrammableStage>;
};
constructor(backend: Backend, nodes: Nodes);
getForCompute(computeNode: ComputeNode, bindings: Binding[]): ComputePipeline;
getForRender(renderObject: RenderObject, promises?: Promise<void>[] | null): RenderPipeline;
delete(object: ComputeNode | RenderObject): RenderObjectData | ComputeNodeData;
dispose(): void;
updateForRender(renderObject: RenderObject): void;
_getComputePipeline(
computeNode: ComputeNode,
stageCompute: ProgrammableStage,
cacheKey: string,
bindings: Binding[],
): ComputePipeline;
_getRenderPipeline(
renderObject: RenderObject,
stageVertex: ProgrammableStage,
stageFragment: ProgrammableStage,
cacheKey: string,
promises: Promise<void>[] | null,
): RenderPipeline;
_getComputeCacheKey(computeNode: ComputeNode, stageCompute: ProgrammableStage): string;
_getRenderCacheKey(
renderObject: RenderObject,
stageVertex: ProgrammableStage,
stageFragment: ProgrammableStage,
): string;
_releasePipeline(pipeline: Pipeline): void;
_releaseProgram(program: ProgrammableStage): void;
_needsComputeUpdate(computeNode: ComputeNode): boolean;
_needsRenderUpdate(renderObject: RenderObject): true | void;
}
export default Pipelines;
15 changes: 15 additions & 0 deletions types/three/examples/jsm/renderers/common/ProgrammableStage.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import NodeAttribute from "../../nodes/core/NodeAttribute.js";
declare class ProgrammableStage {
id: number;
code: string;
stage: "compute" | "vertex" | "fragment";
attributes: NodeAttribute[] | null;
usedTimes: number;
constructor(
code: string,
type: "compute" | "vertex" | "fragment",
transforms?: null,
attributes?: NodeAttribute[] | null,
);
}
export default ProgrammableStage;
8 changes: 8 additions & 0 deletions types/three/examples/jsm/renderers/common/RenderPipeline.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import Pipeline from "./Pipeline.js";
import ProgrammableStage from "./ProgrammableStage.js";
declare class RenderPipeline extends Pipeline {
vertexProgram: ProgrammableStage;
fragmentProgram: ProgrammableStage;
constructor(cacheKey: string, vertexProgram: ProgrammableStage, fragmentProgram: ProgrammableStage);
}
export default RenderPipeline;
2 changes: 1 addition & 1 deletion types/three/examples/jsm/renderers/common/nodes/Nodes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ declare class Nodes extends DataMap<{
getForRender(renderObject: RenderObject): NodeBuilderState;
delete(
object: NodeUniformsGroup | RenderObject | ComputeNode | Scene,
): SceneData | RenderObjectData | NodeUniformsGroupData | ComputeNodeData;
): RenderObjectData | SceneData | NodeUniformsGroupData | ComputeNodeData;
getForCompute(computeNode: ComputeNode): NodeBuilderState;
_createNodeBuilderState(nodeBuilder: NodeBuilder): NodeBuilderState;
getEnvironmentNode(scene: Scene): Node | null;
Expand Down

0 comments on commit 9b284e6

Please sign in to comment.