-
-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add examples * Add more * Update patch * Delete examples * Add built declarations * Add examples * Update patch * Add more * Update patch * Update declarations * Update patch * Delete examples * Update * Add examples * Update patch * Delete examples * Update * Add examples * Update patch * Delete examples * Update * Add examples * Update patch * Update patch * Delete examples * Update declarations * Add examples * Update patch * Delete examples * Update
- Loading branch information
1 parent
9b284e6
commit 167ca24
Showing
20 changed files
with
1,383 additions
and
397 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,41 @@ | ||
import Node from "./Node.js"; | ||
import { NodeData } from "./NodeBuilder.js"; | ||
|
||
export default class NodeCache { | ||
import NodeAttribute from "./NodeAttribute.js"; | ||
import NodeCode from "./NodeCode.js"; | ||
import NodeUniform from "./NodeUniform.js"; | ||
import NodeVar from "./NodeVar.js"; | ||
import NodeVarying from "./NodeVarying.js"; | ||
export interface ShaderStageNodeData { | ||
properties?: | ||
| ( | ||
& { | ||
outputNode: Node | null; | ||
initialized?: boolean | undefined; | ||
} | ||
& { | ||
[K in `_node${string}`]?: Node | undefined; | ||
} | ||
) | ||
| undefined; | ||
bufferAttribute?: NodeAttribute | undefined; | ||
structType?: Node | undefined; | ||
uniform?: NodeUniform<unknown> | undefined; | ||
variable?: NodeVar | undefined; | ||
varying?: NodeVarying | undefined; | ||
code?: NodeCode | undefined; | ||
usageCount?: number | undefined; | ||
snippet?: string | undefined; | ||
} | ||
interface NodeData { | ||
vertex?: ShaderStageNodeData | undefined; | ||
fragment?: ShaderStageNodeData | undefined; | ||
compute?: ShaderStageNodeData | undefined; | ||
any?: ShaderStageNodeData | undefined; | ||
} | ||
declare class NodeCache { | ||
id: number; | ||
nodesData: WeakMap<Node, NodeData>; | ||
|
||
constructor(); | ||
getNodeData(node: Node): NodeData | undefined; | ||
setNodeData(node: Node, data: NodeData): void; | ||
} | ||
export default NodeCache; |
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,17 +1,14 @@ | ||
import UniformNode from "./UniformNode.js"; | ||
|
||
export default class NodeUniform<Value> { | ||
declare class NodeUniform<TValue> { | ||
readonly isNodeUniform: true; | ||
|
||
name: string; | ||
type: string; | ||
node: UniformNode<Value>; | ||
type: string | null; | ||
node: UniformNode<TValue>; | ||
needsUpdate: boolean | undefined; | ||
|
||
constructor(name: string, type: string, node: UniformNode<Value>, needsUpdate?: boolean); | ||
|
||
get(): Value; | ||
set value(val: Value); | ||
|
||
constructor(name: string, type: string | null, node: UniformNode<TValue>, needsUpdate?: undefined); | ||
get value(): TValue; | ||
set value(val: TValue); | ||
get id(): number; | ||
get groupNode(): import("./UniformGroupNode.js").default; | ||
} | ||
export default NodeUniform; |
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,24 +1,18 @@ | ||
import { ShaderNodeObject } from "../shadernode/ShaderNode.js"; | ||
import { NodeUpdateType } from "./constants.js"; | ||
import InputNode from "./InputNode.js"; | ||
import Node from "./Node.js"; | ||
import NodeBuilder from "./NodeBuilder.js"; | ||
import NodeFrame from "./NodeFrame.js"; | ||
import UniformGroupNode from "./UniformGroupNode.js"; | ||
|
||
export default class UniformNode<Value> extends InputNode<Value> { | ||
declare class UniformNode<TValue> extends InputNode<TValue> { | ||
readonly isUniformNode: true; | ||
|
||
groupNode: UniformGroupNode; | ||
|
||
constructor(value: Value, nodeType?: string | null); | ||
|
||
constructor(value: TValue, nodeType?: string | null); | ||
setGroup(group: UniformGroupNode): this; | ||
|
||
getGroup(): UniformGroupNode; | ||
|
||
getUniformHash(builder: NodeBuilder): string; | ||
onUpdate(callback: (frame: NodeFrame, self: this) => TValue | undefined, updateType: NodeUpdateType): this; | ||
generate(builder: NodeBuilder, output: string | null): string; | ||
} | ||
|
||
export const uniform: <Value>( | ||
arg1: InputNode<Value> | Value, | ||
arg2?: Node | string, | ||
) => ShaderNodeObject<UniformNode<Value>>; | ||
export default UniformNode; | ||
export declare const uniform: <TValue>(arg1: InputNode<TValue> | TValue, arg2?: Node | string) => any; |
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,20 @@ | ||
import { BufferAttribute, InterleavedBuffer, InterleavedBufferAttribute } from "three"; | ||
import Backend from "./Backend.js"; | ||
import { AttributeType } from "./Constants.js"; | ||
import DataMap from "./DataMap.js"; | ||
interface Data { | ||
version?: number | undefined; | ||
} | ||
declare class Attributes extends DataMap<{ | ||
attribute: { | ||
key: BufferAttribute | InterleavedBufferAttribute; | ||
value: Data; | ||
}; | ||
}> { | ||
backend: Backend; | ||
constructor(backend: Backend); | ||
delete(attribute: BufferAttribute | InterleavedBufferAttribute): Data; | ||
update(attribute: BufferAttribute | InterleavedBufferAttribute, type: AttributeType): void; | ||
_getBufferAttribute(attribute: BufferAttribute | InterleavedBufferAttribute): InterleavedBuffer | BufferAttribute; | ||
} | ||
export default Attributes; |
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,11 @@ | ||
import Binding from "./Binding.js"; | ||
declare class Buffer extends Binding { | ||
readonly isBuffer: true; | ||
bytesPerElement: number; | ||
_buffer: Float32Array | null; | ||
constructor(name?: string, buffer?: Float32Array | null); | ||
get byteLength(): number; | ||
get buffer(): Float32Array | null; | ||
update(): boolean; | ||
} | ||
export default Buffer; |
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,4 @@ | ||
declare function getFloatLength(floatLength: number): number; | ||
declare function getVectorLength(count: number, vectorLength?: number): number; | ||
declare function getStrideLength(vectorLength: number): number; | ||
export { getFloatLength, getStrideLength, getVectorLength }; |
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
73 changes: 73 additions & 0 deletions
73
types/three/examples/jsm/renderers/common/RenderObject.d.ts
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,73 @@ | ||
import { | ||
BufferAttribute, | ||
BufferGeometry, | ||
Camera, | ||
InterleavedBuffer, | ||
InterleavedBufferAttribute, | ||
Material, | ||
Object3D, | ||
Scene, | ||
} from "three"; | ||
import LightsNode from "../../nodes/lighting/LightsNode.js"; | ||
import Binding from "./Binding.js"; | ||
import ClippingContext from "./ClippingContext.js"; | ||
import Geometries from "./Geometries.js"; | ||
import NodeBuilderState from "./nodes/NodeBuilderState.js"; | ||
import Nodes from "./nodes/Nodes.js"; | ||
import RenderContext from "./RenderContext.js"; | ||
import Renderer from "./Renderer.js"; | ||
import RenderPipeline from "./RenderPipeline.js"; | ||
export default class RenderObject { | ||
_nodes: Nodes; | ||
_geometries: Geometries; | ||
id: number; | ||
renderer: Renderer; | ||
object: Object3D; | ||
material: Material; | ||
scene: Scene; | ||
camera: Camera; | ||
lightsNode: LightsNode; | ||
context: RenderContext; | ||
geometry: BufferGeometry; | ||
version: number; | ||
drawRange: { | ||
start: number; | ||
count: number; | ||
} | null; | ||
attributes: Array<BufferAttribute | InterleavedBufferAttribute> | null; | ||
pipeline: RenderPipeline | null; | ||
vertexBuffers: Array<BufferAttribute | InterleavedBuffer> | null; | ||
clippingContext: ClippingContext; | ||
clippingContextVersion: number; | ||
initialNodesCacheKey: string; | ||
initialCacheKey: string; | ||
_nodeBuilderState: NodeBuilderState | null; | ||
_bindings: Binding[] | null; | ||
onDispose: (() => void) | null; | ||
readonly isRenderObject: true; | ||
onMaterialDispose: () => void; | ||
constructor( | ||
nodes: Nodes, | ||
geometries: Geometries, | ||
renderer: Renderer, | ||
object: Object3D, | ||
material: Material, | ||
scene: Scene, | ||
camera: Camera, | ||
lightsNode: LightsNode, | ||
renderContext: RenderContext, | ||
); | ||
updateClipping(parent: ClippingContext): void; | ||
get clippingNeedsUpdate(): boolean; | ||
getNodeBuilderState(): NodeBuilderState; | ||
getBindings(): Binding[]; | ||
getIndex(): BufferAttribute | null; | ||
getChainArray(): readonly [Object3D<import("three").Object3DEventMap>, Material, RenderContext, LightsNode]; | ||
getAttributes(): (InterleavedBufferAttribute | BufferAttribute)[]; | ||
getVertexBuffers(): (InterleavedBuffer | BufferAttribute)[] | null; | ||
getMaterialCacheKey(): string; | ||
get needsUpdate(): boolean; | ||
getNodesCacheKey(): string; | ||
getCacheKey(): string; | ||
dispose(): void; | ||
} |
59 changes: 59 additions & 0 deletions
59
types/three/examples/jsm/renderers/common/RenderObjects.d.ts
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,59 @@ | ||
import { Camera, Material, Object3D, Scene } from "three"; | ||
import LightsNode from "../../nodes/lighting/LightsNode.js"; | ||
import Bindings from "./Bindings.js"; | ||
import ChainMap from "./ChainMap.js"; | ||
import Geometries from "./Geometries.js"; | ||
import Info from "./Info.js"; | ||
import Nodes from "./nodes/Nodes.js"; | ||
import Pipelines from "./Pipelines.js"; | ||
import RenderContext from "./RenderContext.js"; | ||
import Renderer from "./Renderer.js"; | ||
import RenderObject from "./RenderObject.js"; | ||
declare class RenderObjects { | ||
renderer: Renderer; | ||
nodes: Nodes; | ||
geometries: Geometries; | ||
pipelines: Pipelines; | ||
bindings: Bindings; | ||
info: Info; | ||
chainMaps: { | ||
[passId: string]: ChainMap<readonly [Object3D, Material, RenderContext, LightsNode], RenderObject>; | ||
}; | ||
constructor( | ||
renderer: Renderer, | ||
nodes: Nodes, | ||
geometries: Geometries, | ||
pipelines: Pipelines, | ||
bindings: Bindings, | ||
info: Info, | ||
); | ||
get( | ||
object: Object3D, | ||
material: Material, | ||
scene: Scene, | ||
camera: Camera, | ||
lightsNode: LightsNode, | ||
renderContext: RenderContext, | ||
passId: string | undefined, | ||
): RenderObject; | ||
getChainMap( | ||
passId?: string, | ||
): ChainMap< | ||
readonly [Object3D<import("three").Object3DEventMap>, Material, RenderContext, LightsNode], | ||
RenderObject | ||
>; | ||
dispose(): void; | ||
createRenderObject( | ||
nodes: Nodes, | ||
geometries: Geometries, | ||
renderer: Renderer, | ||
object: Object3D, | ||
material: Material, | ||
scene: Scene, | ||
camera: Camera, | ||
lightsNode: LightsNode, | ||
renderContext: RenderContext, | ||
passId: string | undefined, | ||
): RenderObject; | ||
} | ||
export default RenderObjects; |
Oops, something went wrong.