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

change (Material): remove alphaWrite #167

Merged
merged 7 commits into from
Mar 1, 2022
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 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
<tr>
<td align="center"><a href="https://xk.io/"><img src="https://avatars.githubusercontent.com/u/1046448?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Max Kaye</b></sub></a><br /><a href="https://github.com/three-types/three-ts-types/commits?author=XertroV" title="Documentation">📖</a></td>
<td align="center"><a href="https://github.com/LauferAlex"><img src="https://avatars.githubusercontent.com/u/86115165?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Alejandro Laufer</b></sub></a><br /><a href="https://github.com/three-types/three-ts-types/issues?q=author%3ALauferAlex" title="Bug reports">🐛</a> <a href="https://github.com/three-types/three-ts-types/commits?author=LauferAlex" title="Code">💻</a></td>
<td align="center"><a href="http://www.joemo.co.uk"><img src="https://avatars.githubusercontent.com/u/39060404?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Joe Tipping</b></sub></a><br /><a href="https://github.com/three-types/three-ts-types/commits?author=Gallahron" title="Code">💻</a></td>
</tr>
</tr>
</table>

Expand Down
4 changes: 1 addition & 3 deletions types/three/OTHER_FILES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ examples/jsm/effects/AsciiEffect.d.ts
examples/jsm/effects/ParallaxBarrierEffect.d.ts
examples/jsm/effects/PeppersGhostEffect.d.ts
examples/jsm/effects/StereoEffect.d.ts
examples/jsm/environments/RoomEnvironment.d.ts
examples/jsm/exporters/ColladaExporter.d.ts
examples/jsm/exporters/DRACOExporter.d.ts
examples/jsm/exporters/GLTFExporter.d.ts
Expand Down Expand Up @@ -52,7 +51,6 @@ examples/jsm/loaders/FBXLoader.d.ts
examples/jsm/loaders/GCodeLoader.d.ts
examples/jsm/loaders/KMZLoader.d.ts
examples/jsm/loaders/KTXLoader.d.ts
examples/jsm/loaders/LDrawLoader.d.ts
examples/jsm/loaders/LogLuvLoader.d.ts
examples/jsm/loaders/LottieLoader.d.ts
examples/jsm/loaders/LUT3dlLoader.d.ts
Expand Down Expand Up @@ -258,7 +256,7 @@ examples/jsm/shaders/VolumeShader.d.ts
examples/jsm/shaders/WaterRefractionShader.d.ts
examples/jsm/utils/BufferGeometryUtils.d.ts
examples/jsm/utils/GeometryCompressionUtils.d.ts
examples/jsm/utils/RoughnessMipmapper.d.ts
examples/jsm/utils/PackedPhongMaterial.d.ts
examples/jsm/utils/SceneUtils.d.ts
examples/jsm/utils/ShadowMapViewer.d.ts
examples/jsm/utils/SkeletonUtils.d.ts
Expand Down
2 changes: 1 addition & 1 deletion types/three/examples/jsm/geometries/ConvexGeometry.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { BufferGeometry, Vector3 } from '../../../src/Three';

export class ConvexGeometry extends BufferGeometry {
constructor(points: Vector3[]);
constructor(points?: Vector3[]);
}
6 changes: 6 additions & 0 deletions types/three/examples/jsm/loaders/LDrawLoader.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import { Loader, LoadingManager, Group, Material } from '../../../src/Three';

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

constructor(manager?: LoadingManager);

