Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Rendering improvements #160

Open
wants to merge 94 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
94 commits
Select commit Hold shift + click to select a range
d00cd2a
WMO material creation improvements
fallenoak Jun 12, 2016
9422c3d
Ensure WMO groups clone in proper root WMO context
fallenoak Jun 12, 2016
c73a41d
WMO shader improvements
fallenoak Jun 12, 2016
b12b749
Added equivalent logic to FixColorVertexAlpha
fallenoak Jun 13, 2016
e1deb3c
Added MathUtil
fallenoak Jun 13, 2016
6abb594
Synced WMO material fragment shader with latest changes
fallenoak Jun 13, 2016
e1300e3
Improved transparent pixel handling
fallenoak Jun 13, 2016
afd5ed7
Restored unlit flag support
fallenoak Jun 13, 2016
7af07d2
Improved fallback when world lighting is disabled
fallenoak Jun 13, 2016
a51ef77
Tweaked transparency handling in fragment shader
fallenoak Jun 13, 2016
aa03b52
Fixed wrong index value when loading WMO doodads
fallenoak Jun 13, 2016
5dbf649
More WMO material shader improvements
fallenoak Jun 13, 2016
aa1c1c1
Syntax cleanup
fallenoak Jun 13, 2016
4bc7a43
Merge branch 'master' into refactor/wmo-rendering
fallenoak Jun 14, 2016
de8161d
Improved uniforms in WMO material shaders
fallenoak Jun 14, 2016
ef717d7
Improved syntax
fallenoak Jun 14, 2016
e9fc780
Renamed indoor to interior and simplified interior handling
fallenoak Jun 14, 2016
16158de
Migrated most WMO and WMOGroup creation logic to blueprints
fallenoak Jun 15, 2016
e5c966a
Clarified argument name
fallenoak Jun 15, 2016
5bda239
Worker API improvements
fallenoak Jun 15, 2016
f03820b
Updated various pipeline loaders for latest worker API
fallenoak Jun 15, 2016
f17b9db
Overhauled WMO root and group loading
fallenoak Jun 15, 2016
6958bf7
Improved ContentQueue
fallenoak Jun 15, 2016
4705f4f
Split WMODefinition out from WMOBlueprint
fallenoak Jun 16, 2016
c78f4d9
WMO cleanup
fallenoak Jun 26, 2016
1080dc7
Synced property name
fallenoak Jul 4, 2016
7bac253
Created view classes for WMOs
fallenoak Jul 13, 2016
ce363b8
Cleaned up naming
fallenoak Jul 13, 2016
da08ee7
Added initial implementation of portal class
fallenoak Jul 29, 2016
169ad05
Added basic portal support to WMO roots
fallenoak Jul 29, 2016
d07dd97
Added basic portal support to WMO groups
fallenoak Jul 29, 2016
618cf6b
Exposed flags in WMO group definition header
fallenoak Jul 29, 2016
bd952b4
Exposed bounding boxes on WMO root and group classes
fallenoak Jul 29, 2016
d73355c
Fixed WMO root unloading
fallenoak Jul 30, 2016
75d811b
Removed extraneous bracket
fallenoak Jul 30, 2016
c3b2a13
Fixed various dispose issues in WMORoot
fallenoak Jul 30, 2016
d952cb7
Fixed syntax error
fallenoak Jul 30, 2016
a92f241
When disposing of a WMOGroup, materials need to be iterated over
fallenoak Jul 30, 2016
8828a49
Added camera location mechanism
fallenoak Aug 1, 2016
8aea93a
Switched MOBR indices to typed array
fallenoak Aug 2, 2016
349b509
Added portal loading and placement to WMOHandler
fallenoak Aug 2, 2016
4584e37
Face indices are Uint16s
fallenoak Aug 9, 2016
2a5df1b
Simplified and corrected BSP tree logic
fallenoak Aug 9, 2016
e9fe376
Synced BSPTree constructor changes
fallenoak Aug 9, 2016
6b79b2e
WMOPortal improvements
fallenoak Aug 9, 2016
911690a
Added closestPortal function to WMOGroup
fallenoak Aug 9, 2016
ed4bd3b
Added createFrustum and intersectFrustum functions to WMOPortalView
fallenoak Aug 9, 2016
c8720af
Improved accuracy of WMOManager's locateCamera function
fallenoak Aug 9, 2016
50be517
Pass index through when creating portals in WMORoot
fallenoak Aug 9, 2016
9bc236f
Refactored WMOHandler to be independent of WMOManager
fallenoak Aug 15, 2016
36a278d
Removed unused functions
fallenoak Aug 15, 2016
a029dc3
Slightly reduced object allocations
fallenoak Aug 15, 2016
68edffa
Default portal material visibility to false
fallenoak Aug 15, 2016
6748126
Removed unnecessary transformations
fallenoak Aug 15, 2016
293c9c8
Corrected check to stop failing on index 0
fallenoak Aug 16, 2016
1180a97
Ensure matrixWorld is updated when doodad is added to view
fallenoak Aug 17, 2016
7c81b03
Renamed WMOHandler to WMO
fallenoak Aug 17, 2016
11a3f94
Updated naming
fallenoak Aug 17, 2016
6c00ed1
Updated naming
fallenoak Aug 17, 2016
4a67690
Improved THREEUtil
fallenoak Aug 19, 2016
8026707
Improved WMOPortalView's createFrustum
fallenoak Aug 19, 2016
693ddb7
Fixed ordering of portal vertices to match Wowser's axes
fallenoak Aug 19, 2016
6a87076
Added logic to prevent errors on missing planes
fallenoak Aug 19, 2016
63614e2
Initial implementation of VisibilityManager
fallenoak Aug 19, 2016
238c33f
Added groupInfo to WMORoot
fallenoak Aug 20, 2016
a2cc43d
Improved syntax
fallenoak Aug 20, 2016
0550299
Added WMO root flags
fallenoak Aug 21, 2016
d70f989
Initial implementation of vertex color attenuation in WMO groups
fallenoak Aug 21, 2016
572131e
Improved syntax
fallenoak Aug 22, 2016
5010735
Migrated locate logic to LocationManager
fallenoak Aug 23, 2016
c6bd001
Connected VisibilityManager
fallenoak Aug 23, 2016
52b2b16
Adjusted how the exterior view is managed
fallenoak Aug 23, 2016
6abe07d
Removed superfluous assignment
fallenoak Aug 23, 2016
d6a2c83
Ensure matrixWorld is updated when placing map doodads
fallenoak Aug 23, 2016
f33748f
Cull map doodads based on portal-manipulated visibility
fallenoak Aug 23, 2016
dd44da5
Initial implementation of WorldLight
fallenoak Oct 6, 2016
8a333b4
Stop flipping WMO group geometry
fallenoak Oct 6, 2016
1f833ac
Adjusted BSP tree to expect standard geometry
fallenoak Oct 6, 2016
3f4a6b6
Stop flipping WMO portal geometry and bounding boxes
fallenoak Oct 6, 2016
b0eb318
Added logic for the self illuminated scalar
fallenoak Oct 7, 2016
3405def
Bumped THREE to r81
fallenoak Oct 21, 2016
50a2815
Bumped React to 15.x
fallenoak Oct 21, 2016
887dd47
Bumped Blizzardry to 0.4.x
fallenoak Oct 21, 2016
14b66c8
Tweaked webpack and webpack-dev-server deps
fallenoak Oct 21, 2016
f9e33d5
Bumped Babel to 6.17.x
fallenoak Oct 21, 2016
e141e72
Bumped and tweaked several Babel plugin deps
fallenoak Oct 21, 2016
625c8af
Added GSAP dep (for future use of TweenMax, etc)
fallenoak Oct 21, 2016
46baae3
Bumped html-webpack-plugin dep
fallenoak Oct 21, 2016
080fda6
Updated WMO classes to work with modularized THREE
fallenoak Oct 21, 2016
219f6e4
Updated WorldLight to work with modularized THREE
fallenoak Oct 21, 2016
617e52b
Updated BSPTree to work with modularized THREE
fallenoak Oct 21, 2016
ace0f4f
Updated THREEUtil to work with modularized THREE
fallenoak Oct 21, 2016
c1f5fd5
Cleaned up WMO shaders
fallenoak Oct 22, 2016
718ff78
Removed theoretically unneeded vertex manipulation
fallenoak Oct 24, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 15 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,37 +34,38 @@
],
"dependencies": {
"array-find": "^0.1.1",
"blizzardry": "^0.3.3",
"blizzardry": "^0.4.0",
"bluebird": "^2.10.0",
"byte-buffer": "^1.0.3",
"classnames": "^2.2.0",
"configstore": "^1.2.0",
"deep-equal": "^1.0.0",
"express": "^4.9.3",
"globby": "^5.0.0",
"gsap": "^1.19.0",
"inquirer": "^0.8.5",
"jsbn": "timkurvers/jsbn.git#wowser",
"keymaster": "^1.6.2",
"morgan": "^1.3.2",
"normalize.css": "^3.0.3",
"pngjs": "^2.3.0",
"react": "^0.14.3",
"react-dom": "^0.14.3",
"three": "^0.77.0",
"react": "^15.0.0",
"react-dom": "^15.0.0",
"three": "^0.81.0",
"websockify": "^0.7.1"
},
"devDependencies": {
"babel-core": "^6.9.1",
"babel-eslint": "^6.0.4",
"babel-loader": "^6.2.4",
"babel-plugin-transform-class-properties": "^6.9.1",
"babel-core": "^6.17.0",
"babel-eslint": "^6.1.0",
"babel-loader": "^6.2.0",
"babel-plugin-transform-class-properties": "^6.9.0",
"babel-plugin-transform-export-extensions": "^6.8.0",
"babel-plugin-transform-function-bind": "^6.8.0",
"babel-plugin-transform-es2015-block-scoping": "^6.10.1",
"babel-plugin-transform-es2015-modules-commonjs": "^6.8.0",
"babel-plugin-transform-es2015-block-scoping": "^6.15.0",
"babel-plugin-transform-es2015-modules-commonjs": "^6.16.0",
"babel-plugin-transform-es2015-parameters": "^6.9.0",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-preset-react": "^6.5.0",
"babel-preset-react": "^6.11.0",
"chai": "^3.5.0",
"codeclimate-test-reporter": "^0.1.0",
"css-loader": "^0.23.0",
Expand All @@ -84,7 +85,7 @@
"gulp-plumber": "^1.1.0",
"gulp-remember": "^0.3.0",
"gulp-stylus": "^2.4.0",
"html-webpack-plugin": "^2.20.0",
"html-webpack-plugin": "^2.21.0",
"istanbul": "^0.4.0",
"json-loader": "^0.5.4",
"mocha": "^2.5.0",
Expand All @@ -95,8 +96,8 @@
"style-loader": "^0.13.0",
"stylus-loader": "^1.6.1",
"url-loader": "^0.5.7",
"webpack": "^1.13.1",
"webpack-dev-server": "^1.14.1",
"webpack": "^1.13.0",
"webpack-dev-server": "^1.14.0",
"worker-loader": "^0.7.0"
}
}
19 changes: 13 additions & 6 deletions src/lib/game/world/doodad-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ class DoodadManager {
// Number of milliseconds to wait before loading another portion of doodads.
static LOAD_INTERVAL = 1;

constructor(map) {
this.map = map;
constructor(view, zeropoint) {
this.view = view;
this.zeropoint = zeropoint;

this.chunkRefs = new Map();

this.doodads = new Map();
Expand Down Expand Up @@ -177,16 +179,16 @@ class DoodadManager {
const doodad = this.doodads.get(entry.id);
this.doodads.delete(entry.id);
this.animatedDoodads.delete(entry.id);
this.map.remove(doodad);
this.container.remove(doodad);

M2Blueprint.unload(doodad);
}

// Place a doodad on the world map, adhereing to a provided position, rotation, and scale.
placeDoodad(doodad, position, rotation, scale) {
doodad.position.set(
-(position.z - this.map.constructor.ZEROPOINT),
-(position.x - this.map.constructor.ZEROPOINT),
-(position.z - this.zeropoint),
-(position.x - this.zeropoint),
position.y
);

Expand All @@ -207,11 +209,16 @@ class DoodadManager {
}

// Add doodad to world map.
this.map.add(doodad);
this.view.add(doodad);
doodad.updateMatrix();
doodad.updateMatrixWorld();
}

animate(delta, camera, cameraMoved) {
if (!this.view.visible) {
return;
}

this.animatedDoodads.forEach((doodad) => {
if (!doodad.visible) {
return;
Expand Down
4 changes: 4 additions & 0 deletions src/lib/game/world/handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ class WorldHandler extends EventEmitter {
this.animateEntities(delta, camera, cameraMoved);

if (this.map !== null) {
if (cameraMoved) {
this.map.locateCamera(camera);
}

this.map.animate(delta, camera, cameraMoved);
}

Expand Down
13 changes: 13 additions & 0 deletions src/lib/game/world/light/default.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const fogStart = 20.0;
const fogEnd = 200.0;
const fogRange = fogEnd - fogStart;

const values = {
sunParams: [-0.8, -0.8, -0.8, 0.0],
sunAmbientColor: [ 0.5, 0.5, 0.5, 0.0],
sunDiffuseColor: [ 0.25, 0.5, 1.0, 0.0],
fogParams: [ -(1.0 / (fogRange)), (1.0 / fogRange) * fogEnd, 1.0, 0.0],
fogColor: [ 0.25, 0.5, 1.0, 0.0]
};

export default values;
Loading