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 resolveURL to LoaderUtils #148

Merged
merged 10 commits into from
Nov 6, 2021
Merged
29 changes: 28 additions & 1 deletion .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@
]
},
{
"login": "woo-cie",
"login": "woo-cie",
"name": "Makoto Yamada",
"avatar_url": "https://avatars.githubusercontent.com/u/24642989?v=4",
"profile": "https://github.com/woo-cie",
Expand All @@ -241,6 +241,33 @@
"contributions": [
"code"
]
},
{
"login": "Degubi",
"name": "Degubi",
"avatar_url": "https://avatars.githubusercontent.com/u/13366932?v=4",
"profile": "https://github.com/Degubi",
"contributions": [
"code"
]
},
{
"login": "WCWedin",
"name": "Ibby Wedin",
"avatar_url": "https://avatars.githubusercontent.com/u/110730?v=4",
"profile": "https://github.com/WCWedin",
"contributions": [
"code"
]
},
{
"login": "dbuck",
"name": "dbuck",
"avatar_url": "https://avatars.githubusercontent.com/u/983807?v=4",
"profile": "https://github.com/dbuck",
"contributions": [
"code"
]
}
],
"skipCi": true,
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
<td align="center"><a href="https://benpigchu.com/"><img src="https://avatars.githubusercontent.com/u/9023067?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ben "Pig" Chu</b></sub></a><br /><a href="https://github.com/three-types/three-ts-types/commits?author=benpigchu" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/woo-cie"><img src="https://avatars.githubusercontent.com/u/24642989?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Makoto Yamada</b></sub></a><br /><a href="https://github.com/three-types/three-ts-types/commits?author=woo-cie" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/schwyzl"><img src="https://avatars.githubusercontent.com/u/1556979?v=4?s=100" width="100px;" alt=""/><br /><sub><b>schwyzl</b></sub></a><br /><a href="https://github.com/three-types/three-ts-types/commits?author=schwyzl" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/Degubi"><img src="https://avatars.githubusercontent.com/u/13366932?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Degubi</b></sub></a><br /><a href="https://github.com/three-types/three-ts-types/commits?author=Degubi" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/WCWedin"><img src="https://avatars.githubusercontent.com/u/110730?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ibby Wedin</b></sub></a><br /><a href="https://github.com/three-types/three-ts-types/commits?author=WCWedin" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/dbuck"><img src="https://avatars.githubusercontent.com/u/983807?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Dave Buchhofer</b></sub></a><br /><a href="https://github.com/three-types/three-ts-types/commits?author=dbuck" title="Code">💻</a></td>
</tr>
</table>

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
"contributors:add": "all-contributors add"
},
"devDependencies": {
"@definitelytyped/dtslint-runner": "^0.0.66",
"@definitelytyped/dtslint-runner": "*",
"all-contributors-cli": "^6.19.0",
"dtslint": "latest",
"dtslint": "*",
"husky": "^7.0.1",
"prettier": "2.3.2",
"pretty-quick": "^3.1.1",
Expand Down
3 changes: 2 additions & 1 deletion types/three/OTHER_FILES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ examples/jsm/geometries/BoxLineGeometry.d.ts
examples/jsm/geometries/ConvexGeometry.d.ts
examples/jsm/geometries/DecalGeometry.d.ts
examples/jsm/geometries/LightningStrike.d.ts
examples/jsm/geometries/ParametricGeometries.d.ts
examples/jsm/geometries/RoundedBoxGeometry.d.ts
examples/jsm/geometries/TeapotGeometry.d.ts
examples/jsm/helpers/LightProbeHelper.d.ts
Expand Down Expand Up @@ -223,6 +222,7 @@ examples/jsm/shaders/BrightnessContrastShader.d.ts
examples/jsm/shaders/ColorCorrectionShader.d.ts
examples/jsm/shaders/ColorifyShader.d.ts
examples/jsm/shaders/ConvolutionShader.d.ts
examples/jsm/shaders/CopyShader.d.ts
examples/jsm/shaders/DepthLimitedBlurShader.d.ts
examples/jsm/shaders/DigitalGlitch.d.ts
examples/jsm/shaders/DOFMipMapShader.d.ts
Expand Down Expand Up @@ -250,6 +250,7 @@ examples/jsm/shaders/SMAAShader.d.ts
examples/jsm/shaders/SobelOperatorShader.d.ts
examples/jsm/shaders/SSAOShader.d.ts
examples/jsm/shaders/SSRShader.d.ts
examples/jsm/shaders/SSRrShader.d.ts
examples/jsm/shaders/SubsurfaceScatteringShader.d.ts
examples/jsm/shaders/TechnicolorShader.d.ts
examples/jsm/shaders/ToneMapShader.d.ts
Expand Down
2 changes: 1 addition & 1 deletion types/three/examples/jsm/controls/ArcballControls.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export class ArcballControls extends Object3D {
*/
maxZoom: number;

constructor(camera: Camera, domElement: HTMLElement, scene?: Scene | null | undefined);
constructor(camera: Camera, domElement: HTMLElement, scene?: Scene | null);

dispose(): void;
}
16 changes: 12 additions & 4 deletions types/three/src/core/Raycaster.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ export interface Face {
materialIndex: number;
}

export interface Intersection {
export interface Intersection<TIntersected extends Object3D = Object3D> {
distance: number;
distanceToRay?: number | undefined;
point: Vector3;
index?: number | undefined;
face?: Face | null | undefined;
faceIndex?: number | undefined;
object: Object3D;
object: TIntersected;
uv?: Vector2 | undefined;
instanceId?: number | undefined;
}
Expand Down Expand Up @@ -97,7 +97,11 @@ export class Raycaster {
* @param recursive If true, it also checks all descendants. Otherwise it only checks intersecton with the object. Default is false.
* @param optionalTarget (optional) target to set the result. Otherwise a new Array is instantiated. If set, you must clear this array prior to each call (i.e., array.length = 0;).
*/
intersectObject(object: Object3D, recursive?: boolean, optionalTarget?: Intersection[]): Intersection[];
intersectObject<TIntersected extends Object3D>(
object: Object3D,
recursive?: boolean,
optionalTarget?: Array<Intersection<TIntersected>>,
): Array<Intersection<TIntersected>>;

/**
* Checks all intersection between the ray and the objects with or without the descendants.
Expand All @@ -107,5 +111,9 @@ export class Raycaster {
* @param recursive If true, it also checks all descendants of the objects. Otherwise it only checks intersecton with the objects. Default is false.
* @param optionalTarget (optional) target to set the result. Otherwise a new Array is instantiated. If set, you must clear this array prior to each call (i.e., array.length = 0;).
*/
intersectObjects(objects: Object3D[], recursive?: boolean, optionalTarget?: Intersection[]): Intersection[];
intersectObjects<TIntersected extends Object3D>(
objects: Object3D[],
recursive?: boolean,
optionalTarget?: Array<Intersection<TIntersected>>,
): Array<Intersection<TIntersected>>;
}
1 change: 1 addition & 0 deletions types/three/src/loaders/LoaderUtils.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export interface LoaderUtils {
decodeText(array: BufferSource): string;
extractUrlBase(url: string): string;
resolveURL(url: string, path: string): string;
}

export const LoaderUtils: LoaderUtils;
2 changes: 1 addition & 1 deletion types/three/src/materials/Material.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ export class Material extends EventDispatcher {
* If *null*, the value is opposite that of side, above.
* @default null
*/
shadowSide: Side;
shadowSide: Side | null;

/**
* Defines whether this material is tone mapped according to the renderer's toneMapping setting.
Expand Down
4 changes: 2 additions & 2 deletions types/three/test/cameras/camera-cinematic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ function render() {

raycaster.setFromCamera(mouse, camera);

const intersects = raycaster.intersectObjects(scene.children);
const intersects = raycaster.intersectObjects<THREE.Mesh>(scene.children);

if (intersects.length > 0) {
const targetDistance = intersects[0].distance;
Expand All @@ -121,7 +121,7 @@ function render() {
(INTERSECTED.material as THREE.MeshLambertMaterial).emissive.setHex(INTERSECTED.userData.currentHex);
}

INTERSECTED = intersects[0].object as THREE.Mesh;
INTERSECTED = intersects[0].object;
if (INTERSECTED) {
INTERSECTED.userData.currentHex = (INTERSECTED.material as THREE.MeshLambertMaterial).emissive.getHex();
(INTERSECTED.material as THREE.MeshLambertMaterial).emissive.setHex(0xff0000);
Expand Down
Loading