Changeset 8803:6ddaebeea5dd in orange


Ignore:
Timestamp:
08/26/11 13:55:52 (3 years ago)
Author:
matejd <matejd@…>
Branch:
default
Convert:
e209903c3cc6f878e0ca66aedadc3ece225e966f
Message:

Modified the way symbols are drawn: using wire models + shaded solids now

Location:
orange/OrangeWidgets/plot
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • orange/OrangeWidgets/plot/owplot3d.py

    r8786 r8803  
    118118Axis = enum('X', 'Y', 'Z', 'CUSTOM') 
    119119 
    120 from plot.primitives import normal_from_points, get_2d_symbol_data, get_symbol_data, clamp, normalize 
     120from plot.primitives import normal_from_points, get_symbol_geometry, clamp, normalize, GeometryType 
    121121 
    122122class Legend(object): 
     
    177177        for symbol, color, size, text in self.items: 
    178178            glColor4f(*color) 
    179             triangles = get_2d_symbol_data(symbol) 
     179            triangles = get_symbol_geometry(symbol, GeometryType.SOLID_2D) 
    180180            glBegin(GL_TRIANGLES) 
    181181            for v0, v1, v2, _, _, _ in triangles: 
     
    461461            symbols_sizes = [] 
    462462            for symbol in range(len(Symbol)): 
    463                 triangles = get_2d_symbol_data(symbol) 
     463                triangles = get_symbol_geometry(symbol, GeometryType.SOLID_3D) 
    464464                symbols_indices.append(len(geometry_data) / 3) 
    465465                symbols_sizes.append(len(triangles)) 
     
    468468 
    469469            for symbol in range(len(Symbol)): 
    470                 triangles = get_symbol_data(symbol) 
     470                triangles = get_symbol_geometry(symbol, GeometryType.SOLID_2D) 
    471471                symbols_indices.append(len(geometry_data) / 3) 
    472472                symbols_sizes.append(len(triangles)) 
     
    522522            geometry_data = [] 
    523523            for symbol in range(len(Symbol)): 
    524                 triangles = get_2d_symbol_data(symbol) 
     524                triangles = get_symbol_geometry(symbol, GeometryType.SOLID_2D) 
    525525                triangles = [QVector3D(*v) for triangle in triangles for v in triangle] 
    526526                orangeqt.Plot3D.set_symbol_geometry(self, symbol, 0, triangles) 
    527527 
    528                 triangles = get_symbol_data(symbol) 
     528                triangles = get_symbol_geometry(symbol, GeometryType.SOLID_3D) 
    529529                triangles = [QVector3D(*v) for triangle in triangles for v in triangle] 
    530530                orangeqt.Plot3D.set_symbol_geometry(self, symbol, 1, triangles) 
     531 
     532                edges = get_symbol_geometry(symbol, GeometryType.EDGE_2D) 
     533                edges = [QVector3D(*v) for edge in edges for v in edge] 
     534                orangeqt.Plot3D.set_symbol_geometry(self, symbol, 2, edges) 
     535 
     536                edges = get_symbol_geometry(symbol, GeometryType.EDGE_3D) 
     537                edges = [QVector3D(*v) for edge in edges for v in edge] 
     538                orangeqt.Plot3D.set_symbol_geometry(self, symbol, 3, edges) 
    531539 
    532540        self.symbol_program = QtOpenGL.QGLShaderProgram() 
     
    654662            glDisable(GL_CULL_FACE) 
    655663            glEnable(GL_DEPTH_TEST) 
    656             orangeqt.Plot3D.draw_data(self) 
     664            glEnable(GL_BLEND) 
     665            glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) 
     666            orangeqt.Plot3D.draw_data(self, self.symbol_program.programId(), self.alpha_value / 255.) 
    657667 
    658668        self.symbol_program.release() 
     
    682692                glBindVertexArray(0) 
    683693            else: 
    684                 orangeqt.Plot3D.draw_data(self) 
     694                orangeqt.Plot3D.draw_data(self, self.symbol_program.programId(), self.alpha_value / 255.) 
    685695            self.symbol_program.release() 
    686696            self.tooltip_fbo.release() 
     
    705715                glBindVertexArray(0) 
    706716            else: 
    707                 orangeqt.Plot3D.draw_data(self) 
     717                orangeqt.Plot3D.draw_data(self, self.symbol_program.programId(), self.alpha_value / 255.) 
    708718            self.symbol_program.release() 
    709719 
  • orange/OrangeWidgets/plot/symbol.vs

    r8801 r8803  
    1 #version 150 
     1#extension GL_EXT_gpu_shader4 : enable 
    22 
    33// Each example is drawn using a symbol constructed out 
Note: See TracChangeset for help on using the changeset viewer.