Skip to content

Commit

Permalink
Adds better types and description for controls, eventsPatch, postProc…
Browse files Browse the repository at this point in the history
…essor and rendering modules - #298
  • Loading branch information
hirako2000 committed Jul 21, 2017
1 parent d9e531a commit 264ccc9
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 28 deletions.
16 changes: 6 additions & 10 deletions types/modules/app/ControlsModule.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,31 @@ import {App, ModuleManager} from '../../core';
export class ControlsModule {

/**
* TODO define type for params
* TODO define params type
* @constructor Creates a controls module.
* @param params the parameters.
*/
constructor(params?: any);

/**
* TODO define type for params
* @param self this module
*/
integrate(self: ControlsModule): void;

/**
* TODO define type for params
* @param manager the manager
*/
manager(manager: ModuleManager): void;

/**
* TODO define type
* Sets controls
* @param controls - the controls
* @param controls Working three.js controls object.
*/
setControls(controls?: any): void;
setControls(controls?: object): ControlsModule;

/**
* TODO define type
* Sets update
* @param update
* Sets controls update function
* @param update Update function
*/
setUpdate(update?: any): ControlsModule;
setUpdate(update?: Function): ControlsModule;
}
15 changes: 9 additions & 6 deletions types/modules/app/EventsPatchModule.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import {ModuleManager} from '../../core';

/**
* This one is used in the core to handle events used by modules.
* If you want to make custom events, make a similar one.
*/
export class EventsPatchModule {

/**
Expand All @@ -9,15 +13,14 @@ export class EventsPatchModule {
manager(manager?: ModuleManager): void;

/**
*
* @param originObject
* @param destObject
* @param events the array of events (e.g mouseup)
* This methods patches the list of events on specific object.
* @param originObject the object that gives events.
* @param destObject the object that takes events. Default is this.
* @param events the array of events by names (e.g mouseup).
*/
patchEvents(originObject: any, destObject: any, events: Array<string>): void;
patchEvents(originObject: any, destObject?: any, events?: Array<string>): void;

/**
* TODO define type for params
* @param self this module
*/
integrate(self: EventsPatchModule): void;
Expand Down
11 changes: 6 additions & 5 deletions types/modules/app/PostProcessorModule.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,23 @@ export class PostProcessorModule {
constructor(params?: PostProcessorModuleParams);

/**
* Renders
* Adds RenderPass
*/
render(): PostProcessorModule;

/**
* Adds the given pass to the composer.
* Also sets the pass as the current one.
* TODO define pass type
* @param pass the pass to add.
*/
pass(pass: any): PostProcessorModule;

/**
* Adds the given material as Shader pass
* Adds a pass made from shader material.
* Also sets the shader pass as the current pass.
* @param material the material to add, may contain uniform identified by the textureID
* @param textureID the textureID, for the uniform. Default is readBuffer.
* @param material the ShaderMaterial. May contain uniform identified by the textureID
* @param textureID the textureID, for the uniform. Name of the readBuffer uniform, Default is readBuffer.
*/
shader(material: Material, textureID?: string): PostProcessorModule;

Expand All @@ -60,7 +61,7 @@ export class PostProcessorModule {
renderToScreen(bool?: boolean): PostProcessorModule;

/**
* Same as to, but using defer
* FIXME, this method seems to be going away
* @param name
*/
name(name: string): PostProcessorModule;
Expand Down
33 changes: 26 additions & 7 deletions types/modules/app/RenderingModule.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import {Vector2} from 'three';
import {
Vector2,
Scene,
Camera
} from 'three';

import {Loop} from '../../core';

/**
* RenderingModule properties
Expand Down Expand Up @@ -68,14 +74,22 @@ export class RenderingModule {
constructor(params?: RenderingModuleParams, shadow?: RenderingModuleShadowParam);

/**
* Applies additional ??
* @param name TODO
* @param isApplied will not apply if false. Default is false.
* Apply additional script from RenderingModule.additional
* @param name script name
*/
applyAdditional(name: string, isApplied?: boolean): void;
applyAdditional(name: string): void;


/**
*
* Integrate renderer
* @param element element DOM object
* @param scene used scene
* @param camera used camera
*/
integrateRenderer(element: HTMLElement, scene: Scene, camera: Camera): Loop;

/**
* TODO define effect param
* @param effect
* @param cb
*/
Expand All @@ -100,7 +114,12 @@ export class RenderingModule {
stop(): void;

/**
* (re)Start rendering, also starts all effect loops.
* Resumes rendering, also resumes all effect loops.
*/
play(): void;

/**
* Dispose rendering context
*/
dispose(): void;
}
1 change: 1 addition & 0 deletions types/whs-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ postProcessorModule.renderToScreen(true);
const renderingModule = new RenderingModule();
renderingModule.play();
renderingModule.stop();
renderingModule.dispose();

const resizeModule = new ResizeModule({auto: true});
resizeModule.addAutoresize();
Expand Down

0 comments on commit 264ccc9

Please sign in to comment.