Skip to content

Commit edf9453

Browse files
committed
refactor: rename gap to trim
1 parent 5d22a11 commit edf9453

File tree

13 files changed

+46
-46
lines changed

13 files changed

+46
-46
lines changed

demo/examples/panoviewer/projection-type/cubemap_image.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ <h2>Support variety cubemap format</h2>
6666
projectionType: "cubemap",
6767
image: "../../img/test_cube_3x2_RLUDFB.jpg",
6868
cubemapConfig: {
69-
gap: 3
69+
trim: 3
7070
}
7171
});
7272

demo/examples/panoviewer/projection-type/cubestrip_3x2_image.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ <h2>Support variety cubestrip format</h2>
6565
projectionType: "cubestrip",
6666
image: "../../img/test_cube_3x2_RLUDFB.jpg",
6767
cubemapConfig: {
68-
gap: 3
68+
trim: 3
6969
}
7070
});
7171

demo/examples/panoviewer/projection-type/youtube.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ <h2>EAC Format(Youtube) is supported also.</h2>
7575
cubemapConfig: {
7676
order: "BLFDRU",
7777
tileConfig: [{rotation: 0}, {rotation: 0}, {rotation: 0}, {rotation: 0}, {rotation: -90}, {rotation: 180}],
78-
gap: 3
78+
trim: 3
7979
}
8080
});
8181

src/PanoImageRenderer/PanoImageRenderer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ class PanoImageRenderer extends Component<{
213213
flipHorizontal: false,
214214
rotation: 0
215215
},
216-
gap: 0
216+
trim: 0
217217
},
218218
...cubemapConfig
219219
};

