Skip to content

Commit

Permalink
fix(renderOpt): fix poor performance in handling shadow (#143)
Browse files Browse the repository at this point in the history
fix poor performance in handling shadow
add local dat.gui
update contributing md
improve shadow & perf
stop addlight after maxlight
fix point shadow not remove
remove dat.gui source map
  • Loading branch information
ZenderJK committed May 15, 2023
1 parent 422af0b commit 93d8a1c
Show file tree
Hide file tree
Showing 27 changed files with 3,077 additions and 281 deletions.
2 changes: 1 addition & 1 deletion .github/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ After install all dependenceies of the project, just run `pnpm run dev` to boot
```bash
$ pnpm run dev
```
After executing the above command, visit http://localhost:3000 and try live samples from `/samples`
After executing the above command, visit http://localhost:8000 and try live samples from `/samples`

### Build production libs
To build a production package:
Expand Down
10 changes: 6 additions & 4 deletions packages/debug/GUIHelp.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { GUI } from 'https://unpkg.com/dat.gui@0.7.9/build/dat.gui.module.js'
import { GUI } from './dat.gui.module.js'

/**
* @internal
Expand Down Expand Up @@ -32,8 +32,9 @@ class _GUIHelp {
return this._nullBind;
let dgui = this._current ? this._current : this.gui;

let tobj = {};
tobj[label] = obj[property];
let tobj = {
[label] : obj[property]
}
dgui.add(tobj, label, c, d, e).onChange((v) => {
obj[property] = v;
})
Expand Down Expand Up @@ -109,7 +110,8 @@ class _GUIHelp {
return this._nullBind;
let folder = this.folders[label];
if (folder) {
this._current = this.gui.removeFolder(folder);
this.gui.removeFolder(folder);
this._current = null;
delete this.folders[label];
}
}
Expand Down
138 changes: 0 additions & 138 deletions packages/debug/dat.gui.d.ts

This file was deleted.

145 changes: 145 additions & 0 deletions packages/debug/dat.gui.module.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
// Type definitions for dat.GUI 0.7
// Project: https://github.com/dataarts/dat.gui
// Definitions by: Satoru Kimura <https://github.com/gyohk>, ZongJing Lu <https://github.com/sonic3d>, Richard Roylance <https://github.com/rroylance>, Nahuel Scotti <https://github.com/singuerinc>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

export as namespace dat;

export interface GUIParams {
/**
* Handles GUI's element placement for you.
* @default true
*/
autoPlace?: boolean | undefined;
/**
* If true, starts closed.
* @default false
*/
closed?: boolean | undefined;
/**
* If true, close/open button shows on top of the GUI.
* @default false
*/
closeOnTop?: boolean | undefined;
/**
* If true, GUI is closed by the "h" keypress.
* @default false
*/
hideable?: boolean | undefined;
/**
* JSON object representing the saved state of this GUI.
*/
load?: any;
/**
* The name of this GUI.
*/
name?: string | undefined;
/**
* The identifier for a set of saved values.
*/
preset?: string | undefined;
/**
* The width of GUI element.
*/
width?: number | undefined;
}

export class GUI {
static CLASS_AUTO_PLACE: string;
static CLASS_AUTO_PLACE_CONTAINER: string;
static CLASS_MAIN: string;
static CLASS_CONTROLLER_ROW: string;
static CLASS_TOO_TALL: string;
static CLASS_CLOSED: string;
static CLASS_CLOSE_BUTTON: string;
static CLASS_CLOSE_TOP: string;
static CLASS_CLOSE_BOTTOM: string;
static CLASS_DRAG: string;
static DEFAULT_WIDTH: number;
static TEXT_CLOSED: string;
static TEXT_OPEN: string;

constructor(option?: GUIParams);

__controllers: GUIController[];
__folders: { [folderName: string]: GUI };
domElement: HTMLElement;

add<T extends object>(
target: T,
propName: keyof T,
min?: number,
max?: number,
step?: number,
): GUIController;
add<T extends object>(target: T, propName: keyof T, status: boolean): GUIController;
add<T extends object>(target: T, propName: keyof T, items: string[]): GUIController;
add<T extends object>(target: T, propName: keyof T, items: number[]): GUIController;
add<T extends object>(target: T, propName: keyof T, items: Object): GUIController;

addColor(target: Object, propName: string): GUIController;

remove(controller: GUIController): void;
destroy(): void;

addFolder(propName: string): GUI;
removeFolder(subFolder: GUI): void;

open(): void;
close(): void;
hide(): void;
show(): void;

remember(target: Object, ...additionalTargets: Object[]): void;
getRoot(): GUI;

getSaveObject(): Object;
save(): void;
saveAs(presetName: string): void;
revert(gui: GUI): void;

listen(controller: GUIController): void;
updateDisplay(): void;

// gui properties in dat/gui/GUI.js
readonly parent: GUI;
readonly scrollable: boolean;
readonly autoPlace: boolean;
preset: string;
width: number;
name: string;
closed: boolean;
readonly load: Object;
useLocalStorage: boolean;
}

export class GUIController<T extends object = object> {
domElement: HTMLElement;
object: Object;
property: string;

constructor(object: T, property: keyof T);

options(option: any): GUIController;
name(name: string): GUIController;

listen(): GUIController;
remove(): GUIController;

onChange(fnc: (value?: any) => void): GUIController;
onFinishChange(fnc: (value?: any) => void): GUIController;

setValue(value: any): GUIController;
getValue(): any;

updateDisplay(): GUIController;
isModified(): boolean;

// NumberController
min(n: number): GUIController;
max(n: number): GUIController;
step(n: number): GUIController;

// FunctionController
fire(): GUIController;
}

0 comments on commit 93d8a1c

Please sign in to comment.