Merge pull request #2331 from pandamicro/next

New renderer issue fixes
This commit is contained in:
pandamicro
2018-02-11 11:45:27 +08:00
committed by GitHub
3 changed files with 29 additions and 24 deletions
+3 -3
View File
@@ -558,7 +558,7 @@ var Node = cc.Class({
if (this._rotationX !== value || this._rotationY !== value) {
this._rotationX = this._rotationY = value;
// Update quaternion from rotation
math.quat.fromEuler(this._quat, 0, 0, this._rotationX);
math.quat.fromEuler(this._quat, 0, 0, -this._rotationX);
this._localMatDirty = true;
var cache = this._hasListenerCache;
@@ -587,7 +587,7 @@ var Node = cc.Class({
this._rotationX = value;
// Update quaternion from rotation
if (this._rotationX === this._rotationY) {
math.quat.fromEuler(this._quat, 0, 0, this._rotationX);
math.quat.fromEuler(this._quat, 0, 0, -this._rotationX);
}
else {
math.quat.fromEuler(this._quat, this._rotationX, this._rotationY, 0);
@@ -620,7 +620,7 @@ var Node = cc.Class({
this._rotationY = value;
// Update quaternion from rotation
if (this._rotationX === this._rotationY) {
math.quat.fromEuler(this._quat, 0, 0, this._rotationX);
math.quat.fromEuler(this._quat, 0, 0, -this._rotationX);
}
else {
math.quat.fromEuler(this._quat, this._rotationX, this._rotationY, 0);
+3
View File
@@ -471,7 +471,10 @@ var Label = cc.Class({
material = new SpriteMaterial();
this._texture = new cc.Texture2D();
this._canvas = document.createElement("canvas");
// create canvas with size so that the default texture impl can be created and don't need activate material again
this._canvas.width = this._canvas.height = 1;
this._texture.initWithElement(this._canvas);
this._texture.handleLoadedTexture();
this._context = this._canvas.getContext("2d");
material.texture = this._texture.getImpl();
@@ -31,28 +31,30 @@ const bmfontAssembler = require('./bmfont-assembler');
var labelAssembler = js.addon({
updateRenderData (comp) {
let assembler;
if (comp.font instanceof cc.BitmapFont) {
assembler = bmfontAssembler;
}
else {
assembler = ttfAssembler;
}
let renderData = comp._renderData;
if (!renderData) {
renderData = comp._renderData = assembler.createData(comp);
}
let size = comp.node._contentSize;
let anchor = comp.node._anchorPoint;
renderData.updateSizeNPivot(size.width, size.height, anchor.x, anchor.y);
assembler.update(comp);
renderData.effect = comp.getEffect();
this.datas.length = 0;
this.datas.push(renderData);
if (comp.string) {
let assembler;
if (comp.font instanceof cc.BitmapFont) {
assembler = bmfontAssembler;
}
else {
assembler = ttfAssembler;
}
let renderData = comp._renderData;
if (!renderData) {
renderData = comp._renderData = assembler.createData(comp);
}
let size = comp.node._contentSize;
let anchor = comp.node._anchorPoint;
renderData.updateSizeNPivot(size.width, size.height, anchor.x, anchor.y);
assembler.update(comp);
renderData.effect = comp.getEffect();
this.datas.push(renderData);
}
return this.datas;
},