Skip to content

Commit

Permalink
sprite offset not working yet
Browse files Browse the repository at this point in the history
  • Loading branch information
namel committed Oct 28, 2016
1 parent 4b7938c commit 1712681
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
Binary file added resources/sprite/circle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 3 additions & 7 deletions src/crosshairs.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,9 @@ class Crosshairs {
sprite.texture = spriteTexture;
sprite.texture.wrapS = sprite.texture.wrapT = THREE.RepeatWrapping;

if (!sprite.width || !sprite.height) {
sprite.texture.repeat.set(1 / sprite.columns, 1 / sprite.rows);
} else {
var repeatX = sprite.width / sprite.texture.image.width;
var repeatY = sprite.height / sprite.texture.image.height;
sprite.texture.repeat.set(repeatX, repeatY);
}
var repeatX = 1 / sprite.columns;
var repeatY = 1 / sprite.rows;
sprite.texture.repeat.set(repeatX, repeatY);
var geometry = new THREE.PlaneGeometry(sprite.objWidth, sprite.objHeight, 1, 1);
var spriteMaterial = new THREE.MeshBasicMaterial({
transparent: true,
Expand Down

0 comments on commit 1712681

Please sign in to comment.