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

LDrawLoader: Add WebGPU support. #1364

Merged
merged 4 commits into from
Nov 11, 2024
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
2 changes: 2 additions & 0 deletions types/three/examples/jsm/Addons.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,9 @@ export * from "./loaders/VRMLLoader.js";
export * from "./loaders/VTKLoader.js";
export * from "./loaders/XYZLoader.js";

export * from "./materials/LDrawConditionalLineMaterial.js";
export * from "./materials/MeshGouraudMaterial.js";
export * from "./materials/MeshPostProcessingMaterial.js";

export * from "./math/Capsule.js";
export * from "./math/ColorConverter.js";
Expand Down
10 changes: 10 additions & 0 deletions types/three/examples/jsm/loaders/LDrawLoader.d.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
import { Group, Loader, LoadingManager, Material } from "three";
import { LDrawConditionalLineMaterial } from "../materials/LDrawConditionalLineMaterial.js";
import { LDrawConditionalLineMaterial as LDrawConditionalLineNodeMaterial } from "../materials/LDrawConditionalLineNodeMaterial.js";

export class LDrawLoader extends Loader<Group> {
materials: Material[];
materialsLibrary: Record<string, Material>;

fileMap: Record<string, string>;

smoothNormals: boolean;

ConditionalLineMaterial: typeof LDrawConditionalLineMaterial | typeof LDrawConditionalLineNodeMaterial | null;

constructor(manager?: LoadingManager);

setConditionalLineMaterial(
type: typeof LDrawConditionalLineMaterial | typeof LDrawConditionalLineNodeMaterial,
): this;

preloadMaterials(url: string): Promise<void>;
setFileMap(fileMap: Record<string, string>): void;
setMaterials(materials: Material[]): void;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { ShaderMaterial, ShaderMaterialParameters } from "three";

declare class LDrawConditionalLineMaterial extends ShaderMaterial {
readonly isLDrawConditionalLineMaterial: true;

constructor(parameters?: ShaderMaterialParameters);
}

export { LDrawConditionalLineMaterial };
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { NodeMaterial, NodeMaterialParameters } from "three/tsl";

declare class LDrawConditionalLineMaterial extends NodeMaterial {
readonly isLDrawConditionalLineMaterial: true;

constructor(parameters?: NodeMaterialParameters);
}

export { LDrawConditionalLineMaterial };
4 changes: 2 additions & 2 deletions types/three/src/materials/nodes/MeshNormalNodeMaterial.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Texture } from "../../textures/Texture.js";
import { MeshNormalMaterialParameters } from "../MeshNormalMaterial.js";
import NodeMaterial, { NodeMaterialParameters } from "./NodeMaterial.js";

export interface MeshBasicNodeMaterialParameters extends NodeMaterialParameters, MeshNormalMaterialParameters {
export interface MeshNormalNodeMaterialParameters extends NodeMaterialParameters, MeshNormalMaterialParameters {
}

export default class MeshNormalNodeMaterial extends NodeMaterial {
Expand All @@ -24,5 +24,5 @@ export default class MeshNormalNodeMaterial extends NodeMaterial {
wireframeLinewidth: number;
flatShading: boolean;

constructor(parameters?: MeshBasicNodeMaterialParameters);
constructor(parameters?: MeshNormalNodeMaterialParameters);
}
35 changes: 19 additions & 16 deletions types/three/src/materials/nodes/NodeMaterials.d.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
export { default as InstancedPointsNodeMaterial } from "./InstancedPointsNodeMaterial.js";
export { default as Line2NodeMaterial } from "./Line2NodeMaterial.js";
export { default as LineBasicNodeMaterial } from "./LineBasicNodeMaterial.js";
export { default as LineDashedNodeMaterial } from "./LineDashedNodeMaterial.js";
export { default as MeshBasicNodeMaterial } from "./MeshBasicNodeMaterial.js";
export { default as MeshLambertNodeMaterial } from "./MeshLambertNodeMaterial.js";
export { default as MeshMatcapNodeMaterial } from "./MeshMatcapNodeMaterial.js";
export { default as MeshNormalNodeMaterial } from "./MeshNormalNodeMaterial.js";
export { default as MeshPhongNodeMaterial } from "./MeshPhongNodeMaterial.js";
export { default as MeshPhysicalNodeMaterial } from "./MeshPhysicalNodeMaterial.js";
export {
default as InstancedPointsNodeMaterial,
InstancedPointsNodeMaterialParameters,
} from "./InstancedPointsNodeMaterial.js";
export { default as Line2NodeMaterial, Line2NodeMaterialParameters } from "./Line2NodeMaterial.js";
export { default as LineBasicNodeMaterial, LineBasicNodeMaterialParameters } from "./LineBasicNodeMaterial.js";
export { default as LineDashedNodeMaterial, LineDashedNodeMaterialParameters } from "./LineDashedNodeMaterial.js";
export { default as MeshBasicNodeMaterial, MeshBasicNodeMaterialParameters } from "./MeshBasicNodeMaterial.js";
export { default as MeshLambertNodeMaterial, MeshLambertNodeMaterialParameters } from "./MeshLambertNodeMaterial.js";
export { default as MeshMatcapNodeMaterial, MeshMatcapNodeMaterialParameters } from "./MeshMatcapNodeMaterial.js";
export { default as MeshNormalNodeMaterial, MeshNormalNodeMaterialParameters } from "./MeshNormalNodeMaterial.js";
export { default as MeshPhongNodeMaterial, MeshPhongNodeMaterialParameters } from "./MeshPhongNodeMaterial.js";
export { default as MeshPhysicalNodeMaterial, MeshPhysicalNodeMaterialParameters } from "./MeshPhysicalNodeMaterial.js";
export { default as MeshSSSNodeMaterial } from "./MeshSSSNodeMaterial.js";
export { default as MeshStandardNodeMaterial } from "./MeshStandardNodeMaterial.js";
export { default as MeshToonNodeMaterial } from "./MeshToonNodeMaterial.js";
export { default as NodeMaterial } from "./NodeMaterial.js";
export { default as PointsNodeMaterial } from "./PointsNodeMaterial.js";
export { default as ShadowNodeMaterial } from "./ShadowNodeMaterial.js";
export { default as SpriteNodeMaterial } from "./SpriteNodeMaterial.js";
export { default as MeshStandardNodeMaterial, MeshStandardNodeMaterialParameters } from "./MeshStandardNodeMaterial.js";
export { default as MeshToonNodeMaterial, MeshToonNodeMaterialParameters } from "./MeshToonNodeMaterial.js";
export { default as NodeMaterial, NodeMaterialParameters } from "./NodeMaterial.js";
export { default as PointsNodeMaterial, PointsNodeMaterialParameters } from "./PointsNodeMaterial.js";
export { default as ShadowNodeMaterial, ShadowNodeMaterialParameters } from "./ShadowNodeMaterial.js";
export { default as SpriteNodeMaterial, SpriteNodeMaterialParameters } from "./SpriteNodeMaterial.js";
export { default as VolumeNodeMaterial } from "./VolumeNodeMaterial.js";
Loading