mirror of https://github.com/axmolengine/axmol.git
fix effect test (#20286)
This commit is contained in:
parent
afbf817ec0
commit
292e4c3b4d
|
@ -243,11 +243,11 @@ void ShuffleTiles::shuffle(unsigned int *array, unsigned int len)
|
||||||
Size ShuffleTiles::getDelta(const Size& pos) const
|
Size ShuffleTiles::getDelta(const Size& pos) const
|
||||||
{
|
{
|
||||||
unsigned int idx = static_cast<unsigned int>(pos.width * _gridSize.height + pos.height);
|
unsigned int idx = static_cast<unsigned int>(pos.width * _gridSize.height + pos.height);
|
||||||
|
Vec2 pos2;
|
||||||
|
pos2.x = (float)(_tilesOrder[idx] / (int)_gridSize.height);
|
||||||
|
pos2.y = (float)(_tilesOrder[idx] % (int)_gridSize.height);
|
||||||
|
|
||||||
float x = _tilesOrder[idx] / (_gridSize.height - pos.width);
|
return Size((int)(pos2.x - pos.width), (int)(pos2.y - pos.height));
|
||||||
float y = (float)(_tilesOrder[idx] % (int)(_gridSize.height - pos.height));
|
|
||||||
|
|
||||||
return Size(x, y);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShuffleTiles::placeTile(const Vec2& pos, Tile *t)
|
void ShuffleTiles::placeTile(const Vec2& pos, Tile *t)
|
||||||
|
|
|
@ -811,7 +811,7 @@ void TiledGrid3D::updateVertexAndTexCoordinate()
|
||||||
memcpy((char*)_vertexBuffer + offset, &tempVecPointer[i], sizeof(Vec3));
|
memcpy((char*)_vertexBuffer + offset, &tempVecPointer[i], sizeof(Vec3));
|
||||||
memcpy((char*)_vertexBuffer + offset + sizeof(Vec3), &tempTexPointer[i], sizeof(Vec2));
|
memcpy((char*)_vertexBuffer + offset + sizeof(Vec3), &tempTexPointer[i], sizeof(Vec2));
|
||||||
}
|
}
|
||||||
_drawCommand.createVertexBuffer((unsigned int)(sizeof(Vec3) + sizeof(Vec2) ), numOfPoints, CustomCommand::BufferUsage::DYNAMIC);
|
_drawCommand.createVertexBuffer((sizeof(Vec3) + sizeof(Vec2) ), numOfPoints, CustomCommand::BufferUsage::DYNAMIC);
|
||||||
_drawCommand.updateVertexBuffer(_vertexBuffer, numOfPoints * sizeof(Vec3) + numOfPoints * sizeof(Vec2));
|
_drawCommand.updateVertexBuffer(_vertexBuffer, numOfPoints * sizeof(Vec3) + numOfPoints * sizeof(Vec2));
|
||||||
|
|
||||||
_drawCommand.createIndexBuffer(CustomCommand::IndexFormat::U_SHORT, gradSize * 6, CustomCommand::BufferUsage::DYNAMIC);
|
_drawCommand.createIndexBuffer(CustomCommand::IndexFormat::U_SHORT, gradSize * 6, CustomCommand::BufferUsage::DYNAMIC);
|
||||||
|
|
Loading…
Reference in New Issue