src/PanoImageRenderer/renderer/CubeRenderer.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class CubeRenderer extends Renderer {
8888
const tileConfig = this._extractTileConfig(imageConfig);
8989
const elemSize = 3;
9090
const vertexPerTile = 4;
91-
const { gap } = imageConfig;
91+
const { trim } = imageConfig;
9292

9393
const texCoords = vertexOrder.split("")
9494
.map(face => tileConfig[order.indexOf(face)])
@@ -114,7 +114,7 @@ class CubeRenderer extends Renderer {
114114
}
115115
return tileTemp;
116116
})
117-
.map(coord => this._shrinkCoord({ image, faceCoords: coord, gap }))
117+
.map(coord => this._shrinkCoord({ image, faceCoords: coord, trim }))
118118
.reduce((acc: number[], val: number[][]) => [
119119
...acc,
120120
...val.reduce((coords, coord) => [...coords, ...coord], [])
@@ -258,16 +258,16 @@ void main(void) {
258258
private _shrinkCoord(coordData: {
259259
image: HTMLImageElement | HTMLVideoElement;
260260
faceCoords: number[][];
261-
gap: number
261+
trim: number
262262
}) {
263-
const { image, faceCoords, gap } = coordData;
263+
const { image, faceCoords, trim } = coordData;
264264

265265
const inputTextureSize = Array.isArray(image)
266266
? this.getDimension(image[0]).width
267267
: this.getSourceTileSize(image);
268268

269-
// Shrink by "gap" px
270-
const SHRINK_MULTIPLIER = 1 - gap * (2 / inputTextureSize);
269+
// Shrink by "trim" px
270+
const SHRINK_MULTIPLIER = 1 - trim * (2 / inputTextureSize);
271271

272272
const axisMultipliers = [0, 1, 2].map(axisIndex => {
273273
const axisDir = Math.sign(faceCoords[0][axisIndex]);

src/PanoImageRenderer/renderer/CubeStripRenderer.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ void main(void) {
153153
const rows = 2;
154154

155155
const textureSize = this.getDimension(image);
156-
const { gap } = imageConfig;
156+
const { trim } = imageConfig;
157157

158158
const order = imageConfig.order || "RLUDFB";
159159
let coords: number[][] = [];
@@ -177,7 +177,7 @@ void main(void) {
177177
// Transform Coord By Flip & Rotation
178178
coords = coords
179179
// shrink coord to avoid pixel bleeding
180-
.map(coord => this._shrinkCoord(coord, textureSize, gap))
180+
.map(coord => this._shrinkCoord(coord, textureSize, trim))
181181
.map((coord, i) => this._transformCoord(coord, tileConfigs[i]));
182182

183183
// vertices 에서 지정된 순서대로 그대로 그리기 위해 vertex 의 순서를 BFUDRL 로 재배치
@@ -226,12 +226,12 @@ void main(void) {
226226
return newCoord;
227227
}
228228

229-
private _shrinkCoord(coord: number[], textureSize: { width: number; height: number }, gap: number) {
229+
private _shrinkCoord(coord: number[], textureSize: { width: number; height: number }, trim: number) {
230230
const { width, height } = textureSize;
231231

232-
// Shrink by "gap" px
233-
const SHRINK_Y = gap * (1 / height);
234-
const SHRINK_X = gap * (1 / width);
232+
// Shrink by "trim" px
233+
const SHRINK_Y = trim * (1 / height);
234+
const SHRINK_X = trim * (1 / width);
235235

236236
return [
237237
coord[0] + SHRINK_X, coord[1] + SHRINK_Y,

src/PanoViewer/PanoViewer.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,10 +225,10 @@ class PanoViewer extends Component<PanoViewerEvent> {
225225
* @param {Object} options.cubemapConfig Config cubemap projection layout. It is applied when projectionType is {@link eg.view360.PanoViewer.PROJECTION_TYPE.CUBEMAP} or {@link eg.view360.PanoViewer.PROJECTION_TYPE.CUBESTRIP}<ko>cubemap projection type 의 레이아웃을 설정한다. 이 설정은 ProjectionType이 {@link eg.view360.PanoViewer.PROJECTION_TYPE.CUBEMAP} 혹은 {@link eg.view360.PanoViewer.PROJECTION_TYPE.CUBESTRIP} 인 경우에만 적용된다.</ko>
226226
* @param {Object} [options.cubemapConfig.order = "RLUDBF"(ProjectionType === CUBEMAP) | "RLUDFB" (ProjectionType === CUBESTRIP)] Order of cubemap faces <ko>Cubemap 형태의 이미지가 배치된 순서</ko>
227227
* @param {Object} [options.cubemapConfig.tileConfig = { flipHorizontal:false, rotation: 0 }] Setting about rotation angle(degree) and whether to flip horizontal for each cubemap faces, if you put this object as a array, you can set each faces with different setting. For example, [{flipHorizontal:false, rotation:90}, {flipHorizontal: true, rotation: 180}, ...]<ko>각 Cubemap 면에 대한 회전 각도/좌우반전 여부 설정, 객체를 배열 형태로 지정하여 각 면에 대한 설정을 다르게 지정할 수도 있다. 예를 들어 [{flipHorizontal:false, rotation:90}, {flipHorizontal: true, rotation: 180}, ...]과 같이 지정할 수 있다.</ko>
228+
* @param {Number} [options.cubemapConfig.trim=0] A px distance to discard from each tile side. You can use this value to avoid graphical glitch at where tiles are connected. This option is available when there's only one texture.<ko>각 타일의 끝으로부터 폐기할 px 거리. 이 옵션을 사용하여 타일의 접합부에서 나타나는 그래픽 결함을 완화할 수 있습니다. 이 옵션은 한 개의 텍스쳐만 사용할 때 적용 가능합니다.</ko>
228229
* @param {String} [options.stereoFormat="3dv"] Contents format of the stereoscopic equirectangular projection.<br/>See {@link eg.view360.PanoViewer.STEREO_FORMAT}.<ko>Stereoscopic equirectangular projection type의 콘텐츠 포맷을 설정한다.<br/>{@link eg.view360.PanoViewer.STEREO_FORMAT} 참조.</ko>
229230
* @param {Number} [options.width=width of container] the viewer's width. (in px) <ko>뷰어의 너비 (px 단위)</ko>
230231
* @param {Number} [options.height=height of container] the viewer's height.(in px) <ko>뷰어의 높이 (px 단위)</ko>
231-
*
232232
* @param {Number} [options.yaw=0] Initial Yaw of camera (in degree) <ko>카메라의 초기 Yaw (degree 단위)</ko>
233233
* @param {Number} [options.pitch=0] Initial Pitch of camera (in degree) <ko>카메라의 초기 Pitch (degree 단위)</ko>
234234
* @param {Number} [options.fov=65] Initial vertical field of view of camera (in degree) <ko>카메라의 초기 수직 field of view (degree 단위)</ko>
@@ -336,7 +336,7 @@ class PanoViewer extends Component<PanoViewerEvent> {
336336
flipHorizontal: false,
337337
rotation: 0
338338
},
339-
gap: 0
339+
trim: 0
340340
}, ...options.cubemapConfig
341341
};
342342
this._stereoFormat = options.stereoFormat || STEREO_FORMAT.TOP_BOTTOM;
@@ -551,7 +551,7 @@ class PanoViewer extends Component<PanoViewerEvent> {
551551
flipHorizontal: false,
552552
rotation: 0
553553
},
554-
gap: 0
554+
trim: 0
555555
}, ...param.cubemapConfig
556556
};
557557
const stereoFormat = param.stereoFormat || STEREO_FORMAT.TOP_BOTTOM;

src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export type TileConfig = {
88
export interface CubemapConfig {
99
order: string;
1010
tileConfig: TileConfig | TileConfig[];
11-
gap: number;
11+
trim: number;
1212
}
1313

1414
export type TypedArray = Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array;

0 commit comments

Comments
 (0)