forked from TUDelft-CNS-ATM/bluesky
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
city map and drone trajectory included
- Loading branch information
jbueno
committed
Sep 10, 2021
1 parent
2d83efe
commit cb826dd
Showing
40 changed files
with
193,067 additions
and
300 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>bluesky</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.python.pydev.PyDevBuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.python.pydev.pythonNature</nature> | ||
</natures> | ||
</projectDescription> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
<?eclipse-pydev version="1.0"?><pydev_project> | ||
<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property> | ||
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python interpreter</pydev_property> | ||
<pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH"> | ||
<path>/${PROJECT_DIR_NAME}</path> | ||
</pydev_pathproperty> | ||
</pydev_project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,86 +1,86 @@ | ||
''' BlueSky OpenGL map object. ''' | ||
from os import path | ||
import numpy as np | ||
|
||
from bluesky import settings | ||
from bluesky.ui import palette | ||
from bluesky.ui.qtgl import glhelpers as glh | ||
from bluesky.ui.loadvisuals import load_coastlines | ||
from bluesky import settings | ||
from bluesky.ui.qtgl import glhelpers as glh | ||
import numpy as np | ||
|
||
|
||
settings.set_variable_defaults(gfx_path='data/graphics') | ||
palette.set_default_colours( | ||
background=(0, 0, 0), | ||
coastlines=(85, 85, 115)) | ||
settings.set_variable_defaults( gfx_path='data/graphics' ) | ||
palette.set_default_colours( | ||
background=( 0, 0, 0 ), | ||
coastlines=( 85, 85, 115 ) ) | ||
|
||
|
||
class Map(glh.RenderObject, layer=-100): | ||
class Map( glh.RenderObject, layer=-100 ): | ||
''' Radar screen map OpenGL object. ''' | ||
def __init__(self, parent=None): | ||
super().__init__(parent) | ||
def __init__( self, parent=None ): | ||
super().__init__( parent ) | ||
|
||
self.map = glh.VertexArrayObject(glh.gl.GL_TRIANGLE_FAN) | ||
self.coastlines = glh.VertexArrayObject(glh.gl.GL_LINES) | ||
self.map = glh.VertexArrayObject( glh.gl.GL_TRIANGLE_FAN ) | ||
self.coastlines = glh.VertexArrayObject( glh.gl.GL_LINES ) | ||
self.coastindices = [] | ||
self.vcount_coast = 0 | ||
self.wraplon_loc = 0 | ||
|
||
def create(self): | ||
def create( self ): | ||
''' Create GL objects. ''' | ||
# ------- Coastlines ----------------------------- | ||
coastvertices, self.coastindices = load_coastlines() | ||
self.coastlines.create(vertex=coastvertices, color=palette.coastlines) | ||
self.vcount_coast = len(coastvertices) | ||
self.coastlines.create( vertex=coastvertices, color=palette.coastlines ) | ||
self.vcount_coast = len( coastvertices ) | ||
|
||
mapvertices = np.array( | ||
[-90.0, 540.0, -90.0, -540.0, 90.0, -540.0, 90.0, 540.0], dtype=np.float32) | ||
texcoords = np.array( | ||
[1, 3, 1, 0, 0, 0, 0, 3], dtype=np.float32) | ||
self.wraplon_loc = glh.ShaderSet.get_shader(self.coastlines.shader_type).attribs['lon'].loc | ||
mapvertices = np.array( | ||
[-90.0, 540.0, -90.0, -540.0, 90.0, -540.0, 90.0, 540.0], dtype=np.float32 ) | ||
texcoords = np.array( | ||
[1, 3, 1, 0, 0, 0, 0, 3], dtype=np.float32 ) | ||
self.wraplon_loc = glh.ShaderSet.get_shader( self.coastlines.shader_type ).attribs['lon'].loc | ||
|
||
# Load and bind world texture | ||
max_texture_size = glh.gl.glGetIntegerv(glh.gl.GL_MAX_TEXTURE_SIZE) | ||
print('Maximum supported texture size: %d' % max_texture_size) | ||
max_texture_size = glh.gl.glGetIntegerv( glh.gl.GL_MAX_TEXTURE_SIZE ) | ||
print( 'Maximum supported texture size: %d' % max_texture_size ) | ||
for i in [16384, 8192, 4096]: | ||
if max_texture_size >= i: | ||
fname = path.join(settings.gfx_path, | ||
'world.%dx%d.dds' % (i, i // 2)) | ||
print('Loading texture ' + fname) | ||
self.map.create(vertex=mapvertices, | ||
texcoords=texcoords, texture=fname) | ||
fname = path.join( settings.gfx_path, | ||
'world.%dx%d.dds' % ( i, i // 2 ) ) | ||
print( 'Loading texture ' + fname ) | ||
self.map.create( vertex=mapvertices, | ||
texcoords=texcoords, texture=fname ) | ||
break | ||
|
||
def draw(self, skipmap=False): | ||
def draw( self, skipmap=False ): | ||
# Send the (possibly) updated global uniforms to the buffer | ||
self.shaderset.set_vertex_scale_type(self.shaderset.VERTEX_IS_LATLON) | ||
self.shaderset.set_vertex_scale_type( self.shaderset.VERTEX_IS_LATLON ) | ||
|
||
# --- DRAW THE MAP AND COASTLINES --------------------------------------------- | ||
# Map and coastlines: don't wrap around in the shader | ||
self.shaderset.enable_wrap(False) | ||
self.shaderset.enable_wrap( False ) | ||
|
||
if not skipmap: | ||
self.map.draw() | ||
shaderset = glh.ShaderSet.selected | ||
if shaderset.data.wrapdir == 0: | ||
# Normal case, no wrap around | ||
self.coastlines.draw( | ||
first_vertex=0, vertex_count=self.vcount_coast) | ||
self.coastlines.draw( | ||
first_vertex=0, vertex_count=self.vcount_coast ) | ||
else: | ||
self.coastlines.bind() | ||
shader = glh.ShaderProgram.bound_shader | ||
wrapindex = np.uint32( | ||
self.coastindices[int(shaderset.data.wraplon) + 180]) | ||
wrapindex = np.uint32( | ||
self.coastindices[int( shaderset.data.wraplon ) + 180] ) | ||
if shaderset.data.wrapdir == 1: | ||
shader.setAttributeValue(self.wraplon_loc, 360.0) | ||
self.coastlines.draw( | ||
first_vertex=0, vertex_count=wrapindex) | ||
shader.setAttributeValue(self.wraplon_loc, 0.0) | ||
self.coastlines.draw( | ||
first_vertex=wrapindex, vertex_count=self.vcount_coast - wrapindex) | ||
shader.setAttributeValue( self.wraplon_loc, 360.0 ) | ||
self.coastlines.draw( | ||
first_vertex=0, vertex_count=wrapindex ) | ||
shader.setAttributeValue( self.wraplon_loc, 0.0 ) | ||
self.coastlines.draw( | ||
first_vertex=wrapindex, vertex_count=self.vcount_coast - wrapindex ) | ||
else: | ||
shader.setAttributeValue(self.wraplon_loc, -360.0) | ||
self.coastlines.draw( | ||
first_vertex=wrapindex, vertex_count=self.vcount_coast - wrapindex) | ||
shader.setAttributeValue(self.wraplon_loc, 0.0) | ||
self.coastlines.draw( | ||
first_vertex=0, vertex_count=wrapindex) | ||
shader.setAttributeValue( self.wraplon_loc, -360.0 ) | ||
self.coastlines.draw( | ||
first_vertex=wrapindex, vertex_count=self.vcount_coast - wrapindex ) | ||
shader.setAttributeValue( self.wraplon_loc, 0.0 ) | ||
self.coastlines.draw( | ||
first_vertex=0, vertex_count=wrapindex ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.