Skip to content

Commit

Permalink
Copied over missing files.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexjc committed Jul 14, 2016
1 parent 27f1984 commit 9b3d413
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 4 deletions.
26 changes: 26 additions & 0 deletions animation/bootstrap.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import os
import sys

# Setup the path to known locations of GLFW's DLL on Windows
if sys.platform == 'win32':
import platform
bits = platform.architecture()[0][:2]
os.environ['PATH'] += os.pathsep + r'C:\ProgramData\chocolatey\msvc120-{}\bin'.format(bits)

# Inject support for local font loading into VisPy.
def _get_vispy_font_filename(face, bold, italic):
return os.path.join(os.path.dirname(__file__), 'data/questrial.ttf')

# Fonts on Mac OSX.
if sys.platform == 'darwin':
from vispy.util.fonts import _quartz
_quartz._vispy_fonts = ('Questrial',)
_quartz._get_vispy_font_filename = _get_vispy_font_filename
del _quartz

# Fonts on Windows and Linux.
if sys.platform in ['win32', 'linux']:
from vispy.util.fonts import _freetype
_freetype._vispy_fonts = ('Questrial',)
_freetype._get_vispy_font_filename = _get_vispy_font_filename
del _freetype
7 changes: 3 additions & 4 deletions animation/display.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import os
import sys
import bootstrap # Demonstration specific setup.
# import scipy.misc # Image loading and manipulation.
import vispy.scene # Canvas & visuals for rendering.
import vispy.scene # Canvas & visuals for rendering.
import numpy

import collections
Expand All @@ -24,7 +23,7 @@
class Application(object):


def __init__(self, example_idx, title='nucl.ai16'): #, range=(0,850)):
def __init__(self, example_idx, title='nucl.ai Motion Matching'): #, range=(0,850)):
self.canvas = vispy.scene.SceneCanvas(
title=title,
size=(1280, 720),
Expand Down Expand Up @@ -64,7 +63,7 @@ def __init__(self, example_idx, title='nucl.ai16'): #, range=(0,850)):

self.timer_toggle = True
self.player_position = numpy.asarray([0,0])
self.paths_data = paths_data.PathsData(os.path.join('csv', 'data.csv'), self.params, follow_player=(example_idx == 3), advancing=(example_idx == 3 or example_idx == 2))
self.paths_data = paths_data.PathsData('dota2.csv', self.params, follow_player=(example_idx == 3), advancing=(example_idx == 3 or example_idx == 2))
# init the searched point with some random value - after first mouse move it's a
self.paths_data.mouse_xy = ( ( numpy.random.rand(2) * 10 - 5 ) - numpy.asarray(self.canvas.size) / 2 ) * self.params.SCALE_FACTOR

Expand Down
10 changes: 10 additions & 0 deletions animation/params.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class Params:
SEGMENT_SIZE = 10
TOP_PATHS_NUMBER = 5
SAMPLE_SIZE = 150
SCALE_FACTOR = 200
TELEPORT_THRESHOLD = 40 # it defines a disatnce where we elimiate a segment - we skip all teleports

def __init__(self):
self.VECTOR_POINT = int(self.SEGMENT_SIZE / 2)
self.MOVE_ALONG_STEP_SIZE = int(self.SEGMENT_SIZE / 2)

0 comments on commit 9b3d413

Please # to comment.