Skip to content

Commit 60a0388

Browse files
authored
Merge pull request #280 from WhitestormJS/#278
PR for #278
2 parents 833d11f + e4ac040 commit 60a0388

File tree

6 files changed

+143
-0
lines changed

6 files changed

+143
-0
lines changed

types/modules/index.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from "./mesh";
+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import {App} from '../../core';
2+
3+
interface AnimationModuleParams {
4+
5+
/**
6+
* Speed of the playing animation.
7+
* Defalt is 1 (default animation frames).
8+
*/
9+
speed?: number
10+
}
11+
12+
export class AnimationModule {
13+
14+
/**
15+
* @constructor Creates an animation module.
16+
* @param app the app.
17+
* @param isDeferred sets whether to defer the start of the loop, default is false.
18+
* @param params the parameters.
19+
*/
20+
constructor(app: App, isDeferred?: boolean, params?: AnimationModuleParams);
21+
22+
/**
23+
* Plays the given clip name
24+
* @param clipName - the clip name to play
25+
*/
26+
play(clipName: string): void;
27+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import {App} from '../../core';
2+
3+
interface DynamicGeometryParams {
4+
5+
/**
6+
* Sets whether to use attributes.
7+
* Default is false.
8+
*/
9+
attributes?: boolean,
10+
11+
/**
12+
* TODO alex to explain
13+
* Map of geometry parameters
14+
*/
15+
geometry?: Map
16+
}
17+
18+
export class DynamicGeometryModule {
19+
20+
/**
21+
* @constructor Creates a dynamic geometry module.
22+
* @param params the parameters.
23+
*/
24+
constructor(params?: DynamicGeometryParams);
25+
}

types/modules/mesh/TextureModule.d.ts

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
import {
2+
ClampToEdgeWrapping,
3+
MirroredRepeatWrapping,
4+
RepeatWrapping,
5+
UVMapping,
6+
Vector2
7+
} from 'three';
8+
import {App} from '../../core';
9+
10+
/**
11+
* Texture properties
12+
*/
13+
interface TextureParams {
14+
15+
/**
16+
* The path to the texture (e.g URL)
17+
*/
18+
url: string,
19+
20+
/**
21+
* The type of map (e.g bumpMap)
22+
* Default is map
23+
*/
24+
type?: string,
25+
26+
/**
27+
* Offset of the texture.
28+
* Default is Vector2(0, 0)
29+
*/
30+
offset?: Vector2,
31+
32+
/**
33+
* Repeat
34+
* Default is Vector2(1, 1)
35+
*/
36+
repeat?: Vector2,
37+
38+
/**
39+
* Sets wrapS and wrapT.
40+
* This defines how the texture is wrapped horizontally and vertically, corresponds to UV mapping.
41+
* Default is RepeatWrapping.
42+
*/
43+
wrap?: ClampToEdgeWrapping | MirroredRepeatWrapping | RepeatWrapping | any[],
44+
45+
/**
46+
* How the image is applied to the object.
47+
* An object type of THREE.UVMapping is the default, where the U,V coordinates are used to apply the map.
48+
*/
49+
mapping?: UVMapping,
50+
51+
/**
52+
* Function to set more granular parameters
53+
* e.g const fix = texture => {
54+
* texture.anisotropy = 2;
55+
* texture.magFilter = THREE.LinearFilter;
56+
* texture.minFilter = THREE.LinearMipMapLinearFilter;
57+
* return texture;
58+
* };
59+
*/
60+
fix?: Function
61+
}
62+
63+
export class TextureModule {
64+
65+
/**
66+
* @constructor Creates a texture module.
67+
* @param textures the texture(s) properties
68+
*/
69+
constructor(textures: TextureParams | TextureParams[]);
70+
}

types/modules/mesh/index.d.ts

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export * from "./AnimationModule";
2+
export * from "./DynamicGeometryModule";
3+
export * from "./TextureModule";

types/whs-tests.ts

+17
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ import {
2727
SpotLight
2828
} from './components/lights';
2929

30+
import {
31+
TextureModule,
32+
} from './modules/mesh';
33+
3034

3135
// Core
3236
const app = new App();
@@ -151,3 +155,16 @@ pointLight.addTo(app);
151155
const spotLight = new SpotLight({build: false});
152156
spotLight.build();
153157
spotLight.addTo(app);
158+
159+
// Mesh Modules
160+
161+
let textureModule = new TextureModule([{
162+
url: 'some/path',
163+
type: 'map'
164+
}]
165+
);
166+
textureModule = new TextureModule({
167+
url: 'some/path',
168+
type: 'bumpMap'
169+
}
170+
);

0 commit comments

Comments
 (0)