Skip to content

Commit

Permalink
skinnedmesh -> weightedmesh
Browse files Browse the repository at this point in the history
  • Loading branch information
flyover committed Apr 5, 2016
1 parent 0e60f8e commit 707e3b0
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 21 deletions.
2 changes: 1 addition & 1 deletion demo/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ main.start = function() {
switch (attachment.type) {
case 'region':
case 'mesh':
case 'skinnedmesh':
case 'weightedmesh':
var image_key = attachment_key;
var image_url = file_path + spine_data.skeleton.images + image_key + ".png";
counter_inc();
Expand Down
10 changes: 5 additions & 5 deletions demo/render-ctx2d.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ RenderCtx2D.prototype.loadData = function(spine_data, atlas_data, images) {
var vertex_texcoord = attachment_info.vertex_texcoord = new Float32Array(attachment.uvs);
var vertex_triangle = attachment_info.vertex_triangle = new Uint16Array(attachment.triangles);
break;
case 'skinnedmesh':
case 'weightedmesh':
var slot_info = slot_info_map[slot_key] = slot_info_map[slot_key] || {};
var attachment_info_map = slot_info.attachment_info_map = slot_info.attachment_info_map || {};
var attachment_info = attachment_info_map[attachment_key] = {};
Expand Down Expand Up @@ -136,7 +136,7 @@ RenderCtx2D.prototype.updatePose = function(spine_pose, atlas_data) {
}
}
break;
case 'skinnedmesh':
case 'weightedmesh':
var skin_info = render.skin_info_map[spine_pose.skin_key],
default_skin_info = render.skin_info_map['default'];
var slot_info = skin_info.slot_info_map[slot_key] || default_skin_info.slot_info_map[slot_key];
Expand Down Expand Up @@ -286,7 +286,7 @@ RenderCtx2D.prototype.drawPose = function(spine_pose, atlas_data) {
ctxApplyAtlasSitePosition(ctx, site);
ctxDrawImageMesh(ctx, attachment_info.vertex_triangle, attachment_info.vertex_position, attachment_info.vertex_texcoord, image, site, page);
break;
case 'skinnedmesh':
case 'weightedmesh':
var skin_info = render.skin_info_map[spine_pose.skin_key],
default_skin_info = render.skin_info_map['default'];
var slot_info = skin_info.slot_info_map[slot_key] || default_skin_info.slot_info_map[slot_key];
Expand Down Expand Up @@ -359,7 +359,7 @@ RenderCtx2D.prototype.drawDebugPose = function(spine_pose, atlas_data) {
ctxApplyAtlasSitePosition(ctx, site);
ctxDrawMesh(ctx, attachment_info.vertex_triangle, attachment_info.vertex_position, 'rgba(127,127,127,1.0)', 'rgba(127,127,127,0.25)');
break;
case 'skinnedmesh':
case 'weightedmesh':
var skin_info = render.skin_info_map[spine_pose.skin_key],
default_skin_info = render.skin_info_map['default'];
var slot_info = skin_info.slot_info_map[slot_key] || default_skin_info.slot_info_map[slot_key];
Expand Down Expand Up @@ -439,7 +439,7 @@ RenderCtx2D.prototype.drawDebugData = function(spine_pose, atlas_data) {
ctxApplyAtlasSitePosition(ctx, site);
ctxDrawMesh(ctx, attachment_info.vertex_triangle, attachment_info.vertex_position, 'rgba(127,127,127,1.0)', 'rgba(127,127,127,0.25)');
break;
case 'skinnedmesh':
case 'weightedmesh':
var skin_info = render.skin_info_map[spine_pose.skin_key],
default_skin_info = render.skin_info_map['default'];
var slot_info = skin_info.slot_info_map[slot_key] || default_skin_info.slot_info_map[slot_key];
Expand Down
8 changes: 4 additions & 4 deletions demo/render-webgl.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ RenderWebGL.prototype.dropData = function(spine_data, atlas_data) {
});
});
break;
case 'skinnedmesh':
case 'weightedmesh':
var gl_vertex = attachment_info.gl_vertex;
gl.deleteBuffer(gl_vertex.position.buffer);
gl.deleteBuffer(gl_vertex.blenders.buffer);
Expand Down Expand Up @@ -257,7 +257,7 @@ RenderWebGL.prototype.loadData = function(spine_data, atlas_data, images) {
}
});
break;
case 'skinnedmesh':
case 'weightedmesh':
var slot_info = slot_info_map[slot_key] = slot_info_map[slot_key] || {};
var attachment_info_map = slot_info.attachment_info_map = slot_info.attachment_info_map || {};
var attachment_info = attachment_info_map[attachment_key] = {};
Expand Down Expand Up @@ -462,7 +462,7 @@ RenderWebGL.prototype.loadData = function(spine_data, atlas_data, images) {
switch (attachment.type) {
case 'region':
case 'mesh':
case 'skinnedmesh':
case 'weightedmesh':
var image_key = attachment_key;
var image = images[image_key];
var gl_texture = render.gl_textures[image_key] = gl.createTexture();
Expand Down Expand Up @@ -671,7 +671,7 @@ RenderWebGL.prototype.drawPose = function(spine_pose, atlas_data) {
gl.useProgram(null);
}
break;
case 'skinnedmesh':
case 'weightedmesh':
var skin_info = render.skin_info_map[spine_pose.skin_key],
default_skin_info = render.skin_info_map['default'];
var slot_info = skin_info.slot_info_map[slot_key] || default_skin_info.slot_info_map[slot_key];
Expand Down
24 changes: 13 additions & 11 deletions spine.js
Original file line number Diff line number Diff line change
Expand Up @@ -1255,52 +1255,52 @@ spine.MeshAttachment.prototype.load = function(json) {
* @constructor
* @extends {spine.Attachment}
*/
spine.SkinnedMeshAttachment = function() {
goog.base(this, 'skinnedmesh');
spine.WeightedMeshAttachment = function() {
goog.base(this, 'weightedmesh');
this.color = new spine.Color();
this.triangles = [];
this.edges = [];
this.vertices = [];
this.uvs = [];
}

goog.inherits(spine.SkinnedMeshAttachment, spine.Attachment);
goog.inherits(spine.WeightedMeshAttachment, spine.Attachment);

/**
* @type {spine.Color}
*/
spine.SkinnedMeshAttachment.prototype.color;
spine.WeightedMeshAttachment.prototype.color;

/**
* @type {Array.<number>}
*/
spine.SkinnedMeshAttachment.prototype.triangles;
spine.WeightedMeshAttachment.prototype.triangles;

/**
* @type {Array.<number>}
*/
spine.SkinnedMeshAttachment.prototype.edges;
spine.WeightedMeshAttachment.prototype.edges;

/**
* @type {Array.<number>}
*/
spine.SkinnedMeshAttachment.prototype.vertices;
spine.WeightedMeshAttachment.prototype.vertices;

/**
* @type {Array.<number>}
*/
spine.SkinnedMeshAttachment.prototype.uvs;
spine.WeightedMeshAttachment.prototype.uvs;

/**
* @type {number}
*/
spine.SkinnedMeshAttachment.prototype.hull = 0;
spine.WeightedMeshAttachment.prototype.hull = 0;

/**
* @return {spine.Attachment}
* @param {Object.<string,?>} json
*/
spine.SkinnedMeshAttachment.prototype.load = function(json) {
spine.WeightedMeshAttachment.prototype.load = function(json) {
goog.base(this, 'load', json);

var attachment = this;
Expand Down Expand Up @@ -1349,7 +1349,9 @@ spine.SkinSlot.prototype.load = function(json) {
skin_slot.attachments[attachment_key] = new spine.MeshAttachment().load(json_attachment);
break;
case 'skinnedmesh':
skin_slot.attachments[attachment_key] = new spine.SkinnedMeshAttachment().load(json_attachment);
json_attachment.type = 'weightedmesh';
case 'weightedmesh':
skin_slot.attachments[attachment_key] = new spine.WeightedMeshAttachment().load(json_attachment);
break;
}
});
Expand Down

0 comments on commit 707e3b0

Please sign in to comment.