load(
Expand All @@ -10,6 +15,7 @@ export class LDrawLoader extends Loader {
onError?: (event: ErrorEvent) => void,
): void;
loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise<Group>;
preloadMaterials(url: string): Promise<void>;
setFileMap(fileMap: Record<string, string>): void;
setMaterials(materials: Material[]): void;

Expand Down
2 changes: 1 addition & 1 deletion types/three/examples/jsm/nodes/utils/ColorSpaceNode.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class ColorSpaceNode extends TempNode {
nodeType: string;

fromEncoding(encoding: number): void;
fromDecoding(encoding: number): void;
fromDecoding(): void;
copy(source: ColorSpaceNode): this;

static Nodes: {
Expand Down
5 changes: 5 additions & 0 deletions types/three/examples/jsm/utils/LDrawUtils.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Group, Object3D } from '../../../src/Three';

export namespace LDrawUtils {
function mergeObject(object: Object3D): Group;
}
10 changes: 10 additions & 0 deletions types/three/examples/jsm/utils/PackedPhongMaterial.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/**
* `PackedPhongMaterial` inherited from THREE.MeshPhongMaterial
*
* @param {Object} parameters
*/
import { MeshPhongMaterial, MeshPhongMaterialParameters } from '../../../src/Three';

export class PackedPhongMaterial extends MeshPhongMaterial {
constructor(parameters: MeshPhongMaterialParameters);
}
7 changes: 0 additions & 7 deletions types/three/examples/jsm/utils/RoughnessMipmapper.d.ts

This file was deleted.

22 changes: 10 additions & 12 deletions types/three/examples/jsm/utils/SceneUtils.d.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import { BufferGeometry, Group, InstancedMesh, Material, Object3D, Scene } from '../../../src/Three';

export namespace SceneUtils {
function createMeshesFromInstancedMesh(instancedMesh: InstancedMesh): Group;
function createMultiMaterialObject(geometry: BufferGeometry, materials: Material[]): Group;
/**
* @deprecated Use scene.attach( child ) instead.
*/
function detach(child: Object3D, parent: Object3D, scene: Scene): void;
/**
* @deprecated Use parent.attach( child ) instead.
*/
function attach(child: Object3D, scene: Scene, parent: Object3D): void;
}
export function createMeshesFromInstancedMesh(instancedMesh: InstancedMesh): Group;
export function createMultiMaterialObject(geometry: BufferGeometry, materials: Material[]): Group;
/**
* @deprecated Use scene.attach( child ) instead.
*/
export function detach(child: Object3D, parent: Object3D, scene: Scene): void;
/**
* @deprecated Use parent.attach( child ) instead.
*/
export function attach(child: Object3D, scene: Scene, parent: Object3D): void;
2 changes: 1 addition & 1 deletion types/three/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Type definitions for three 0.136
// Type definitions for three 0.137
// Project: https://threejs.org/
// Definitions by: Josh Ellis <https://github.com/joshuaellis>
// Nathan Bierema <https://github.com/Methuselah96>
Expand Down
20 changes: 3 additions & 17 deletions types/three/src/constants.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,11 @@ export const FloatType: TextureDataType;
export const HalfFloatType: TextureDataType;
export const UnsignedShort4444Type: TextureDataType;
export const UnsignedShort5551Type: TextureDataType;
export const UnsignedShort565Type: TextureDataType;
export const UnsignedInt248Type: TextureDataType;

// Pixel formats
export enum PixelFormat {}
export const AlphaFormat: PixelFormat;
export const RGBFormat: PixelFormat;
export const RGBAFormat: PixelFormat;
export const LuminanceFormat: PixelFormat;
export const LuminanceAlphaFormat: PixelFormat;
Expand All @@ -164,8 +162,9 @@ export const RedFormat: PixelFormat;
export const RedIntegerFormat: PixelFormat;
export const RGFormat: PixelFormat;
export const RGIntegerFormat: PixelFormat;
export const RGBIntegerFormat: PixelFormat;
export const RGBAIntegerFormat: PixelFormat;
export const _SRGBFormat: PixelFormat; // fallback for WebGL 1
export const _SRGBAFormat: PixelFormat; // fallback for WebGL 1

// Internal Pixel Formats
export type PixelFormatGPU =
Expand Down Expand Up @@ -224,6 +223,7 @@ export type PixelFormatGPU =
| 'RGB10_A2'
| 'RGB10_A2UI'
| 'SRGB8_ALPHA8'
| 'SRGB8'
| 'DEPTH_COMPONENT16'
| 'DEPTH_COMPONENT24'
| 'DEPTH_COMPONENT32F'
Expand Down Expand Up @@ -264,20 +264,6 @@ export const RGBA_ASTC_10x8_Format: CompressedPixelFormat;
export const RGBA_ASTC_10x10_Format: CompressedPixelFormat;
export const RGBA_ASTC_12x10_Format: CompressedPixelFormat;
export const RGBA_ASTC_12x12_Format: CompressedPixelFormat;
export const SRGB8_ALPHA8_ASTC_4x4_Format: CompressedPixelFormat;
export const SRGB8_ALPHA8_ASTC_5x4_Format: CompressedPixelFormat;
export const SRGB8_ALPHA8_ASTC_5x5_Format: CompressedPixelFormat;
export const SRGB8_ALPHA8_ASTC_6x5_Format: CompressedPixelFormat;
export const SRGB8_ALPHA8_ASTC_6x6_Format: CompressedPixelFormat;
export const SRGB8_ALPHA8_ASTC_8x5_Format: CompressedPixelFormat;
export const SRGB8_ALPHA8_ASTC_8x6_Format: CompressedPixelFormat;
export const SRGB8_ALPHA8_ASTC_8x8_Format: CompressedPixelFormat;
export const SRGB8_ALPHA8_ASTC_10x5_Format: CompressedPixelFormat;
export const SRGB8_ALPHA8_ASTC_10x6_Format: CompressedPixelFormat;
export const SRGB8_ALPHA8_ASTC_10x8_Format: CompressedPixelFormat;
export const SRGB8_ALPHA8_ASTC_10x10_Format: CompressedPixelFormat;
export const SRGB8_ALPHA8_ASTC_12x10_Format: CompressedPixelFormat;
export const SRGB8_ALPHA8_ASTC_12x12_Format: CompressedPixelFormat;

// BPTC compressed texture formats
export const RGBA_BPTC_Format: CompressedPixelFormat;
Expand Down
1 change: 1 addition & 0 deletions types/three/src/core/Raycaster.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export interface Intersection<TIntersected extends Object3D = Object3D> {
faceIndex?: number | undefined;
object: TIntersected;
uv?: Vector2 | undefined;
uv2?: Vector2 | undefined;
instanceId?: number | undefined;
}

Expand Down
2 changes: 2 additions & 0 deletions types/three/src/extras/ImageUtils.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,6 @@ export namespace ImageUtils {
onLoad?: (texture: Texture) => void,
onError?: (message: string) => void,
): Texture;

function sRGBToLinear(image: any): HTMLCanvasElement | { data: number[]; width: number; height: number };
}
4 changes: 2 additions & 2 deletions types/three/src/extras/PMREMGenerator.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { Scene } from '../scenes/Scene';
export class PMREMGenerator {
constructor(renderer: WebGLRenderer);
fromScene(scene: Scene, sigma?: number, near?: number, far?: number): WebGLRenderTarget;
fromEquirectangular(equirectangular: Texture): WebGLRenderTarget;
fromCubemap(cubemap: CubeTexture): WebGLRenderTarget;
fromEquirectangular(equirectangular: Texture, renderTarget?: WebGLRenderTarget | null): WebGLRenderTarget;
fromCubemap(cubemap: CubeTexture, renderTarget?: WebGLRenderTarget | null): WebGLRenderTarget;
compileCubemapShader(): void;
compileEquirectangularShader(): void;
dispose(): void;
Expand Down
6 changes: 0 additions & 6 deletions types/three/src/materials/Material.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,6 @@ export class Material extends EventDispatcher {
*/
fog: boolean;

/**
* When this property is set to THREE.RGBFormat, the material is considered to be opaque and alpha values are ignored.
* @default THREE.RGBAFormat
*/
format: PixelFormat;

/**
* Unique number of this material instance.
*/
Expand Down
4 changes: 2 additions & 2 deletions types/three/src/math/Box3.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class Box3 {
setFromBufferAttribute(bufferAttribute: BufferAttribute): this;
setFromPoints(points: Vector3[]): this;
setFromCenterAndSize(center: Vector3, size: Vector3): this;
setFromObject(object: Object3D): this;
setFromObject(object: Object3D, precise?: boolean): this;
clone(): this;
copy(box: Box3): this;
makeEmpty(): this;
Expand All @@ -35,7 +35,7 @@ export class Box3 {
expandByPoint(point: Vector3): this;
expandByVector(vector: Vector3): this;
expandByScalar(scalar: number): this;
expandByObject(object: Object3D): this;
expandByObject(object: Object3D, precise?: boolean): this;
containsPoint(point: Vector3): boolean;
containsBox(box: Box3): boolean;
getParameter(point: Vector3, target: Vector3): Vector3;
Expand Down
2 changes: 2 additions & 0 deletions types/three/src/math/Color.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ export interface HSL {
l: number;
}

export function SRGBToLinear(c: number): number;

/**
* Represents a color. See also {@link ColorUtils}.
*
Expand Down
4 changes: 3 additions & 1 deletion types/three/src/renderers/webgl/WebGLUtils.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { CompressedPixelFormat, TextureEncoding } from '../../constants';

export class WebGLUtils {
constructor(gl: WebGLRenderingContext | WebGL2RenderingContext, extensions: any, capabilities: any);

convert(p: any): void;
convert(p: CompressedPixelFormat, encoding?: TextureEncoding | null): void;
}
2 changes: 1 addition & 1 deletion types/three/src/renderers/webxr/WebXRManager.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class WebXRManager extends EventDispatcher {
getSession(): XRSession | null;
setSession(value: XRSession): Promise<void>;
getCamera(camera: Camera): Camera;
setAnimationLoop(callback: XRFrameRequestCallback): void;
setAnimationLoop(callback: XRFrameRequestCallback | null): void;
getFoveation(): number | undefined;
setFoveation(foveation: number): void;
dispose(): void;
Expand Down
2 changes: 1 addition & 1 deletion types/three/src/textures/CubeTexture.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export class CubeTexture extends Texture {
* @param [wrapT=THREE.ClampToEdgeWrapping]
* @param [magFilter=THREE.LinearFilter]
* @param [minFilter=THREE.LinearMipmapLinearFilter]
* @param [format=THREE.RGBFormat]
* @param [format=THREE.RGBAFormat]
* @param [type=THREE.UnsignedByteType]
* @param [anisotropy=1]
* @param [encoding=THREE.LinearEncoding]
Expand Down
2 changes: 1 addition & 1 deletion types/three/src/textures/VideoTexture.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export class VideoTexture extends Texture {
* @param [wrapT=THREE.ClampToEdgeWrapping]
* @param [magFilter=THREE.LinearFilter]
* @param [minFilter=THREE.LinearFilter]
* @param [format=THREE.RGBFormat]
* @param [format=THREE.RGBAFormat]
* @param [type=THREE.UnsignedByteType]
* @param [anisotropy=1]
*/
Expand Down
72 changes: 72 additions & 0 deletions types/three/test/loaders/loaders-gltfloader.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import * as THREE from 'three';

import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls';
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader';
import { RGBELoader } from 'three/examples/jsm/loaders/RGBELoader';

let camera: THREE.PerspectiveCamera;
let scene: THREE.Scene;
let renderer: THREE.WebGLRenderer;

init();
render();

function init() {
const container = document.createElement('div');
document.body.appendChild(container);

camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.25, 20);
camera.position.set(-1.8, 0.6, 2.7);

scene = new THREE.Scene();

new RGBELoader().setPath('textures/equirectangular/').load('royal_esplanade_1k.hdr', texture => {
texture.mapping = THREE.EquirectangularReflectionMapping;

scene.background = texture;
scene.environment = texture;

render();

// model

const loader = new GLTFLoader().setPath('models/gltf/DamagedHelmet/glTF/');
loader.load('DamagedHelmet.gltf', gltf => {
scene.add(gltf.scene);

render();
});
});

renderer = new THREE.WebGLRenderer({ antialias: true });
renderer.setPixelRatio(window.devicePixelRatio);
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1;
renderer.outputEncoding = THREE.sRGBEncoding;
container.appendChild(renderer.domElement);

const controls = new OrbitControls(camera, renderer.domElement);
controls.addEventListener('change', render); // use if there is no animation loop
controls.minDistance = 2;
controls.maxDistance = 10;
controls.target.set(0, 0, -0.2);
controls.update();

window.addEventListener('resize', onWindowResize);
}

function onWindowResize() {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();

renderer.setSize(window.innerWidth, window.innerHeight);

render();
}

//

function render() {
renderer.render(scene, camera);
}
Loading