language stringclasses 1
value | owner stringlengths 2 15 | repo stringlengths 2 21 | sha stringlengths 45 45 | message stringlengths 7 36.3k | path stringlengths 1 199 | patch stringlengths 15 102k | is_multipart bool 2
classes |
|---|---|---|---|---|---|---|---|
Other | mrdoob | three.js | e683d1910bf61acaa1c8149d12f81e2b5871f4b7.json | Fix typo in webgpu/constants.js (#22795) | examples/jsm/renderers/webgpu/constants.js | @@ -107,8 +107,8 @@ export const GPUTextureFormat = {
RGBA8Snorm: 'rgba8snorm',
RGBA8Uint: 'rgba8uint',
RGBA8Sint: 'rgba8sint',
- BRGA8Unorm: 'bgra8unorm',
- BRGA8UnormSRGB: 'bgra8unorm-srgb',
+ BGRA8Unorm: 'bgra8unorm',
+ BGRA8UnormSRGB: 'bgra8unorm-srgb',
// Packed 32-bit formats
RGB9E5UFloat: 'rgb9e5ufloat',
RGB10A2Unorm: 'rgb10a2unorm', | true |
Other | mrdoob | three.js | b800b2283c16d97e9a208eb8e7592614cab2229c.json | Fix Euler property typo in setFromEuler
euler.order -> euler._order | src/math/Quaternion.js | @@ -216,7 +216,7 @@ Object.assign( Quaternion.prototype, {
}
- const x = euler._x, y = euler._y, z = euler._z, order = euler.order;
+ const x = euler._x, y = euler._y, z = euler._z, order = euler._order;
// http://www.mathworks.com/matlabcentral/fileexchange/
// 20696-function-to-convert-between-dcm-euler-angles-quaternions-and-euler-vectors/ | false |
Other | mrdoob | three.js | e1e076e59c58a784638d6b0c95c5c36413f6fb44.json | Fix linting errors | src/constants.d.ts | @@ -367,4 +367,4 @@ export const DynamicCopyUsage: Usage;
export const StreamCopyUsage: Usage;
export const GLSL1: string;
-export const GLSL3: string;
\ No newline at end of file
+export const GLSL3: string; | true |
Other | mrdoob | three.js | e1e076e59c58a784638d6b0c95c5c36413f6fb44.json | Fix linting errors | src/constants.js | @@ -196,5 +196,5 @@ export const StaticCopyUsage = 35046;
export const DynamicCopyUsage = 35050;
export const StreamCopyUsage = 35042;
-export const GLSL1 = "#version 100 es"
-export const GLSL3 = "#version 300 es"
\ No newline at end of file
+export const GLSL1 = "#version 100 es";
+export const GLSL3 = "#version 300 es"; | true |
Other | mrdoob | three.js | e1e076e59c58a784638d6b0c95c5c36413f6fb44.json | Fix linting errors | src/renderers/webgl/WebGLProgram.js | @@ -2,7 +2,6 @@ import { WebGLUniforms } from './WebGLUniforms.js';
import { WebGLShader } from './WebGLShader.js';
import { ShaderChunk } from '../shaders/ShaderChunk.js';
import { NoToneMapping, AddOperation, MixOperation, MultiplyOperation, EquirectangularRefractionMapping, CubeRefractionMapping, EquirectangularReflectionMapping, CubeUVRefractionMapping, CubeUVReflectionMapping, CubeReflectionMapping, PCFSoftShadowMap, PCFShadowMap, VSMShadowMap, ACESFilmicToneMapping, CineonToneMapping, CustomToneMapping, ReinhardToneMapping, LinearToneMapping, GammaEncoding, RGBDEncoding, RGBM16Encoding, RGBM7Encoding, RGBEEncoding, sRGBEncoding, LinearEncoding, LogLuvEncoding } from '../../constants.js';
-import { GLSL3 } from '../../constants.js';
let programIdCount = 0;
@@ -411,7 +410,7 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
if ( parameters.isRawShaderMaterial ) {
prefixVertex = [
-
+
customDefines
].filter( filterEmptyLine ).join( '\n' );
@@ -679,15 +678,15 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
// Automated GLSL 3.0 conversion. The shader chunks of standard shaders (eg MeshStandardMaterial) require GLSL 3.0 features.
// Apply these conversions if no glslVersion is specified.
- versionString = '#version 300 es\n'
+ versionString = '#version 300 es\n';
- prefixVertex = [
+ prefixVertex = [
'#define attribute in',
'#define varying out',
'#define texture2D texture'
].join( '\n' ) + '\n' + prefixVertex;
- prefixFragment = [
+ prefixFragment = [
'#define varying in',
'out highp vec4 pc_fragColor;',
'#define gl_FragColor pc_fragColor', | true |
Other | mrdoob | three.js | debb7eb046ca167fa627fd873fd6bbd7e188b221.json | Fix linting errors | src/materials/ShaderMaterial.js | @@ -111,7 +111,7 @@ ShaderMaterial.prototype.copy = function ( source ) {
this.extensions = Object.assign( {}, source.extensions );
- this.glslVersion = source.glslVersion
+ this.glslVersion = source.glslVersion;
return this;
@@ -121,9 +121,9 @@ ShaderMaterial.prototype.toJSON = function ( meta ) {
const data = Material.prototype.toJSON.call( this, meta );
- data.glslVersion = this.glslVersion
+ data.glslVersion = this.glslVersion;
data.uniforms = {};
-
+
for ( const name in this.uniforms ) {
const uniform = this.uniforms[ name ]; | true |
Other | mrdoob | three.js | debb7eb046ca167fa627fd873fd6bbd7e188b221.json | Fix linting errors | src/renderers/webgl/WebGLProgram.js | @@ -405,7 +405,7 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
const program = gl.createProgram();
let prefixVertex, prefixFragment;
- let versionString = parameters.glslVersion ? '#version ' + parameters.glslVersion : ''
+ let versionString = parameters.glslVersion ? '#version ' + parameters.glslVersion : '';
if ( parameters.isRawShaderMaterial ) {
| true |
Other | mrdoob | three.js | 76f12cd5f09e11795166d8a41a731e0b415993e7.json | Add plugins and libraries page | docs/list.json | @@ -15,7 +15,8 @@
"Creating text": "manual/en/introduction/Creating-text",
"Loading 3D models": "manual/en/introduction/Loading-3D-models",
"FAQ": "manual/en/introduction/FAQ",
- "Useful links": "manual/en/introduction/Useful-links"
+ "Useful links": "manual/en/introduction/Useful-links",
+ "Libraries and Plugins": "manual/en/introduction/Libraries-and-Plugins"
},
"Next Steps": { | true |
Other | mrdoob | three.js | 76f12cd5f09e11795166d8a41a731e0b415993e7.json | Add plugins and libraries page | docs/manual/en/introduction/Libraries-and-Plugins.html | @@ -0,0 +1,74 @@
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8" />
+ <base href="../../../" />
+ <script src="page.js"></script>
+ <link type="text/css" rel="stylesheet" href="page.css" />
+ </head>
+ <body>
+ <h1>[name]</h1>
+
+ <p class="desc">
+ Listed here are externally developed compatible libraries and plugins for three.js. This
+ list and the associated packages are maintained by the community and not guaranteed
+ to be up to date. If you'd like to update this list make PR!
+ </p>
+
+ <h3>Physics</h3>
+
+ <ul>
+ <li>[link:https://github.com/lo-th/Oimo.js/ Oimo.js]</li>
+ <li>[link:https://enable3d.io/ enable3d]</li>
+ <li>[link:https://github.com/kripken/ammo.js/ ammo.js]</li>
+ <li>[link:https://github.com/pmndrs/cannon-es cannon-es]</li>
+ </ul>
+
+ <h3>Postprocessing</h3>
+
+ <ul>
+ <li>[link:https://github.com/vanruesc/postprocessing postprocessing]</li>
+ </ul>
+
+ <h3>Intersection and Raycasting Performance</h3>
+
+ <ul>
+ <li>[link:https://github.com/gkjohnson/three-mesh-bvh three-mesh-bvh]</li>
+ </ul>
+
+ <h3>File Formats</h3>
+
+ <ul>
+ <li>[link:https://github.com/gkjohnson/urdf-loaders/tree/master/javascript urdf-loader]</li>
+ <li>[link:https://github.com/NASA-AMMOS/3DTilesRendererJS 3d-tiles-renderer-js]</li>
+ </ul>
+
+ <h3>3D Text and Layout</h3>
+
+ <ul>
+ <li>[link:https://github.com/protectwise/troika/tree/master/packages/troika-three-text troika-three-text]</li>
+ <li>[link:https://github.com/felixmariotto/three-mesh-ui three-mesh-ui]</li>
+ </ul>
+
+ <h3>Particle Systems</h3>
+
+ <ul>
+ <li>[link:https://github.com/creativelifeform/three-nebula three-nebula]</li>
+ </ul>
+
+ <h3>Game AI</h3>
+
+ <ul>
+ <li>[link:https://mugen87.github.io/yuka/ yuka]</li>
+ <li>[link:https://github.com/donmccurdy/three-pathfinding three-pathfinding]</li>
+ </ul>
+
+ <h3>Wrappers and Frameworks</h3>
+
+ <ul>
+ <li>[link:https://aframe.io/ A-Frame]</li>
+ <li>[link:https://github.com/pmndrs/react-three-fiber react-three-fiber]</li>
+ </ul>
+
+ </body>
+</html> | true |
Other | mrdoob | three.js | 5b89174f415cd527f9e486a4b5ea4f085a61a05f.json | Add loadAsync typing | examples/jsm/loaders/3DMLoader.d.ts | @@ -14,4 +14,6 @@ export class Rhino3dmLoader extends Loader {
setWorkerLimit( workerLimit: number ): Rhino3dmLoader;
dispose(): Rhino3dmLoader;
+ loadAsync( url: string, onProgress?: ( event: ProgressEvent ) => void ): Promise<Object3D>;
+
} | true |
Other | mrdoob | three.js | 5b89174f415cd527f9e486a4b5ea4f085a61a05f.json | Add loadAsync typing | examples/jsm/loaders/3MFLoader.d.ts | @@ -13,4 +13,6 @@ export class ThreeMFLoader extends Loader {
parse( data: ArrayBuffer ): Group;
addExtension( extension: object ):void
+ loadAsync( url: string, onProgress?: ( event: ProgressEvent ) => void ): Promise<Group>;
+
} | true |
Other | mrdoob | three.js | 5b89174f415cd527f9e486a4b5ea4f085a61a05f.json | Add loadAsync typing | examples/jsm/loaders/AMFLoader.d.ts | @@ -11,4 +11,6 @@ export class AMFLoader extends Loader {
load( url: string, onLoad: ( object: Group ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ): void;
parse( data: ArrayBuffer ): Group;
+ loadAsync( url: string, onProgress?: ( event: ProgressEvent ) => void ): Promise<Group>;
+
} | true |
Other | mrdoob | three.js | 5b89174f415cd527f9e486a4b5ea4f085a61a05f.json | Add loadAsync typing | examples/jsm/loaders/AssimpLoader.d.ts | @@ -17,4 +17,6 @@ export class AssimpLoader extends Loader {
load( url: string, onLoad: ( result: Assimp ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ) : void;
parse( buffer: ArrayBuffer, path: string ) : Assimp;
+ loadAsync( url: string, onProgress?: ( event: ProgressEvent ) => void ): Promise<Assimp>;
+
} | true |
Other | mrdoob | three.js | 5b89174f415cd527f9e486a4b5ea4f085a61a05f.json | Add loadAsync typing | examples/jsm/loaders/BVHLoader.d.ts | @@ -20,4 +20,6 @@ export class BVHLoader extends Loader {
load( url: string, onLoad: ( bvh: BVH ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ) : void;
parse( text: string ) : BVH;
+ loadAsync( url: string, onProgress?: ( event: ProgressEvent ) => void ): Promise<BVH>;
+
} | true |
Other | mrdoob | three.js | 5b89174f415cd527f9e486a4b5ea4f085a61a05f.json | Add loadAsync typing | examples/jsm/loaders/BasisTextureLoader.d.ts | @@ -27,6 +27,8 @@ export class BasisTextureLoader extends Loader {
detectSupport( renderer: WebGLRenderer ): this;
dispose(): void;
load( url: string, onLoad: ( texture: CompressedTexture ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ): void;
+ loadAsync( url: string, onProgress?: ( event: ProgressEvent ) => void ): Promise<CompressedTexture>;
+
setTranscoderPath( path: string ): this;
setWorkerLimit( workerLimit: number ): this;
| true |
Other | mrdoob | three.js | 5b89174f415cd527f9e486a4b5ea4f085a61a05f.json | Add loadAsync typing | examples/jsm/loaders/ColladaLoader.d.ts | @@ -18,4 +18,6 @@ export class ColladaLoader extends Loader {
load( url: string, onLoad: ( collada: Collada ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ) : void;
parse( text: string, path: string ) : Collada;
+ loadAsync( url: string, onProgress?: ( event: ProgressEvent ) => void ): Promise<Collada>;
+
} | true |
Other | mrdoob | three.js | 5b89174f415cd527f9e486a4b5ea4f085a61a05f.json | Add loadAsync typing | examples/jsm/loaders/DRACOLoader.d.ts | @@ -15,4 +15,6 @@ export class DRACOLoader extends Loader {
preload(): DRACOLoader;
dispose(): DRACOLoader;
+ loadAsync( url: string, onProgress?: ( event: ProgressEvent ) => void ): Promise<BufferGeometry>;
+
} | true |
Other | mrdoob | three.js | 5b89174f415cd527f9e486a4b5ea4f085a61a05f.json | Add loadAsync typing | examples/jsm/loaders/FBXLoader.d.ts | @@ -11,4 +11,6 @@ export class FBXLoader extends Loader {
load( url: string, onLoad: ( object: Group ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ) : void;
parse( FBXBuffer: ArrayBuffer | string, path: string ) : Group;
+ loadAsync( url: string, onProgress?: ( event: ProgressEvent ) => void ): Promise<Group>;
+
} | true |
Other | mrdoob | three.js | 5b89174f415cd527f9e486a4b5ea4f085a61a05f.json | Add loadAsync typing | examples/jsm/loaders/GCodeLoader.d.ts | @@ -12,4 +12,6 @@ export class GCodeLoader extends Loader {
load( url: string, onLoad: ( object: Group ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ) : void;
parse( data: string ) : Group;
+ loadAsync( url: string, onProgress?: ( event: ProgressEvent ) => void ): Promise<Group>;
+
} | true |
Other | mrdoob | three.js | 5b89174f415cd527f9e486a4b5ea4f085a61a05f.json | Add loadAsync typing | examples/jsm/loaders/GLTFLoader.d.ts | @@ -50,6 +50,8 @@ export class GLTFLoader extends Loader {
parse( data: ArrayBuffer | string, path: string, onLoad: ( gltf: GLTF ) => void, onError?: ( event: ErrorEvent ) => void ) : void;
+ loadAsync( url: string, onProgress?: ( event: ProgressEvent ) => void ): Promise<GLTF>;
+
}
export interface GLTFReference { | true |
Other | mrdoob | three.js | 5b89174f415cd527f9e486a4b5ea4f085a61a05f.json | Add loadAsync typing | examples/jsm/loaders/HDRCubeTextureLoader.d.ts | @@ -16,4 +16,6 @@ export class HDRCubeTextureLoader extends Loader {
load( urls: string[], onLoad: ( texture: CubeTexture ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ): void;
setDataType( type: TextureDataType ): this;
+ loadAsync( url: string, onProgress?: ( event: ProgressEvent ) => void ): Promise<CubeTexture>;
+
} | true |
Other | mrdoob | three.js | 5b89174f415cd527f9e486a4b5ea4f085a61a05f.json | Add loadAsync typing | examples/jsm/loaders/KMZLoader.d.ts | @@ -12,4 +12,6 @@ export class KMZLoader extends Loader {
load( url: string, onLoad: ( kmz: Collada ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ): void;
parse( data: ArrayBuffer ): Collada;
+ loadAsync( url: string, onProgress?: ( event: ProgressEvent ) => void ): Promise<Collada>;
+
} | true |
Other | mrdoob | three.js | 5b89174f415cd527f9e486a4b5ea4f085a61a05f.json | Add loadAsync typing | examples/jsm/loaders/LDrawLoader.d.ts | @@ -18,4 +18,6 @@ export class LDrawLoader extends Loader {
addMaterial( material: Material ): void;
getMaterial( colourCode: string ): Material | null;
+ loadAsync( url: string, onProgress?: ( event: ProgressEvent ) => void ): Promise<Group>;
+
} | true |
Other | mrdoob | three.js | 5b89174f415cd527f9e486a4b5ea4f085a61a05f.json | Add loadAsync typing | examples/jsm/loaders/LUT3dlLoader.d.ts | @@ -25,4 +25,6 @@ export class LUT3dlLoader extends Loader {
);
parse( data: string ): LUT3dlResult;
+ loadAsync( url: string, onProgress?: ( event: ProgressEvent ) => void ): Promise<LUT3dlResult>;
+
} | true |
Other | mrdoob | three.js | 5b89174f415cd527f9e486a4b5ea4f085a61a05f.json | Add loadAsync typing | examples/jsm/loaders/LUTCubeLoader.d.ts | @@ -29,4 +29,6 @@ export class LUTCubeLoader extends Loader {
);
parse( data: string ): LUTCubeResult;
+ loadAsync( url: string, onProgress?: ( event: ProgressEvent ) => void ): Promise<LUTCubeResult>;
+
} | true |
Other | mrdoob | three.js | 5b89174f415cd527f9e486a4b5ea4f085a61a05f.json | Add loadAsync typing | examples/jsm/loaders/LWOLoader.d.ts | @@ -26,4 +26,6 @@ export class LWOLoader extends Loader {
load( url: string, onLoad: ( lwo: LWO ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ) : void;
parse( data: ArrayBuffer, path: string, modelName: string ): LWO;
+ loadAsync( url: string, onProgress?: ( event: ProgressEvent ) => void ): Promise<LWO>;
+
} | true |
Other | mrdoob | three.js | 5b89174f415cd527f9e486a4b5ea4f085a61a05f.json | Add loadAsync typing | examples/jsm/loaders/LottieLoader.d.ts | @@ -12,4 +12,6 @@ export class LottieLoader extends Loader {
setQuality( value: Number ) : void;
+ loadAsync( url: string, onProgress?: ( event: ProgressEvent ) => void ): Promise<CanvasTexture>;
+
} | true |
Other | mrdoob | three.js | 5b89174f415cd527f9e486a4b5ea4f085a61a05f.json | Add loadAsync typing | examples/jsm/loaders/MD2Loader.d.ts | @@ -11,4 +11,6 @@ export class MD2Loader extends Loader {
load( url: string, onLoad: ( geometry: BufferGeometry ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ): void;
parse( data: ArrayBuffer ): BufferGeometry;
+ loadAsync( url: string, onProgress?: ( event: ProgressEvent ) => void ): Promise<BufferGeometry>;
+
} | true |
Other | mrdoob | three.js | 5b89174f415cd527f9e486a4b5ea4f085a61a05f.json | Add loadAsync typing | examples/jsm/loaders/MDDLoader.d.ts | @@ -17,4 +17,6 @@ export class MDDLoader extends Loader {
load( url: string, onLoad: ( result: MDD ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ) : void;
parse( data: ArrayBuffer ) : MDD;
+ loadAsync( url: string, onProgress?: ( event: ProgressEvent ) => void ): Promise<MDD>;
+
} | true |
Other | mrdoob | three.js | 5b89174f415cd527f9e486a4b5ea4f085a61a05f.json | Add loadAsync typing | examples/jsm/loaders/MMDLoader.d.ts | @@ -29,4 +29,6 @@ export class MMDLoader extends Loader {
loadWithAnimation( url: string, vmdUrl: string | string[], onLoad: ( object: MMDLoaderAnimationObject ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ): void;
setAnimationPath( animationPath: string ): this;
+ loadAsync( url: string, onProgress?: ( event: ProgressEvent ) => void ): Promise<SkinnedMesh>;
+
} | true |
Other | mrdoob | three.js | 5b89174f415cd527f9e486a4b5ea4f085a61a05f.json | Add loadAsync typing | examples/jsm/loaders/MTLLoader.d.ts | @@ -48,6 +48,8 @@ export class MTLLoader extends Loader {
parse( text: string, path: string ) : MTLLoader.MaterialCreator;
setMaterialOptions( value: MaterialCreatorOptions ) : void;
+ loadAsync( url: string, onProgress?: ( event: ProgressEvent ) => void ): Promise<MTLLoader.MaterialCreator>;
+
}
export interface MaterialInfo { | true |
Other | mrdoob | three.js | 5b89174f415cd527f9e486a4b5ea4f085a61a05f.json | Add loadAsync typing | examples/jsm/loaders/OBJLoader.d.ts | @@ -16,4 +16,6 @@ export class OBJLoader extends Loader {
parse( data: string ) : Group;
setMaterials( materials: MTLLoader.MaterialCreator ) : this;
+ loadAsync( url: string, onProgress?: ( event: ProgressEvent ) => void ): Promise<Group>;
+
} | true |
Other | mrdoob | three.js | 5b89174f415cd527f9e486a4b5ea4f085a61a05f.json | Add loadAsync typing | examples/jsm/loaders/OBJLoader2.d.ts | @@ -42,4 +42,6 @@ export class OBJLoader2 extends Loader {
load( url: string, onLoad: ( object3d: Object3D ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void, onMeshAlter?: ( meshData: object ) => void ): void;
parse( content: ArrayBuffer | string ): Object3D;
+ loadAsync( url: string, onProgress?: ( event: ProgressEvent ) => void ): Promise<Object3D>;
+
} | true |
Other | mrdoob | three.js | 5b89174f415cd527f9e486a4b5ea4f085a61a05f.json | Add loadAsync typing | examples/jsm/loaders/PCDLoader.d.ts | @@ -13,4 +13,6 @@ export class PCDLoader extends Loader {
load( url: string, onLoad: ( points: Points ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ) : void;
parse( data: ArrayBuffer | string, url: string ) : Points;
+ loadAsync( url: string, onProgress?: ( event: ProgressEvent ) => void ): Promise<Points>;
+
} | true |
Other | mrdoob | three.js | 5b89174f415cd527f9e486a4b5ea4f085a61a05f.json | Add loadAsync typing | examples/jsm/loaders/PDBLoader.d.ts | @@ -20,4 +20,6 @@ export class PDBLoader extends Loader {
load( url: string, onLoad: ( pdb: PDB ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ) : void;
parse( text: string ) : PDB;
+ loadAsync( url: string, onProgress?: ( event: ProgressEvent ) => void ): Promise<PDB>;
+
} | true |
Other | mrdoob | three.js | 5b89174f415cd527f9e486a4b5ea4f085a61a05f.json | Add loadAsync typing | examples/jsm/loaders/PLYLoader.d.ts | @@ -14,4 +14,6 @@ export class PLYLoader extends Loader {
setPropertyNameMapping( mapping: object ) : void;
parse( data: ArrayBuffer | string ) : BufferGeometry;
+ loadAsync( url: string, onProgress?: ( event: ProgressEvent ) => void ): Promise<BufferGeometry>;
+
} | true |
Other | mrdoob | three.js | 5b89174f415cd527f9e486a4b5ea4f085a61a05f.json | Add loadAsync typing | examples/jsm/loaders/PRWMLoader.d.ts | @@ -12,6 +12,8 @@ export class PRWMLoader extends Loader {
load( url: string, onLoad: ( geometry: BufferGeometry ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ) : void;
parse( data: ArrayBuffer ) : BufferGeometry;
+ loadAsync( url: string, onProgress?: ( event: ProgressEvent ) => void ): Promise<BufferGeometry>;
+
static isBigEndianPlatform(): boolean;
} | true |
Other | mrdoob | three.js | 5b89174f415cd527f9e486a4b5ea4f085a61a05f.json | Add loadAsync typing | examples/jsm/loaders/STLLoader.d.ts | @@ -12,4 +12,6 @@ export class STLLoader extends Loader {
load( url: string, onLoad: ( geometry: BufferGeometry ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ) : void;
parse( data: ArrayBuffer | string ) : BufferGeometry;
+ loadAsync( url: string, onProgress?: ( event: ProgressEvent ) => void ): Promise<BufferGeometry>;
+
} | true |
Other | mrdoob | three.js | 5b89174f415cd527f9e486a4b5ea4f085a61a05f.json | Add loadAsync typing | examples/jsm/loaders/SVGLoader.d.ts | @@ -29,6 +29,8 @@ export class SVGLoader extends Loader {
load( url: string, onLoad: ( data: SVGResult ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ) : void;
parse( text: string ) : SVGResult;
+ loadAsync( url: string, onProgress?: ( event: ProgressEvent ) => void ): Promise<SVGResult>;
+
static getStrokeStyle( width?: number, color?: string, lineJoin?: string, lineCap?: string, miterLimit?: number ): StrokeStyle;
static pointsToStroke( points: Vector3[], style: StrokeStyle, arcDivisions?: number, minDistance?: number ): BufferGeometry;
static pointsToStrokeWithBuffers( points: Vector3[], style: StrokeStyle, arcDivisions?: number, minDistance?: number, vertices?: number[], normals?: number[], uvs?: number[], vertexOffset?: number ): number; | true |
Other | mrdoob | three.js | 5b89174f415cd527f9e486a4b5ea4f085a61a05f.json | Add loadAsync typing | examples/jsm/loaders/TDSLoader.d.ts | @@ -21,6 +21,8 @@ export class TDSLoader extends Loader {
load( url: string, onLoad: ( object: Group ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ): void;
parse( arraybuffer: ArrayBuffer, path: string ): Group;
+ loadAsync( url: string, onProgress?: ( event: ProgressEvent ) => void ): Promise<Group>;
+
debugMessage( message: object ): void;
endChunk( chunk: object ): void;
nextChunk( data: DataView, chunk: object ): void; | true |
Other | mrdoob | three.js | 5b89174f415cd527f9e486a4b5ea4f085a61a05f.json | Add loadAsync typing | examples/jsm/loaders/TGALoader.d.ts | @@ -11,4 +11,6 @@ export class TGALoader extends Loader {
load( url: string, onLoad: ( texture: Texture ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ) : void;
parse( data: ArrayBuffer ) : Texture;
+ loadAsync( url: string, onProgress?: ( event: ProgressEvent ) => void ): Promise<Texture>;
+
} | true |
Other | mrdoob | three.js | 5b89174f415cd527f9e486a4b5ea4f085a61a05f.json | Add loadAsync typing | examples/jsm/loaders/TTFLoader.d.ts | @@ -11,4 +11,6 @@ export class TTFLoader extends Loader {
load( url: string, onLoad: ( json: object ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ): void;
parse( arraybuffer: ArrayBuffer ): object;
+ loadAsync( url: string, onProgress?: ( event: ProgressEvent ) => void ): Promise<object>;
+
} | true |
Other | mrdoob | three.js | 5b89174f415cd527f9e486a4b5ea4f085a61a05f.json | Add loadAsync typing | examples/jsm/loaders/TiltLoader.d.ts | @@ -11,4 +11,6 @@ export class TiltLoader extends Loader {
load( url: string, onLoad: ( object: Group ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ): void;
parse( data: ArrayBuffer ): Group;
+ loadAsync( url: string, onProgress?: ( event: ProgressEvent ) => void ): Promise<Group>;
+
} | true |
Other | mrdoob | three.js | 5b89174f415cd527f9e486a4b5ea4f085a61a05f.json | Add loadAsync typing | examples/jsm/loaders/VOXLoader.d.ts | @@ -10,4 +10,6 @@ export class VOXLoader extends Loader {
load( url: string, onLoad: ( chunks: Array<object> ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ): void;
parse( data: ArrayBuffer ): Array<object>;
+ loadAsync( url: string, onProgress?: ( event: ProgressEvent ) => void ): Promise<Array<object>>;
+
} | true |
Other | mrdoob | three.js | 5b89174f415cd527f9e486a4b5ea4f085a61a05f.json | Add loadAsync typing | examples/jsm/loaders/VRMLLoader.d.ts | @@ -11,4 +11,6 @@ export class VRMLLoader extends Loader {
load( url: string, onLoad: ( scene: Scene ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ) : void;
parse( data: string, path: string ) : Scene;
+ loadAsync( url: string, onProgress?: ( event: ProgressEvent ) => void ): Promise<Scene>;
+
} | true |
Other | mrdoob | three.js | 5b89174f415cd527f9e486a4b5ea4f085a61a05f.json | Add loadAsync typing | examples/jsm/loaders/VRMLoader.d.ts | @@ -15,4 +15,6 @@ export class VRMLoader extends Loader {
parse( gltf: GLTF, onLoad: ( scene: GLTF ) => void ): void;
setDRACOLoader( dracoLoader: DRACOLoader ): this;
+ loadAsync( url: string, onProgress?: ( event: ProgressEvent ) => void ): Promise<GLTF>;
+
} | true |
Other | mrdoob | three.js | 5b89174f415cd527f9e486a4b5ea4f085a61a05f.json | Add loadAsync typing | examples/jsm/loaders/VTKLoader.d.ts | @@ -11,4 +11,6 @@ export class VTKLoader extends Loader {
load( url: string, onLoad: ( geometry: BufferGeometry ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ): void;
parse( data: ArrayBuffer | string, path: string ): BufferGeometry;
+ loadAsync( url: string, onProgress?: ( event: ProgressEvent ) => void ): Promise<BufferGeometry>;
+
} | true |
Other | mrdoob | three.js | 5b89174f415cd527f9e486a4b5ea4f085a61a05f.json | Add loadAsync typing | examples/jsm/loaders/XLoader.d.ts | @@ -16,4 +16,6 @@ export class XLoader extends Loader {
load( url: string, onLoad: ( object: XResult ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ): void;
parse( data: ArrayBuffer | string, onLoad: ( object: object ) => void ): object;
+ loadAsync( url: string, onProgress?: ( event: ProgressEvent ) => void ): Promise<XResult>;
+
} | true |
Other | mrdoob | three.js | 5b89174f415cd527f9e486a4b5ea4f085a61a05f.json | Add loadAsync typing | examples/jsm/loaders/XYZLoader.d.ts | @@ -11,4 +11,6 @@ export class XYZLoader extends Loader {
load( url: string, onLoad: ( geometry: BufferGeometry ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ): void;
parse( data: string, onLoad: ( geometry: BufferGeometry ) => void ): object;
+ loadAsync( url: string, onProgress?: ( event: ProgressEvent ) => void ): Promise<BufferGeometry>;
+
} | true |
Other | mrdoob | three.js | 5b89174f415cd527f9e486a4b5ea4f085a61a05f.json | Add loadAsync typing | src/loaders/AnimationLoader.d.ts | @@ -14,4 +14,6 @@ export class AnimationLoader extends Loader {
): void;
parse( json: any ): AnimationClip[];
+ loadAsync( url: string, onProgress?: ( event: ProgressEvent ) => void ): Promise<AnimationClip[]>;
+
} | true |
Other | mrdoob | three.js | 5b89174f415cd527f9e486a4b5ea4f085a61a05f.json | Add loadAsync typing | src/loaders/AudioLoader.d.ts | @@ -12,4 +12,6 @@ export class AudioLoader extends Loader {
onError?: ( event: ErrorEvent ) => void
): void;
+ loadAsync( url: string, onProgress?: ( event: ProgressEvent ) => void ): Promise<AudioBuffer>;
+
} | true |
Other | mrdoob | three.js | 5b89174f415cd527f9e486a4b5ea4f085a61a05f.json | Add loadAsync typing | src/loaders/BufferGeometryLoader.d.ts | @@ -15,4 +15,6 @@ export class BufferGeometryLoader extends Loader {
): void;
parse( json: any ): InstancedBufferGeometry | BufferGeometry;
+ loadAsync( url: string, onProgress?: ( event: ProgressEvent ) => void ): Promise<InstancedBufferGeometry | BufferGeometry>;
+
} | true |
Other | mrdoob | three.js | 5b89174f415cd527f9e486a4b5ea4f085a61a05f.json | Add loadAsync typing | src/loaders/CompressedTextureLoader.d.ts | @@ -13,4 +13,6 @@ export class CompressedTextureLoader extends Loader {
onError?: ( event: ErrorEvent ) => void
): CompressedTexture;
+ loadAsync( url: string, onProgress?: ( event: ProgressEvent ) => void ): Promise<CompressedTexture>;
+
} | true |
Other | mrdoob | three.js | 5b89174f415cd527f9e486a4b5ea4f085a61a05f.json | Add loadAsync typing | src/loaders/CubeTextureLoader.d.ts | @@ -13,4 +13,6 @@ export class CubeTextureLoader extends Loader {
onError?: ( event: ErrorEvent ) => void
): CubeTexture;
+ loadAsync( url: string, onProgress?: ( event: ProgressEvent ) => void ): Promise<CubeTexture>;
+
} | true |
Other | mrdoob | three.js | 5b89174f415cd527f9e486a4b5ea4f085a61a05f.json | Add loadAsync typing | src/loaders/DataTextureLoader.d.ts | @@ -13,4 +13,6 @@ export class DataTextureLoader extends Loader {
onError?: ( event: ErrorEvent ) => void
): void;
+ loadAsync( url: string, onProgress?: ( event: ProgressEvent ) => void ): Promise<DataTexture>;
+
} | true |
Other | mrdoob | three.js | 5b89174f415cd527f9e486a4b5ea4f085a61a05f.json | Add loadAsync typing | src/loaders/FileLoader.d.ts | @@ -17,4 +17,6 @@ export class FileLoader extends Loader {
setMimeType( mimeType: MimeType ): FileLoader;
setResponseType( responseType: string ): FileLoader;
+ loadAsync( url: string, onProgress?: ( event: ProgressEvent ) => void ): Promise<string | ArrayBuffer>;
+
} | true |
Other | mrdoob | three.js | 5b89174f415cd527f9e486a4b5ea4f085a61a05f.json | Add loadAsync typing | src/loaders/FontLoader.d.ts | @@ -14,4 +14,6 @@ export class FontLoader extends Loader {
): void;
parse( json: any ): Font;
+ loadAsync( url: string, onProgress?: ( event: ProgressEvent ) => void ): Promise<Font>;
+
} | true |
Other | mrdoob | three.js | 5b89174f415cd527f9e486a4b5ea4f085a61a05f.json | Add loadAsync typing | src/loaders/ImageBitmapLoader.d.ts | @@ -20,4 +20,6 @@ export class ImageBitmapLoader extends Loader {
onError?: ( event: ErrorEvent ) => void
): any;
+ loadAsync( url: string, onProgress?: ( event: ProgressEvent ) => void ): Promise<ImageBitmap>;
+
} | true |
Other | mrdoob | three.js | 5b89174f415cd527f9e486a4b5ea4f085a61a05f.json | Add loadAsync typing | src/loaders/ImageLoader.d.ts | @@ -16,4 +16,6 @@ export class ImageLoader extends Loader {
onError?: ( event: ErrorEvent ) => void
): HTMLImageElement;
+ loadAsync( url: string, onProgress?: ( event: ProgressEvent ) => void ): Promise<HTMLImageElement>;
+
} | true |
Other | mrdoob | three.js | 5b89174f415cd527f9e486a4b5ea4f085a61a05f.json | Add loadAsync typing | src/loaders/MaterialLoader.d.ts | @@ -21,4 +21,6 @@ export class MaterialLoader extends Loader {
setTextures( textures: { [key: string]: Texture } ): this;
parse( json: any ): Material;
+ loadAsync( url: string, onProgress?: ( event: ProgressEvent ) => void ): Promise<Material>;
+
} | true |
Other | mrdoob | three.js | 5b89174f415cd527f9e486a4b5ea4f085a61a05f.json | Add loadAsync typing | src/loaders/ObjectLoader.d.ts | @@ -31,4 +31,6 @@ export class ObjectLoader extends Loader {
animations: AnimationClip[]
): T;
+ loadAsync<ObjectType extends Object3D>( url: string, onProgress?: ( event: ProgressEvent ) => void ): Promise<ObjectType>;
+
} | true |
Other | mrdoob | three.js | 5b89174f415cd527f9e486a4b5ea4f085a61a05f.json | Add loadAsync typing | src/loaders/TextureLoader.d.ts | @@ -17,4 +17,6 @@ export class TextureLoader extends Loader {
onError?: ( event: ErrorEvent ) => void
): Texture;
+ loadAsync( url: string, onProgress?: ( event: ProgressEvent ) => void ): Promise<Texture>;
+
} | true |
Other | mrdoob | three.js | 6485112961efcabc1610f3fdc3badfa3561ae473.json | Add setFromMatrix3 function
Add test | docs/api/en/math/Matrix4.html | @@ -368,6 +368,9 @@ <h3>[method:this set]( [param:Float n11], [param:Float n12], [param:Float n13],
[page:Float n12], ... [page:Float n44].
</p>
+ <h3>[method:this setFromMatrix3]( [param:Matrix3 m] )</h3>
+ <p>Set the upper 3x3 elements of this matrix to the values of the Matrix3 [page:Matrix3 m].</p>
+
<h3>[method:this setPosition]( [param:Vector3 v] )</h3>
<h3>[method:this setPosition]( [param:Float x], [param:Float y], [param:Float z] ) // optional API</h3>
<p> | true |
Other | mrdoob | three.js | 6485112961efcabc1610f3fdc3badfa3561ae473.json | Add setFromMatrix3 function
Add test | docs/api/zh/math/Matrix4.html | @@ -351,6 +351,9 @@ <h3>[method:this set]( [param:Float n11], [param:Float n12], [param:Float n13],
以行优先的格式将传入的数值设置给该矩阵中的元素[page:.elements elements]。
</p>
+ <h3>[method:this setFromMatrix3]( [param:Matrix3 m] )</h3>
+ <p>Set the upper 3x3 elements of this matrix to the values of the Matrix3 [page:Matrix3 m].</p>
+
<h3>[method:this setPosition]( [param:Vector3 v] )</h3>
<h3>[method:this setPosition]( [param:Float x], [param:Float y], [param:Float z] ) // optional API</h3>
<p> | true |
Other | mrdoob | three.js | 6485112961efcabc1610f3fdc3badfa3561ae473.json | Add setFromMatrix3 function
Add test | src/math/Matrix4.js | @@ -83,6 +83,23 @@ class Matrix4 {
}
+ setFromMatrix3( m ) {
+
+ const me = m.elements;
+
+ this.set(
+
+ me[ 0 ], me[ 3 ], me[ 6 ], 0,
+ me[ 1 ], me[ 4 ], me[ 7 ], 0,
+ me[ 2 ], me[ 5 ], me[ 8 ], 0,
+ 0, 0, 0, 1
+
+ );
+
+ return this;
+
+ }
+
extractBasis( xAxis, yAxis, zAxis ) {
xAxis.setFromMatrixColumn( this, 0 ); | true |
Other | mrdoob | three.js | 6485112961efcabc1610f3fdc3badfa3561ae473.json | Add setFromMatrix3 function
Add test | test/unit/src/math/Matrix4.tests.js | @@ -1,5 +1,6 @@
/* global QUnit */
+import { Matrix3 } from '../../../../src/math/Matrix3';
import { Matrix4 } from '../../../../src/math/Matrix4';
import { Vector3 } from '../../../../src/math/Vector3';
import { Euler } from '../../../../src/math/Euler';
@@ -163,6 +164,25 @@ export default QUnit.module( 'Maths', () => {
} );
+ QUnit.test( "setFromMatrix4", ( assert ) => {
+
+ var a = new Matrix3().set(
+ 0, 1, 2,
+ 3, 4, 5,
+ 6, 7, 8
+ );
+ var b = new Matrix4();
+ var c = new Matrix4().set(
+ 0, 1, 2, 0,
+ 3, 4, 5, 0,
+ 6, 7, 8, 0,
+ 0, 0, 0, 1
+ );
+ b.setFromMatrix3( a );
+ assert.ok( b.equals( c ) );
+
+ } );
+
QUnit.test( "copyPosition", ( assert ) => {
var a = new Matrix4().set( 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 ); | true |
Other | mrdoob | three.js | 6e6bb25c2fb9561b3ee72dd6e7b94d9d4d3614cd.json | fix Matrix3 docs typo | docs/api/en/math/Matrix3.html | @@ -159,7 +159,7 @@ <h3>[method:this premultiply]( [param:Matrix3 m] )</h3>
<p>Pre-multiplies this matrix by [page:Matrix3 m].</p>
<h3>[method:this setFromMatrix4]( [param:Matrix4 m] )</h3>
- <p>Set this matrx to the upper 3x3 matrix of the Matrix4 [page:Matrix4 m].</p>
+ <p>Set this matrix to the upper 3x3 matrix of the Matrix4 [page:Matrix4 m].</p>
<h3>[method:this setUvTransform]( [param:Float tx], [param:Float ty], [param:Float sx], [param:Float sy], [param:Float rotation], [param:Float cx], [param:Float cy] )</h3>
<p> | false |
Other | mrdoob | three.js | 4f708fbcd1d22f3e79b07bbf30a1e6189aa05bca.json | Set background to null only if it's a color | src/extras/PMREMGenerator.js | @@ -271,6 +271,7 @@ class PMREMGenerator {
if ( background && background.isColor ) {
_backgroundColor.copy( background );
+ scene.background = null;
} else {
@@ -287,7 +288,6 @@ class PMREMGenerator {
_backgroundColor.multiplyScalar( Math.pow( 2.0, - fExp ) );
const alpha = ( fExp + 128.0 ) / 255.0;
renderer.setClearColor( _backgroundColor, alpha );
- scene.background = null;
for ( let i = 0; i < 6; i ++ ) { | false |
Other | mrdoob | three.js | 8e3d91ff52f163b56f0931c1915e8d0429e31ff7.json | Improve PMREM handling of background color | src/extras/PMREMGenerator.js | @@ -54,6 +54,7 @@ const ENCODINGS = {
const _flatCamera = /*@__PURE__*/ new OrthographicCamera();
const { _lodPlanes, _sizeLods, _sigmas } = /*@__PURE__*/ _createPlanes();
const _clearColor = /*@__PURE__*/ new Color();
+const _backgroundColor = /*@__PURE__*/ new Color();
let _oldTarget = null;
// Golden Ratio
@@ -261,24 +262,34 @@ class PMREMGenerator {
const toneMapping = renderer.toneMapping;
renderer.getClearColor( _clearColor );
const clearAlpha = renderer.getClearAlpha();
+ const originalBackground = scene.background;
renderer.toneMapping = NoToneMapping;
renderer.outputEncoding = LinearEncoding;
- let background = scene.background;
+ const background = scene.background;
if ( background && background.isColor ) {
- background.convertSRGBToLinear();
- // Convert linear to RGBE
- const maxComponent = Math.max( background.r, background.g, background.b );
- const fExp = Math.min( Math.max( Math.ceil( Math.log2( maxComponent ) ), - 128.0 ), 127.0 );
- background = background.multiplyScalar( Math.pow( 2.0, - fExp ) );
- const alpha = ( fExp + 128.0 ) / 255.0;
- renderer.setClearColor( background, alpha );
- scene.background = null;
+ _backgroundColor.copy( background );
+
+ } else {
+
+ _backgroundColor.copy( _clearColor );
}
+
+ _backgroundColor.convertSRGBToLinear();
+
+ // Convert linear to RGBE
+ const maxComponent = Math.max( _backgroundColor.r, _backgroundColor.g, _backgroundColor.b );
+ const fExp = Math.min( Math.max( Math.ceil( Math.log2( maxComponent ) ), - 128.0 ), 127.0 );
+ _backgroundColor.multiplyScalar( Math.pow( 2.0, - fExp ) );
+ const alpha = ( fExp + 128.0 ) / 255.0;
+ renderer.setClearColor( _backgroundColor, alpha );
+ scene.background = null;
+
+
for ( let i = 0; i < 6; i ++ ) {
const col = i % 3;
@@ -309,6 +320,7 @@ class PMREMGenerator {
renderer.toneMapping = toneMapping;
renderer.outputEncoding = outputEncoding;
renderer.setClearColor( _clearColor, clearAlpha );
+ scene.background = originalBackground;
}
| false |
Other | mrdoob | three.js | 123c4b6d72c503e48ffa466993f8e8091f721aab.json | Remove workaround for Adreno bug (#24611) | src/renderers/shaders/ShaderChunk/normal_fragment_begin.glsl.js | @@ -3,10 +3,8 @@ float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
#ifdef FLAT_SHADED
- // Workaround for Adreno GPUs not able to do dFdx( vViewPosition )
-
- vec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );
- vec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );
+ vec3 fdx = dFdx( vViewPosition );
+ vec3 fdy = dFdy( vViewPosition );
vec3 normal = normalize( cross( fdx, fdy ) );
#else | false |
Other | mrdoob | three.js | fdb7011cfec9ffb5bfdeb00d8dfb1a0225d12bdf.json | FIx minor typos (#24590) | examples/jsm/utils/BufferGeometryUtils.js | @@ -385,7 +385,7 @@ function interleaveAttributes( attributes ) {
let arrayLength = 0;
let stride = 0;
- // calculate the the length and type of the interleavedBuffer
+ // calculate the length and type of the interleavedBuffer
for ( let i = 0, l = attributes.length; i < l; ++ i ) {
const attribute = attributes[ i ];
@@ -555,7 +555,7 @@ function estimateBytesUsed( geometry ) {
/**
* @param {BufferGeometry} geometry
* @param {number} tolerance
- * @return {BufferGeometry>}
+ * @return {BufferGeometry}
*/
function mergeVertices( geometry, tolerance = 1e-4 ) {
@@ -704,7 +704,7 @@ function mergeVertices( geometry, tolerance = 1e-4 ) {
/**
* @param {BufferGeometry} geometry
* @param {number} drawMode
- * @return {BufferGeometry>}
+ * @return {BufferGeometry}
*/
function toTrianglesDrawMode( geometry, drawMode ) {
| false |
Other | mrdoob | three.js | 65be6b7d29cb61cdbfbc59e7dcfabdbb20878f15.json | prevent save-image on long press | threejs/threejs-game-conga-line-w-notes.html | @@ -15,6 +15,11 @@
html, body {
margin: 0;
height: 100%;
+ user-select: none;
+ }
+ img, canvas {
+ /* prevent the save-image on long press on mobile */
+ pointer-events: none;
}
#c {
width: 100%; | true |
Other | mrdoob | three.js | 65be6b7d29cb61cdbfbc59e7dcfabdbb20878f15.json | prevent save-image on long press | threejs/threejs-game-conga-line.html | @@ -15,6 +15,11 @@
html, body {
margin: 0;
height: 100%;
+ user-select: none;
+ }
+ img, canvas {
+ /* prevent the save-image on long press on mobile */
+ pointer-events: none;
}
#c {
width: 100%; | true |
Other | mrdoob | three.js | 65be6b7d29cb61cdbfbc59e7dcfabdbb20878f15.json | prevent save-image on long press | threejs/threejs-game-player-input.html | @@ -15,6 +15,11 @@
html, body {
margin: 0;
height: 100%;
+ user-select: none;
+ }
+ img, canvas {
+ /* prevent the save-image on long press on mobile */
+ pointer-events: none;
}
#c {
width: 100%; | true |
Other | mrdoob | three.js | dc774f8298ca3b2b5163140c0905d23e1529f674.json | fix no-js pre | threejs/lessons/resources/lesson.css | @@ -42,6 +42,11 @@ pre.prettyprint {
pre.prettyprint li {
white-space: pre;
}
+pre.prettyprint code {
+ color: #CCC;
+ font-family: "Lucida Console", Monaco, monospace;
+ display: block;
+}
/* to handle long words in paragraph */
p code { | false |
Other | mrdoob | three.js | 2e9e14b9838cf75525556d5eb66ac75f1c8a4cbd.json | add more animals | .eslintrc.js | @@ -77,6 +77,7 @@ module.exports = {
"no-comma-dangle": [0],
"no-irregular-whitespace": 2,
"no-multi-spaces": [0],
+ "no-loop-func": 0,
"no-obj-calls": 2,
"no-redeclare": [0],
"no-shadow": [0], | true |
Other | mrdoob | three.js | 2e9e14b9838cf75525556d5eb66ac75f1c8a4cbd.json | add more animals | threejs/threejs-game-conga-line-w-notes.html | @@ -917,11 +917,27 @@
'zebra',
'horse',
];
- animalModelNames.forEach((name, ndx) => {
+ const base = new THREE.Object3D();
+ const offset = new THREE.Object3D();
+ base.add(offset);
+
+ // position animals in a spiral.
+ const numAnimals = 28;
+ const arc = 10;
+ const b = 10 / (2 * Math.PI);
+ let r = 10;
+ let phi = r / b;
+ for (let i = 0; i < numAnimals; ++i) {
+ const name = animalModelNames[rand(animalModelNames.length) | 0];
const gameObject = gameObjectManager.createGameObject(scene, name);
gameObject.addComponent(Animal, models[name]);
- gameObject.transform.position.x = (ndx + 1) * 5;
- });
+ base.rotation.y = phi;
+ offset.position.x = r;
+ offset.updateWorldMatrix(true, false);
+ offset.getWorldPosition(gameObject.transform.position);
+ phi += arc / r;
+ r = b * phi;
+ }
}
function resizeRendererToDisplaySize(renderer) { | true |
Other | mrdoob | three.js | abf01a221ee0d2ecda20ab042820ec6f0df50fa8.json | handle globals.debug starting false | threejs/lessons/threejs-game.md | @@ -1692,11 +1692,14 @@ we've used else where
```js
+const gui = new dat.GUI();
+gui.add(globals, 'debug').onChange(showHideDebugInfo);
++showHideDebugInfo();
const labelContainerElem = document.querySelector('#labels');
+function showHideDebugInfo() {
+ labelContainerElem.style.display = globals.debug ? '' : 'none';
+}
++showHideDebugInfo();
+
class StateDisplayHelper extends Component {
...
@@ -2004,6 +2007,45 @@ by setting the material's [`opacity`](Material.opacity).
After the loop it the removes the transform
from the scene and the note itself from active gameobjects.
+One last thing, let's add a few more animals
+
+```js
+function init() {
+
+ ...
+
+ const animalModelNames = [
+ 'pig',
+ 'cow',
+ 'llama',
+ 'pug',
+ 'sheep',
+ 'zebra',
+ 'horse',
+ ];
++ const base = new THREE.Object3D();
++ const offset = new THREE.Object3D();
++ base.add(offset);
++
++ // position animals in a spiral.
++ const numAnimals = 28;
++ const arc = 10;
++ const b = 10 / (2 * Math.PI);
++ let r = 10;
++ let phi = r / b;
++ for (let i = 0; i < numAnimals; ++i) {
++ const name = animalModelNames[rand(animalModelNames.length) | 0];
+ const gameObject = gameObjectManager.createGameObject(scene, name);
+ gameObject.addComponent(Animal, models[name]);
++ base.rotation.y = phi;
++ offset.position.x = r;
++ offset.updateWorldMatrix(true, false);
++ offset.getWorldPosition(gameObject.transform.position);
++ phi += arc / r;
++ r = b * phi;
+ }
+```
+
{{{example url="../threejs-game-conga-line-w-notes.html"}}}
You might be asking, why not use `setTimeout`? The problem with `setTimeout` | true |
Other | mrdoob | three.js | abf01a221ee0d2ecda20ab042820ec6f0df50fa8.json | handle globals.debug starting false | threejs/threejs-game-conga-line-w-notes.html | @@ -615,11 +615,14 @@
const gui = new dat.GUI();
gui.add(globals, 'debug').onChange(showHideDebugInfo);
+ gui.close();
const labelContainerElem = document.querySelector('#labels');
function showHideDebugInfo() {
labelContainerElem.style.display = globals.debug ? '' : 'none';
}
+ showHideDebugInfo();
+
class StateDisplayHelper extends Component {
constructor(gameObject, size) {
super(gameObject); | true |
Other | mrdoob | three.js | 105d0731d725435188aaf76af55953ab9b68da4f.json | remove hasOwnProperty usage | threejs/resources/webgl-debug-helper.js | @@ -544,12 +544,10 @@
// Override the getError function with one that returns our saved results.
if (wrapper.getError) {
wrapper.getError = function() {
- for (const err in glErrorShadow) {
- if (glErrorShadow.hasOwnProperty(err)) {
- if (glErrorShadow[err]) {
- glErrorShadow[err] = false;
- return err;
- }
+ for (const err of glErrorShadow) {
+ if (glErrorShadow[err]) {
+ glErrorShadow[err] = false;
+ return err;
}
}
return ctx.NO_ERROR; | false |
Other | mrdoob | three.js | b92cd9e8166c1ce2761b43094f99fcb4cd0c9597.json | fix multiple material blurb | threejs/lessons/threejs-textures.md | @@ -96,16 +96,22 @@ It works!
{{{example url="../threejs-textured-cube-6-textures.html" }}}
-It should be noted though that by default the only geometry that supports multiple
-materials is the `BoxGeometry` and `BoxBufferGeometry`. For other cases you will
-need to build or load custom geometry and/or modify texture coordinates. It's far
-more common to use a [Texture Atlas](https://en.wikipedia.org/wiki/Texture_atlas)
-if you want to allow multiple images on a single
-geometry.
+It should be noted though that not all geometry types supports multiple
+materials. `BoxGeometry` and `BoxBufferGeometry` can use 6 materials one for each face.
+`ConeGeometry` and `ConeBufferGeometry` can use 2 materials, one for the bottom and one for the cone.
+`CylinderGeometry` and `CylinderBufferGeometry` can use 3 materials, bottom, top, and side.
+For other cases you will need to build or load custom geometry and/or modify texture coordinates.
+
+It's far more common in other 3D engines and far more performant to use a
+[Texture Atlas](https://en.wikipedia.org/wiki/Texture_atlas)
+if you want to allow multiple images on a single geometry. A Texture atlas
+is where you put multiple images in a single texture and then use texture coordinates
+on the vertices of your geometry to select which parts of a texture are used on
+each triangle in your geometry.
What are texture coordinates? They are data added to each vertex of a piece of geometry
that specify what part of the texture corresponds to that specific vertex.
-We'll go over them when we start building custom geometry.
+We'll go over them when we start [building custom geometry](threejs-custom-geometry.html).
## <a name="loading"></a> Loading Textures
| false |
Other | mrdoob | three.js | a7dd46198d24a1f5f96dedefce2f3a82921554ce.json | add note color and more coroutine info | threejs/lessons/threejs-game.md | @@ -1871,10 +1871,31 @@ function* countOTo9() {
}
```
-If we passed this function to the `CoroutineRunner` above it would print
+If we added this function to the `CoroutineRunner` above it would print
out each number, 0 to 9, once per frame or rather once per time we called `runner.update`.
-In the player let's use a coroutine to emit a note every half second to 1 second
+```js
+const runner = new CoroutineRunner();
+runner.add(count0To9);
+while(runner.isBusy()) {
+ runner.update();
+}
+```
+
+Coroutines are removed automatically when they are finished.
+To remove a coroutine early, before it reaches the end you need to keep
+a reference to its generator like this
+
+```js
+const gen = count0To9();
+runner.add(gen);
+
+// sometime later
+
+runner.remove(gen);
+```
+
+In any case, in the player let's use a coroutine to emit a note every half second to 1 second
```js
class Player extends Component {
@@ -1928,12 +1949,16 @@ function makeTextTexture(str) {
ctx.font = '60px sans-serif';
ctx.textAlign = 'center';
ctx.textBaseline = 'middle';
+ ctx.fillStyle = '#FFF';
ctx.fillText(str, ctx.canvas.width / 2, ctx.canvas.height / 2);
return new THREE.CanvasTexture(ctx.canvas);
}
const noteTexture = makeTextTexture('♪');
```
+The texture we create above is white each means when we use it
+we can set the material's color and get a note of any color.
+
Now that we have a noteTexture here's the `Note` component.
It uses `SpriteMaterial` and a `Sprite` like we covered in
[the article on billboards](threejs-billboards.html)
@@ -1944,6 +1969,7 @@ class Note extends Component {
super(gameObject);
const {transform} = gameObject;
const noteMaterial = new THREE.SpriteMaterial({
+ color: new THREE.Color().setHSL(rand(1), 1, 0.5),
map: noteTexture,
side: THREE.DoubleSide,
transparent: true,
@@ -1981,8 +2007,8 @@ from the scene and the note itself from active gameobjects.
{{{example url="../threejs-game-conga-line-w-notes.html"}}}
You might be asking, why not use `setTimeout`? The problem with `setTimeout`
-is it's not related to the game clock. For example above we make the maximum
-amount of time allowed to elapse between frames is 1/20th of a second.
+is it's not related to the game clock. For example above we made the maximum
+amount of time allowed to elapse between frames to be 1/20th of a second.
Our coroutine system will respect that limit but `setTimeout` would not.
Of course we could have made a simple timer ourselves
@@ -1992,6 +2018,7 @@ class Player ... {
update() {
this.noteTimer -= globals.deltaTime;
if (this.noteTimer <= 0) {
+ // reset timer
this.noteTimer = rand(0.5, 1);
// create a gameobject with a note component
}
@@ -2037,6 +2064,17 @@ function* animalCoroutine() {
This would have worked but of course as soon as our states were not so linear
we'd have had to switch to a `FiniteStateMachine`.
+It also wasn't clear to me if coroutines should run independently of their
+components. We could have made a global `CoroutineRunner` and put all
+coroutines on it. That would make cleaning them up harder. As it is now
+if the gameobject is removed all of it's components are removed and
+therefore the coroutine runners created are no longer called and it will
+all get garbage collected. If we had global runner then it would be
+the responsibility of each component to remove any coroutines it added
+or else some other mechanism of registering coroutines with a particular
+component or gameobject would be needed so that removing one removes the
+others.
+
There are lots more issues a
normal game engine would deal with. As it is there is no order to how
gameobjects or their components are run. They are just run in the order added. | true |
Other | mrdoob | three.js | a7dd46198d24a1f5f96dedefce2f3a82921554ce.json | add note color and more coroutine info | threejs/threejs-game-conga-line-w-notes.html | @@ -194,11 +194,11 @@
const models = {
pig: { url: 'resources/models/animals/Pig.gltf' },
cow: { url: 'resources/models/animals/Cow.gltf' },
- llama: { url: 'resources/models/animals/Llama.gltf' },
- pug: { url: 'resources/models/animals/Pug.gltf' },
- sheep: { url: 'resources/models/animals/Sheep.gltf' },
- zebra: { url: 'resources/models/animals/Zebra.gltf' },
- horse: { url: 'resources/models/animals/Horse.gltf' },
+ llama: { url: 'resources/models/animals/llama.gltf' },
+ pug: { url: 'resources/models/animals/pug.gltf' },
+ sheep: { url: 'resources/models/animals/sheep.gltf' },
+ zebra: { url: 'resources/models/animals/zebra.gltf' },
+ horse: { url: 'resources/models/animals/horse.gltf' },
knight: { url: 'resources/models/knight/KnightCharacter.gltf' },
};
{
@@ -676,16 +676,19 @@
ctx.font = '60px sans-serif';
ctx.textAlign = 'center';
ctx.textBaseline = 'middle';
+ ctx.fillStyle = '#FFF';
ctx.fillText(str, ctx.canvas.width / 2, ctx.canvas.height / 2);
return new THREE.CanvasTexture(ctx.canvas);
}
+ const noteTexture = makeTextTexture('♪');
class Note extends Component {
constructor(gameObject) {
super(gameObject);
const {transform} = gameObject;
const noteMaterial = new THREE.SpriteMaterial({
- map: makeTextTexture('♪'),
+ color: new THREE.Color().setHSL(rand(1), 1, 0.5),
+ map: noteTexture,
side: THREE.DoubleSide,
transparent: true,
}); | true |
Other | mrdoob | three.js | c8358e30aa2acca40e8f4a1f2041fc558534636f.json | remove test file | threejs/threejs-game-load-models-test.html | @@ -1,218 +0,0 @@
-<!-- Licensed under a BSD license. See license.html for license -->
-<!DOCTYPE html>
-<html>
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
- <title>Three.js - Game - Load Models</title>
- <style>
- html, body {
- margin: 0;
- height: 100%;
- }
- #c {
- width: 100%;
- height: 100%;
- display: block;
- }
- #loading {
- position: absolute;
- left: 0;
- top: 0;
- width: 100%;
- height: 100%;
- display: flex;
- align-items: center;
- justify-content: center;
- text-align: center;
- font-size: xx-large;
- font-family: sans-serif;
- }
- #loading>div>div {
- padding: 2px;
- }
- .progress {
- width: 50vw;
- border: 1px solid black;
- }
- #progressbar {
- width: 0%;
- height: 1em;
- background-color: #888;
- background-image: linear-gradient(
- -45deg,
- rgba(255, 255, 255, .5) 25%,
- transparent 25%,
- transparent 50%,
- rgba(255, 255, 255, .5) 50%,
- rgba(255, 255, 255, .5) 75%,
- transparent 75%,
- transparent
- );
- background-size: 50px 50px;
- animation: progressanim 2s linear infinite;
- }
-
- @keyframes progressanim {
- 0% {
- background-position: 50px 50px;
- }
- 100% {
- background-position: 0 0;
- }
- }
- </style>
- </head>
- <body>
- <canvas id="c"></canvas>
- <div id="loading">
- <div>
- <div>...loading...</div>
- <div class="progress"><div id="progressbar"></div></div>
- </div>
- </div>
- </body>
-<script src="resources/threejs/r105/three.min.js"></script>
-<script src="resources/threejs/r105/js/controls/OrbitControls.js"></script>
-<script src="resources/threejs/r105/js/loaders/GLTFLoader.js"></script>
-<script src="resources/threejs/r105/js/utils/SkeletonUtils.js"></script>
-<script>
-'use strict';
-
-/* global THREE */
-
-function main() {
- const canvas = document.querySelector('#c');
- const renderer = new THREE.WebGLRenderer({canvas});
-
- const fov = 45;
- const aspect = 2; // the canvas default
- const near = 0.1;
- const far = 100;
- const camera = new THREE.PerspectiveCamera(fov, aspect, near, far);
- camera.position.set(0, 20, 40);
-
- const controls = new THREE.OrbitControls(camera, canvas);
- controls.target.set(0, 5, 0);
- controls.update();
-
- const scene = new THREE.Scene();
- scene.background = new THREE.Color('white');
-
- function addLight(...pos) {
- const color = 0xFFFFFF;
- const intensity = 1;
- const light = new THREE.DirectionalLight(color, intensity);
- light.position.set(...pos);
- scene.add(light);
- scene.add(light.target);
- }
- addLight(5, 5, 2);
- addLight(-5, 5, 5);
-
- const manager = new THREE.LoadingManager();
- manager.onLoad = init;
-
- const progressbarElem = document.querySelector('#progressbar');
- manager.onProgress = (url, itemsLoaded, itemsTotal) => {
- progressbarElem.style.width = `${itemsLoaded / itemsTotal * 100 | 0}%`;
- };
-
- const models = {
- pig: { url: 'resources/models/animals/Pig.gltf' },
- cow: { url: 'resources/models/animals/Cow.gltf' },
- llama: { url: 'resources/models/animals/Llama.gltf' },
- pug: { url: 'resources/models/animals/Pug.gltf' },
- sheep: { url: 'resources/models/animals/Sheep.gltf' },
- zebra: { url: 'resources/models/animals/Zebra.gltf' },
- horse: { url: 'resources/models/animals/Horse.gltf' },
- knight: { url: 'resources/models/knight/KnightCharacter.gltf' },
- };
- {
- const gltfLoader = new THREE.GLTFLoader(manager);
- Object.values(models).forEach((model) => {
- gltfLoader.load(model.url, (gltf) => {
- console.log('loaded:', model.url);
- model.gltf = gltf;
- }, undefined, (error) => {
- console.error(model.url, error);
- });
- });
- }
-
- /* eslint no-console: "off" */
- function prepModelsAndAnimations() {
- console.log('prep models-----------------');
- Object.values(models).forEach(model => {
- const animsByName = {};
- console.log(model.url, model.gltf ? 'has gltf' : 'missing gltf');
- model.gltf.animations.forEach((clip) => {
- animsByName[clip.name] = clip;
- });
- model.animations = animsByName;
- });
- }
-
- const mixers = [];
-
- function init() {
- // hide the loading bar
- const loadingElem = document.querySelector('#loading');
- loadingElem.style.display = 'none';
-
- prepModelsAndAnimations();
-
- Object.values(models).forEach((model, ndx) => {
- const clonedScene = THREE.SkeletonUtils.clone(model.gltf.scene);
- const root = new THREE.Object3D();
- root.add(clonedScene);
- scene.add(root);
- root.position.x = (ndx - 3) * 3;
-
- const mixer = new THREE.AnimationMixer(clonedScene);
- const firstClip = Object.values(model.animations)[0];
- const action = mixer.clipAction(firstClip);
- action.play();
- mixers.push(mixer);
- });
- }
-
- function resizeRendererToDisplaySize(renderer) {
- const canvas = renderer.domElement;
- const width = canvas.clientWidth;
- const height = canvas.clientHeight;
- const needResize = canvas.width !== width || canvas.height !== height;
- if (needResize) {
- renderer.setSize(width, height, false);
- }
- return needResize;
- }
-
- let then = 0;
- function render(now) {
- now *= 0.001; // convert to seconds
- const deltaTime = now - then;
- then = now;
-
- if (resizeRendererToDisplaySize(renderer)) {
- const canvas = renderer.domElement;
- camera.aspect = canvas.clientWidth / canvas.clientHeight;
- camera.updateProjectionMatrix();
- }
-
- for (const mixer of mixers) {
- mixer.update(deltaTime);
- }
-
- renderer.render(scene, camera);
-
- requestAnimationFrame(render);
- }
-
- requestAnimationFrame(render);
-}
-
-main();
-</script>
-</html>
- | false |
Other | mrdoob | three.js | 6491fb4b69d89a24ae5dfe41865ddd0460703276.json | fix cases of animal model urls | threejs/lessons/threejs-game.md | @@ -69,11 +69,11 @@ manager.onLoad = init;
const models = {
pig: { url: 'resources/models/animals/Pig.gltf' },
cow: { url: 'resources/models/animals/Cow.gltf' },
- llama: { url: 'resources/models/animals/llama.gltf' },
- pug: { url: 'resources/models/animals/pug.gltf' },
- sheep: { url: 'resources/models/animals/sheep.gltf' },
- zebra: { url: 'resources/models/animals/zebra.gltf' },
- horse: { url: 'resources/models/animals/horse.gltf' },
+ llama: { url: 'resources/models/animals/Llama.gltf' },
+ pug: { url: 'resources/models/animals/Pug.gltf' },
+ sheep: { url: 'resources/models/animals/Sheep.gltf' },
+ zebra: { url: 'resources/models/animals/Zebra.gltf' },
+ horse: { url: 'resources/models/animals/Horse.gltf' },
knight: { url: 'resources/models/knight/KnightCharacter.gltf' },
};
{
@@ -740,31 +740,31 @@ And running it got this list in [the JavaScript console](https://developers.goog
WalkSlow
Death
Idle
- ------->: resources/models/animals/llama.gltf
+ ------->: resources/models/animals/Llama.gltf
Jump
Idle
Walk
Death
WalkSlow
- ------->: resources/models/animals/pug.gltf
+ ------->: resources/models/animals/Pug.gltf
Jump
Walk
Idle
WalkSlow
Death
- ------->: resources/models/animals/sheep.gltf
+ ------->: resources/models/animals/Sheep.gltf
WalkSlow
Death
Jump
Walk
Idle
- ------->: resources/models/animals/zebra.gltf
+ ------->: resources/models/animals/Zebra.gltf
Jump
Walk
Death
WalkSlow
Idle
- ------->: resources/models/animals/horse.gltf
+ ------->: resources/models/animals/Horse.gltf
Jump
WalkSlow
Death | true |
Other | mrdoob | three.js | 6491fb4b69d89a24ae5dfe41865ddd0460703276.json | fix cases of animal model urls | threejs/threejs-game-check-animations.html | @@ -121,11 +121,11 @@
const models = {
pig: { url: 'resources/models/animals/Pig.gltf' },
cow: { url: 'resources/models/animals/Cow.gltf' },
- llama: { url: 'resources/models/animals/llama.gltf' },
- pug: { url: 'resources/models/animals/pug.gltf' },
- sheep: { url: 'resources/models/animals/sheep.gltf' },
- zebra: { url: 'resources/models/animals/zebra.gltf' },
- horse: { url: 'resources/models/animals/horse.gltf' },
+ llama: { url: 'resources/models/animals/Llama.gltf' },
+ pug: { url: 'resources/models/animals/Pug.gltf' },
+ sheep: { url: 'resources/models/animals/Sheep.gltf' },
+ zebra: { url: 'resources/models/animals/Zebra.gltf' },
+ horse: { url: 'resources/models/animals/Horse.gltf' },
knight: { url: 'resources/models/knight/KnightCharacter.gltf' },
};
{ | true |
Other | mrdoob | three.js | 6491fb4b69d89a24ae5dfe41865ddd0460703276.json | fix cases of animal model urls | threejs/threejs-game-conga-line-w-notes.html | @@ -194,11 +194,11 @@
const models = {
pig: { url: 'resources/models/animals/Pig.gltf' },
cow: { url: 'resources/models/animals/Cow.gltf' },
- llama: { url: 'resources/models/animals/llama.gltf' },
- pug: { url: 'resources/models/animals/pug.gltf' },
- sheep: { url: 'resources/models/animals/sheep.gltf' },
- zebra: { url: 'resources/models/animals/zebra.gltf' },
- horse: { url: 'resources/models/animals/horse.gltf' },
+ llama: { url: 'resources/models/animals/Llama.gltf' },
+ pug: { url: 'resources/models/animals/Pug.gltf' },
+ sheep: { url: 'resources/models/animals/Sheep.gltf' },
+ zebra: { url: 'resources/models/animals/Zebra.gltf' },
+ horse: { url: 'resources/models/animals/Horse.gltf' },
knight: { url: 'resources/models/knight/KnightCharacter.gltf' },
};
{ | true |
Other | mrdoob | three.js | 6491fb4b69d89a24ae5dfe41865ddd0460703276.json | fix cases of animal model urls | threejs/threejs-game-conga-line.html | @@ -194,11 +194,11 @@
const models = {
pig: { url: 'resources/models/animals/Pig.gltf' },
cow: { url: 'resources/models/animals/Cow.gltf' },
- llama: { url: 'resources/models/animals/llama.gltf' },
- pug: { url: 'resources/models/animals/pug.gltf' },
- sheep: { url: 'resources/models/animals/sheep.gltf' },
- zebra: { url: 'resources/models/animals/zebra.gltf' },
- horse: { url: 'resources/models/animals/horse.gltf' },
+ llama: { url: 'resources/models/animals/Llama.gltf' },
+ pug: { url: 'resources/models/animals/Pug.gltf' },
+ sheep: { url: 'resources/models/animals/Sheep.gltf' },
+ zebra: { url: 'resources/models/animals/Zebra.gltf' },
+ horse: { url: 'resources/models/animals/Horse.gltf' },
knight: { url: 'resources/models/knight/KnightCharacter.gltf' },
};
{ | true |
Other | mrdoob | three.js | 6491fb4b69d89a24ae5dfe41865ddd0460703276.json | fix cases of animal model urls | threejs/threejs-game-just-player.html | @@ -128,11 +128,11 @@
const models = {
pig: { url: 'resources/models/animals/Pig.gltf' },
cow: { url: 'resources/models/animals/Cow.gltf' },
- llama: { url: 'resources/models/animals/llama.gltf' },
- pug: { url: 'resources/models/animals/pug.gltf' },
- sheep: { url: 'resources/models/animals/sheep.gltf' },
- zebra: { url: 'resources/models/animals/zebra.gltf' },
- horse: { url: 'resources/models/animals/horse.gltf' },
+ llama: { url: 'resources/models/animals/Llama.gltf' },
+ pug: { url: 'resources/models/animals/Pug.gltf' },
+ sheep: { url: 'resources/models/animals/Sheep.gltf' },
+ zebra: { url: 'resources/models/animals/Zebra.gltf' },
+ horse: { url: 'resources/models/animals/Horse.gltf' },
knight: { url: 'resources/models/knight/KnightCharacter.gltf' },
};
{ | true |
Other | mrdoob | three.js | 6491fb4b69d89a24ae5dfe41865ddd0460703276.json | fix cases of animal model urls | threejs/threejs-game-load-models-test.html | @@ -121,11 +121,11 @@
const models = {
pig: { url: 'resources/models/animals/Pig.gltf' },
cow: { url: 'resources/models/animals/Cow.gltf' },
- llama: { url: 'resources/models/animals/llama.gltf' },
- pug: { url: 'resources/models/animals/pug.gltf' },
- sheep: { url: 'resources/models/animals/sheep.gltf' },
- zebra: { url: 'resources/models/animals/zebra.gltf' },
- horse: { url: 'resources/models/animals/horse.gltf' },
+ llama: { url: 'resources/models/animals/Llama.gltf' },
+ pug: { url: 'resources/models/animals/Pug.gltf' },
+ sheep: { url: 'resources/models/animals/Sheep.gltf' },
+ zebra: { url: 'resources/models/animals/Zebra.gltf' },
+ horse: { url: 'resources/models/animals/Horse.gltf' },
knight: { url: 'resources/models/knight/KnightCharacter.gltf' },
};
{ | true |
Other | mrdoob | three.js | 6491fb4b69d89a24ae5dfe41865ddd0460703276.json | fix cases of animal model urls | threejs/threejs-game-load-models.html | @@ -121,11 +121,11 @@
const models = {
pig: { url: 'resources/models/animals/Pig.gltf' },
cow: { url: 'resources/models/animals/Cow.gltf' },
- llama: { url: 'resources/models/animals/llama.gltf' },
- pug: { url: 'resources/models/animals/pug.gltf' },
- sheep: { url: 'resources/models/animals/sheep.gltf' },
- zebra: { url: 'resources/models/animals/zebra.gltf' },
- horse: { url: 'resources/models/animals/horse.gltf' },
+ llama: { url: 'resources/models/animals/Llama.gltf' },
+ pug: { url: 'resources/models/animals/Pug.gltf' },
+ sheep: { url: 'resources/models/animals/Sheep.gltf' },
+ zebra: { url: 'resources/models/animals/Zebra.gltf' },
+ horse: { url: 'resources/models/animals/Horse.gltf' },
knight: { url: 'resources/models/knight/KnightCharacter.gltf' },
};
{ | true |
Other | mrdoob | three.js | 6491fb4b69d89a24ae5dfe41865ddd0460703276.json | fix cases of animal model urls | threejs/threejs-game-player-input.html | @@ -163,11 +163,11 @@
const models = {
pig: { url: 'resources/models/animals/Pig.gltf' },
cow: { url: 'resources/models/animals/Cow.gltf' },
- llama: { url: 'resources/models/animals/llama.gltf' },
- pug: { url: 'resources/models/animals/pug.gltf' },
- sheep: { url: 'resources/models/animals/sheep.gltf' },
- zebra: { url: 'resources/models/animals/zebra.gltf' },
- horse: { url: 'resources/models/animals/horse.gltf' },
+ llama: { url: 'resources/models/animals/Llama.gltf' },
+ pug: { url: 'resources/models/animals/Pug.gltf' },
+ sheep: { url: 'resources/models/animals/Sheep.gltf' },
+ zebra: { url: 'resources/models/animals/Zebra.gltf' },
+ horse: { url: 'resources/models/animals/Horse.gltf' },
knight: { url: 'resources/models/knight/KnightCharacter.gltf' },
};
{ | true |
Other | mrdoob | three.js | d811a8e6250d96b8527eb22b36ea795977591255.json | test ios fix3 | threejs/threejs-game-load-models-test.html | @@ -0,0 +1,218 @@
+<!-- Licensed under a BSD license. See license.html for license -->
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
+ <title>Three.js - Game - Load Models</title>
+ <style>
+ html, body {
+ margin: 0;
+ height: 100%;
+ }
+ #c {
+ width: 100%;
+ height: 100%;
+ display: block;
+ }
+ #loading {
+ position: absolute;
+ left: 0;
+ top: 0;
+ width: 100%;
+ height: 100%;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ text-align: center;
+ font-size: xx-large;
+ font-family: sans-serif;
+ }
+ #loading>div>div {
+ padding: 2px;
+ }
+ .progress {
+ width: 50vw;
+ border: 1px solid black;
+ }
+ #progressbar {
+ width: 0%;
+ height: 1em;
+ background-color: #888;
+ background-image: linear-gradient(
+ -45deg,
+ rgba(255, 255, 255, .5) 25%,
+ transparent 25%,
+ transparent 50%,
+ rgba(255, 255, 255, .5) 50%,
+ rgba(255, 255, 255, .5) 75%,
+ transparent 75%,
+ transparent
+ );
+ background-size: 50px 50px;
+ animation: progressanim 2s linear infinite;
+ }
+
+ @keyframes progressanim {
+ 0% {
+ background-position: 50px 50px;
+ }
+ 100% {
+ background-position: 0 0;
+ }
+ }
+ </style>
+ </head>
+ <body>
+ <canvas id="c"></canvas>
+ <div id="loading">
+ <div>
+ <div>...loading...</div>
+ <div class="progress"><div id="progressbar"></div></div>
+ </div>
+ </div>
+ </body>
+<script src="resources/threejs/r105/three.min.js"></script>
+<script src="resources/threejs/r105/js/controls/OrbitControls.js"></script>
+<script src="resources/threejs/r105/js/loaders/GLTFLoader.js"></script>
+<script src="resources/threejs/r105/js/utils/SkeletonUtils.js"></script>
+<script>
+'use strict';
+
+/* global THREE */
+
+function main() {
+ const canvas = document.querySelector('#c');
+ const renderer = new THREE.WebGLRenderer({canvas});
+
+ const fov = 45;
+ const aspect = 2; // the canvas default
+ const near = 0.1;
+ const far = 100;
+ const camera = new THREE.PerspectiveCamera(fov, aspect, near, far);
+ camera.position.set(0, 20, 40);
+
+ const controls = new THREE.OrbitControls(camera, canvas);
+ controls.target.set(0, 5, 0);
+ controls.update();
+
+ const scene = new THREE.Scene();
+ scene.background = new THREE.Color('white');
+
+ function addLight(...pos) {
+ const color = 0xFFFFFF;
+ const intensity = 1;
+ const light = new THREE.DirectionalLight(color, intensity);
+ light.position.set(...pos);
+ scene.add(light);
+ scene.add(light.target);
+ }
+ addLight(5, 5, 2);
+ addLight(-5, 5, 5);
+
+ const manager = new THREE.LoadingManager();
+ manager.onLoad = init;
+
+ const progressbarElem = document.querySelector('#progressbar');
+ manager.onProgress = (url, itemsLoaded, itemsTotal) => {
+ progressbarElem.style.width = `${itemsLoaded / itemsTotal * 100 | 0}%`;
+ };
+
+ const models = {
+ pig: { url: 'resources/models/animals/Pig.gltf' },
+ cow: { url: 'resources/models/animals/Cow.gltf' },
+ llama: { url: 'resources/models/animals/llama.gltf' },
+ pug: { url: 'resources/models/animals/pug.gltf' },
+ sheep: { url: 'resources/models/animals/sheep.gltf' },
+ zebra: { url: 'resources/models/animals/zebra.gltf' },
+ horse: { url: 'resources/models/animals/horse.gltf' },
+ knight: { url: 'resources/models/knight/KnightCharacter.gltf' },
+ };
+ {
+ const gltfLoader = new THREE.GLTFLoader(manager);
+ Object.values(models).forEach((model) => {
+ gltfLoader.load(model.url, (gltf) => {
+ console.log('loaded:', model.url);
+ model.gltf = gltf;
+ }, undefined, (error) => {
+ console.error(model.url, error);
+ });
+ });
+ }
+
+ /* eslint no-console: "off" */
+ function prepModelsAndAnimations() {
+ console.log('prep models-----------------');
+ Object.values(models).forEach(model => {
+ const animsByName = {};
+ console.log(model.url, model.gltf ? 'has gltf' : 'missing gltf');
+ model.gltf.animations.forEach((clip) => {
+ animsByName[clip.name] = clip;
+ });
+ model.animations = animsByName;
+ });
+ }
+
+ const mixers = [];
+
+ function init() {
+ // hide the loading bar
+ const loadingElem = document.querySelector('#loading');
+ loadingElem.style.display = 'none';
+
+ prepModelsAndAnimations();
+
+ Object.values(models).forEach((model, ndx) => {
+ const clonedScene = THREE.SkeletonUtils.clone(model.gltf.scene);
+ const root = new THREE.Object3D();
+ root.add(clonedScene);
+ scene.add(root);
+ root.position.x = (ndx - 3) * 3;
+
+ const mixer = new THREE.AnimationMixer(clonedScene);
+ const firstClip = Object.values(model.animations)[0];
+ const action = mixer.clipAction(firstClip);
+ action.play();
+ mixers.push(mixer);
+ });
+ }
+
+ function resizeRendererToDisplaySize(renderer) {
+ const canvas = renderer.domElement;
+ const width = canvas.clientWidth;
+ const height = canvas.clientHeight;
+ const needResize = canvas.width !== width || canvas.height !== height;
+ if (needResize) {
+ renderer.setSize(width, height, false);
+ }
+ return needResize;
+ }
+
+ let then = 0;
+ function render(now) {
+ now *= 0.001; // convert to seconds
+ const deltaTime = now - then;
+ then = now;
+
+ if (resizeRendererToDisplaySize(renderer)) {
+ const canvas = renderer.domElement;
+ camera.aspect = canvas.clientWidth / canvas.clientHeight;
+ camera.updateProjectionMatrix();
+ }
+
+ for (const mixer of mixers) {
+ mixer.update(deltaTime);
+ }
+
+ renderer.render(scene, camera);
+
+ requestAnimationFrame(render);
+ }
+
+ requestAnimationFrame(render);
+}
+
+main();
+</script>
+</html>
+ | false |
Other | mrdoob | three.js | 9e68a027e090315e3f8622e4848e575bf5107927.json | test ios fix2 | threejs/threejs-game-load-models.html | @@ -130,7 +130,7 @@
};
{
const gltfLoader = new THREE.GLTFLoader(manager);
- Object.value(models).forEach((model) => {
+ Object.values(models).forEach((model) => {
gltfLoader.load(model.url, (gltf) => {
model.gltf = gltf;
}); | false |
Other | mrdoob | three.js | 59337fc8540acd4b0a355b4e2e27f49bfd41eb27.json | fix iframe css | threejs/lessons/resources/lesson.css | @@ -322,6 +322,7 @@ iframe.noborder {
}
.threejs_example_container>div {
border: 1px solid black;
+ margin: 0 auto;
}
iframe.external_diagram {
@@ -489,10 +490,14 @@ pre.prettyprint.lighttheme .fun { color: #900; } /* function name */
.threejs_example {
max-height: 400px;
}
- iframe {
+ .threejs_example_container>div {
max-width: 95%;
+ }
+ .threejs_diagram_container iframe {
+ max-width: 95%;
}
- iframe.background {
+ }
+ iframe.background {
max-width: 100%;
}
} | false |
Other | mrdoob | three.js | 8981347a2cdaf6efbdd4ee3949cf330a917f93bc.json | add css for footnotes | threejs/lessons/resources/lesson.css | @@ -17,6 +17,16 @@ table {
margin-bottom: 1em;
}
+.footnote {
+ font-size: smaller;
+ vertical-align: baseline;
+ position: relative;
+ top: -0.4em;
+}
+.footnotes {
+ font-size: smaller;
+}
+
pre {
background: rgb(143, 140, 140);
padding: 1em; | false |
Other | mrdoob | three.js | 2caae7c4e4f338c004d77a060a7f59737306fc3b.json | fix a fixer | threejs/lessons/resources/lesson.js | @@ -308,6 +308,9 @@ $(document).ready(function($){
const classRE = /^(\w+)$/;
$('a').each(function() {
const href = this.getAttribute('href');
+ if (!href) {
+ return;
+ }
const m = methodPropertyRE.exec(href);
if (m) {
const codeKeywordLink = getKeywordLink(m[1]); | false |
Other | mrdoob | three.js | 44e589f7619e80bd087b8e1778dda173d2192df6.json | change debug title | .vscode/launch.json | @@ -4,10 +4,11 @@
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
+
{
"type": "node",
"request": "launch",
- "name": "Launch Program",
+ "name": "Build Lessons",
"program": "${workspaceFolder}/node_modules/grunt-cli/bin/grunt",
"args": ["buildlessons"],
"console": "internalConsole", | false |
Other | mrdoob | three.js | fd0c00def8dbb57efdceb91b87f95988d0d5af85.json | remove un-needed categories | threejs/lessons/ru/threejs-cameras.md | @@ -1,6 +1,5 @@
Title: Three.js - Камера
Description: Как использовать камеру в Three.js
-Category: fundamentals
TOC: Камера
Эта статья является частью серии статей о three.js. | true |
Other | mrdoob | three.js | fd0c00def8dbb57efdceb91b87f95988d0d5af85.json | remove un-needed categories | threejs/lessons/ru/threejs-fundamentals.md | @@ -1,6 +1,5 @@
Title: Основы Three.js
Description: Твой первый урок по Three.js начинаетсся с основ
-Category: basics
TOC: Базовые принципы
Это первая статья в серии статей о three.js. | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.