出于业务的需求,我们实现了一套直播可用的轻量型人脸贴纸。下面简单介绍一下实现的过程和难点。
01
技术分析
02
流程介绍
03
实现细节及难点
"position": {
"flag": 49,
"x": 185.59,
"y": 299.39
},
"rotateCenter": [
{
"flag": 49,
"x": 239.92,
"y": 357.87
}
],
"scale": {
"pointA":
{
"flag": 6,
"x": 185.59,
"y": 299.39
},
"pointB":
{
"flag": 13,
"x": 293.67,
"y": 298.72
}
},
"begin":“sticker1.complete”
_modelViewMatrix = GLKMatrix4Identity;
_viewMatrix = GLKMatrix4MakeLookAt(0, 0, 6, 0, 0, 0, 0, 1, 0);
float ratio = outputFramebuffer.size.width/outputFramebuffer.size.height;
_projectionMatrix = GLKMatrix4MakeFrustum(-ratio, ratio, -1, 1, 3, 9);
x = x * imageWidth / imageHeight * 2 * ProjectionScale ;
y = y * imageHeight / imageHeight * 2 * ProjectionScale;
//x,y范围[-1, 1],ProjectionScale代表这贴纸跟近平面的坐标比例为2
04
项目优势
05
注释