Skip to content

Commit

Permalink
fix bug of createQuad
Browse files Browse the repository at this point in the history
  • Loading branch information
GuoLei1990 committed Sep 25, 2019
1 parent 615157d commit 8d54b2f
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/layaAir/laya/d3/resource/models/PrimitiveMesh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -641,18 +641,12 @@ export class PrimitiveMesh {
* @param width 宽
*/
static createQuad(long: number = 1, width: number = 1): Mesh {
const vertexCount: number = 4;
const indexCount: number = 6;
//定义顶点数据结构
var vertexDeclaration: VertexDeclaration = VertexMesh.getVertexDeclaration("POSITION,NORMAL,UV");
//单个顶点数据个数,总共字节数/单个字节数
var vertexFloatStride: number = vertexDeclaration.vertexStride / 4;

var halfLong: number = long / 2;
var halfWidth: number = width / 2;

var vertices: Float32Array = new Float32Array([halfLong, halfWidth, 0, 0, 0, 1, 0, 0, halfLong, halfWidth, 0, 0, 0, 1, 1, 0, -halfLong, -halfWidth, 0, 0, 0, 1, 0, 1, halfLong, -halfWidth, 0, 0, 0, 1, 1, 1]);

var vertices: Float32Array = new Float32Array([-halfLong, halfWidth, 0, 0, 0, 1, 0, 0, halfLong, halfWidth, 0, 0, 0, 1, 1, 0, -halfLong, -halfWidth, 0, 0, 0, 1, 0, 1, halfLong, -halfWidth, 0, 0, 0, 1, 1, 1]);
var indices: Uint16Array = new Uint16Array([0, 1, 2, 3, 2, 1]);

return PrimitiveMesh._createMesh(vertexDeclaration, vertices, indices);
Expand Down

0 comments on commit 8d54b2f

Please sign in to comment.