Skip to content

Commit

Permalink
Merge pull request #108 from playcanvas/master
Browse files Browse the repository at this point in the history
m
  • Loading branch information
guycalledfrank committed Jun 24, 2015
2 parents 267bda5 + 69f9fd4 commit 7cdfef0
Show file tree
Hide file tree
Showing 13 changed files with 321 additions and 87 deletions.
18 changes: 18 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# PlayCanvas Engine Changes

### v0.169.5
* [FIX] Load cubemap for scene skybox if not preloaded

### v0.169.4
* [FIX] Error when loading audiosource assets
* withCredentials is now an option when making a request via pc.net.http

### v0.169.3
* Can now load materials using a dictionary format
* [FIX] Remove skybox event handlers when scene skybox is removed
* [FIX] Handle cubemap changes when material references a cubemap

### v0.169.2
* Added asset_registry#filter method
* Added camera_component#horizontalFov to allow the fov to be either horizontal or vertical
* [FIX] Changed Enter key code to 13
* [FIX] Removed seams from skybox when using lower mips

### v0.169.1
* [FIX] Absolute script URLs

Expand Down
73 changes: 47 additions & 26 deletions src/asset/asset_registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,32 +174,6 @@ pc.extend(pc, function () {
var load = !!(asset.file);
var open = !load;

// check for special case for cubemaps
if (asset.file && asset.type === "cubemap") {
load = false;
open = false;
// loading prefiltered cubemap data
this._loader.load(asset.file.url, "texture", function (err, texture) {
if (!err) {
// Fudging an asset so that we can apply texture settings from the cubemap to the DDS texture
self._loader.patch({
resource: texture,
type: "texture",
data: asset.data
}, self);

// store in asset data
asset.data.dds = texture;
_open();
} else {
self.fire("error", err, asset);
self.fire("error:" + asset.id, err, asset);
asset.fire("error", err, asset);
return;
}
});
}

var _load = function () {
var url = asset.file.url;

Expand Down Expand Up @@ -247,6 +221,32 @@ pc.extend(pc, function () {
asset.fire("load", asset);
};

// check for special case for cubemaps
if (asset.file && asset.type === "cubemap") {
load = false;
open = false;
// loading prefiltered cubemap data
this._loader.load(asset.file.url, "texture", function (err, texture) {
if (!err) {
// Fudging an asset so that we can apply texture settings from the cubemap to the DDS texture
self._loader.patch({
resource: texture,
type: "texture",
data: asset.data
}, self);

// store in asset data
asset.data.dds = texture;
_open();
} else {
self.fire("error", err, asset);
self.fire("error:" + asset.id, err, asset);
asset.fire("error", err, asset);
return;
}
});
}

if (!asset.file) {
_open();
} else if (load) {
Expand Down Expand Up @@ -417,6 +417,27 @@ pc.extend(pc, function () {
}
},

/**
* @function
* @name pc.AssetRegistry#filter
* @description Return all Assets that satisfy filter callback
* @param {Function} callback The callback function that is used to filter assets, return `true` to include asset to result list
* @returns {[pc.Asset]} A list of all Assets found
* @example
* var assets = app.assets.filter(function(asset) {
* return asset.name.indexOf('monster') !== -1;
* });
* console.log("Found " + assets.length + " assets, where names contains 'monster'");
*/
filter: function (callback) {
var items = [ ];
for(var i = 0, len = this._assets.length; i < len; i++) {
if (callback(this._assets[i]))
items.push(this._assets[i]);
}
return items;
},

/**
* @function
* @name pc.AssetRegistry#find
Expand Down
6 changes: 3 additions & 3 deletions src/framework/components/audiosource/audiosource_component.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,16 +293,16 @@ pc.extend(pc, function () {
});
} else {
// don't wait for assets that aren't in the registry
count--
count--;
if (count === 0) {
_done();
}
// but if they are added insert them into source list
assets.on("add:" + ids[index], function (asset) {
this.system.app.assets.on("add:" + ids[index], function (asset) {
asset.ready(function (asset) {
this.data.sources[asset.name] = asset.resource;
});
})
});
}
}, this);
}
Expand Down
5 changes: 5 additions & 0 deletions src/framework/components/camera/camera_component.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ pc.extend(pc, function () {
this.on("set_clearDepthBuffer", this.updateClearFlags, this);
this.on("set_renderTarget", this.onSetRenderTarget, this);
this.on("set_rect", this.onSetRect, this);
this.on("set_horizontalFov", this.onSetHorizontalFov, this);
this.on("set_frustumCulling", this.onSetFrustumCulling, this);
};
CameraComponent = pc.inherits(CameraComponent, pc.Component);
Expand Down Expand Up @@ -148,6 +149,10 @@ pc.extend(pc, function () {
this.data.camera.setFarClip(newValue);
},

onSetHorizontalFov: function (name, oldValue, newValue) {
this.data.camera.setHorizontalFov(newValue);
},

onSetFrustumCulling: function (name, oldValue, newValue) {
this.data.camera.frustumCulling = newValue;
},
Expand Down
2 changes: 1 addition & 1 deletion src/graphics/programlib/programlib_skybox.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pc.programlib.skybox = {
createShaderDefinition: function (device, options) {
var getSnippet = pc.programlib.getSnippet;
var chunks = pc.shaderChunks;
var mip2size = [128, 64, 32, 16, 8, 4];
var mip2size = [128, 64, 16, 8, 4, 2];

return {
attributes: {
Expand Down
58 changes: 29 additions & 29 deletions src/input/input_input.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@
/**
* @enum pc.EVENT
* @name pc.EVENT_TOUCHCANCEL
* @description Name of event fired when a touch point is interupted in some way.
* The exact reasons for cancelling a touch can vary from device to device.
* For example, a modal alert pops up during the interaction; the touch point leaves the document area;
* @description Name of event fired when a touch point is interupted in some way.
* The exact reasons for cancelling a touch can vary from device to device.
* For example, a modal alert pops up during the interaction; the touch point leaves the document area;
* or there are more touch points than the device supports, in which case the earliest touch point is canceled.
*/
EVENT_TOUCHCANCEL: 'touchcancel',
Expand All @@ -98,7 +98,7 @@
* @enum pc.KEY
* @name pc.KEY_ENTER
*/
KEY_ENTER: 14,
KEY_ENTER: 13,
/**
* @enum pc.KEY
* @name pc.KEY_SHIFT
Expand Down Expand Up @@ -599,111 +599,111 @@
*/
MOUSEBUTTON_RIGHT: 2,

/**
/**
* @description Index for pad 1
*/
PAD_1: 0,
/**
/**
* @description Index for pad 2
*/
PAD_2: 1,
/**
/**
* @description Index for pad 3
*/
PAD_3: 2,
/**
/**
* @description Index for pad 4
*/
PAD_4: 3,

/**
/**
* @description The first face button, from bottom going clockwise
*/
PAD_FACE_1: 0,
/**
/**
* @description The second face button, from bottom going clockwise
*/
PAD_FACE_2: 1,
/**
/**
* @description The third face button, from bottom going clockwise
*/
PAD_FACE_3: 2,
/**
/**
* @description The fourth face button, from bottom going clockwise
*/
PAD_FACE_4: 3,


/**
/**
* @description The first shoulder button on the left
*/
PAD_L_SHOULDER_1: 4,
/**
/**
* @description The first shoulder button on the right
*/
PAD_R_SHOULDER_1: 5,
/**
/**
* @description The second shoulder button on the left
*/
PAD_L_SHOULDER_2: 6,
/**
/**
* @description The second shoulder button on the right
*/
PAD_R_SHOULDER_2: 7,

/**
/**
* @description The select button
*/
PAD_SELECT: 8,
/**
/**
* @description The start button
*/
PAD_START: 9,

/**
/**
* @description The button when depressing the left analogue stick
*/
PAD_L_STICK_BUTTON: 10,
/**
/**
* @description The button when depressing the right analogue stick
*/
PAD_R_STICK_BUTTON: 11,

/**
/**
* @description Direction pad up
*/
PAD_UP: 12,
/**
/**
* @description Direction pad down
*/
PAD_DOWN: 13,
/**
/**
* @description Direction pad left
*/
PAD_LEFT: 14,
/**
/**
* @description Direction pad right
*/
PAD_RIGHT: 15,

/**
/**
* @description Vendor specific button
*/
PAD_VENDOR: 16,

/**
/**
* @description Horizontal axis on the left analogue stick
*/
PAD_L_STICK_X: 0,
/**
/**
* @description Vertical axis on the left analogue stick
*/
PAD_L_STICK_Y: 1,
/**
/**
* @description Horizontal axis on the right analogue stick
*/
PAD_R_STICK_X: 2,
/**
/**
* @description Vertical axis on the right analogue stick
*/
PAD_R_STICK_Y: 3
Expand Down
Loading

0 comments on commit 7cdfef0

Please sign in to comment.