mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-01 07:42:38 +08:00
Merge pull request #2129 from pandamicro/next
Upgrade to renderer.js v1.5.2
This commit is contained in:
@@ -163,21 +163,6 @@ var Canvas = cc.Class({
|
||||
}
|
||||
Canvas.instance = this;
|
||||
|
||||
if ( !this.node._sizeProvider ) {
|
||||
// this.node._sizeProvider = designResolutionWrapper;
|
||||
this.node.width = cc.visibleRect.width;
|
||||
this.node.height = cc.visibleRect.height;
|
||||
}
|
||||
else if (CC_DEV) {
|
||||
var renderer = this.node.getComponent(cc._RendererUnderSG);
|
||||
if (renderer) {
|
||||
cc.errorID(6701, cc.js.getClassName(renderer));
|
||||
}
|
||||
else {
|
||||
cc.errorID(6702);
|
||||
}
|
||||
}
|
||||
|
||||
cc.director.on(cc.Director.EVENT_BEFORE_VISIT, this.alignWithScreen, this);
|
||||
|
||||
if (CC_EDITOR) {
|
||||
@@ -237,19 +222,19 @@ var Canvas = cc.Class({
|
||||
}
|
||||
else {
|
||||
var canvasSize = cc.visibleRect;
|
||||
designSize = cc.view.getDesignResolutionSize();
|
||||
var clipTopRight = !this.fitHeight && !this.fitWidth;
|
||||
var offsetX = 0;
|
||||
var offsetY = 0;
|
||||
if (clipTopRight) {
|
||||
designSize = cc.view.getDesignResolutionSize();
|
||||
// offset the canvas to make it in the center of screen
|
||||
offsetX = (designSize.width - canvasSize.width) * 0.5;
|
||||
offsetY = (designSize.height - canvasSize.height) * 0.5;
|
||||
}
|
||||
this.node.setPosition(canvasSize.width * 0.5 + offsetX, canvasSize.height * 0.5 + offsetY);
|
||||
}
|
||||
this.node.width = cc.visibleRect.width;
|
||||
this.node.height = cc.visibleRect.height;
|
||||
this.node.width = designSize.width;
|
||||
this.node.height = designSize.height;
|
||||
},
|
||||
|
||||
onResized: function () {
|
||||
|
||||
@@ -496,7 +496,7 @@ var Sprite = cc.Class({
|
||||
this._material = renderer.materialUtil.get(url);
|
||||
if (!this._material) {
|
||||
this._material = new SpriteMaterial();
|
||||
this._material.mainTexture = texture.getImpl();
|
||||
this._material.texture = texture.getImpl();
|
||||
renderer.materialUtil.register(url, this._material);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,9 @@ function _initBuiltins(device) {
|
||||
});
|
||||
|
||||
return {
|
||||
defaultTexture
|
||||
defaultTexture: defaultTexture,
|
||||
programTemplates: renderEngine.shaders.templates,
|
||||
programChunks: renderEngine.shaders.chunks,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -73,13 +75,13 @@ module.exports = {
|
||||
this._camera = new renderEngine.Camera({
|
||||
x: 0, y: 0, w: canvas.width, h: canvas.height
|
||||
});
|
||||
this._camera.setStages([
|
||||
'transparent'
|
||||
]);
|
||||
this.scene.addCamera(this._camera);
|
||||
|
||||
let builtins = _initBuiltins(this.device);
|
||||
this._forward = new renderEngine.ForwardRenderer(this.device, {
|
||||
defaultTexture: builtins.defaultTexture,
|
||||
programTemplates: renderEngine.shaders.templates,
|
||||
programChunks: renderEngine.shaders.chunks,
|
||||
});
|
||||
this._forward = new renderEngine.ForwardRenderer(this.device, builtins);
|
||||
},
|
||||
|
||||
updateCameraViewport () {
|
||||
@@ -92,6 +94,6 @@ module.exports = {
|
||||
},
|
||||
|
||||
render () {
|
||||
this._forward.render(this._camera, this.scene);
|
||||
this._forward.render(this.scene);
|
||||
}
|
||||
};
|
||||
+2241
-714
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user