mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-23 04:49:15 +08:00
Object3D updates (#23203)
* Object3D updates * Fix tests referring to old `shading` property.
This commit is contained in:
@@ -215,7 +215,7 @@
|
||||
//
|
||||
|
||||
var sphereGeometry = new THREE.SphereGeometry(0.1, 32, 32);
|
||||
var sphereMaterial = new THREE.MeshBasicMaterial({color: 0xff0000, shading: THREE.FlatShading});
|
||||
var sphereMaterial = new THREE.MeshBasicMaterial({color: 0xff0000, flatShading: true});
|
||||
|
||||
for (var i = 0; i < 40; i++) {
|
||||
|
||||
@@ -313,4 +313,4 @@
|
||||
renderer.render(scene, camera);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@
|
||||
|
||||
loader.load( "models/animated/flamingo.js", function( geometry ) {
|
||||
|
||||
var material = new THREE.MeshPhongMaterial( { color: 0xffffff, specular: 0xffffff, shininess: 20, morphTargets: true, vertexColors: THREE.FaceColors, shading: THREE.FlatShading } );
|
||||
var material = new THREE.MeshPhongMaterial( { color: 0xffffff, specular: 0xffffff, shininess: 20, morphTargets: true, vertexColors: THREE.FaceColors, flatShading: true } );
|
||||
var mesh = new THREE.Mesh( geometry, material );
|
||||
|
||||
var s = 0.35;
|
||||
|
||||
@@ -56,20 +56,20 @@
|
||||
|
||||
materials.push(new THREE.MeshLambertMaterial({ map: texture, transparent: true }));
|
||||
materials.push(new THREE.MeshLambertMaterial({ color: 0xdddddd }));
|
||||
materials.push(new THREE.MeshPhongMaterial({ color: 0xdddddd, specular: 0x009900, shininess: 30, shading: THREE.FlatShading }));
|
||||
materials.push(new THREE.MeshPhongMaterial({ color: 0xdddddd, specular: 0x009900, shininess: 30, flatShading: true }));
|
||||
materials.push(new THREE.MeshNormalMaterial());
|
||||
materials.push(new THREE.MeshBasicMaterial({ color: 0xffaa00, transparent: true, blending: THREE.AdditiveBlending }));
|
||||
//materials.push( new THREE.MeshBasicMaterial( { color: 0xff0000, blending: THREE.SubtractiveBlending } ) );
|
||||
|
||||
materials.push(new THREE.MeshLambertMaterial({ color: 0xdddddd }));
|
||||
materials.push(new THREE.MeshPhongMaterial({ color: 0xdddddd, specular: 0x009900, shininess: 30, shading: THREE.SmoothShading, map: texture, transparent: true }));
|
||||
materials.push(new THREE.MeshPhongMaterial({ color: 0xdddddd, specular: 0x009900, shininess: 30, flatShading: false, map: texture, transparent: true }));
|
||||
materials.push(new THREE.MeshNormalMaterial({}));
|
||||
materials.push(new THREE.MeshBasicMaterial({ color: 0xffaa00, wireframe: true }));
|
||||
|
||||
materials.push(new THREE.MeshDepthMaterial());
|
||||
|
||||
materials.push(new THREE.MeshLambertMaterial({ color: 0x666666, emissive: 0xff0000 }));
|
||||
materials.push(new THREE.MeshPhongMaterial({ color: 0x000000, specular: 0x666666, emissive: 0xff0000, shininess: 10, shading: THREE.SmoothShading, opacity: 0.9, transparent: true }));
|
||||
materials.push(new THREE.MeshPhongMaterial({ color: 0x000000, specular: 0x666666, emissive: 0xff0000, shininess: 10, flatShading: false, opacity: 0.9, transparent: true }));
|
||||
|
||||
materials.push(new THREE.MeshBasicMaterial({ map: texture, transparent: true }));
|
||||
|
||||
@@ -100,7 +100,7 @@
|
||||
let material = materials[i];
|
||||
|
||||
geometry = material instanceof THREE.MeshFaceMaterial ? geometry_pieces :
|
||||
(material.shading == THREE.FlatShading ? geometry_flat : geometry_smooth);
|
||||
(material.flatShading ? geometry_flat : geometry_smooth);
|
||||
|
||||
sphere = new THREE.Mesh(geometry, material);
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
scene.add(object);
|
||||
|
||||
var geometry = new THREE.SphereGeometry(1, 4, 4);
|
||||
var material = new THREE.MeshPhongMaterial({ color: 0xffffff, shading: THREE.FlatShading });
|
||||
var material = new THREE.MeshPhongMaterial({ color: 0xffffff, flatShading: true });
|
||||
|
||||
for (var i = 0; i < 100; i++) {
|
||||
|
||||
@@ -84,4 +84,4 @@
|
||||
composer.render();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
51
types/three/three-core.d.ts
vendored
51
types/three/three-core.d.ts
vendored
@@ -450,11 +450,6 @@ export class Camera extends Object3D {
|
||||
|
||||
getWorldDirection(optionalTarget?: Vector3): Vector3;
|
||||
|
||||
/**
|
||||
* This make the camera look at the vector position in local space.
|
||||
* @param vector point to look at
|
||||
*/
|
||||
lookAt(vector: Vector3): void;
|
||||
}
|
||||
|
||||
export class CubeCamera extends Object3D {
|
||||
@@ -1620,6 +1615,12 @@ export class Object3D extends EventDispatcher {
|
||||
*/
|
||||
userData: any;
|
||||
|
||||
/**
|
||||
* Used to check whether this or derived classes are Object3Ds. Default is true.
|
||||
* You should not change this, as it is used internally for optimisation.
|
||||
*/
|
||||
isObject3D: boolean;
|
||||
|
||||
/**
|
||||
* Calls before rendering object
|
||||
*/
|
||||
@@ -1670,6 +1671,13 @@ export class Object3D extends EventDispatcher {
|
||||
*/
|
||||
rotateOnAxis(axis: Vector3, angle: number): Object3D;
|
||||
|
||||
/**
|
||||
* Rotate an object along an axis in world space. The axis is assumed to be normalized. Method Assumes no rotated parent.
|
||||
* @param axis A normalized vector in object space.
|
||||
* @param angle The angle in radians.
|
||||
*/
|
||||
rotateOnWorldAxis(axis: Vector3, angle: number): Object3D;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param angle
|
||||
@@ -1729,6 +1737,7 @@ export class Object3D extends EventDispatcher {
|
||||
* @param vector A world vector to look at.
|
||||
*/
|
||||
lookAt(vector: Vector3): void;
|
||||
lookAt(x: number, y: number, z: number): void;
|
||||
|
||||
/**
|
||||
* Adds object as child of this object.
|
||||
@@ -1738,7 +1747,7 @@ export class Object3D extends EventDispatcher {
|
||||
/**
|
||||
* Removes object as child of this object.
|
||||
*/
|
||||
remove(object: Object3D): void;
|
||||
remove(...object: Object3D[]): void;
|
||||
|
||||
/**
|
||||
* Searches through the object's children and returns the first with a matching id, optionally recursive.
|
||||
@@ -1788,13 +1797,6 @@ export class Object3D extends EventDispatcher {
|
||||
* @param recursive
|
||||
*/
|
||||
copy(source: this, recursive?: boolean): this;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
eulerOrder: string;
|
||||
getChildByName(name: string): Object3D;
|
||||
translate(distance: number, axis: Vector3): Object3D;
|
||||
}
|
||||
|
||||
export interface Intersection {
|
||||
@@ -2364,8 +2366,6 @@ export interface MaterialParameters {
|
||||
transparent?: boolean;
|
||||
vertexColors?: Colors;
|
||||
visible?: boolean;
|
||||
|
||||
shading?: Shading;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2598,15 +2598,6 @@ export class Material extends EventDispatcher {
|
||||
*/
|
||||
update(): void;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
warpRGB: Color;
|
||||
|
||||
/**
|
||||
* @deprecated Removed, use .flatShading instead.
|
||||
*/
|
||||
shading: Shading;
|
||||
}
|
||||
|
||||
export interface LineBasicMaterialParameters extends MaterialParameters {
|
||||
@@ -2662,7 +2653,6 @@ export interface MeshBasicMaterialParameters extends MaterialParameters {
|
||||
combine?: Combine;
|
||||
reflectivity?: number;
|
||||
refractionRatio?: number;
|
||||
shading?: Shading;
|
||||
wireframe?: boolean;
|
||||
wireframeLinewidth?: number;
|
||||
wireframeLinecap?: string;
|
||||
@@ -2684,7 +2674,6 @@ export class MeshBasicMaterial extends Material {
|
||||
combine: Combine;
|
||||
reflectivity: number;
|
||||
refractionRatio: number;
|
||||
shading: Shading;
|
||||
wireframe: boolean;
|
||||
wireframeLinewidth: number;
|
||||
wireframeLinecap: string;
|
||||
@@ -6621,7 +6610,7 @@ export class ConeBufferGeometry extends BufferGeometry {
|
||||
export class ConeGeometry extends CylinderGeometry {
|
||||
constructor(radius?: number, height?: number, radialSegment?: number, heightSegment?: number, openEnded?: boolean, thetaStart?: number, thetaLength?: number);
|
||||
}
|
||||
|
||||
|
||||
export class DodecahedronBufferGeometry extends PolyhedronBufferGeometry {
|
||||
constructor(radius?: number, detail?: number);
|
||||
}
|
||||
@@ -6681,7 +6670,7 @@ export class LatheGeometry extends Geometry {
|
||||
phiLength: number;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
export class OctahedronBufferGeometry extends PolyhedronBufferGeometry {
|
||||
constructor(radius?: number, detail?: number);
|
||||
}
|
||||
@@ -6721,10 +6710,10 @@ export class PlaneGeometry extends Geometry {
|
||||
heightSegments: number;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
export class PolyhedronBufferGeometry extends BufferGeometry {
|
||||
constructor(vertices: number[], indices: number[], radius: number, detail: number);
|
||||
|
||||
|
||||
parameters: {
|
||||
vertices: number[];
|
||||
indices: number[];
|
||||
@@ -6820,7 +6809,7 @@ export class SphereGeometry extends Geometry {
|
||||
thetaLength: number;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
export class TetrahedronBufferGeometry extends PolyhedronBufferGeometry {
|
||||
constructor(radius?: number, detail?: number);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user