You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
(11) |
Apr
(47) |
May
(14) |
Jun
|
Jul
(73) |
Aug
(4) |
Sep
(2) |
Oct
(60) |
Nov
(48) |
Dec
(66) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
|
Feb
(1) |
Mar
(27) |
Apr
(82) |
May
(89) |
Jun
(91) |
Jul
(44) |
Aug
(53) |
Sep
(113) |
Oct
(20) |
Nov
(37) |
Dec
(10) |
2008 |
Jan
|
Feb
(2) |
Mar
|
Apr
(2) |
May
(21) |
Jun
(3) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2009 |
Jan
(76) |
Feb
(89) |
Mar
(52) |
Apr
(11) |
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
(27) |
2010 |
Jan
(11) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(9) |
Sep
|
Oct
|
Nov
|
Dec
(14) |
2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(2) |
Sep
(11) |
Oct
(3) |
Nov
|
Dec
|
2013 |
Jan
(4) |
Feb
|
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <Ult...@us...> - 2009-02-21 08:34:55
|
Revision: 1051 http://opengate.svn.sourceforge.net/opengate/?rev=1051&view=rev Author: Ultrasick Date: 2009-02-21 08:34:45 +0000 (Sat, 21 Feb 2009) Log Message: ----------- adding functionality to decrease and increase the size of the 3 views Modified Paths: -------------- branches/ogEditor/data/modules/texturizer/scripts/main/variables.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/view_model/index.py Added Paths: ----------- branches/ogEditor/data/modules/texturizer/graphic/ branches/ogEditor/data/modules/texturizer/graphic/buttons/ branches/ogEditor/data/modules/texturizer/graphic/buttons/decrease_view_size.png branches/ogEditor/data/modules/texturizer/graphic/buttons/increase_view_size.png templates/branches/ templates/branches/ogEditor/ templates/branches/ogEditor/data/ templates/branches/ogEditor/data/modules/ templates/branches/ogEditor/data/modules/texturizer/ templates/branches/ogEditor/data/modules/texturizer/graphic/ templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/ templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/decrease_view_size.pspimage Added: branches/ogEditor/data/modules/texturizer/graphic/buttons/decrease_view_size.png =================================================================== (Binary files differ) Property changes on: branches/ogEditor/data/modules/texturizer/graphic/buttons/decrease_view_size.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogEditor/data/modules/texturizer/graphic/buttons/increase_view_size.png =================================================================== (Binary files differ) Property changes on: branches/ogEditor/data/modules/texturizer/graphic/buttons/increase_view_size.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: branches/ogEditor/data/modules/texturizer/scripts/main/variables.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/main/variables.py 2009-02-18 19:55:44 UTC (rev 1050) +++ branches/ogEditor/data/modules/texturizer/scripts/main/variables.py 2009-02-21 08:34:45 UTC (rev 1051) @@ -9,4 +9,7 @@ colors = {} colors['black'] = gtk.gdk.color_parse('#000000') colors['red'] = gtk.gdk.color_parse('#FF0000') -colors['white'] = gtk.gdk.color_parse('#FFFFFF') \ No newline at end of file +colors['white'] = gtk.gdk.color_parse('#FFFFFF') + +# define view size +view_size = 250 \ No newline at end of file Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/view_model/index.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/view_model/index.py 2009-02-18 19:55:44 UTC (rev 1050) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/view_model/index.py 2009-02-21 08:34:45 UTC (rev 1051) @@ -12,44 +12,89 @@ screen.frame.add(table) table.show() -# show top view -screen.top_view = gtk.DrawingArea() -screen.top_view.set_size_request(200, 200) -table.attach(screen.top_view, 0, 1, 0, 1) -screen.top_view.show() +class tools: + def __init__(self, parent): + # create an empty toolbar + self.bar = gtk.Toolbar() + #self.bar.append_space(3) + parent.attach(self.bar, 0, 2, 0, 1) + self.bar.show() -# show front view -screen.front_view = gtk.DrawingArea() -screen.front_view.set_size_request(200, 200) -table.attach(screen.front_view, 0, 1, 1, 2) -screen.front_view.show() + # create the "decrease view size" icon + image = gtk.Image() + image.set_from_file(path[0] + '/graphic/buttons/decrease_view_size.png') -# show side view -screen.side_view = gtk.DrawingArea() -screen.side_view.set_size_request(200, 200) -table.attach(screen.side_view, 1, 2, 1, 2) -screen.side_view.show() + # add the "decrease view size" button + self.bar.append_item('decrease view size', 'decrease the view size', '', image, self.change_view_size, -1) + # create the "increase view size" icon + image = gtk.Image() + image.set_from_file(path[0] + '/graphic/buttons/increase_view_size.png') + + # add the "increase view size" button + self.bar.append_item('increase view size', 'increase the view size', '', image, self.change_view_size, 1) + + def change_view_size(self, widget, direction): + global view_size + + step = 50 + + # check if the decreasing the view size would lead into 0 width + if direction<1 and view_size<=step: + return + + # calculate new view size + view_size += step * direction + + # redraw all views + screen.views.draw_all() + +tools(table) + class views: - def __init__(self): + def __init__(self, parent): + # show top view + self.top_view = gtk.DrawingArea() + parent.attach(self.top_view, 0, 1, 1, 2) + self.top_view.show() + + # show front view + self.front_view = gtk.DrawingArea() + parent.attach(self.front_view, 0, 1, 2, 3) + self.front_view.show() + + # show side view + self.side_view = gtk.DrawingArea() + parent.attach(self.side_view, 1, 2, 2, 3) + self.side_view.show() + # define the colors for the top view - screen.top_view.window.colors = {} + self.top_view.window.colors = {} for color_name, color_content in colors.items(): - screen.top_view.window.colors[color_name] = screen.top_view.window.new_gc(foreground = screen.top_view.window.get_colormap().alloc_color(color_content)) + self.top_view.window.colors[color_name] = self.top_view.window.new_gc(foreground = self.top_view.window.get_colormap().alloc_color(color_content)) # define the colors for the front view - screen.front_view.window.colors = {} + self.front_view.window.colors = {} for color_name, color_content in colors.items(): - screen.front_view.window.colors[color_name] = screen.front_view.window.new_gc(foreground = screen.front_view.window.get_colormap().alloc_color(color_content)) + self.front_view.window.colors[color_name] = self.front_view.window.new_gc(foreground = self.front_view.window.get_colormap().alloc_color(color_content)) # define the colors for the side view - screen.side_view.window.colors = {} + self.side_view.window.colors = {} for color_name, color_content in colors.items(): - screen.side_view.window.colors[color_name] = screen.side_view.window.new_gc(foreground = screen.side_view.window.get_colormap().alloc_color(color_content)) + self.side_view.window.colors[color_name] = self.side_view.window.new_gc(foreground = self.side_view.window.get_colormap().alloc_color(color_content)) + # add to draw all views to the background processes + self.draw_all() + + def draw_all(self): + # update sizes + self.top_view.set_size_request(view_size, view_size) + self.front_view.set_size_request(view_size, view_size) + self.side_view.set_size_request(view_size, view_size) + # add the drawing of the top view to the background processes background_processes.add('drawing the top view', self.draw, 'top_view') @@ -62,47 +107,47 @@ def draw(self, drawing_area): # choose the right drawing area and axes if drawing_area=='top_view': - drawing_area = screen.top_view.window + drawing_area = self.top_view.window axis_0 = 0 # x axis_1 = 1 # y elif drawing_area=='front_view': - drawing_area = screen.front_view.window + drawing_area = self.front_view.window axis_0 = 0 # x axis_1 = 2 # z elif drawing_area=='side_view': - drawing_area = screen.side_view.window + drawing_area = self.side_view.window axis_0 = 1 # y axis_1 = 2 # z # calculate the center for the first axis - axis_0_center = 200 - axis_0_center -= (model['dimensions'][axis_0]['length']/model['dimensions']['maximum_length']) * 190 + axis_0_center = view_size + axis_0_center -= (model['dimensions'][axis_0]['length']/model['dimensions']['maximum_length']) * (view_size - 10) axis_0_center /= 2 - axis_0_center -= (model['dimensions'][axis_0]['min']/model['dimensions']['maximum_length']) * 190 + axis_0_center -= (model['dimensions'][axis_0]['min']/model['dimensions']['maximum_length']) * (view_size - 10) # calculate the center for the second axis - axis_1_center = 200 - axis_1_center -= (model['dimensions'][axis_1]['length']/model['dimensions']['maximum_length']) * 190 + axis_1_center = view_size + axis_1_center -= (model['dimensions'][axis_1]['length']/model['dimensions']['maximum_length']) * (view_size - 10) axis_1_center /= 2 - axis_1_center += (model['dimensions'][axis_1]['max']/model['dimensions']['maximum_length']) * 190 + axis_1_center += (model['dimensions'][axis_1]['max']/model['dimensions']['maximum_length']) * (view_size - 10) # fill the background of the drawing area with white color - drawing_area.draw_polygon(drawing_area.colors['white'], true, [(0, 0), (200, 0), (200, 200), (0, 200)]) + drawing_area.draw_polygon(drawing_area.colors['white'], true, [(0, 0), (view_size, 0), (view_size, view_size), (0, view_size)]) # draw the edges for edge in model['edges']: # calculate the x position - position_x_start = int(round((edge[0][axis_0]/model['dimensions']['maximum_length']) * 190 + axis_0_center)) - position_x_end = int(round((edge[1][axis_0]/model['dimensions']['maximum_length']) * 190 + axis_0_center)) + position_x_start = int(round((edge[0][axis_0]/model['dimensions']['maximum_length']) * (view_size - 10) + axis_0_center)) + position_x_end = int(round((edge[1][axis_0]/model['dimensions']['maximum_length']) * (view_size - 10) + axis_0_center)) # calculate the y position - position_y_start = int(round((((edge[0][axis_1] * (-1))/model['dimensions']['maximum_length']) * 190) + axis_1_center)) - position_y_end = int(round((((edge[1][axis_1] * (-1))/model['dimensions']['maximum_length']) * 190) + axis_1_center)) + position_y_start = int(round((((edge[0][axis_1] * (-1))/model['dimensions']['maximum_length']) * (view_size - 10)) + axis_1_center)) + position_y_end = int(round((((edge[1][axis_1] * (-1))/model['dimensions']['maximum_length']) * (view_size - 10)) + axis_1_center)) # draw the edge drawing_area.draw_line(drawing_area.colors['black'], position_x_start, position_y_start, position_x_end, position_y_end) -screen.views = views() \ No newline at end of file +screen.views = views(table) \ No newline at end of file Added: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/decrease_view_size.pspimage =================================================================== (Binary files differ) Property changes on: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/decrease_view_size.pspimage ___________________________________________________________________ Added: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-02-18 19:55:56
|
Revision: 1050 http://opengate.svn.sourceforge.net/opengate/?rev=1050&view=rev Author: Ultrasick Date: 2009-02-18 19:55:44 +0000 (Wed, 18 Feb 2009) Log Message: ----------- removing the progress bar from the module. It was nice to look at but it kept the user from continuing working and slowed down the script execution dramatically. What a waste of programming time. Modified Paths: -------------- branches/ogEditor/data/modules/texturizer/scripts/main/functions.py branches/ogEditor/data/modules/texturizer/scripts/screens/global/index.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/new/index.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/view_model/index.py Modified: branches/ogEditor/data/modules/texturizer/scripts/main/functions.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/main/functions.py 2009-02-18 19:22:30 UTC (rev 1049) +++ branches/ogEditor/data/modules/texturizer/scripts/main/functions.py 2009-02-18 19:55:44 UTC (rev 1050) @@ -36,6 +36,9 @@ # set caption window.status_bar.caption.set_text(process['caption'] + ' ...') + # update the GUI + update_ui() + if process['function_parameter']==none: # run the function process['function']() @@ -44,7 +47,7 @@ process['function'](process['function_parameter']) # reset the status bar - window.status_bar.reset() + window.status_bar.caption.set_text('(there is no background process running)') return true Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/global/index.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/global/index.py 2009-02-18 19:22:30 UTC (rev 1049) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/global/index.py 2009-02-18 19:55:44 UTC (rev 1050) @@ -1,7 +1,7 @@ # -*- coding: cp1252 -*- # show vbox for the menu and the content -window.vbox = gtk.VBox() +window.vbox = gtk.VBox(spacing = 3) window.add(window.vbox) window.vbox.show() @@ -42,38 +42,14 @@ class status_bar: def __init__(self): - # show a table - self.table = gtk.Table() - window.vbox.add(self.table) - self.table.show() - # show horizontal line self.separator = gtk.HSeparator() - self.table.attach(self.separator, 0, 2, 0, 1, ypadding = 3) + window.vbox.add(self.separator) self.separator.show() # show caption self.caption = gtk.Label('(there is no background process running)') - self.table.attach(self.caption, 0, 1, 1, 2) + window.vbox.add(self.caption) self.caption.show() - # show progress bar - self.progress_bar = gtk.ProgressBar() - self.table.attach(self.progress_bar, 1, 2, 1, 2, xpadding = 3) - self.progress_bar.show() - - def update(self, fraction): - # update the progress bar - self.progress_bar.set_fraction(fraction) - - # update the GUI - update_ui() - - def reset(self): - # reset the caption - self.caption.set_text('(there is no background process running)') - - # reset the progress bar - self.progress_bar.set_fraction(0) - window.status_bar = status_bar() \ No newline at end of file Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/new/index.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/new/index.py 2009-02-18 19:22:30 UTC (rev 1049) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/new/index.py 2009-02-18 19:55:44 UTC (rev 1050) @@ -63,9 +63,6 @@ # close the file file.close() - # count the number of faces - number_of_faces = len(lines) - try: global model except: @@ -98,12 +95,12 @@ # create a new array for the edges model['edges'] = [] - for line_number, line_content in enumerate(lines): + for line in lines: # trim whitespaces - line_content = line_content.strip() + line = line.strip() # split at the " " - face = line_content.split(' ') + face = line.split(' ') # reset/create an array for the new face face_new = [] @@ -134,9 +131,6 @@ # save the edges of the face self.save_edges(face_new) - # update the progress bar on the status bar - window.status_bar.update((line_number + 1)/number_of_faces) - # update length values model['dimensions'][0]['length'] = model['dimensions'][0]['max'] - model['dimensions'][0]['min'] model['dimensions'][1]['length'] = model['dimensions'][1]['max'] - model['dimensions'][1]['min'] Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/view_model/index.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/view_model/index.py 2009-02-18 19:22:30 UTC (rev 1049) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/view_model/index.py 2009-02-18 19:55:44 UTC (rev 1050) @@ -92,23 +92,17 @@ # fill the background of the drawing area with white color drawing_area.draw_polygon(drawing_area.colors['white'], true, [(0, 0), (200, 0), (200, 200), (0, 200)]) - # count the number of edges - number_of_edges = len(model['edges']) - # draw the edges - for edge_number, edge_content in enumerate(model['edges']): + for edge in model['edges']: # calculate the x position - position_x_start = int(round((edge_content[0][axis_0]/model['dimensions']['maximum_length']) * 190 + axis_0_center)) - position_x_end = int(round((edge_content[1][axis_0]/model['dimensions']['maximum_length']) * 190 + axis_0_center)) + position_x_start = int(round((edge[0][axis_0]/model['dimensions']['maximum_length']) * 190 + axis_0_center)) + position_x_end = int(round((edge[1][axis_0]/model['dimensions']['maximum_length']) * 190 + axis_0_center)) # calculate the y position - position_y_start = int(round((((edge_content[0][axis_1] * (-1))/model['dimensions']['maximum_length']) * 190) + axis_1_center)) - position_y_end = int(round((((edge_content[1][axis_1] * (-1))/model['dimensions']['maximum_length']) * 190) + axis_1_center)) + position_y_start = int(round((((edge[0][axis_1] * (-1))/model['dimensions']['maximum_length']) * 190) + axis_1_center)) + position_y_end = int(round((((edge[1][axis_1] * (-1))/model['dimensions']['maximum_length']) * 190) + axis_1_center)) # draw the edge drawing_area.draw_line(drawing_area.colors['black'], position_x_start, position_y_start, position_x_end, position_y_end) - # update the progress bar on the status bar - window.status_bar.update((edge_number + 1)/number_of_edges) - screen.views = views() \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-02-18 19:22:38
|
Revision: 1049 http://opengate.svn.sourceforge.net/opengate/?rev=1049&view=rev Author: Ultrasick Date: 2009-02-18 19:22:30 +0000 (Wed, 18 Feb 2009) Log Message: ----------- forgott to update the progress bar while drawing a view Modified Paths: -------------- branches/ogEditor/data/modules/texturizer/scripts/screens/project/view_model/index.py Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/view_model/index.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/view_model/index.py 2009-02-18 19:18:12 UTC (rev 1048) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/view_model/index.py 2009-02-18 19:22:30 UTC (rev 1049) @@ -92,17 +92,23 @@ # fill the background of the drawing area with white color drawing_area.draw_polygon(drawing_area.colors['white'], true, [(0, 0), (200, 0), (200, 200), (0, 200)]) + # count the number of edges + number_of_edges = len(model['edges']) + # draw the edges - for edge in model['edges']: + for edge_number, edge_content in enumerate(model['edges']): # calculate the x position - position_x_start = int(round((edge[0][axis_0]/model['dimensions']['maximum_length']) * 190 + axis_0_center)) - position_x_end = int(round((edge[1][axis_0]/model['dimensions']['maximum_length']) * 190 + axis_0_center)) + position_x_start = int(round((edge_content[0][axis_0]/model['dimensions']['maximum_length']) * 190 + axis_0_center)) + position_x_end = int(round((edge_content[1][axis_0]/model['dimensions']['maximum_length']) * 190 + axis_0_center)) # calculate the y position - position_y_start = int(round((((edge[0][axis_1] * (-1))/model['dimensions']['maximum_length']) * 190) + axis_1_center)) - position_y_end = int(round((((edge[1][axis_1] * (-1))/model['dimensions']['maximum_length']) * 190) + axis_1_center)) + position_y_start = int(round((((edge_content[0][axis_1] * (-1))/model['dimensions']['maximum_length']) * 190) + axis_1_center)) + position_y_end = int(round((((edge_content[1][axis_1] * (-1))/model['dimensions']['maximum_length']) * 190) + axis_1_center)) # draw the edge drawing_area.draw_line(drawing_area.colors['black'], position_x_start, position_y_start, position_x_end, position_y_end) + # update the progress bar on the status bar + window.status_bar.update((edge_number + 1)/number_of_edges) + screen.views = views() \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-02-18 19:18:31
|
Revision: 1048 http://opengate.svn.sourceforge.net/opengate/?rev=1048&view=rev Author: Ultrasick Date: 2009-02-18 19:18:12 +0000 (Wed, 18 Feb 2009) Log Message: ----------- adding functionality to view the loaded model Modified Paths: -------------- branches/ogEditor/data/modules/texturizer/scripts/main/functions.py branches/ogEditor/data/modules/texturizer/scripts/main/variables.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/new/index.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/view_model/index.py Modified: branches/ogEditor/data/modules/texturizer/scripts/main/functions.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/main/functions.py 2009-02-17 21:49:15 UTC (rev 1047) +++ branches/ogEditor/data/modules/texturizer/scripts/main/functions.py 2009-02-18 19:18:12 UTC (rev 1048) @@ -12,28 +12,22 @@ class background_processes: def __init__(self): # create an array for the background processes - self.processes = {} + self.processes = [] - # create arrays for the processes of low priority and one for the processes of low priority - self.processes['low'] = [] - self.processes['high'] = [] - # store none run id self.run_id = none - def add(self, caption, function, priority): + def add(self, caption, function, function_parameter = none): # add process to the queue - self.processes[priority].append({'caption' : caption, 'function' : function}) + self.processes.append({'caption' : caption, 'function' : function, 'function_parameter' : function_parameter}) if self.run_id==none: # add the run function to the idle functions self.run_id = gobject.idle_add(self.run) def run(self): - if len(self.processes['high'])>0: - process = self.processes['high'].pop(0) - elif len(self.processes['low'])>0: - process = self.processes['low'].pop(0) + if len(self.processes)>0: + process = self.processes.pop(0) else: self.run_id = none @@ -42,8 +36,12 @@ # set caption window.status_bar.caption.set_text(process['caption'] + ' ...') - # run the function - process['function']() + if process['function_parameter']==none: + # run the function + process['function']() + else: + # run the function + process['function'](process['function_parameter']) # reset the status bar window.status_bar.reset() @@ -52,7 +50,7 @@ background_processes = background_processes() -class config_file: +'''class config_file: def __init__(self): # define user array global user @@ -116,7 +114,7 @@ # close the config file file.close() -#config_file = config_file() +config_file = config_file()''' def isfloat(number): legal = ['-', '.', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'] Modified: branches/ogEditor/data/modules/texturizer/scripts/main/variables.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/main/variables.py 2009-02-17 21:49:15 UTC (rev 1047) +++ branches/ogEditor/data/modules/texturizer/scripts/main/variables.py 2009-02-18 19:18:12 UTC (rev 1048) @@ -8,4 +8,5 @@ # define different colors colors = {} colors['black'] = gtk.gdk.color_parse('#000000') +colors['red'] = gtk.gdk.color_parse('#FF0000') colors['white'] = gtk.gdk.color_parse('#FFFFFF') \ No newline at end of file Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/new/index.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/new/index.py 2009-02-17 21:49:15 UTC (rev 1047) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/new/index.py 2009-02-18 19:18:12 UTC (rev 1048) @@ -45,7 +45,7 @@ self.name = self.file_selection_window.get_filename() # add the loading process to the background processes - background_processes.add('loading raw faces file', self.load, 'high') + background_processes.add('loading raw faces file', self.load) # destroy the window self.destroy_file_selection_window() @@ -79,22 +79,25 @@ # create new arrays for the dimensions model['dimensions'] = {} - model['dimensions']['x'] = {} - model['dimensions']['y'] = {} - model['dimensions']['z'] = {} + model['dimensions'][0] = {} # x + model['dimensions'][1] = {} # x + model['dimensions'][2] = {} # z # define min and max coordinates for the x-axis - model['dimensions']['x']['min'] = 999999 - model['dimensions']['x']['max'] = -999999 + model['dimensions'][0]['min'] = 999999 + model['dimensions'][0]['max'] = -999999 # define min and max coordinates for the y-axis - model['dimensions']['y']['min'] = 999999 - model['dimensions']['y']['max'] = -999999 + model['dimensions'][1]['min'] = 999999 + model['dimensions'][1]['max'] = -999999 # define min and max coordinates for the z-axis - model['dimensions']['z']['min'] = 999999 - model['dimensions']['z']['max'] = -999999 + model['dimensions'][2]['min'] = 999999 + model['dimensions'][2]['max'] = -999999 + # create a new array for the edges + model['edges'] = [] + for line_number, line_content in enumerate(lines): # trim whitespaces line_content = line_content.strip() @@ -114,30 +117,9 @@ y = float(face.pop(0)) z = float(face.pop(0)) - # update min coorinate for the x-axis - if x<model['dimensions']['x']['min']: - model['dimensions']['x']['min'] = x + # save the new min and max values + self.save_min_and_max(x, y, z) - # update max coorinate for the x-axis - if x>model['dimensions']['x']['max']: - model['dimensions']['x']['max'] = x - - # update min coorinate for the y-axis - if y<model['dimensions']['y']['min']: - model['dimensions']['y']['min'] = y - - # update max coorinate for the y-axis - if y>model['dimensions']['y']['max']: - model['dimensions']['y']['max'] = y - - # update min coorinate for the z-axis - if z<model['dimensions']['z']['min']: - model['dimensions']['z']['min'] = z - - # update max coorinate for the z-axis - if z>model['dimensions']['z']['max']: - model['dimensions']['z']['max'] = z - # save the coordinates as a vertice vertice.append(x) vertice.append(y) @@ -149,12 +131,59 @@ # save the new face in the model['faces'] array model['faces'].append(face_new) + # save the edges of the face + self.save_edges(face_new) + # update the progress bar on the status bar window.status_bar.update((line_number + 1)/number_of_faces) # update length values - model['dimensions']['x']['length'] = model['dimensions']['x']['max'] - model['dimensions']['x']['min'] - model['dimensions']['y']['length'] = model['dimensions']['y']['max'] - model['dimensions']['y']['min'] - model['dimensions']['z']['length'] = model['dimensions']['z']['max'] - model['dimensions']['z']['min'] + model['dimensions'][0]['length'] = model['dimensions'][0]['max'] - model['dimensions'][0]['min'] + model['dimensions'][1]['length'] = model['dimensions'][1]['max'] - model['dimensions'][1]['min'] + model['dimensions'][2]['length'] = model['dimensions'][2]['max'] - model['dimensions'][2]['min'] + model['dimensions']['maximum_length'] = max(model['dimensions'][0]['length'], model['dimensions'][1]['length'], model['dimensions'][2]['length']) + def save_min_and_max(self, x, y, z): + # update min coorinate for the x-axis + if x<model['dimensions'][0]['min']: + model['dimensions'][0]['min'] = x + + # update max coorinate for the x-axis + if x>model['dimensions'][0]['max']: + model['dimensions'][0]['max'] = x + + # update min coorinate for the y-axis + if y<model['dimensions'][1]['min']: + model['dimensions'][1]['min'] = y + + # update max coorinate for the y-axis + if y>model['dimensions'][1]['max']: + model['dimensions'][1]['max'] = y + + # update min coorinate for the z-axis + if z<model['dimensions'][2]['min']: + model['dimensions'][2]['min'] = z + + # update max coorinate for the z-axis + if z>model['dimensions'][2]['max']: + model['dimensions'][2]['max'] = z + + def save_edges(self, face): + for vertice_number, vertice_content in enumerate(face): + first_vertice = vertice_content + + try: + second_vertice = face[vertice_number + 1] + except: + second_vertice = face[0] + + self.save_edge(first_vertice, second_vertice) + + def save_edge(self, first_vertice, second_vertice): + for edge in model['edges']: + if edge==[first_vertice, second_vertice] or edge==[second_vertice, first_vertice]: + return false + + model['edges'].append([first_vertice, second_vertice]) + screen.raw_file = raw_file(table) \ No newline at end of file Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/view_model/index.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/view_model/index.py 2009-02-17 21:49:15 UTC (rev 1047) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/view_model/index.py 2009-02-18 19:18:12 UTC (rev 1048) @@ -1,6 +1,108 @@ # -*- coding: cp1252 -*- # show frame -screen.frame = gtk.Frame('the model:') +screen.frame = gtk.Frame('view the model:') screen.put(screen.frame, 0, 2) screen.frame.show() + +# show a table +table = gtk.Table() +table.set_col_spacings(3) +table.set_row_spacings(3) +screen.frame.add(table) +table.show() + +# show top view +screen.top_view = gtk.DrawingArea() +screen.top_view.set_size_request(200, 200) +table.attach(screen.top_view, 0, 1, 0, 1) +screen.top_view.show() + +# show front view +screen.front_view = gtk.DrawingArea() +screen.front_view.set_size_request(200, 200) +table.attach(screen.front_view, 0, 1, 1, 2) +screen.front_view.show() + +# show side view +screen.side_view = gtk.DrawingArea() +screen.side_view.set_size_request(200, 200) +table.attach(screen.side_view, 1, 2, 1, 2) +screen.side_view.show() + +class views: + def __init__(self): + # define the colors for the top view + screen.top_view.window.colors = {} + + for color_name, color_content in colors.items(): + screen.top_view.window.colors[color_name] = screen.top_view.window.new_gc(foreground = screen.top_view.window.get_colormap().alloc_color(color_content)) + + # define the colors for the front view + screen.front_view.window.colors = {} + + for color_name, color_content in colors.items(): + screen.front_view.window.colors[color_name] = screen.front_view.window.new_gc(foreground = screen.front_view.window.get_colormap().alloc_color(color_content)) + + # define the colors for the side view + screen.side_view.window.colors = {} + + for color_name, color_content in colors.items(): + screen.side_view.window.colors[color_name] = screen.side_view.window.new_gc(foreground = screen.side_view.window.get_colormap().alloc_color(color_content)) + + # add the drawing of the top view to the background processes + background_processes.add('drawing the top view', self.draw, 'top_view') + + # add the drawing of the front view to the background processes + background_processes.add('drawing the front view', self.draw, 'front_view') + + # add the drawing of the side view to the background processes + background_processes.add('drawing the side view', self.draw, 'side_view') + + def draw(self, drawing_area): + # choose the right drawing area and axes + if drawing_area=='top_view': + drawing_area = screen.top_view.window + + axis_0 = 0 # x + axis_1 = 1 # y + elif drawing_area=='front_view': + drawing_area = screen.front_view.window + + axis_0 = 0 # x + axis_1 = 2 # z + elif drawing_area=='side_view': + drawing_area = screen.side_view.window + + axis_0 = 1 # y + axis_1 = 2 # z + + # calculate the center for the first axis + axis_0_center = 200 + axis_0_center -= (model['dimensions'][axis_0]['length']/model['dimensions']['maximum_length']) * 190 + axis_0_center /= 2 + axis_0_center -= (model['dimensions'][axis_0]['min']/model['dimensions']['maximum_length']) * 190 + + # calculate the center for the second axis + axis_1_center = 200 + axis_1_center -= (model['dimensions'][axis_1]['length']/model['dimensions']['maximum_length']) * 190 + axis_1_center /= 2 + axis_1_center += (model['dimensions'][axis_1]['max']/model['dimensions']['maximum_length']) * 190 + + # fill the background of the drawing area with white color + drawing_area.draw_polygon(drawing_area.colors['white'], true, [(0, 0), (200, 0), (200, 200), (0, 200)]) + + # draw the edges + for edge in model['edges']: + # calculate the x position + position_x_start = int(round((edge[0][axis_0]/model['dimensions']['maximum_length']) * 190 + axis_0_center)) + position_x_end = int(round((edge[1][axis_0]/model['dimensions']['maximum_length']) * 190 + axis_0_center)) + + # calculate the y position + position_y_start = int(round((((edge[0][axis_1] * (-1))/model['dimensions']['maximum_length']) * 190) + axis_1_center)) + position_y_end = int(round((((edge[1][axis_1] * (-1))/model['dimensions']['maximum_length']) * 190) + axis_1_center)) + + # draw the edge + drawing_area.draw_line(drawing_area.colors['black'], position_x_start, position_y_start, position_x_end, position_y_end) + +screen.views = views() \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <spo...@us...> - 2009-02-17 23:22:22
|
Revision: 1047 http://opengate.svn.sourceforge.net/opengate/?rev=1047&view=rev Author: spom_spom Date: 2009-02-17 21:49:15 +0000 (Tue, 17 Feb 2009) Log Message: ----------- first steps of network recovery Modified Paths: -------------- trunk/src/Console.cpp trunk/src/Entity.h trunk/src/GameStateManager.cpp trunk/src/KeyMap.cpp trunk/src/Makefile.am trunk/src/Moveable.h trunk/src/Opengate.h trunk/src/ResourceManager.h trunk/src/Sector.cpp trunk/src/Sector.h trunk/src/SectorMovableObject.cpp trunk/src/SectorMovableObject.h trunk/src/Vessel.h trunk/src/common.cpp trunk/src/common.h trunk/src/networkClient.cpp trunk/src/networkClient.h trunk/src/networkProtocol.cpp trunk/src/networkProtocol.h trunk/src/networkServer.cpp trunk/src/networkServer.h trunk/src/networkServerUser.cpp trunk/src/networkServerUser.h trunk/src/opengateclient.cpp trunk/src/opengateserver.cpp Modified: trunk/src/Console.cpp =================================================================== --- trunk/src/Console.cpp 2009-02-17 17:39:53 UTC (rev 1046) +++ trunk/src/Console.cpp 2009-02-17 21:49:15 UTC (rev 1047) @@ -155,8 +155,8 @@ if ( e.key == OIS::KC_LCONTROL ) resources_->keymap()->setGlobalKeyModifier( KEY_NONE ); if ( e.key == OIS::KC_RCONTROL ) resources_->keymap()->setGlobalKeyModifier( KEY_NONE ); if ( e.key == OIS::KC_LSHIFT ) resources_->keymap()->setGlobalKeyModifier( KEY_NONE ); - if ( e.key == OIS::KC_RSHIFT ) resources_->keymap()->setGlobalKeyModifier( KEY_NONE ); - + if ( e.key == OIS::KC_RSHIFT ) resources_->keymap()->setGlobalKeyModifier( KEY_NONE ); + return true; } Modified: trunk/src/Entity.h =================================================================== --- trunk/src/Entity.h 2009-02-17 17:39:53 UTC (rev 1046) +++ trunk/src/Entity.h 2009-02-17 21:49:15 UTC (rev 1047) @@ -95,7 +95,8 @@ inline int techLevel( ) const { return techLevel_; } inline void setMass( long mass ){ mass_ = mass; } - inline Uint32 mass( ) const { return mass_; } + virtual inline Uint32 mass( ) const { return mass_; } + virtual inline Uint32 totalMass() const { return mass_; } inline void setSize( int size ){ size_ = size; } inline int size( ) const { return size_; } Modified: trunk/src/GameStateManager.cpp =================================================================== --- trunk/src/GameStateManager.cpp 2009-02-17 17:39:53 UTC (rev 1046) +++ trunk/src/GameStateManager.cpp 2009-02-17 21:49:15 UTC (rev 1047) @@ -311,7 +311,7 @@ } bool GameStateManager::createAvatar(){ - resources_.avatar = new Avatar( resources_.network->userName(), resources_.network->userID() ); + resources_.avatar = new Avatar( resources_.network->userName(), resources_.network->localUserID() ); resources_.avatar->setVessel( *resources_.entityManager->vessel( "apteryx" ) ); resources_.avatar->vessel( )->setPowerPlant( resources_.entityManager->powerPlant( "Spud" ) ); resources_.avatar->vessel( )->setEngine( resources_.entityManager->engine( "T-E-15" ) ); @@ -448,12 +448,12 @@ bool GameStateManager::captureNetwork(){ //** start capture network; std::vector < std::vector < char > > msgs; - std::vector < MessageBodyShipMovement * > movements; + std::vector < MessageBodyShipMovement > movements; resources_.network->pull( msgs ); Sector * sector = NULL; if ( stateStack_.back()->name() == "UnDockedState" ){ - sector = dynamic_cast < UnDockedState * >(stateStack_.back())->sector(); + sector = dynamic_cast < UnDockedState * >( stateStack_.back() )->sector(); } if ( msgs.size() > 0 ) { @@ -472,6 +472,17 @@ MessageBodyChat msg( &msgs[ i ][ 0 ] ); log_->chat( resources_.network->userName( msg.senderID() ), msg.message() ); } break; + case PROTO_SHIP_REGISTER: if ( sector ) sector->receiveVesselRegister( &msgs[ i ][ 0 ] ); break; + case PROTO_SHIP_DEREGISTER: if ( sector ) sector->receiveVesselDeRegister( &msgs[ i ][ 0 ] ); break; +// case PROTO_SHIP_DIED: if ( sector ) sector->receiveVesselDied( &msgs[ i ][ 0 ] ); break; +// case PROTO_SHIP_STATUS: if ( sector ) sector->receiveVesselStatus( &msgs[ i ][ 0 ] ); break; +// case PROTO_SHIP_MOVEMENT:{ +// //** we handle that in sum, so we can ignore dups because of packet loss +// MessageBodyShipMovement *msg = new MessageBodyShipMovement( &msgs[ i ][ 0 ] ); +// movements.push_back( MessageBodyShipMovement( &msgs[ i ][ 0 ] ) ); +// } break; +// case PROTO_SHIP_PROJECTILEFIRED: if ( sector ) sector->receiveProjectile( &msgs[ i ][ 0 ] ); break; +// case PROTO_SHIP_AMMOHIT: if ( sector ) sector->receiveVesselAmmoHit( &msgs[ i ][ 0 ] ); break; default: std::cerr << "PROTO type unknown: " << msgs[ i ][ 0 ] << " " << msgs[ i ].size() << std::endl; @@ -515,40 +526,6 @@ init_( state ); } -// bool GameStateManager::pushGameState( GameState * state ){ -// // pause current game state -// if ( !stateStack_.empty() ) { -// if ( !stateStack_.back()->pause() ){ -// return false; -// } -// cleanup_( stateStack_.back() ); -// } -// -// // store and init the new state -// stateStack_.push_back( state ); -// init_( state ); -// stateStack_.back()->enter(); -// -// return true; -// } -// -// void GameStateManager::popGameState( ) { -// // cleanup the current game state -// if ( !stateStack_.empty() ) { -// cleanup_( stateStack_.back() ); -// stateStack_.back()->exit(); -// stateStack_.pop_back(); -// } -// -// // resume previous game state or quit if there isn't one -// if ( !stateStack_.empty() ) { -// init_( stateStack_.back() ); -// stateStack_.back()->resume(); -// } else { -// shutdown(); -// } -// } - void GameStateManager::shutdown( ){ shutdownRequest_ = true; } Modified: trunk/src/KeyMap.cpp =================================================================== --- trunk/src/KeyMap.cpp 2009-02-17 17:39:53 UTC (rev 1046) +++ trunk/src/KeyMap.cpp 2009-02-17 21:49:15 UTC (rev 1047) @@ -72,6 +72,7 @@ /*! Actions for console. */ consoleActionMap_[ keycode( OIS::KC_SYSRQ ) ] = &Console::keyActionScreenshot; consoleActionMap_[ keycode( OIS::KC_Q, KEY_CONTROL ) ]= &Console::keyActionShutdown_DEV; + // consoleActionMap_[ keycode( OIS::KC_F4, KEY_ALT ) ] = &Console::keyActionShutdown_DEV; /*! Actions for development, will removed later. */ unDockedActionMap_[ keycode( OIS::KC_F ) ] = &UnDockedState::keyActionToggleFiltering_DEV; Modified: trunk/src/Makefile.am =================================================================== --- trunk/src/Makefile.am 2009-02-17 17:39:53 UTC (rev 1046) +++ trunk/src/Makefile.am 2009-02-17 21:49:15 UTC (rev 1047) @@ -1,8 +1,7 @@ bin_PROGRAMS = \ opengateclient \ opengateserver -# testaimanager - + opengateclient_SOURCES = \ opengateclient.cpp \ common.h \ @@ -108,16 +107,6 @@ SectorStationPadObject.cpp \ SectorVesselObject.h \ SectorVesselObject.cpp \ - SectorObject.h \ - SectorObject.cpp \ - SectorObjectAvatar.h \ - SectorObjectAvatar.cpp \ - SectorObjectMoveable.h \ - SectorObjectMoveable.cpp \ - SectorObjectMissile.h \ - SectorObjectMissile.cpp \ - SectorObjectVessel.h \ - SectorObjectVessel.cpp \ SectorProjectileObject.h \ SectorProjectileObject.cpp \ ShipConfigDialog.h \ Modified: trunk/src/Moveable.h =================================================================== --- trunk/src/Moveable.h 2009-02-17 17:39:53 UTC (rev 1046) +++ trunk/src/Moveable.h 2009-02-17 21:49:15 UTC (rev 1047) @@ -18,8 +18,8 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#ifndef _OPENGATE_MOVEABLE__H -#define _OPENGATE_MOVEABLE__H +#ifndef _OPENGATE_MOVABLE__H +#define _OPENGATE_MOVABLE__H #include "Entity.h" @@ -69,4 +69,4 @@ } // namespace OpenGate -#endif //_OPENGATE_MOVEABLE__H +#endif //_OPENGATE_MOVABLE__H Modified: trunk/src/Opengate.h =================================================================== --- trunk/src/Opengate.h 2009-02-17 17:39:53 UTC (rev 1046) +++ trunk/src/Opengate.h 2009-02-17 21:49:15 UTC (rev 1047) @@ -34,6 +34,8 @@ class String; class EventArgs; class Listbox; + class OgreCEGUIRenderer; + class System; } namespace OpenGate{ @@ -77,22 +79,32 @@ class DockedState; class UnDockedState; +class GameState; +class GameStateManager; + class Gun; class Engine; class Hud; class LogManager; +class OpenALSoundManager; class OpenALSoundSource; class OpcodeCollisionDetection; class Planet; class Projectile; + class RadarObject; class GunObject; class EngineObject; +class KeyMap; +class EntityManager; +class InputManager; + class ResourceManager; + class Sector; class SectorAvatarObject; class SectorBaseObject; @@ -113,12 +125,6 @@ class SectorStationPadObject; class SectorVesselObject; -class SectorObject; -class SectorObjectAvatar; -class SectorObjectMissile; -class SectorObjectMovable; -class SectorObjectVessel; - class Station; class StationObject; Modified: trunk/src/ResourceManager.h =================================================================== --- trunk/src/ResourceManager.h 2009-02-17 17:39:53 UTC (rev 1046) +++ trunk/src/ResourceManager.h 2009-02-17 21:49:15 UTC (rev 1047) @@ -23,10 +23,7 @@ #include <OgreSingleton.h> -namespace CEGUI { - class OgreCEGUIRenderer; - class System; -} +#include "Opengate.h" namespace OpenGate{ @@ -35,21 +32,6 @@ * */ -class NetworkClient; -class InputManager; -class LogManager; -class AiManager; -class OpenALSoundManager; -class GameState; -class GameStateManager; -class Avatar; -class Console; -class Entity; -class Station; -class KeyMap; -class OpcodeCollisionDetection; -class EntityManager; - class ResourceManager : public Ogre::Singleton< ResourceManager > { public: Ogre::RenderWindow * renderWindow; Modified: trunk/src/Sector.cpp =================================================================== --- trunk/src/Sector.cpp 2009-02-17 17:39:53 UTC (rev 1046) +++ trunk/src/Sector.cpp 2009-02-17 21:49:15 UTC (rev 1047) @@ -29,6 +29,7 @@ #include "GunObject.h" #include "LogManager.h" #include "Missile.h" +#include "networkClient.h" #include "OpcodeWrapper.h" #include "RadarObject.h" #include "ResourceManager.h" @@ -135,6 +136,10 @@ case SECTOR_MISSILE_OBJECT_RTTI: objectHeap_[ dynamic_cast< SectorMissileObject * >( obj )->missile()->name() ].push_back( obj ); break; + case SECTOR_AVATAR_OBJECT_RTTI: + objectHeap_[ dynamic_cast< SectorMissileObject * >( obj )->missile()->name() ].push_back( obj ); + sendVesselDeRegister( dynamic_cast< SectorAvatarObject * >( obj ) ); + break; default: delete( obj ); obj = NULL; @@ -223,9 +228,12 @@ avatar_->setVelocity( Ogre::Vector3( 0.0, 0.0, 0.0 ) ); } insertMeshObject_( avatar_ ); + + sendVesselRegister( avatar_ ); + return avatar_; } - + SectorVesselObject * Sector::createVesselObject( Vessel * vessel ){ SectorVesselObject * obj; if ( objectHeap_[ vessel->name() ].empty() ){ @@ -432,10 +440,89 @@ koordAxisNode_->scale( length, length, length ); } +void Sector::sendVesselRegister( SectorVesselObject * obj ){ + if ( obj ) { + log_->info( std::string( "Send register " ) + obj->name() + " id:" + toStr( obj->vessel()->id() ) ); + MessageBodyShipRegister msg( 0, 0, obj->name(), obj->mainNode()->getPosition().ptr(), + obj->vessel()->id(), obj->vessel()->totalMass(), obj->maxShield(), obj->maxThrust() ); + network_->send( msg ); + } +} +void Sector::receiveVesselRegister( const MessageBodyShipRegister & msg ){ + log_->info( std::string( "Receive vessel register: " ) + toStr( msg.senderID() ) + " id:" + toStr( msg.vesselID() ) ) ; + + ClientUserObject * user( network_->user( msg.senderID() ) ); + if ( user ){ + SectorMovableObject * obj; + obj = new SectorMovableObject( user->name(), this, ResourceManager::getSingleton().entityManager->vessel( msg.vesselID() ) ); + log_->debug( "Sector::createMovableObject new " + obj->name() ); + insertMeshObject_( obj ); + user->setSectorObject( obj ); + + obj->mainNode()->setPosition( toOgreVec( msg.position() ) ); + +// obj->setMass( msg.mass() ); +// obj->setMaxShield( msg.maxShield() ); +// obj->setMaxThrust( msg.maxThrust() ); +// obj->setMaxSpeed( std::sqrt( msg.maxThrust() / obj->movable()->dragFactor() ) ); + } +// if ( !movableObjects_.count( createGlobalID( msg.senderID(), msg.childID() ) ) ){ +// if ( msg.childID() == 0 ){ +// log_->info( "Create player object " + msg.name()+ " " + toStr( msg.senderID() ) + " VesselID: " + toStr( msg.vesselID() ) ); +// SectorObjectMovable * obj = createMovable( msg.name(), msg.senderID(), msg.childID(), +// *ResourceManager::getSingleton().entityManager->vessel( msg.vesselID() ) ); +// obj->mainNode()->setPosition( toOgreVec( msg.position() ) ); +// obj->setMass( msg.mass() ); +// obj->setMaxShield( msg.maxShield() ); +// obj->setMaxThrust( msg.maxThrust() ); +// obj->setMaxSpeed( std::sqrt( msg.maxThrust() / obj->movable()->dragFactor() ) ); +// std::cout << msg << std::endl; +// +// } else { +// log_->info( "Create ai object " + msg.name()+ " " + toStr( msg.senderID() ) + " " + +// toStr( (int)msg.childID() ) + " " + toStr( msg.vesselID() ) ); +// +// // SectorObjectMoveableAi * obj = createAiMoveableObject( msg.name(), msg.senderID(), msg.childID(), +// // *VesselManager::getSingleton().vessel( msg.vesselID() ) ); +// // obj->mainNode()->setPosition( toOgreVec( msg.position() ) ); +// // +// // if ( movableObjects_.count( createGlobalID( msg.senderID(), 0 ) ) ){ +// // log_->info( "ai object target: " + movableObjects_[ createGlobalID( msg.senderID(), 0 ) ]->name() ); +// // obj->setTarget( movableObjects_[ createGlobalID( msg.senderID(), 0 ) ] ); +// // } +// } +// +// sendAllVesselInfos( ); +// +// } else { +// log_->warn( std::string( "Registering: object allready exist: " ) + +// movableObjects_[ createGlobalID( msg.senderID(), msg.childID() ) ]->name() ); +// } +} +void Sector::sendVesselDeRegister( SectorVesselObject * obj ){ + if ( obj ) { + log_->info( std::string( "Send deregister " ) + obj->name() ); + MessageBodyShipDeRegister msg( 0, 0 ); + network_->send( msg ); + } +} +void Sector::receiveVesselDeRegister( const MessageBodyShipDeRegister & msg ){ +// if ( movableObjects_.count( createGlobalID( msg.senderID(), msg.childID() ) ) ){ +// log_->info( std::string( "Receive deregister " ) +// + movableObjects_[ createGlobalID( msg.senderID(), msg.childID() ) ]->name() ); +// +// SectorObjectMovable *obj = movableObjects_[ createGlobalID( msg.senderID(), msg.childID() ) ]; +// obj->destroy(); +// +// } else { +// log_->warn( std::string( "Deregistering request for unknown object: " ) + +// toStr( msg.senderID() ) + ": " + toStr( (int)msg.childID() ) ); +// } +} @@ -464,6 +551,8 @@ + + #else #include "Sector.h" Modified: trunk/src/Sector.h =================================================================== --- trunk/src/Sector.h 2009-02-17 17:39:53 UTC (rev 1046) +++ trunk/src/Sector.h 2009-02-17 21:49:15 UTC (rev 1047) @@ -101,7 +101,12 @@ void showEcliptic( bool show ); void flipShowEcliptic( ); - + + void sendVesselRegister( SectorVesselObject * obj ); + void receiveVesselRegister( const MessageBodyShipRegister & msg ); + + void sendVesselDeRegister( SectorVesselObject * obj ); + void receiveVesselDeRegister( const MessageBodyShipDeRegister & msg ); protected: /*! do not destruct objects manualy, let them send false during update loop */ void destructCollObject_( SectorCollisionObject * obj ); Modified: trunk/src/SectorMovableObject.cpp =================================================================== --- trunk/src/SectorMovableObject.cpp 2009-02-17 17:39:53 UTC (rev 1046) +++ trunk/src/SectorMovableObject.cpp 2009-02-17 21:49:15 UTC (rev 1047) @@ -71,7 +71,7 @@ setThrustRate( 0.0 ); thrust_ = 0; - mass_ = movable_->mass(); + mass_ = movable_->totalMass(); armor_ = movable_->armor(); maxArmor_ = movable_->armor(); maxShield_ = 1; Modified: trunk/src/SectorMovableObject.h =================================================================== --- trunk/src/SectorMovableObject.h 2009-02-17 17:39:53 UTC (rev 1046) +++ trunk/src/SectorMovableObject.h 2009-02-17 21:49:15 UTC (rev 1047) @@ -57,6 +57,9 @@ /*! Return the relative thrust values from 0 to 1*/ inline Ogre::Real thrustRate() const { return thrustRate_; } + + /*! Return the maximum thrust*/ + inline Uint32 maxThrust() const { return maxThrust_; } /*! Returns the speed of the object, will be recalculated in every update loop */ inline double speed() const { return speed_; } Modified: trunk/src/Vessel.h =================================================================== --- trunk/src/Vessel.h 2009-02-17 17:39:53 UTC (rev 1046) +++ trunk/src/Vessel.h 2009-02-17 21:49:15 UTC (rev 1047) @@ -121,7 +121,7 @@ int allEquipmentMaximumSize( ) const; /*! Return the total mass based on the mounted equipment */ - Uint32 totalMass() const; + virtual Uint32 totalMass() const; /*! Return the maximum thrust based on the mounted engines. */ Uint32 maxThrust() const; Modified: trunk/src/common.cpp =================================================================== --- trunk/src/common.cpp 2009-02-17 17:39:53 UTC (rev 1046) +++ trunk/src/common.cpp 2009-02-17 21:49:15 UTC (rev 1047) @@ -20,6 +20,8 @@ #include "common.h" +namespace OpenGate{ + void myMSleep( int ms ) { #ifdef WIN32 Sleep( ms ); @@ -64,3 +66,5 @@ if ( str.size() > 0 ) vect[ count ] = toDouble( str ); return vect; } + +} // namespace OpenGate Modified: trunk/src/common.h =================================================================== --- trunk/src/common.h 2009-02-17 17:39:53 UTC (rev 1046) +++ trunk/src/common.h 2009-02-17 21:49:15 UTC (rev 1047) @@ -48,7 +48,7 @@ #include <algorithm> #include <sys/timeb.h> #include <stdexcept> - + typedef uint8_t Uint8; typedef uint16_t Uint16; typedef uint32_t Uint32; @@ -57,8 +57,8 @@ #define PATHSEPARATOR "\\" typedef size_t uint; -#include <windows.h> -#undef near +#include <windows.h> +#undef near #undef far #else #define PATHSEPARATOR "/" @@ -70,7 +70,8 @@ // template< typename T > struct CMD_Ptr { // typedef void (T::*Type)( const std::vector< std::string > &); // }; - +namespace OpenGate{ + struct Triangle { int a, b, c; }; @@ -363,4 +364,6 @@ return true; } +} //namespace OpenGate{ + #endif // _OPENGATE_COMMON__H Modified: trunk/src/networkClient.cpp =================================================================== --- trunk/src/networkClient.cpp 2009-02-17 17:39:53 UTC (rev 1046) +++ trunk/src/networkClient.cpp 2009-02-17 21:49:15 UTC (rev 1047) @@ -28,8 +28,7 @@ namespace OpenGate{ NetworkClient::NetworkClient( boost::asio::io_service & io_service, const std::string & hostName, bool enable ) - : io_service_( io_service ), socket_( io_service ), resolver_( io_service ), - hostname_( hostName ), online_( false ){ + : io_service_( io_service ), socket_( io_service ), hostname_( hostName ), online_( false ){ log_ = LogManager::getSingletonPtr(); pingTime_ = 0; @@ -37,50 +36,40 @@ if ( enable ){ log_->info( std::string( "Connecting to " ) + hostname_ + ":" + toStr( (int)OG_PORT ) ); - boost::system::error_code error = boost::asio::error::host_not_found; - try { - tcp::resolver::query query( hostname_, toStr( (int)OG_PORT) ); - tcp::resolver::iterator endpoint_iterator = resolver_.resolve( query ); - tcp::resolver::iterator end; - - while ( error && endpoint_iterator != end ) { - socket_.close(); - socket_.connect( *endpoint_iterator++, error ); - } + try{ + // Resolve the host name into an IP address. + boost::asio::ip::tcp::resolver resolver( io_service ); + boost::asio::ip::tcp::resolver::query query( hostname_, toStr( (int)OG_PORT) ) ; - if ( error ) { - std::cout << "networkClient:53 throw boost::system_error( error );" << std::endl; - } + boost::asio::ip::tcp::resolver::iterator endpoint_iterator = resolver.resolve( query ); + boost::asio::ip::tcp::endpoint endpoint = *endpoint_iterator; + online_ = true; + socket_.async_connect( endpoint, boost::bind( &NetworkClient::handleConnect_, this, boost::asio::placeholders::error, ++endpoint_iterator ) ); } catch ( std::exception & e) { log_->fatal( std::string( "std::exception: " ) + e.what() ); - } catch (...) { - log_->fatal( "Unkown exception occured while resolving the server" ); } - - if ( !error ){ - log_->info( "Connected: waiting for userID. " ); - online_ = true; - boost::asio::async_read( socket_, - boost::asio::buffer( readMsg_.data(), Message::HeaderLength + MessageBodyUserID( Uint32(0) ).dataSize() ), - boost::bind( & NetworkClient::handleReceiveUserID, this, boost::asio::placeholders::error ) ); - } else { - log_->fatal( "NetworkClient: asio error" + toStr( error ) ); - } } else { - log_->fatal( "Offline-mode forced by selection." ); + log_->info( "Offline-mode forced by selection." ); } } NetworkClient::~NetworkClient(){ - close(); + close(); } +void NetworkClient::pull( std::vector< std::vector< char > > & msg ){ + while ( !msgsToPull_.empty() ) { + msg.push_back( msgsToPull_.front() ); + msgsToPull_.pop_front(); + } +} + void NetworkClient::login( const std::string & userName, const std::string & passwd ) { - userName_ = userName; - if ( online_ ){ - MessageBodyUserName msg( userName ); - send( msg ); - } + userName_ = userName; + if ( online_ ){ + MessageBodyUserName msg( userName ); + send( msg ); + } } void NetworkClient::send( MessageBodyBase & msg ) { @@ -88,92 +77,118 @@ msg.setSenderID( userID_ ); // log_->debug( std::string( "MESSAGE_PROTO " ) + toStr( (int)msg.type() ) ); - handleSendMsg( msg ); + handleSendMsg_( msg ); // io_service_.post( boost::bind( & Client::handleSendMsg, this, msg ) ); } } void NetworkClient::close() { - if ( online_ ){ - io_service_.post( boost::bind( & NetworkClient::doClose, this ) ); - } + if ( online_ ){ + io_service_.post( boost::bind( & NetworkClient::closeConnection_, this ) ); + } } -std::string NetworkClient::userName( Uint32 userID ) { +ClientUserObject * NetworkClient::user( Uint32 userID ){ + itFind_ = users_.find( userID ); + if ( itFind_ != users_.end() ) { + return itFind_->second; + } + log_->fatal( std::string( "Requested user = " ) + toStr( userID ) + " does not exist" ); + return NULL; +} + +const std::string & NetworkClient::userName( Uint32 userID ) { if ( userID == 0 ) return userName_; if ( users_.count( userID ) ){ - std::string str( users_[ userID ] ); - return str; + return users_[ userID ]->name(); } else { - return "unknown user: " + toStr( userID ) ; + std::cerr << "***************************************************************" << std::endl; + std::cerr << " unknown user: " << toStr( userID ) << std::endl; + std::cerr << "***************************************************************" << std::endl; } + return userName_; } -void NetworkClient::handleReceiveUserID( const boost::system::error_code & error ) { +void NetworkClient::handleConnect_( const boost::system::error_code & e, boost::asio::ip::tcp::resolver::iterator endpoint_iterator) { + if ( !e ) { + log_->info( "Connected: waiting for userID. " ); + //! first wait for userID + boost::asio::async_read( socket_, + boost::asio::buffer( incomingMsg_.data(), Message::HeaderLength + MessageBodyUserID( Uint32(0) ).dataSize() ), + boost::bind( & NetworkClient::handleReceiveUserID_, this, boost::asio::placeholders::error ) ); + //connection_.async_read( stocks_, boost::bind(&client::handle_read, this, boost::asio::placeholders::error)); + } + else if ( endpoint_iterator != boost::asio::ip::tcp::resolver::iterator() ) { + // Try the next endpoint. + socket_.close(); + boost::asio::ip::tcp::endpoint endpoint = *endpoint_iterator; + socket_.async_connect( endpoint, boost::bind( &NetworkClient::handleConnect_, this, boost::asio::placeholders::error, ++endpoint_iterator ) ); + } else { + log_->fatal( "NetworkClient::handleConnect: " + e.message() ); + } +} + +void NetworkClient::handleReceiveUserID_( const boost::system::error_code & e ) { if ( online_ ){ - std::cout << "handleReceiveUserID " << std::endl; - - if ( !error && readMsg_.decodeHeader() ) { - MessageBodyBase base( readMsg_.body() ); - - switch( base.type() ){ - case PROTO_USERID: { - MessageBodyUserID msg( readMsg_.body() ); - userID_ = (int)msg.userID(); - } break; + if ( !e && incomingMsg_.decodeHeader() ) { + + switch( incomingMsg_.bodyType() ){ + case PROTO_USERID: { + MessageBodyUserID msg( incomingMsg_.body() ); + userID_ = (int)msg.userID(); + log_->info( std::string( "received userID " ) + toStr( userID_ ) ); + } break; default: - log_->fatal( std::string( "unknown MESSAGE_PROTO " ) + toStr( base.type() ) ); - log_->fatal( "wait for userid " ); - boost::asio::async_read( socket_, - boost::asio::buffer( readMsg_.data(), Message::HeaderLength+MessageBodyUserID( Uint32(0) ).dataSize() ), - boost::bind( & NetworkClient::handleReceiveUserID, this, boost::asio::placeholders::error ) ); + log_->fatal( std::string( "unknown MESSAGE_PROTO " ) + toStr( incomingMsg_.bodyType() ) ); + log_->fatal( "NetworkClient::handleReceiveUserID_ wait for userid." ); + //! without valid userID no advanced network interpretation + boost::asio::async_read( socket_, + boost::asio::buffer( incomingMsg_.data(), Message::HeaderLength + MessageBodyUserID( Uint32(0) ).dataSize() ), + boost::bind( & NetworkClient::handleReceiveUserID_, this, boost::asio::placeholders::error ) ); } + //! we got a userID so we start main networking boost::asio::async_read( socket_, - boost::asio::buffer( readMsg_.data(), Message::HeaderLength ), - boost::bind( & NetworkClient::handleReadMessageHeader, this, boost::asio::placeholders::error ) ); + boost::asio::buffer( incomingMsg_.data(), Message::HeaderLength ), + boost::bind( & NetworkClient::handleReadMessageHeader_, this, boost::asio::placeholders::error ) ); } else { - // log_->fatal( std::string( "handleReceiveUserID: " ) + error.what() ); - log_->fatal( std::string( "handleReceiveUserID: " ) + toStr( error ) ); + log_->fatal( "NetworkClient::handleReceiveUserID: " + e.message() ); + closeConnection_(); } } // if online } -void NetworkClient::handleReadMessageHeader( const boost::system::error_code & error ) { +void NetworkClient::handleReadMessageHeader_( const boost::system::error_code & e ) { if ( online_ ){ - if ( !error && readMsg_.decodeHeader() ) { + if ( !e && incomingMsg_.decodeHeader() ) { // std::cout << "handle_read_header " << (int)readMsg_.bodyLength() << std::endl; - boost::asio::async_read( socket_, - boost::asio::buffer( readMsg_.body(), readMsg_.bodyLength() ), - boost::bind( &NetworkClient::handleReadMessageBody, this, boost::asio::placeholders::error ) ); + boost::asio::async_read( socket_, + boost::asio::buffer( incomingMsg_.body(), incomingMsg_.bodyLength() ), + boost::bind( &NetworkClient::handleReadMessageBody_, this, boost::asio::placeholders::error ) ); } else { - log_->fatal( std::string( "handleReadMessageHeader: " ) + toStr( error ) ); - // log_->fatal( std::string( "handleReadMessageHeader: " ) + error.what() ); - doClose(); + log_->fatal( "NetworkClient::handleReadMessageHeader: " + e.message() ); + closeConnection_(); } } // if online } -void NetworkClient::handleReadMessageBody( const boost::system::error_code & error ) { +void NetworkClient::handleReadMessageBody_( const boost::system::error_code & e ) { if ( online_ ){ - if ( !error ) { - MessageBodyBase base( readMsg_.body() ); - // std::cout << "Type: = " << (int)base.type() << std::endl; - - switch( base.type() ){ + if ( !e ) { + switch( incomingMsg_.bodyType() ){ case PROTO_USERNAME: { - MessageBodyUserName msg( readMsg_.body() ); + MessageBodyUserName msg( incomingMsg_.body() ); log_->info( std::string( "New user = " ) + toStr((int)msg.senderID()) + " " + msg.userName() ); - users_[ (int)msg.senderID() ] = msg.userName(); + users_[ (int)msg.senderID() ] = new ClientUserObject( msg.senderID(), msg.userName() ); } break; case PROTO_CONNECTION_REFUSED: { - MessageBodyConnectionRefused msg( readMsg_.body() ); + MessageBodyConnectionRefused msg( incomingMsg_.body() ); switch ( msg.reason() ){ case CONNECTION_REFUSED_USER_ALREADY_EXIST: log_->fatal( std::string( "Connection refused: " ) + userName_ + " already conneced to the server" ); - doClose(); + closeConnection_(); online_ = false; break; default: @@ -181,67 +196,68 @@ } } break; case PROTO_DISCONNECT: { - MessageBodyDisconnect msg( readMsg_.body() ); - log_->info( std::string( "Disconnect user = " ) + toStr( (int)msg.userID() ) + - " " + userName( (int)msg.userID() ) ); - users_.erase( users_.find( (int)msg.userID() ) ) ; + MessageBodyDisconnect msg( incomingMsg_.body() ); + log_->info( std::string( "Disconnect user = " ) + toStr( (int)msg.userID() ) + " " + userName( (int)msg.userID() ) ); + + ClientUserObject * obj = this->user( msg.userID() ); + if ( obj ){ + users_.erase( users_.find( (int)msg.userID() ) ) ; + delete obj; + } + } break; default: -// if ( base.type() == PROTO_SHIPMOVEMENT ) { -// MessageBodyShipMovement m( readMsg_.body() ); -// std::cout << m << std::endl; -// } - std::vector < char > vec( readMsg_.bodyLength() ); - vec.resize( readMsg_.bodyLength() ); - memcpy( &vec[ 0 ], (char*)readMsg_.body(), readMsg_.bodyLength() ); + std::vector < char > vec( incomingMsg_.bodyLength() ); + vec.resize( incomingMsg_.bodyLength() ); + memcpy( &vec[ 0 ], (char*)incomingMsg_.body(), incomingMsg_.bodyLength() ); msgsToPull_.push_back( vec ); } boost::asio::async_read( socket_, - boost::asio::buffer( readMsg_.data(), Message::HeaderLength ), - boost::bind( & NetworkClient::handleReadMessageHeader, this, boost::asio::placeholders::error ) ); + boost::asio::buffer( incomingMsg_.data(), Message::HeaderLength ), + boost::bind( & NetworkClient::handleReadMessageHeader_, this, boost::asio::placeholders::error ) ); } else { - log_->fatal( std::string( "handleReadMessageBody error: " ) + toStr( error ) ); - // log_->fatal( std::string( "handleReadMessageBody error: " ) + error.what() ); - doClose(); + log_->fatal( "NetworkClient::handleReadMessageBody: " + e.message() ); + closeConnection_(); } } // if online } -void NetworkClient::handleSendMsg( MessageBodyBase & body ) { +void NetworkClient::handleSendMsg_( MessageBodyBase & body ) { if ( online_ ){ // std::cout << "Send to server, type: " << (int)body.type() << std::endl; - bool write_in_progress = !msgsToWrite_.empty(); - msgsToWrite_.push_back( Message( body ) ); - // std::cout << "send.length() = " << msgsToWrite_.front().length() << std::endl; + bool write_in_progress = !outMessageQueue_.empty(); + outMessageQueue_.push_back( Message( body ) ); + + //! initial write call if ( !write_in_progress ) { boost::asio::async_write( socket_, - boost::asio::buffer( msgsToWrite_.front().data(), msgsToWrite_.front().length() ), - boost::bind( & NetworkClient::handleWrite, this, boost::asio::placeholders::error ) ); + boost::asio::buffer( outMessageQueue_.front().data(), outMessageQueue_.front().length() ), + boost::bind( & NetworkClient::handleWrite_, this, boost::asio::placeholders::error ) ); } } } -void NetworkClient::handleWrite( const boost::system::error_code & error ) { +void NetworkClient::handleWrite_( const boost::system::error_code & e ) { if ( online_ ){ - if ( !error ){ - msgsToWrite_.pop_front(); - if ( !msgsToWrite_.empty() ) { + if ( !e ){ + outMessageQueue_.pop_front(); + //! write untile queue is empty + if ( !outMessageQueue_.empty() ) { boost::asio::async_write( socket_, - boost::asio::buffer( msgsToWrite_.front().data(), msgsToWrite_.front().length() ), - boost::bind( &NetworkClient::handleWrite, this, boost::asio::placeholders::error ) ); + boost::asio::buffer( outMessageQueue_.front().data(), outMessageQueue_.front().length() ), + boost::bind( &NetworkClient::handleWrite_, this, boost::asio::placeholders::error ) ); } } else { - // log_->fatal( std::string( "handleWrite: " ) + error.what() ); - log_->fatal( std::string( "handleWrite: " ) + toStr( error ) ); - doClose(); + log_->fatal( "NetworkClient::handleWrite: " + e.message() ); + closeConnection_(); } - }// if online + } } -void NetworkClient::doClose() { +void NetworkClient::closeConnection_() { if ( online_ ){ //myMSleep( 1000 ); // log_->info( std::string( "Network closed, user disconnected." ) ); Modified: trunk/src/networkClient.h =================================================================== --- trunk/src/networkClient.h 2009-02-17 17:39:53 UTC (rev 1046) +++ trunk/src/networkClient.h 2009-02-17 21:49:15 UTC (rev 1047) @@ -24,6 +24,8 @@ #include <boost/asio.hpp> #include <boost/bind.hpp> +#include "Opengate.h" + #include "LogManager.h" #include "networkProtocol.h" @@ -33,28 +35,58 @@ typedef std::deque< Message > MessageQueue; +class ClientUserObject { +public: + ClientUserObject( Uint32 userID, const std::string & name ): userID_( userID ), name_( name ) { + sectorObject_ = NULL; + } + ~ClientUserObject( ){} + + inline Uint32 userID() const { return userID_; } + + inline const std::string & name() const { return name_; } + + inline void setSectorObject( SectorMovableObject * sectorObject ) { sectorObject_ = sectorObject; } + + inline SectorMovableObject * sectorObject() { return sectorObject_; } + +protected: + Uint32 userID_; + std::string name_; + SectorMovableObject * sectorObject_; +}; + class NetworkClient { public: - NetworkClient( boost::asio::io_service & io_service, const std::string & hostName, bool enable = true ); + NetworkClient( boost::asio::io_service & io_service, const std::string & hostName, bool enable = true ); - ~NetworkClient(); + ~NetworkClient(); + + /*! Return online status */ + bool online() const { return online_; } - void login( const std::string & userName, const std::string & passwd = "" ); + /*! Return the hostname */ + const std::string & hostname() const { return hostname_; } + + /*! Login to the connected server with username an passwd */ + void login( const std::string & userName, const std::string & passwd = "" ); - void send( MessageBodyBase & msg ); - - void close(); + /*! Close connection. */ + void close(); - Uint32 userID() const { return userID_; } + /*! Return userID for the local user. */ + Uint32 localUserID() const { return userID_; } - void setUserName( const std::string & name ){ userName_ = name; } + /*! Set a default username for offline mode (userID==0)*/ + void setDefaultUserName( const std::string & username ){ userName_ = username; } - std::string userName( Uint32 userID = 0 ); + /*! Return the username for a registered userID */ + const std::string & userName( Uint32 userID = 0 ); - bool online() const { return online_; } - - std::string hostname() const { return hostname_; } - + void send( MessageBodyBase & msg ); + + ClientUserObject * user( Uint32 userID ); + void ping(){ if ( online_ ) { } else { @@ -64,40 +96,39 @@ float pingTime(){ return pingTime_; } - void pull( std::vector< std::vector< char > > & msg ){ - while ( !msgsToPull_.empty() ) { - msg.push_back( msgsToPull_.front() ); - msgsToPull_.pop_front(); - } - } + void pull( std::vector< std::vector< char > > & msg ); private: - - void handleReceiveUserID( const boost::system::error_code & error ); + void handleConnect_( const boost::system::error_code & e, boost::asio::ip::tcp::resolver::iterator endpoint_iterator ); + + void handleReceiveUserID_( const boost::system::error_code & error ); - void handleReadMessageHeader( const boost::system::error_code & error ); + void handleReadMessageHeader_( const boost::system::error_code & error ); - void handleReadMessageBody( const boost::system::error_code & error ); + void handleReadMessageBody_( const boost::system::error_code & error ); - void handleSendMsg( MessageBodyBase & body ); + void handleSendMsg_( MessageBodyBase & body ); - void handleWrite( const boost::system::error_code & error ); + void handleWrite_( const boost::system::error_code & error ); - void doClose(); - + void closeConnection_(); + + // connection connection_; + boost::asio::io_service & io_service_; tcp::socket socket_; - tcp::resolver resolver_; std::string hostname_; bool online_; - Message readMsg_; - MessageQueue msgsToWrite_; + Message incomingMsg_; + MessageQueue outMessageQueue_; + MessageQueue inMessageQueue_; std::deque< std::vector< char > > msgsToPull_; std::string userName_; - std::map < Uint32, std::string > users_; + std::map < Uint32, ClientUserObject * > users_; + std::map < Uint32, ClientUserObject * >::iterator itFind_; Uint32 userID_; float pingTime_; Modified: trunk/src/networkProtocol.cpp =================================================================== --- trunk/src/networkProtocol.cpp 2009-02-17 17:39:53 UTC (rev 1046) +++ trunk/src/networkProtocol.cpp 2009-02-17 21:49:15 UTC (rev 1047) @@ -52,9 +52,9 @@ Uint32 mass, Uint32 maxShield, Uint32 maxThrust ) : MessageBodyShipBase( childID ), name_( name ), vesselID_( vesselID ), mass_( mass ), maxShield_( maxShield ), maxThrust_( maxThrust ){ - senderID_ = senderID; - type_ = (Uint8)PROTO_SHIP_REGISTER; - pos_.v[ 0 ] = pos[ 0 ]; pos_.v[ 1 ] = pos[ 1 ]; pos_.v[ 2 ] = pos[ 2 ]; + senderID_ = senderID; + type_ = (Uint8)PROTO_SHIP_REGISTER; + pos_.v[ 0 ] = pos[ 0 ]; pos_.v[ 1 ] = pos[ 1 ]; pos_.v[ 2 ] = pos[ 2 ]; } MessageBodyShipRegister::MessageBodyShipRegister( const char * data ) Modified: trunk/src/networkProtocol.h =================================================================== --- trunk/src/networkProtocol.h 2009-02-17 17:39:53 UTC (rev 1046) +++ trunk/src/networkProtocol.h 2009-02-17 21:49:15 UTC (rev 1047) @@ -28,6 +28,7 @@ #include <iostream> #include <sstream> #include <string> +#include <limits> namespace OpenGate{ @@ -58,6 +59,7 @@ #define OG_PORT 1234 +#define PROTO_NONE 0 #define PROTO_BASE 1 #define PROTO_USERID 2 #define PROTO_USERNAME 3 @@ -77,8 +79,12 @@ #define CONNECTION_REFUSED_USER_ALREADY_EXIST 1 +inline void writeToOut( std::stringstream & out, std::string & str ){ + out.write( ( char * )( str.c_str() ), sizeof( char ) * str.length() ); +} + template < class T > void writeToOut( std::stringstream & out, T & val ){ - out.write( ( char * )( T * ) & val, sizeof( T ) ); + out.write( ( char * )( T * ) & val, sizeof( T ) ); } template < class T > void writeToData( char * data, const T & val, int & count ){ @@ -97,86 +103,85 @@ */ class MessageBodyBase{ public: + /*! Constructor */ + MessageBodyBase( ) : type_( 0 ), senderID_( 0 ) { + type_ = (Uint8)PROTO_BASE; + } - /*! Constructor */ - MessageBodyBase( ) : type_( 0 ), senderID_( 0 ) { - type_ = (Uint8)PROTO_BASE; - } + /*! Constructor with data */ + MessageBodyBase( const char * data ) : type_( 0 ), senderID_( 0 ) { + type_ = (Uint8)PROTO_BASE; + int count = 0; + readFromData( type_, data, count ); + readFromData( senderID_, data, count ); + } - /*! Constructor with data */ - MessageBodyBase( const char * data ) : type_( 0 ), senderID_( 0 ) { - type_ = (Uint8)PROTO_BASE; - int count = 0; - readFromData( type_, data, count ); - readFromData( senderID_, data, count ); - } + /*! Destructor */ + virtual ~MessageBodyBase(){ } - /*! Destructor */ - virtual ~MessageBodyBase(){ } + inline virtual char * data() { + out_.str( "" ); + createOutStream(); + outData_ = out_.str(); + return (char*)&outData_[ 0 ]; + } - inline virtual char * data() { - out_.str( "" ); - createOutStream(); - outData_ = out_.str(); - return (char*)&outData_[ 0 ]; - } + inline virtual void createOutStream() { + writeToOut( out_, type_ ); + writeToOut( out_, senderID_ ); + } - inline virtual void createOutStream() { - writeToOut( out_, type_ ); - writeToOut( out_, senderID_ ); - } + inline int length() const { return outData_.length(); } - inline int length() const { return outData_.length(); } + inline Uint8 type() const { return type_; } - inline Uint8 type() const { return type_; } + inline Uint32 senderID( ) const { return senderID_; } - inline Uint32 senderID( ) const { return senderID_; } + inline void setSenderID( Uint32 senderID ) { senderID_ = senderID; } - inline void setSenderID( Uint32 senderID ) { senderID_ = senderID; } + inline virtual int dataSize() const { return sizeof( Uint8 ) + sizeof( Uint32 ); } - inline virtual int dataSize() const { return sizeof( Uint8 ) + sizeof( Uint32 ); } + friend std::ostream & operator << ( std::ostream & str, const MessageBodyBase & msg ){ + str << "Type: " << (int)( msg.type() ) << " senderID: " << msg.senderID(); + return str; + } - friend std::ostream & operator << ( std::ostream & str, const MessageBodyBase & msg ){ - str << "Type: " << (int)( msg.type() ) << " senderID: " << msg.senderID() ; - return str; - } - protected: - Uint8 type_; - Uint32 senderID_; - std::stringstream out_; - std::string outData_; + Uint8 type_; + Uint32 senderID_; + + std::stringstream out_; + std::string outData_; }; - /*! * \brief This class encapsulates the User ID to send it over the network * \author Carsten <spo...@us...> */ class MessageBodyUserID : public MessageBodyBase{ public: - MessageBodyUserID( Uint32 userID ) : MessageBodyBase(), userID_( userID ){ - type_ = (Uint8)PROTO_USERID; - } + MessageBodyUserID( Uint32 userID ) : MessageBodyBase(), userID_( userID ){ + type_ = (Uint8)PROTO_USERID; + } - MessageBodyUserID( const char * data ) : MessageBodyBase( data ) { - int count = MessageBodyBase::dataSize(); - readFromData( userID_, data, count ); - } + MessageBodyUserID( const char * data ) : MessageBodyBase( data ) { + int count = MessageBodyBase::dataSize(); + readFromData( userID_, data, count ); + } - ~MessageBodyUserID( ){ } + virtual ~MessageBodyUserID( ){ } - virtual void createOutStream() { - MessageBodyBase::createOutStream(); - writeToOut( out_, userID_ ); - } + virtual void createOutStream() { + MessageBodyBase::createOutStream(); + writeToOut( out_, userID_ ); + } - inline virtual int dataSize() const { return MessageBodyBase::dataSize() + sizeof( Uint32 ); } + inline virtual int dataSize() const { return MessageBodyBase::dataSize() + sizeof( Uint32 ); } - inline Uint32 userID( ) const { return userID_; } + inline Uint32 userID( ) const { return userID_; } protected: - Uint32 userID_; + Uint32 userID_; }; /*! @@ -185,13 +190,13 @@ */ class MessageBodyDisconnect : public MessageBodyUserID{ public: - MessageBodyDisconnect( Uint32 userID ) : MessageBodyUserID( userID ){ - type_ = (Uint8)PROTO_DISCONNECT; - } + MessageBodyDisconnect( Uint32 userID ) : MessageBodyUserID( userID ){ + type_ = (Uint8)PROTO_DISCONNECT; + } - MessageBodyDisconnect( const char * data ) : MessageBodyUserID( data ) { } + MessageBodyDisconnect( const char * data ) : MessageBodyUserID( data ) { } - ~MessageBodyDisconnect( ){ } + virtual ~MessageBodyDisconnect( ){ } protected: }; @@ -201,33 +206,32 @@ */ class MessageBodyUserName : public MessageBodyBase{ public: - MessageBodyUserName( const std::string & username, Uint32 senderID = 0 ) : MessageBodyBase(), username_( username ){ - type_ = (Uint8)PROTO_USERNAME; - senderID_ = senderID; - nameLength_ = username.length(); - } + MessageBodyUserName( const std::string & username, Uint32 senderID = 0 ) : MessageBodyBase(), username_( username ){ + type_ = (Uint8)PROTO_USERNAME; + senderID_ = senderID; + nameLength_ = min( (size_t)std::numeric_limits< Uint8 >::max(), username.length() ); + } - MessageBodyUserName( const char * data ) : MessageBodyBase( data ) { - int count = MessageBodyBase::dataSize(); - readFromData( nameLength_, data, count ); - - std::string msg( (char*) &data[ count ], nameLength_ ); count += nameLength_; - username_ = msg; - } + MessageBodyUserName( const char * data ) : MessageBodyBase( data ) { + int count = MessageBodyBase::dataSize(); + readFromData( nameLength_, data, count ); + std::string msg( (char*) &data[ count ], nameLength_ ); count += nameLength_; + username_ = msg; + } - ~MessageBodyUserName(){} + virtual ~MessageBodyUserName(){} - virtual void createOutStream() { - MessageBodyBase::createOutStream(); - writeToOut( out_, nameLength_ ); - out_.write( ( char* )( username_.c_str() ), sizeof( char ) * nameLength_ ); - } + virtual void createOutStream() { + MessageBodyBase::createOutStream(); + writeToOut( out_, nameLength_ ); + writeToOut( out_, username_ ); + } - inline std::string userName( ) const { return username_; } + inline const std::string & userName( ) const { return username_; } protected: - Uint8 nameLength_; - std::string username_; + Uint8 nameLength_; + std::string username_; }; /*! @@ -236,26 +240,26 @@ */ class MessageBodyConnectionRefused : public MessageBodyBase{ public: - MessageBodyConnectionRefused( Uint8 reason ) : MessageBodyBase(), reason_( reason ){ - type_ = (Uint8)PROTO_CONNECTION_REFUSED; - } + MessageBodyConnectionRefused( Uint8 reason ) : MessageBodyBase(), reason_( reason ){ + type_ = (Uint8)PROTO_CONNECTION_REFUSED; + } - MessageBodyConnectionRefused( const char * data ) : MessageBodyBase( data ) { - int count = MessageBodyBase::dataSize(); - readFromData( reason_, data, count ); - } + MessageBodyConnectionRefused( const char * data ) : MessageBodyBase( data ) { + int count = MessageBodyBase::dataSize(); + readFromData( reason_, data, count ); + } - ~MessageBodyConnectionRefused(){} + virtual ~MessageBodyConnectionRefused(){} - virtual void createOutStream() { - MessageBodyBase::createOutStream(); - writeToOut( out_, reason_ ); - } + virtual void createOutStream() { + MessageBodyBase::createOutStream(); + writeToOut( out_, reason_ ); + } - inline Uint8 reason( ) const { return reason_; } + inline Uint8 reason( ) const { return reason_; } protected: - Uint8 reason_; + Uint8 reason_; }; /*! @@ -264,36 +268,35 @@ */ class MessageBodyChat : public MessageBodyBase { public: - MessageBodyChat( const std::string & message ) : MessageBodyBase(), message_( message ) { - type_ = (Uint8)PROTO_CHAT; - } + MessageBodyChat( const std::string & message ) : MessageBodyBase(), message_( message ) { + type_ = (Uint8)PROTO_CHAT; + } - MessageBodyChat( const char * data ) : MessageBodyBase( data ) { - int count = MessageBodyBase::dataSize(); - readFromData( messageLength_, data, count ); + MessageBodyChat( const char * data ) : MessageBodyBase( data ) { + int count = MessageBodyBase::dataSize(); + readFromData( messageLength_, data, count ); - std::string msg( (char*) &data[ count ], messageLength_ ); count += messageLength_; - message_ = msg; - } + std::string msg( (char*) &data[ count ], messageLength_ ); count += messageLength_; + message_ = msg; + } - virtual ~MessageBodyChat(){ - } + virtual ~MessageBodyChat(){ + } - void createOutStream() { - MessageBodyBase::createOutStream(); - messageLength_ = message_.length(); - writeToOut( out_, messageLength_ ); + void createOutStream() { + MessageBodyBase::createOutStream(); + messageLength_ = message_.length(); + writeToOut( out_, messageLength_ ); + writeToOut( out_, message_ ); + } - out_.write( ( char* )( message_.c_str() ), sizeof( char ) * messageLength_ ); - } + inline void setMessage( const std::string & message ){ message_ = message; } - inline void setMessage( const std::string & message ){ message_ = message; } + inline const std::string & message( ) const { return message_; } - inline std::string message( ) const { return message_; } - protected: - mutable Uint16 messageLength_; - std::string message_; + Uint16 messageLength_; + std::string message_; }; /*! @@ -302,29 +305,28 @@ */ class MessageBodyShipBase : public MessageBodyBase { public: - MessageBodyShipBase( Uint8 childID ) - : MessageBodyBase(), childID_( childID ){ - type_ = (Uint8)PROTO_SHIP_BASE; - } + MessageBodyShipBase( const Uint8 childID = 0 ) : MessageBodyBase(), childID_( childID ){ + type_ = (Uint8)PROTO_SHIP_BASE; + } - MessageBodyShipBase( const char * data ) : MessageBodyBase( data ){ - int count = MessageBodyBase::dataSize(); - readFromData( childID_, data, count ); - } + MessageBodyShipBase( const char * data ) : MessageBodyBase( data ){ + int count = MessageBodyBase::dataSize(); + readFromData( childID_, data, count ); + } - virtual ~MessageBodyShipBase( ){ } + virtual ~MessageBodyShipBase( ){ } - inline void createOutStream() { - MessageBodyBase::createOutStream(); - writeToOut( out_, childID_ ); - } + inline void createOutStream() { + MessageBodyBase::createOutStream(); + writeToOut( out_, childID_ ); + } - inline Uint8 childID( ) const { return childID_; } + inline Uint8 childID( ) const { return childID_; } - inline virtual int dataSize() const { return MessageBodyBase::dataSize() + sizeof( Uint8 ); } + inline virtual int dataSize() const { return MessageBodyBase::dataSize() + sizeof( Uint8 ); } protected: - Uint8 childID_; + Uint8 childID_; }; class MessageBodyShipRegister : public MessageBodyShipBase { @@ -339,7 +341,10 @@ void createOutStream(); - inline std::string name() const { return name_; } + inline const std::string & name() const { + std::cerr << "this should not be used" << std::endl; + return name_; + } FVector3 position() const; inline Uint16 vesselID() const { return vesselID_; } @@ -364,44 +369,44 @@ class MessageBodyShipDeRegister : public MessageBodyShipBase { public: - MessageBodyShipDeRegister( const Uint32 senderID, const Uint8 childID ): MessageBodyShipBase( childID ){ - senderID_ = senderID; - type_ = (Uint8)PROTO_SHIP_DEREGISTER; - } + MessageBodyShipDeRegister( const Uint32 senderID, const Uint8 childID = 0 ): MessageBodyShipBase( childID ){ + senderID_ = senderID; + type_ = (Uint8)PROTO_SHIP_DEREGISTER; + } - MessageBodyShipDeRegister( const char * data ) : MessageBodyShipBase( data ){ } + MessageBodyShipDeRegister( const char * data ) : MessageBodyShipBase( data ){ } - virtual ~MessageBodyShipDeRegister( ){ } + virtual ~MessageBodyShipDeRegister( ){ } - inline void createOutStream() { MessageBodyShipBase::createOutStream(); } + inline void createOutStream() { MessageBodyShipBase::createOutStream(); } - friend std::ostream & operator << ( std::ostream & str, const MessageBodyShipDeRegister & msg ){ - str << "Type: " << (int)( msg.type() ) << " senderID: " << msg.senderID() << " childID: " << msg.childID(); - return str; - } + friend std::ostream & operator << ( std::ostream & str, const MessageBodyShipDeRegister & msg ){ + str << "ShipDeRegister Type: " << (int)( msg.type() ) << " senderID: " << msg.senderID() << " childID: " << msg.childID(); + return str; + } protected: }; class MessageBodyShipDied : public MessageBodyShipBase { public: - MessageBodyShipDied( const Uint32 senderID, const Uint8 childID ): MessageBodyShipBase( childID ){ - senderID_ = senderID; - type_ = (Uint8)PROTO_SHIP_DIED; - } + MessageBodyShipDied( const Uint32 senderID, const Uint8 childID = 0 ): MessageBodyShipBase( childID ){ + senderID_ = senderID; + type_ = (Uint8)PROTO_SHIP_DIED; + } - MessageBodyShipDied( const char * data ) : MessageBodyShipBase( data ){ } + MessageBodyShipDied( const char * data ) : MessageBodyShipBase( data ){ } - virtual ~MessageBodyShipDied( ){ } + virtual ~MessageBodyShipDied( ){ } - inline void createOutStream() { MessageBodyShipBase::createOutStream(); } + inline void createOutStream() { MessageBodyShipBase::createOutStream(); } - friend std::ostream & operator << ( std::ostream & str, const MessageBodyShipDied & msg ){ - str << "Type: " << (int)( msg.type() ) << " senderID: " << msg.senderID() << " childID: " << msg.childID(); - return str; - } + friend std::ostream & operator << ( std::ostream & str, const MessageBodyShipDied & msg ){ + str << "ShipDied Type: " << (int)( msg.type() ) << " senderID: " << msg.senderID() << " childID: " << msg.childID(); + return str; + } +protected: -protected: }; class MessageBodyShipMovement : public MessageBodyShipBase { @@ -484,7 +489,7 @@ Uint32 shield_; Uint32 armor_; - //** using bitmask is slightly better; + //** using bitmask is slightly better; bool fire_; bool afterburner_; bool break_; @@ -497,7 +502,7 @@ MessageBodyShipProjectileFired( const char * data ); - ~MessageBodyShipProjectileFired( ){} + virtual ~MessageBodyShipProjectileFired( ){} void createOutStream(); @@ -532,7 +537,7 @@ readFromData( damage_, data, count ); } - ~MessageBodyShipAmmoHit( ){ + virtual ~MessageBodyShipAmmoHit( ){ } void createOutStream() { MessageBodyShipBase::createOutStream(); @@ -556,45 +561,47 @@ class Message{ public: - enum { HeaderLength = sizeof( Uint16 ) }; - enum { MaxBodyLength = 1024 }; + enum { HeaderLength = sizeof( Uint16 ) }; + enum { MaxBodyLength = 1024 }; - Message( ) : bodyLength_( 0 ) { } + Message( ) : bodyLength_( 0 ) { } - Message( MessageBodyBase & body ) : bodyLength_( 0 ) { - void * data = body.data(); - bodyLength_ = body.length(); - memcpy( data_, &bodyLength_, sizeof( bodyLength_ ) ); - memcpy( data_ + HeaderLength, data, bodyLength_ ); + Message( MessageBodyBase & body ) : bodyLength_( 0 ) { + void * data = body.data(); + bodyLength_ = body.length(); + memcpy( data_, &bodyLength_, sizeof( bodyLength_ ) ); + memcpy( data_ + HeaderLength, data, bodyLength_ ); + } - int count = 0; - Uint16 tmp = 0; - readFromData( tmp, data_, count ); - } + virtual ~Message() {} + + const char * data() const { return data_; } - const char * data() const { return data_; } + char * data() { return data_; } - char * data() { return data_; } + bool decodeHeader() { + int count = 0; + readFromData( bodyLength_, data_, count ); + if ( bodyLength_ > MaxBodyLength ) { + std::cerr << "Message::decodeHeader fails: " << bodyLength_ << " > " << MaxBodyLength << std::endl; + bodyLength_ = 0; + return false; + } + return true; + } - bool decodeHeader() { - int count = 0; - readFromData( bodyLength_, data_, count ); - if ( bodyLength_ > MaxBodyLength ) { - std::cerr << "Message::decodeHeader fails: " << bodyLength_ << " > " << MaxBodyLength << std::endl; - bodyLength_ = 0; - return false; + inline Uint16 length() const { return HeaderLength + bodyLength_; } + inline const char * body() const { return data_ + HeaderLength; } + inline char * body() { return data_ + HeaderLength; } + inline Uint16 bodyLength() const { return bodyLength_; } + inline Uint8 bodyType() const { + if ( bodyLength_ > sizeof( Uint8 ) ) return (Uint8... [truncated message content] |
From: <Ult...@us...> - 2009-02-17 17:39:59
|
Revision: 1046 http://opengate.svn.sourceforge.net/opengate/?rev=1046&view=rev Author: Ultrasick Date: 2009-02-17 17:39:53 +0000 (Tue, 17 Feb 2009) Log Message: ----------- making economy completly dependent of the ore price Modified Paths: -------------- doc/how_the_economy_works.odt doc/how_the_economy_works.pdf Modified: doc/how_the_economy_works.odt =================================================================== (Binary files differ) Modified: doc/how_the_economy_works.pdf =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-02-17 17:39:17
|
Revision: 1045 http://opengate.svn.sourceforge.net/opengate/?rev=1045&view=rev Author: Ultrasick Date: 2009-02-17 17:39:13 +0000 (Tue, 17 Feb 2009) Log Message: ----------- forgott thouse files Added Paths: ----------- branches/ogEditor/data/modules/texturizer/scripts/screens/project/view_model/ branches/ogEditor/data/modules/texturizer/scripts/screens/project/view_model/index.py Added: branches/ogEditor/data/modules/texturizer/scripts/screens/project/view_model/index.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/view_model/index.py (rev 0) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/view_model/index.py 2009-02-17 17:39:13 UTC (rev 1045) @@ -0,0 +1,6 @@ +# -*- coding: cp1252 -*- + +# show frame +screen.frame = gtk.Frame('the model:') +screen.put(screen.frame, 0, 2) +screen.frame.show() Property changes on: branches/ogEditor/data/modules/texturizer/scripts/screens/project/view_model/index.py ___________________________________________________________________ Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-02-17 17:34:42
|
Revision: 1044 http://opengate.svn.sourceforge.net/opengate/?rev=1044&view=rev Author: Ultrasick Date: 2009-02-17 17:34:38 +0000 (Tue, 17 Feb 2009) Log Message: ----------- adding functionality to load a *.raw file with the raw faces of a model the model can't be displayed jet, nor be texturized - it can only be loaded Modified Paths: -------------- branches/ogEditor/data/modules/texturizer/index.py branches/ogEditor/data/modules/texturizer/scripts/main/functions.py branches/ogEditor/data/modules/texturizer/scripts/screens/global/index.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/new/index.py Modified: branches/ogEditor/data/modules/texturizer/index.py =================================================================== --- branches/ogEditor/data/modules/texturizer/index.py 2009-02-16 19:13:23 UTC (rev 1043) +++ branches/ogEditor/data/modules/texturizer/index.py 2009-02-17 17:34:38 UTC (rev 1044) @@ -12,7 +12,7 @@ # show window window = gtk.Window() -window.set_border_width(2) +window.set_border_width(3) window.set_title('ogEditor - texturizer') window.show() @@ -34,7 +34,7 @@ # show "screen"-container screen = gtk.Fixed() - window.vbox.add(screen) + window.content.add(screen) screen.show() # show screen Modified: branches/ogEditor/data/modules/texturizer/scripts/main/functions.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/main/functions.py 2009-02-16 19:13:23 UTC (rev 1043) +++ branches/ogEditor/data/modules/texturizer/scripts/main/functions.py 2009-02-17 17:34:38 UTC (rev 1044) @@ -9,6 +9,49 @@ #from string import replace #import urllib +class background_processes: + def __init__(self): + # create an array for the background processes + self.processes = {} + + # create arrays for the processes of low priority and one for the processes of low priority + self.processes['low'] = [] + self.processes['high'] = [] + + # store none run id + self.run_id = none + + def add(self, caption, function, priority): + # add process to the queue + self.processes[priority].append({'caption' : caption, 'function' : function}) + + if self.run_id==none: + # add the run function to the idle functions + self.run_id = gobject.idle_add(self.run) + + def run(self): + if len(self.processes['high'])>0: + process = self.processes['high'].pop(0) + elif len(self.processes['low'])>0: + process = self.processes['low'].pop(0) + else: + self.run_id = none + + return false + + # set caption + window.status_bar.caption.set_text(process['caption'] + ' ...') + + # run the function + process['function']() + + # reset the status bar + window.status_bar.reset() + + return true + +background_processes = background_processes() + class config_file: def __init__(self): # define user array Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/global/index.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/global/index.py 2009-02-16 19:13:23 UTC (rev 1043) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/global/index.py 2009-02-17 17:34:38 UTC (rev 1044) @@ -33,4 +33,47 @@ if name=='project/new': show_screen(name) -window.menu = menu() \ No newline at end of file +window.menu = menu() + +# show container for the content +window.content = gtk.Alignment() +window.vbox.pack_start(window.content, false, true) +window.content.show() + +class status_bar: + def __init__(self): + # show a table + self.table = gtk.Table() + window.vbox.add(self.table) + self.table.show() + + # show horizontal line + self.separator = gtk.HSeparator() + self.table.attach(self.separator, 0, 2, 0, 1, ypadding = 3) + self.separator.show() + + # show caption + self.caption = gtk.Label('(there is no background process running)') + self.table.attach(self.caption, 0, 1, 1, 2) + self.caption.show() + + # show progress bar + self.progress_bar = gtk.ProgressBar() + self.table.attach(self.progress_bar, 1, 2, 1, 2, xpadding = 3) + self.progress_bar.show() + + def update(self, fraction): + # update the progress bar + self.progress_bar.set_fraction(fraction) + + # update the GUI + update_ui() + + def reset(self): + # reset the caption + self.caption.set_text('(there is no background process running)') + + # reset the progress bar + self.progress_bar.set_fraction(0) + +window.status_bar = status_bar() \ No newline at end of file Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/new/index.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/new/index.py 2009-02-16 19:13:23 UTC (rev 1043) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/new/index.py 2009-02-17 17:34:38 UTC (rev 1044) @@ -44,7 +44,117 @@ # save the file name self.name = self.file_selection_window.get_filename() + # add the loading process to the background processes + background_processes.add('loading raw faces file', self.load, 'high') + # destroy the window self.destroy_file_selection_window() + # show next screen + show_screen('project/view_model') + + def load(self): + # open the file + file = open(self.name, 'r') + + # read the lines + lines = file.readlines() + + # close the file + file.close() + + # count the number of faces + number_of_faces = len(lines) + + try: + global model + except: + pass + + # create a new array for the model + model = {} + + # create a new array for the faces + model['faces'] = [] + + # create new arrays for the dimensions + model['dimensions'] = {} + model['dimensions']['x'] = {} + model['dimensions']['y'] = {} + model['dimensions']['z'] = {} + + # define min and max coordinates for the x-axis + model['dimensions']['x']['min'] = 999999 + model['dimensions']['x']['max'] = -999999 + + # define min and max coordinates for the y-axis + model['dimensions']['y']['min'] = 999999 + model['dimensions']['y']['max'] = -999999 + + # define min and max coordinates for the z-axis + model['dimensions']['z']['min'] = 999999 + model['dimensions']['z']['max'] = -999999 + + for line_number, line_content in enumerate(lines): + # trim whitespaces + line_content = line_content.strip() + + # split at the " " + face = line_content.split(' ') + + # reset/create an array for the new face + face_new = [] + + while face: + # reset/create an array for a vertice + vertice = [] + + # grab x, y and z coordinate + x = float(face.pop(0)) + y = float(face.pop(0)) + z = float(face.pop(0)) + + # update min coorinate for the x-axis + if x<model['dimensions']['x']['min']: + model['dimensions']['x']['min'] = x + + # update max coorinate for the x-axis + if x>model['dimensions']['x']['max']: + model['dimensions']['x']['max'] = x + + # update min coorinate for the y-axis + if y<model['dimensions']['y']['min']: + model['dimensions']['y']['min'] = y + + # update max coorinate for the y-axis + if y>model['dimensions']['y']['max']: + model['dimensions']['y']['max'] = y + + # update min coorinate for the z-axis + if z<model['dimensions']['z']['min']: + model['dimensions']['z']['min'] = z + + # update max coorinate for the z-axis + if z>model['dimensions']['z']['max']: + model['dimensions']['z']['max'] = z + + # save the coordinates as a vertice + vertice.append(x) + vertice.append(y) + vertice.append(z) + + # add the vertice to the new face array + face_new.append(vertice) + + # save the new face in the model['faces'] array + model['faces'].append(face_new) + + # update the progress bar on the status bar + window.status_bar.update((line_number + 1)/number_of_faces) + + # update length values + model['dimensions']['x']['length'] = model['dimensions']['x']['max'] - model['dimensions']['x']['min'] + model['dimensions']['y']['length'] = model['dimensions']['y']['max'] - model['dimensions']['y']['min'] + model['dimensions']['z']['length'] = model['dimensions']['z']['max'] - model['dimensions']['z']['min'] + screen.raw_file = raw_file(table) \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-02-16 19:13:46
|
Revision: 1043 http://opengate.svn.sourceforge.net/opengate/?rev=1043&view=rev Author: Ultrasick Date: 2009-02-16 19:13:23 +0000 (Mon, 16 Feb 2009) Log Message: ----------- adding modul "texturizer" to the ogEditor. The module doesn't work jet. It's just an nearly empty window. Added Paths: ----------- branches/ogEditor/data/ branches/ogEditor/data/modules/ branches/ogEditor/data/modules/texturizer/ branches/ogEditor/data/modules/texturizer/index.py branches/ogEditor/data/modules/texturizer/scripts/ branches/ogEditor/data/modules/texturizer/scripts/main/ branches/ogEditor/data/modules/texturizer/scripts/main/functions.py branches/ogEditor/data/modules/texturizer/scripts/main/variables.py branches/ogEditor/data/modules/texturizer/scripts/screens/ branches/ogEditor/data/modules/texturizer/scripts/screens/global/ branches/ogEditor/data/modules/texturizer/scripts/screens/global/index.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/ branches/ogEditor/data/modules/texturizer/scripts/screens/project/new/ branches/ogEditor/data/modules/texturizer/scripts/screens/project/new/index.py Added: branches/ogEditor/data/modules/texturizer/index.py =================================================================== --- branches/ogEditor/data/modules/texturizer/index.py (rev 0) +++ branches/ogEditor/data/modules/texturizer/index.py 2009-02-16 19:13:23 UTC (rev 1043) @@ -0,0 +1,44 @@ +# -*- coding: cp1252 -*- + +from __future__ import division +import gtk +from sys import path + +# load different variables +execfile(path[0] + '/scripts/main/variables.py') + +# load different functions +execfile(path[0] + '/scripts/main/functions.py') + +# show window +window = gtk.Window() +window.set_border_width(2) +window.set_title('ogEditor - texturizer') +window.show() + +# exit program, if window is closed +window.connect('delete_event', gtk.main_quit) + +# show global widgets +execfile(path[0] + '/scripts/screens/global/index.py') + +def show_screen(screen_name, show_loading_screen = false): + # set screen container global + global screen + + # try to destroy the previous screen + try: + screen.destroy() + except: + pass + + # show "screen"-container + screen = gtk.Fixed() + window.vbox.add(screen) + screen.show() + + # show screen + execfile(path[0] + '/scripts/screens/' + screen_name + '/index.py') + +# enter main loop +gtk.main() \ No newline at end of file Property changes on: branches/ogEditor/data/modules/texturizer/index.py ___________________________________________________________________ Added: svn:eol-style + native Added: branches/ogEditor/data/modules/texturizer/scripts/main/functions.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/main/functions.py (rev 0) +++ branches/ogEditor/data/modules/texturizer/scripts/main/functions.py 2009-02-16 19:13:23 UTC (rev 1043) @@ -0,0 +1,122 @@ +# -*- coding: cp1252 -*- + +import gobject +#from os import listdir +#from os import path as check +#from os import system +#from os import urandom +#from string import join +#from string import replace +#import urllib + +class config_file: + def __init__(self): + # define user array + global user + user = {} + + # define the display array + global display + display = {} + + # open the config file + file = open(path[0] + '/config.ini', 'r') + + for line in file.readlines(): + # trim whitespaces + line = line.strip() + + # split at the ":" + data = line.split(':') + + try: + # trim whitespaces + data[0] = data[0].strip() + data[1] = data[1].strip() + except: + # failed because there was a line like "username:" in the config file, define data[1] + data.append('') + + if data[0]=='[user]': + # select current array + current_array = user + elif data[0]=='[display]': + # select current array + current_array = display + elif data[0]=='': + # it's an empty line, just pass it + continue + else: + # save the read data into the current array + current_array[data[0]] = data[1] + + # close the config file + file.close() + + def write(self, username, password): + # define output array + output = [] + + # define output + output.append('[user]') + output.append('username: ' + username) + output.append('password: ' + password) + output.append('[display]') + output.append('show startup video: false') + + # open the config file + file = open(path[0] + '/config.ini', 'w') + + # write the output to the file + file.write(join(output, '\n')) + + # close the config file + file.close() + +#config_file = config_file() + +def isfloat(number): + legal = ['-', '.', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'] + + for character in str(number): + if character not in legal: + return false + + return true + +def isint(number): + legal = ['-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'] + + for character in str(number): + if character not in legal: + return false + + return true + +def print_array(Array, level = 0): + print 'array(' + + if type(Array)==list: + for Schlussel, Wert in enumerate(Array): + if type(Wert)==list or type(Wert)==dict: + print '\t' * (level + 1) + '[' + str(Schlussel) + '] =' , + print_array(Wert, level + 1) + else: + print '\t' * (level + 1) + '[' + str(Schlussel) + '] =' , str(Wert) + elif type(Array)==dict: + for Schlussel, Wert in Array.items(): + if type(Wert)==list or type(Wert)==dict: + print '\t' * (level + 1) + '[' + str(Schlussel) + '] =' , + print_array(Wert, level + 1) + else: + print '\t' * (level + 1) + '[' + str(Schlussel) + '] =' , str(Wert) + else: + print 'unbekanntes Format' + + print '\t' * level + ')' + + return '' + +def update_ui(): + while gtk.events_pending(): + gtk.main_iteration(false) \ No newline at end of file Property changes on: branches/ogEditor/data/modules/texturizer/scripts/main/functions.py ___________________________________________________________________ Added: svn:eol-style + native Added: branches/ogEditor/data/modules/texturizer/scripts/main/variables.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/main/variables.py (rev 0) +++ branches/ogEditor/data/modules/texturizer/scripts/main/variables.py 2009-02-16 19:13:23 UTC (rev 1043) @@ -0,0 +1,11 @@ +# -*- coding: cp1252 -*- + +# define true, false und none +true = 1 +false = 0 +none = None + +# define different colors +colors = {} +colors['black'] = gtk.gdk.color_parse('#000000') +colors['white'] = gtk.gdk.color_parse('#FFFFFF') \ No newline at end of file Property changes on: branches/ogEditor/data/modules/texturizer/scripts/main/variables.py ___________________________________________________________________ Added: svn:eol-style + native Added: branches/ogEditor/data/modules/texturizer/scripts/screens/global/index.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/global/index.py (rev 0) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/global/index.py 2009-02-16 19:13:23 UTC (rev 1043) @@ -0,0 +1,36 @@ +# -*- coding: cp1252 -*- + +# show vbox for the menu and the content +window.vbox = gtk.VBox() +window.add(window.vbox) +window.vbox.show() + +class menu: + def __init__(self): + # show bar + self.bar = gtk.MenuBar() + window.vbox.pack_start(self.bar, false, true) + self.bar.show() + + # show "project" menu + self.project = gtk.MenuItem('project') + self.bar.append(self.project) + self.project.show() + + # create a menu + menu = gtk.Menu() + self.project.set_submenu(menu) + + # create menu item "new" + self.project.new = gtk.MenuItem('new') + menu.add(self.project.new) + self.project.new.show() + + # connect the function to the menu item + self.project.new.connect('activate', self.clicked, 'project/new') + + def clicked(self, item, name): + if name=='project/new': + show_screen(name) + +window.menu = menu() \ No newline at end of file Property changes on: branches/ogEditor/data/modules/texturizer/scripts/screens/global/index.py ___________________________________________________________________ Added: svn:eol-style + native Added: branches/ogEditor/data/modules/texturizer/scripts/screens/project/new/index.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/new/index.py (rev 0) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/new/index.py 2009-02-16 19:13:23 UTC (rev 1043) @@ -0,0 +1,50 @@ +# -*- coding: cp1252 -*- + +# show frame +screen.frame = gtk.Frame('start a new project:') +screen.put(screen.frame, 0, 2) +screen.frame.show() + +# show a table +table = gtk.Table() +table.set_row_spacings(2) +screen.frame.add(table) +table.show() + +class raw_file: + def __init__(self, parent): + # show "select a *.raw file containing the raw faces of the model (use the export function in blender):" + text = gtk.Label('select a *.raw file containing the raw faces of the model (use the export function in blender):') + parent.attach(text, 0, 1, 0, 1, xpadding = 2) + text.show() + + # show button to open the file selection window + button = gtk.Button('select') + parent.attach(button, 1, 2, 0, 1, xpadding = 2, ypadding = 2) + button.show() + + # add function to show the file selection window + button.connect('clicked', lambda x: self.show_file_selection_window()) + + def show_file_selection_window(self): + # show file selection window + self.file_selection_window = gtk.FileSelection() + self.file_selection_window.set_border_width(2) + self.file_selection_window.show() + + # add functions to the buttons of the file selection window + self.file_selection_window.ok_button.connect('clicked', lambda x: self.save_file_name()) + self.file_selection_window.cancel_button.connect('clicked', lambda x: self.destroy_file_selection_window()) + + def destroy_file_selection_window(self): + # destroy the window + self.file_selection_window.destroy() + + def save_file_name(self): + # save the file name + self.name = self.file_selection_window.get_filename() + + # destroy the window + self.destroy_file_selection_window() + +screen.raw_file = raw_file(table) \ No newline at end of file Property changes on: branches/ogEditor/data/modules/texturizer/scripts/screens/project/new/index.py ___________________________________________________________________ Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <spo...@us...> - 2009-02-15 17:25:30
|
Revision: 1042 http://opengate.svn.sourceforge.net/opengate/?rev=1042&view=rev Author: spom_spom Date: 2009-02-15 17:25:23 +0000 (Sun, 15 Feb 2009) Log Message: ----------- win compatibility commit for the client Modified Paths: -------------- trunk/win32/ogsectorclient/ogsectorclient.cbp trunk/win32/ogsectorclient/ogsectorclient.exe Modified: trunk/win32/ogsectorclient/ogsectorclient.cbp =================================================================== --- trunk/win32/ogsectorclient/ogsectorclient.cbp 2009-02-15 16:14:10 UTC (rev 1041) +++ trunk/win32/ogsectorclient/ogsectorclient.cbp 2009-02-15 17:25:23 UTC (rev 1042) @@ -7,7 +7,7 @@ <Option compiler="gcc" /> <Build> <Target title="Release"> - <Option output="ogsectorclient" prefix_auto="1" extension_auto="1" /> + <Option output="ogsectorclient.exe" prefix_auto="1" extension_auto="1" /> <Option working_dir="..\ogsectorclient" /> <Option object_output="obj\Release\" /> <Option type="0" /> @@ -37,12 +37,11 @@ <Add library=".\ogg.dll" /> <Add library=".\vorbisfile.dll" /> <Add library=".\boost_regex.dll" /> - <Add library="./boost_thread-mt.dll" /> - <Add library="./boost_system-mt.dll" /> + <Add library=".\boost_thread-mt.dll" /> + <Add library=".\boost_system-mt.dll" /> <Add library="ws2_32" /> <Add library="mswsock" /> - <Add library="./OpenAL32.lib" /> - <Add library="./vorbisfile.dll" /> + <Add library=".\OpenAL32.dll" /> </Linker> </Target> </Build> @@ -120,8 +119,6 @@ <Unit filename="..\..\src\OpenALSoundManager.cpp" /> <Unit filename="..\..\src\OpenALSoundManager.h" /> <Unit filename="..\..\src\Opengate.h" /> - <Unit filename="..\..\src\Planet.cpp" /> - <Unit filename="..\..\src\Planet.h" /> <Unit filename="..\..\src\Projectile.cpp" /> <Unit filename="..\..\src\Projectile.h" /> <Unit filename="..\..\src\RadarObject.cpp" /> @@ -142,6 +139,8 @@ <Unit filename="..\..\src\SectorChildObject.h" /> <Unit filename="..\..\src\SectorCollisionObject.cpp" /> <Unit filename="..\..\src\SectorCollisionObject.h" /> + <Unit filename="..\..\src\SectorEnvironmentObject.cpp" /> + <Unit filename="..\..\src\SectorEnvironmentObject.h" /> <Unit filename="..\..\src\SectorExplosionObject.cpp" /> <Unit filename="..\..\src\SectorExplosionObject.h" /> <Unit filename="..\..\src\SectorMeshObject.cpp" /> @@ -188,8 +187,6 @@ <Unit filename="..\..\src\tinyxml\tinyxmlparser.cpp" /> <Extensions> <code_completion /> - <envvars /> - <debugger /> </Extensions> </Project> </CodeBlocks_project_file> Modified: trunk/win32/ogsectorclient/ogsectorclient.exe =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <spo...@us...> - 2009-02-15 16:14:16
|
Revision: 1041 http://opengate.svn.sourceforge.net/opengate/?rev=1041&view=rev Author: spom_spom Date: 2009-02-15 16:14:10 +0000 (Sun, 15 Feb 2009) Log Message: ----------- add missing singlecolor.cg Modified Paths: -------------- trunk/data/materials/gradientshader.cg trunk/data/materials/gradientshader.material trunk/data/materials/singlecolor.material Added Paths: ----------- trunk/data/materials/singlecolor.cg Modified: trunk/data/materials/gradientshader.cg =================================================================== --- trunk/data/materials/gradientshader.cg 2009-02-15 15:27:03 UTC (rev 1040) +++ trunk/data/materials/gradientshader.cg 2009-02-15 16:14:10 UTC (rev 1041) @@ -5,7 +5,7 @@ void gradient_vp( in float4 position : POSITION, uniform float4x4 worldViewProj, uniform float3 camera_position_object_space, - uniform float4 customParamColour, + uniform float4 customParamColor, uniform float4 customParamRadius, out float4 oPosition : POSITION, out float4 oColor : COLOR @@ -26,5 +26,5 @@ Rc = Rc / (objectradius * objectradius); // recalibrate (-1..1) float ratio = (1+Rc); // recalibrate ( 0..2) - (x2 to emphasis the color) - oColor= ratio * customParamColour; + oColor= ratio * customParamColor; } Modified: trunk/data/materials/gradientshader.material =================================================================== --- trunk/data/materials/gradientshader.material 2009-02-15 15:27:03 UTC (rev 1040) +++ trunk/data/materials/gradientshader.material 2009-02-15 16:14:10 UTC (rev 1041) @@ -6,7 +6,7 @@ default_params { - param_named_auto worldViewProj worldviewproj_matrix + param_named_auto worldViewProj worldviewproj_matrix param_named_auto camera_position_object_space camera_position_object_space } } @@ -26,7 +26,7 @@ depth_write on vertex_program_ref VertexPrograms/Gradient_Unified { - param_named_auto customParamColour custom 0 + param_named_auto customParamColor custom 0 param_named_auto customParamRadius custom 1 } } Added: trunk/data/materials/singlecolor.cg =================================================================== --- trunk/data/materials/singlecolor.cg (rev 0) +++ trunk/data/materials/singlecolor.cg 2009-02-15 16:14:10 UTC (rev 1041) @@ -0,0 +1,9 @@ +void singlecolor_vp( float4 objectPos : POSITION, + uniform float4 customParamColor, + uniform float4x4 modelViewProjection, + out float4 oPos : POSITION, + out float4 oColor : COLOR ) +{ + oPos = mul( modelViewProjection, objectPos); + oColor = customParamColor; +} Modified: trunk/data/materials/singlecolor.material =================================================================== --- trunk/data/materials/singlecolor.material 2009-02-15 15:27:03 UTC (rev 1040) +++ trunk/data/materials/singlecolor.material 2009-02-15 16:14:10 UTC (rev 1041) @@ -22,7 +22,7 @@ pass { scene_blend alpha_blend - depth_write on + depth_write off vertex_program_ref VertexPrograms/SingleColor_Unified { param_named_auto customParamColor custom 0 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <spo...@us...> - 2009-02-15 15:27:13
|
Revision: 1040 http://opengate.svn.sourceforge.net/opengate/?rev=1040&view=rev Author: spom_spom Date: 2009-02-15 15:27:03 +0000 (Sun, 15 Feb 2009) Log Message: ----------- try to fix simple shader Modified Paths: -------------- trunk/data/materials/gradientshader.cg trunk/data/materials/gradientshader.material trunk/data/materials/planet.material trunk/src/AiManager.cpp trunk/src/AiObject.cpp trunk/src/Makefile.am trunk/src/ResourceManager.cpp trunk/src/Sector.cpp trunk/src/SectorBeaconObject.cpp trunk/src/SectorEnvironmentObject.cpp trunk/src/SectorMovableObject.cpp trunk/src/SectorStationObject.cpp trunk/src/UnDockedState.cpp Added Paths: ----------- trunk/data/materials/singlecolor.material Removed Paths: ------------- trunk/src/Station.cpp trunk/src/Station.h Modified: trunk/data/materials/gradientshader.cg =================================================================== --- trunk/data/materials/gradientshader.cg 2009-02-15 14:10:46 UTC (rev 1039) +++ trunk/data/materials/gradientshader.cg 2009-02-15 15:27:03 UTC (rev 1040) @@ -28,13 +28,3 @@ oColor= ratio * customParamColour; } - - -// ----------------------------------------------------------------- -// Gradient shader : fragment program -// Author : David de Lorenzo -// ----------------------------------------------------------------- -float4 main_fp(in float4 color : COLOR) : COLOR0 -{ - return (color); -} Modified: trunk/data/materials/gradientshader.material =================================================================== --- trunk/data/materials/gradientshader.material 2009-02-15 14:10:46 UTC (rev 1039) +++ trunk/data/materials/gradientshader.material 2009-02-15 15:27:03 UTC (rev 1040) @@ -1,49 +1,34 @@ -vertex_program shader/gradientVP_CG cg +vertex_program VertexPrograms/Gradient_CG cg { - source gradientshader.cg - entry_point gradient_vp - profiles vs_1_1 arbvp1 + source gradientshader.cg + entry_point gradient_vp + profiles vs_1_1 arbvp1 vp20 - default_params - { - param_named_auto worldViewProj worldviewproj_matrix - param_named_auto camera_position_object_space camera_position_object_space - } -} - -vertex_program shader/gradientVP_Unified unified -{ - delegate shader/gradientVP_CG + default_params + { + param_named_auto worldViewProj worldviewproj_matrix + param_named_auto camera_position_object_space camera_position_object_space + } } -fragment_program shader/gradientFP_CG cg +vertex_program VertexPrograms/Gradient_Unified unified { - source gradientshader.cg - entry_point main_fp - profiles ps_1_1 arbfp1 + delegate VertexPrograms/Gradient_CG } -vertex_program shader/gradientFP_Unified unified -{ - delegate shader/gradientFP_CG -} - -material shader/gradient +material Shader/Gradient { - technique - { - pass - { - scene_blend alpha_blend - depth_write on - vertex_program_ref shader/gradientVP_Unified - { - param_named_auto customParamColour custom 0 - param_named_auto customParamRadius custom 1 - } - fragment_program_ref shader/gradientFP_Unified - { - } - } - } + technique + { + pass + { + scene_blend alpha_blend + depth_write on + vertex_program_ref VertexPrograms/Gradient_Unified + { + param_named_auto customParamColour custom 0 + param_named_auto customParamRadius custom 1 + } + } + } } Modified: trunk/data/materials/planet.material =================================================================== --- trunk/data/materials/planet.material 2009-02-15 14:10:46 UTC (rev 1039) +++ trunk/data/materials/planet.material 2009-02-15 15:27:03 UTC (rev 1040) @@ -2,7 +2,8 @@ { source planet.cg entry_point main_vp - profiles arbvp1 vp20 vs_1_1 + //profiles arbvp1 vp20 vs_1_1 + profiles arbvp1 vs_1_1 default_params { @@ -17,7 +18,8 @@ { source planet.cg entry_point main_fp - profiles arbfp1 fp20 ps_1_1 + //profiles arbfp1 fp20 ps_1_1 + profiles arbfp1 ps_1_1 default_params { } @@ -27,7 +29,8 @@ { source planet.cg entry_point cloud_vp - profiles arbvp1 vp20 vs_1_1 + //profiles arbvp1 vp20 vs_1_1 + profiles arbvp1 vs_1_1 default_params { @@ -42,7 +45,8 @@ { source planet.cg entry_point cloud_fp - profiles arbfp1 fp20 ps_1_1 + //profiles arbfp1 fp20 ps_1_1 + profiles arbfp1 ps_1_1 default_params { } @@ -52,7 +56,8 @@ { source planet.cg entry_point atmos_vp - profiles arbvp1 vp20 vs_1_1 + //profiles arbvp1 vp20 vs_1_1 + profiles arbvp1 vs_1_1 default_params { @@ -67,7 +72,8 @@ { source planet.cg entry_point atmos_fp - profiles arbfp1 fp20 ps_1_1 +// profiles arbfp1 fp20 ps_1_1 + profiles arbfp1 ps_1_1 default_params { } Added: trunk/data/materials/singlecolor.material =================================================================== --- trunk/data/materials/singlecolor.material (rev 0) +++ trunk/data/materials/singlecolor.material 2009-02-15 15:27:03 UTC (rev 1040) @@ -0,0 +1,32 @@ +vertex_program VertexPrograms/SingleColor_CG cg +{ + source singlecolor.cg + entry_point singlecolor_vp + profiles vs_1_1 arbvp1 vp20 + + default_params + { + param_named_auto modelViewProjection worldviewproj_matrix + } +} + +vertex_program VertexPrograms/SingleColor_Unified unified +{ + delegate VertexPrograms/SingleColor_CG +} + +material Shader/SingleColor +{ + technique + { + pass + { + scene_blend alpha_blend + depth_write on + vertex_program_ref VertexPrograms/SingleColor_Unified + { + param_named_auto customParamColor custom 0 + } + } + } +} Modified: trunk/src/AiManager.cpp =================================================================== --- trunk/src/AiManager.cpp 2009-02-15 14:10:46 UTC (rev 1039) +++ trunk/src/AiManager.cpp 2009-02-15 15:27:03 UTC (rev 1040) @@ -30,7 +30,6 @@ #include "ResourceManager.h" #include "Sector.h" #include "SectorVesselObject.h" -#include "Station.h" #include "UnDockedState.h" #include "Vessel.h" #include "networkClient.h" Modified: trunk/src/AiObject.cpp =================================================================== --- trunk/src/AiObject.cpp 2009-02-15 14:10:46 UTC (rev 1039) +++ trunk/src/AiObject.cpp 2009-02-15 15:27:03 UTC (rev 1040) @@ -28,7 +28,6 @@ #include "SectorVesselObject.h" #include "SectorStationObject.h" #include "SectorStationPadObject.h" -#include "Station.h" #include "Vessel.h" Modified: trunk/src/Makefile.am =================================================================== --- trunk/src/Makefile.am 2009-02-15 14:10:46 UTC (rev 1039) +++ trunk/src/Makefile.am 2009-02-15 15:27:03 UTC (rev 1040) @@ -122,8 +122,6 @@ SectorProjectileObject.cpp \ ShipConfigDialog.h \ ShipConfigDialog.cpp \ - Station.h \ - Station.cpp \ UnDockedState.cpp \ UnDockedState.h \ Vessel.h \ Modified: trunk/src/ResourceManager.cpp =================================================================== --- trunk/src/ResourceManager.cpp 2009-02-15 14:10:46 UTC (rev 1039) +++ trunk/src/ResourceManager.cpp 2009-02-15 15:27:03 UTC (rev 1040) @@ -20,12 +20,11 @@ #include "tinyxml/tinyxml.h" #include "ResourceManager.h" -#include "LogManager.h" -#include "Station.h" #include "Entity.h" #include "Equipment.h" #include "KeyMap.h" +#include "LogManager.h" #include <OgreArchiveManager.h> #include <OgreFileSystem.h> Modified: trunk/src/Sector.cpp =================================================================== --- trunk/src/Sector.cpp 2009-02-15 14:10:46 UTC (rev 1039) +++ trunk/src/Sector.cpp 2009-02-15 15:27:03 UTC (rev 1040) @@ -399,20 +399,20 @@ koordAxisMO_ = sceneMgr_->createManualObject( koordAxisNode_->getName()+ "/manualObject" ); Ogre::Real length = 20; - koordAxisMO_->begin( "singleColor", Ogre::RenderOperation::OT_LINE_LIST); + koordAxisMO_->begin( "Shader/SingleColor", Ogre::RenderOperation::OT_LINE_LIST); koordAxisMO_->getSection( 0 )->setCustomParameter( 0, Ogre::Vector4( 1.0, 0.0, 0.0, 1.0 ) ); koordAxisMO_->position( 0.0, 0.0, 0.0 ); koordAxisMO_->position( 1.0, 0.0, 0.0 ); koordAxisMO_->position( 0.0, 0.0, 0.0 ); koordAxisMO_->end(); - koordAxisMO_->begin( "singleColor", Ogre::RenderOperation::OT_LINE_LIST); + koordAxisMO_->begin( "Shader/SingleColor", Ogre::RenderOperation::OT_LINE_LIST); koordAxisMO_->getSection( 1 )->setCustomParameter( 0, Ogre::Vector4( 0.0, 1.0, 0.0, 1.0 ) ); koordAxisMO_->position( 0.0, 1.0, 0.0 ); koordAxisMO_->position( 0.0, 0.0, 0.0 ); koordAxisMO_->end(); - koordAxisMO_->begin( "singleColor", Ogre::RenderOperation::OT_LINE_LIST); + koordAxisMO_->begin( "Shader/SingleColor", Ogre::RenderOperation::OT_LINE_LIST); koordAxisMO_->getSection( 2 )->setCustomParameter( 0, Ogre::Vector4( 0.0, 0.0, 1.0, 1.0 ) ); koordAxisMO_->position( 0.0, 0.0, 1.0 ); koordAxisMO_->position( 0.0, 0.0, 0.0 ); @@ -1068,86 +1068,7 @@ return avatar_; } -void Sector::createKoordAxis( ){ - koordAxisNode_ = sceneMgr_->getRootSceneNode()->createChildSceneNode( "axisnode" ); - koordAxisMO_ = sceneMgr_->createManualObject( koordAxisNode_->getName()+ "/manualObject" ); - Ogre::Real length = 20; - - koordAxisMO_->begin( "singleColor", Ogre::RenderOperation::OT_LINE_LIST); - koordAxisMO_->getSection( 0 )->setCustomParameter( 0, Ogre::Vector4( 1.0, 0.0, 0.0, 1.0 ) ); - koordAxisMO_->position( 0.0, 0.0, 0.0 ); - koordAxisMO_->position( 1.0, 0.0, 0.0 ); - koordAxisMO_->position( 0.0, 0.0, 0.0 ); - koordAxisMO_->end(); - - koordAxisMO_->begin( "singleColor", Ogre::RenderOperation::OT_LINE_LIST); - koordAxisMO_->getSection( 1 )->setCustomParameter( 0, Ogre::Vector4( 0.0, 1.0, 0.0, 1.0 ) ); - koordAxisMO_->position( 0.0, 1.0, 0.0 ); - koordAxisMO_->position( 0.0, 0.0, 0.0 ); - koordAxisMO_->end(); - - koordAxisMO_->begin( "singleColor", Ogre::RenderOperation::OT_LINE_LIST); - koordAxisMO_->getSection( 2 )->setCustomParameter( 0, Ogre::Vector4( 0.0, 0.0, 1.0, 1.0 ) ); - koordAxisMO_->position( 0.0, 0.0, 1.0 ); - koordAxisMO_->position( 0.0, 0.0, 0.0 ); - koordAxisMO_->end(); - - koordAxisMO_->begin( "BaseWhiteNoLighting", Ogre::RenderOperation::OT_LINE_LIST); - koordAxisMO_->position( -1.0, 0.0, 0.0 ); - koordAxisMO_->position( 0.0, 0.0, 0.0 ); - koordAxisMO_->position( 0.0, -1.0, 0.0 ); - koordAxisMO_->position( 0.0, 0.0, 0.0 ); - koordAxisMO_->position( 0.0, 0.0, -1.0 ); -// koordAxisMO_->line( 0, 1 ); -// koordAxisMO_->line( 0, 2 ); -// koordAxisMO_->line( 0, 3 ); - koordAxisMO_->end(); - koordAxisNode_->attachObject( koordAxisMO_ ); - koordAxisNode_->scale( length, length, length ); -} -void Sector::createCircle( ){ - Ogre::String name = "testcircle"; - - Ogre::SceneNode * object = sceneMgr_->getRootSceneNode()->createChildSceneNode( name ); - Ogre::ManualObject * circle = sceneMgr_->createManualObject( name + "shape" ); - - Ogre::Real radius = 200; - Ogre::Real thickness = 200.0; // Of course this must be less than the radius value. - Ogre::Real nSegments = 96; - Ogre::Real dPhi = 2.0 * 3.141592 / nSegments; - - circle->begin( "shader/gradient", Ogre::RenderOperation::OT_TRIANGLE_LIST); - circle->getSection( 0 )->setCustomParameter( 0, Ogre::Vector4( 23./255, 118./255, 9./255, 0.1 ) ); - circle->getSection( 0 )->setCustomParameter( 1, Ogre::Vector4( radius, 0, 0, 0 ) ); - - unsigned point_index = 0; - - for ( int segment = 0; segment < nSegments; segment++ ) { - Ogre::Real theta = segment * dPhi; - circle->position( radius * cos( theta ), - 0, - radius * sin( theta ) ); - circle->position( (radius - thickness) * cos( theta ), - 0, - (radius - thickness) * sin( theta ) ); - - if ( segment > 0 ){ - point_index = (segment+1)*2-1; - circle->quad( point_index, point_index-1, point_index-3, point_index-2 ); - circle->quad( point_index, point_index-2, point_index-3, point_index-1 ); - } - } - circle->quad( 1, 0, (uint)nSegments*2-2, (uint)nSegments*2-1 ); - circle->quad( 1, (uint)nSegments*2-1, (uint)nSegments*2-2, 0 ); - circle->end(); - - object->translate( 0, 0, 50); - object->pitch( Ogre::Degree( 10 ) ); - object->attachObject( circle ); - -} - void Sector::sendAllVesselMovements( ){ if ( avatar_ ) sendVesselMovement( avatar_ ); } Modified: trunk/src/SectorBeaconObject.cpp =================================================================== --- trunk/src/SectorBeaconObject.cpp 2009-02-15 14:10:46 UTC (rev 1039) +++ trunk/src/SectorBeaconObject.cpp 2009-02-15 15:27:03 UTC (rev 1040) @@ -51,19 +51,19 @@ } if ( entity()->getSubEntity( i )->getMaterialName() == "beacon/pad_mount_0" ){ - entity()->getSubEntity( i )->setMaterialName( "singleColor" ); + entity()->getSubEntity( i )->setMaterialName( "Shader/SingleColor" ); entity()->getSubEntity( i )->setCustomParameter( 0, Ogre::Vector4( 0.5, 0.5, 0.5, 1.0 ) ); entryPad_ = new SectorBeaconPadObject( "EntryPad", this, entity()->getSubEntity( i ) ); entryPad_->changeEntity( "beacon_pad.mesh" ); - entryPad_->entity()->setMaterialName( "singleColor" ); + entryPad_->entity()->setMaterialName( "Shader/SingleColor" ); entryPad_->entity()->getSubEntity( 0 )->setCustomParameter( 0, Ogre::Vector4( 0.8, 0.0, 0.0, 0.2 ) ); } if ( entity()->getSubEntity( i )->getMaterialName() == "beacon/pad_mount_1" ){ - entity()->getSubEntity( i )->setMaterialName( "singleColor" ); + entity()->getSubEntity( i )->setMaterialName( "Shader/SingleColor" ); entity()->getSubEntity( i )->setCustomParameter( 0, Ogre::Vector4( 0.5, 0.5, 0.5, 1.0 ) ); exitPad_ = new SectorBeaconPadObject( "ExitPad", this, entity()->getSubEntity( i ) ); exitPad_->changeEntity( "beacon_pad.mesh" ); - exitPad_->entity()->setMaterialName( "singleColor" ); + exitPad_->entity()->setMaterialName( "Shader/SingleColor" ); exitPad_->entity()->getSubEntity( 0 )->setCustomParameter( 0, Ogre::Vector4( 0.8, 0.0, 0.0, 0.2 ) ); } } Modified: trunk/src/SectorEnvironmentObject.cpp =================================================================== --- trunk/src/SectorEnvironmentObject.cpp 2009-02-15 14:10:46 UTC (rev 1039) +++ trunk/src/SectorEnvironmentObject.cpp 2009-02-15 15:27:03 UTC (rev 1040) @@ -63,10 +63,10 @@ mainNode_->attachObject( entity_ ); mainNode_->setPosition( Ogre::Vector3( 0000.0, 0000.0, 50000 ) ); - //planetNode_->pitch( Ogre::Degree(30) ); - + // mainNode_->setVisible( false ); + cloudNode_ = mainNode_->createChildSceneNode( mainNode_->getName() + "/cloud" ); - + // cloudNode_->setVisible( true ); cloudEntity_ = entity_->clone( cloudNode_->getName() ); cloudEntity_->setMaterialName( "Planet/Cloud" ); @@ -229,7 +229,7 @@ unsigned point_index = 0; - entity_->begin( "shader/gradient", Ogre::RenderOperation::OT_TRIANGLE_LIST); + entity_->begin( "Shader/Gradient", Ogre::RenderOperation::OT_TRIANGLE_LIST); entity_->getSection( 0 )->setCustomParameter( 0, Ogre::Vector4( 0.0, 0.0, 1.0, 0.2 ) ); entity_->getSection( 0 )->setCustomParameter( 1, Ogre::Vector4( nx * dx, 0.0, 0.0, 0.0 ) ); @@ -243,7 +243,7 @@ } entity_->end(); - entity_->begin( "shader/gradient", Ogre::RenderOperation::OT_TRIANGLE_LIST); + entity_->begin( "Shader/Gradient", Ogre::RenderOperation::OT_TRIANGLE_LIST); entity_->getSection( 1 )->setCustomParameter( 0, Ogre::Vector4( 0.0, 0.0, 1.0, 0.2 ) ); entity_->getSection( 1 )->setCustomParameter( 1, Ogre::Vector4( nz * dz, 0.0, 0.0, 0.0 ) ); @@ -257,7 +257,7 @@ } entity_->end(); - entity_->begin( "shader/gradient", Ogre::RenderOperation::OT_TRIANGLE_LIST); + entity_->begin( "Shader/Gradient", Ogre::RenderOperation::OT_TRIANGLE_LIST); entity_->getSection( 2 )->setCustomParameter( 0, Ogre::Vector4( 0.0, 1.0, 0.0, 0.2 ) ); entity_->getSection( 2 )->setCustomParameter( 1, Ogre::Vector4( nx * dx, 0.0, 0.0, 0.0 ) ); @@ -271,7 +271,7 @@ } entity_->end(); - entity_->begin( "shader/gradient", Ogre::RenderOperation::OT_TRIANGLE_LIST); + entity_->begin( "Shader/Gradient", Ogre::RenderOperation::OT_TRIANGLE_LIST); entity_->getSection( 3 )->setCustomParameter( 0, Ogre::Vector4( 0.0, 1.0, 0.0, 0.2 ) ); entity_->getSection( 3 )->setCustomParameter( 1, Ogre::Vector4( nz * dz, 0.0, 0.0, 0.0 ) ); Modified: trunk/src/SectorMovableObject.cpp =================================================================== --- trunk/src/SectorMovableObject.cpp 2009-02-15 14:10:46 UTC (rev 1039) +++ trunk/src/SectorMovableObject.cpp 2009-02-15 15:27:03 UTC (rev 1040) @@ -74,6 +74,7 @@ mass_ = movable_->mass(); armor_ = movable_->armor(); maxArmor_ = movable_->armor(); + maxShield_ = 1; shield_ = 0; setDestroyRequest_( false ); Modified: trunk/src/SectorStationObject.cpp =================================================================== --- trunk/src/SectorStationObject.cpp 2009-02-15 14:10:46 UTC (rev 1039) +++ trunk/src/SectorStationObject.cpp 2009-02-15 15:27:03 UTC (rev 1040) @@ -113,7 +113,7 @@ for ( int i = 0; i < nRings; i ++ ){ radius = rMin + i * 10 * rMin / nRings ; - ringEntity_->begin( "shader/gradient", Ogre::RenderOperation::OT_TRIANGLE_LIST); + ringEntity_->begin( "Shader/Gradient", Ogre::RenderOperation::OT_TRIANGLE_LIST); ringEntity_->getSection( i )->setCustomParameter( 0, Ogre::Vector4( 0.0, 1.0-(double)i/nRings, (double)i/nRings, 0.4 ) ); ringEntity_->getSection( i )->setCustomParameter( 1, Ogre::Vector4( radius, 0, 0, 0 ) ); Deleted: trunk/src/Station.cpp =================================================================== --- trunk/src/Station.cpp 2009-02-15 14:10:46 UTC (rev 1039) +++ trunk/src/Station.cpp 2009-02-15 15:27:03 UTC (rev 1040) @@ -1,403 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006-2007 by OpenGate development team * - * spo...@us... * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ - -#include "Station.h" - -#include "AiObject.h" -#include "GameStateManager.h" -#include "Sector.h" -#include "SectorObjectVessel.h" -#include "OpcodeWrapper.h" -#include "UnDockedState.h" - -#include <OgreString.h> -#include <OgreMesh.h> -#include <OgreSubMesh.h> -#include <OgreEntity.h> -#include <OgreSubEntity.h> -#include <OgreMeshManager.h> -#include <OgreSceneManager.h> -#include <OgreManualObject.h> -#include <OgreBillboard.h> -#include <OgreBillboardSet.h> - -namespace OpenGate{ - -Pad::Pad( const std::string & name, SectorObject * parent, Ogre::SubEntity * padSubEntity ) - : BaseObject( name, parent->sector(), 0, 0, parent->rotNode() ), parent_( parent ){ - - padManualObject_ = sceneMgr_->createManualObject( mainNode_->getName() + "/ManualObject" ); - - std::vector < Ogre::Vector3 > verts; - std::vector < Triangle > tris; - readSubEntity( padSubEntity, verts, tris ); - - //padManualObject_->begin( "BaseWhiteNoLighting", Ogre::RenderOperation::OT_TRIANGLE_LIST ); - padManualObject_->begin( padSubEntity->getMaterialName(), Ogre::RenderOperation::OT_TRIANGLE_LIST ); - - Ogre::Real xmin( 9e99 ), xmax( -9e99 ), ymin( 9e99 ), ymax( -9e99 ), zmin( 9e99 ), zmax( -9e99 ); - position_ = Ogre::Vector3::ZERO; - - for( uint i = 0; i < verts.size(); i++ ){ - position_ += verts[ i ]; - - xmin = min( xmin, verts[ i ][ 0 ] ); xmax = max( xmax, verts[ i ][ 0 ] ); - ymin = min( ymin, verts[ i ][ 1 ] ); ymax = max( ymax, verts[ i ][ 1 ] ); - zmin = min( zmin, verts[ i ][ 2 ] ); zmax = max( zmax, verts[ i ][ 2 ] ); - padManualObject_->position( verts[ i ] ); //pReal[ 0 ], pReal[ 1 ], pReal[ 2 ] ); - } - - position_ /= verts.size(); - radius_ = max( xmax-xmin, ymax-ymin ); - radius_ = max( radius_, zmax - zmin ); - radius_ /= 2.0; - - direction_ = Ogre::Vector3::ZERO; - for ( uint i = 0; i < tris.size(); i++ ) { - padManualObject_->triangle( tris[ i ].a, tris[ i ].b, tris[ i ].c ); - direction_ += ( ( verts[ tris[ i ].b ] - verts[ tris[ i ].a ] ) - .crossProduct( verts[ tris[ i ].c ] - verts[ tris[ i ].a ] ) ).normalisedCopy(); - } - - direction_ /= tris.size(); - padManualObject_->end(); - - padMesh_ = padManualObject_->convertToMesh( padManualObject_->getName() + "/Mesh" ); - padEntity_ = sceneMgr_->createEntity( padMesh_->getName() + "/Entity", padMesh_->getName() ); - mainNode_->attachObject( padEntity_ ); - mainNode_->translate( direction_.normalisedCopy() * 0.1 ); -} - -Pad::~Pad( ){ - mainNode_->detachObject( padEntity_ ); - sceneMgr_->destroyEntity( padEntity_ ); - Ogre::MeshManager::getSingleton().remove( padMesh_->getName() ); - sceneMgr_->destroyManualObject( padManualObject_ ); -} - -StationPad::StationPad( const std::string & name, StationObject * station, Ogre::SubEntity * padSubEntity, - bool docking ) - : Pad( name, station, padSubEntity), docking_( docking ){ - - if ( docking_ ){ - if ( ResourceManager::getSingleton().collisionManager ){ - ResourceManager::getSingleton().collisionManager->createObject( this ); - } - } -} - -StationPad::~StationPad( ){ - if ( ResourceManager::getSingleton().collisionManager ){ - ResourceManager::getSingleton().collisionManager->destroyObject( this ); - } -} - -void StationPad::collide( BaseObject * object ){ - if ( docking_ ) { - if ( object->rtti() == AVATAR_RTTI ){ - std::cout << "StationPad::collide() docking request for " << object->name() << std::endl; - // sector_->listener()->changeToDockedState(); - } else if ( object->rtti() == SECTOROBJECTVESSEL_RTTI ){ - std::cout << "StationPad::collide() docking request for " << object->name() << std::endl; - //dynamic_cast< SectorObjectVessel * >( object )->controler()->kill(); -// ResourceManager::getSingleton().collisionManager->dettachObject( padEntity_, this, "DockPad" ); - object->destroy( ); - } - } - -} - -StationObject::StationObject( Station & station, Sector * sector ) - : SectorObject( station.name(), sector ), station_( &station ){ - - dockPad_ = NULL; - flashLights_ = NULL; - - setShape( station_->meshName() ); - - for ( uint i = 0; i < entity()->getNumSubEntities(); i ++ ){ - std::cout << entity()->getSubEntity( i )->getMaterialName() << " Techniques: " - << entity()->getSubEntity( i )->getMaterial()->getNumTechniques() << " used: " - << entity()->getSubEntity( i )->getTechnique()->getName() << std::endl; - -// for ( uint j = 0; j < entity()->getSubEntity( i )->getMaterial()->getNumTechniques(); j ++ ){ -// std::cout << entity()->getSubEntity( i )->getMaterial()->getTechnique( j )->getName() << std::endl; -// } - - if ( entity()->getSubEntity( i )->getMaterialName() == "Flashlight/Red" ){ - createFlashLights( entity()->getSubEntity( i ) ); - } - if ( entity()->getSubEntity( i )->getMaterialName() == "Station/DockPad" ){ - dockPad_ = new StationPad( name_ + "DockPad", this, entity()->getSubEntity( i ), true ); - } - if ( entity()->getSubEntity( i )->getMaterialName() == "Station/LaunchPad.001" ){ - launchPad_ = new StationPad( name_ + "LaunchPad", this, entity()->getSubEntity( i ), false ); - } - } - - setBaseRot( station_->baseYaw(), station_->basePitch(), station_->baseRoll() ); - setBaseSize( station_->baseSize() ); - - if ( dockPad_ ){ - createRings( dockPad_->position(), dockPad_->radius(), dockPad_->direction() ); - ringNode_->setVisible( false ); - } -} - -StationObject::~StationObject( ) { - if ( launchPad_ ) delete launchPad_; - - if ( dockPad_ ){ - delete dockPad_; - ringNode_->detachObject( ringEntity_ ); - sceneMgr_->destroyManualObject( ringEntity_ ); - mainNodeEntityRot_->removeAndDestroyChild( ringNode_->getName() ); - } - if ( flashLights_ ){ - mainNodeEntityRot_->detachObject( flashLights_ ); - sceneMgr_->destroyBillboardSet( flashLights_ ); - } - - Ogre::MeshManager::getSingleton().unload( station_->meshName() ); -} - -void StationObject::collide( BaseObject * object ){ - // std::cout << "Sector: " << name_ << " collide with " << object->getTypeID() << " " << object->name()<< std::endl; -} - -void StationObject::addObserver( SectorObject * obj ){ - observers_.insert( obj ); - if ( obj->rtti() == AVATAR_RTTI ){ - showRings( true ); - } -} - -void StationObject::delObserver( SectorObject * obj ){ - if ( obj->rtti() == AVATAR_RTTI ){ - showRings( false ); - } - observers_.erase( obj ); -} - -void StationObject::showRings( bool show ){ ringNode_->setVisible( show ); } - -void StationObject::createFlashLights( Ogre::SubEntity * entity ){ - - entity->setVisible( false ); - std::vector< Ogre::Vector3 > verts; - std::vector< Triangle > tris; - readSubEntity( entity, verts, tris ); - - uint nLights = tris.size() / 2; - - flashLights_ = sceneMgr_->createBillboardSet( name_ + "_BBS", nLights ); - flashLights_->setMaterialName( entity->getMaterialName() ); - - Ogre::Billboard *bb; - - for ( uint i = 0; i < nLights; i ++ ){ - bb = flashLights_->createBillboard( Ogre::Vector3::ZERO, Ogre::ColourValue( 1.0f, 0.0f, 0.0f, 1.0f) ); - bb->setDimensions( (verts[ i * 4 + 1 ] - verts[ i * 4 ] ).length(), - (verts[ i * 4 + 1 ] - verts[ i * 4 ] ).length() ); - bb->setPosition( ( verts[ i * 4 ] + verts[ i * 4 + 1 ] + verts[ i * 4 + 2 ] + verts[ i * 4 + 3] ) / 4.0 ); - } - mainNodeEntityRot_->attachObject( flashLights_ ); -} - -Ogre::Vector3 StationObject::launchPadPosition() const { -// mainNodeEntityRot_->_update(true, true); -// std::cout << "StationObject::launchPadPosition() " << mainNodeEntityRot_->_getFullTransform() * launchPad_->position() << std::endl; -// std::cout << "StationObject::launchPadPosition() " << launchPad_->position() << std::endl; - return mainNodeEntityRot_->_getFullTransform()* launchPad_->position(); -// return Ogre::Vector3( 0.0, 0.0, 0.0 ); -} - -Ogre::Vector3 StationObject::launchPadDirection() const { - // return launchPadNode_->getOrientation().zAxis() * -1.0; - // return mainNodeEntityRot_->_getDerivedOrientation() * launchPad_->direction(); -// return -launchPad_->padNode()->getOrientation().zAxis(); ; - // return launchPadNode_->getWorldOrientation(); -//return Ogre::Vector3( 1.0, 0.0, 0.0 ); - return mainNodeEntityRot_->_getDerivedOrientation() * launchPad_->direction() ; -} -Ogre::Vector3 StationObject::dockPadPosition() const { - return mainNodeEntityRot_->_getFullTransform()* dockPad_->position(); - // return dockPad_->padNode()->getWorldPosition(); -} - -Ogre::Vector3 StationObject::dockPadDirection() const { - return mainNodeEntityRot_->_getDerivedOrientation() * dockPad_->direction() ; -} - -Ogre::Vector3 StationObject::dockingRingStart( ) const { - // 400.0 == nRings * length; - return mainNodeEntityRot_->_getFullTransform()* ( dockPad_->position() + dockPad_->direction() * 20.0 ); - //return dockPadPosition() + dockPadDirection() * 800.0; - //return ringNode_->getWorldPosition() + ringNode_->getWorldOrientation().zAxis() * 400.0; -} - -Ogre::Vector3 StationObject::dockingRingEnd( ) const { - return dockPadPosition(); -} - - -void StationObject::createRings( const Ogre::Vector3 & position, Ogre::Real rMin, const Ogre::Vector3 & direction ){ - Ogre::Vector3 targetDir( direction ); - if ( targetDir == Ogre::Vector3::ZERO ) targetDir = mainNodeEntityRot_->getOrientation().zAxis(); - - Ogre::String name = name_+ "/Rings"; - - ringNode_ = mainNodeEntityRot_->createChildSceneNode( name ); - ringEntity_ = sceneMgr_->createManualObject( name + "shape" ); - - Ogre::Real radius = rMin; - Ogre::Real thickness = rMin / 5.0; // Of course this must be less than the radius value. - Ogre::Real nSegments = 6; - Ogre::Real dPhi = 2.0 * 3.141592 / nSegments; - Ogre::Real length = 20; - int nRings = 20; - - unsigned point_index = 0; - - for ( int i = 0; i < nRings; i ++ ){ - radius = rMin + i * 10 * rMin / nRings ; - - ringEntity_->begin( "shader/gradient", Ogre::RenderOperation::OT_TRIANGLE_LIST); - ringEntity_->getSection( i )->setCustomParameter( 0, Ogre::Vector4( 0.0, 1.0-(double)i/nRings, (double)i/nRings, 0.4 ) ); - ringEntity_->getSection( i )->setCustomParameter( 1, Ogre::Vector4( radius, 0, 0, 0 ) ); - - for ( int segment = 0; segment < nSegments; segment++ ) { - Ogre::Real theta = segment * dPhi + dPhi/2.0; - - ringEntity_->position( radius * cos( theta ), i * ( length / nRings ), - radius * sin( theta ) ); - ringEntity_->position( (radius - thickness) * cos( theta ), i * ( length / nRings ), - (radius - thickness) * sin( theta ) ); - if ( segment > 0 ){ - point_index = (segment+1)*2-1; - ringEntity_->quad( point_index, point_index-1, point_index-3, point_index-2 ); - ringEntity_->quad( point_index, point_index-2, point_index-3, point_index-1 ); - } - } - ringEntity_->quad( 1, 0, (uint)nSegments*2-2, (uint)nSegments*2-1 ); - ringEntity_->quad( 1, (uint)nSegments*2-1, (uint)nSegments*2-2, 0 ); - ringEntity_->end(); - } - - Ogre::Quaternion rot = Ogre::Vector3( 0.0, 1.0, 0.0 ).getRotationTo( targetDir ); - - ringNode_->rotate( rot ); - ringNode_->translate( position ); - ringNode_->attachObject( ringEntity_ ); -} - -BeaconPad::BeaconPad( const std::string & name, BeaconObject * beacon, Ogre::SubEntity * padSubEntity ) - : Pad( name, beacon, padSubEntity){ - - if ( ResourceManager::getSingleton().collisionManager ){ - ResourceManager::getSingleton().collisionManager->createObject( this ); - } -} - -BeaconPad::~BeaconPad( ){ - if ( ResourceManager::getSingleton().collisionManager ){ - ResourceManager::getSingleton().collisionManager->destroyObject( this ); - } -} - -void BeaconPad::collide( BaseObject * object ){ - if ( object->rtti() == AVATAR_RTTI ){ - std::cout << "BeaconPad::collide() bcu for " << object->name() << std::endl; - } else if ( object->rtti() == SECTOROBJECTVESSEL_RTTI ){ - std::cout << "BeaconPad::collide() bcu for " << object->name() << std::endl; - } -} - -void BeaconPad::changeEntity( const std::string & meshname ){ - if ( ResourceManager::getSingleton().collisionManager ){ - ResourceManager::getSingleton().collisionManager->detach( this ); - } - mainNode_->detachObject( padEntity_ ); - sceneMgr_->destroyEntity( padEntity_ ); - padEntity_ = sceneMgr_->createEntity( name_ + "/Entity", meshname ); - mainNode_->attachObject( padEntity_ ); - mainNode_->translate( position_ ); - if ( ResourceManager::getSingleton().collisionManager ){ - ResourceManager::getSingleton().collisionManager->attach( this ); - } -} - - -BeaconObject::BeaconObject( Sector * sector ) - : SectorObject ( sector->name() + "/Beacon ", sector ), entryPad_( NULL ), exitPad_( NULL ) { - - setShape( "beacon.mesh" ); - //entity_->setMaterialName( "Sta/TS/Background" ); - - for ( uint i = 0; i < entity()->getNumSubEntities(); i ++ ){ - std::cout << entity()->getSubEntity( i )->getMaterialName() << " Techniques: " - << entity()->getSubEntity( i )->getMaterial()->getNumTechniques() << " used: " - << entity()->getSubEntity( i )->getTechnique()->getName() << std::endl; - - if ( entity()->getSubEntity( i )->getMaterialName() == "beacon/bg" ){ - entity()->getSubEntity( i )->setMaterialName( "Sta/TS/Background" ); - } - - if ( entity()->getSubEntity( i )->getMaterialName() == "beacon/pad_mount_0" ){ - entity()->getSubEntity( i )->setMaterialName( "singleColor" ); - entity()->getSubEntity( i )->setCustomParameter( 0, Ogre::Vector4( 0.5, 0.5, 0.5, 1.0 ) ); - entryPad_ = new BeaconPad( "EntryPad", this, entity()->getSubEntity( i ) ); - entryPad_->changeEntity( "beacon_pad.mesh" ); - entryPad_->entity()->setMaterialName( "singleColor" ); - entryPad_->entity()->getSubEntity( 0 )->setCustomParameter( 0, Ogre::Vector4( 0.8, 0.0, 0.0, 0.2 ) ); - } - if ( entity()->getSubEntity( i )->getMaterialName() == "beacon/pad_mount_1" ){ - entity()->getSubEntity( i )->setMaterialName( "singleColor" ); - entity()->getSubEntity( i )->setCustomParameter( 0, Ogre::Vector4( 0.5, 0.5, 0.5, 1.0 ) ); - exitPad_ = new BeaconPad( "ExitPad", this, entity()->getSubEntity( i ) ); - exitPad_->changeEntity( "beacon_pad.mesh" ); - exitPad_->entity()->setMaterialName( "singleColor" ); - exitPad_->entity()->getSubEntity( 0 )->setCustomParameter( 0, Ogre::Vector4( 0.8, 0.0, 0.0, 0.2 ) ); - } - } - - -// std::vector < Ogre::Vector3 > verts; -// std::vector < Triangle > tris; -// readSubEntity( entity_, verts, tris ); - - - -} - -BeaconObject::~BeaconObject( ){ - if ( entryPad_ ) delete entryPad_; - if ( exitPad_ ) delete exitPad_; -} - -Ogre::Vector3 BeaconObject::entrancePosition() const { - return Ogre::Vector3::ZERO; -} - -Ogre::Vector3 BeaconObject::exitPosition() const { - return Ogre::Vector3::ZERO; -} - -} // namespace OpenGate Deleted: trunk/src/Station.h =================================================================== --- trunk/src/Station.h 2009-02-15 14:10:46 UTC (rev 1039) +++ trunk/src/Station.h 2009-02-15 15:27:03 UTC (rev 1040) @@ -1,199 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006-2007 by OpenGate development team * - * spo...@us... * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ - -#ifndef _OPENGATE_STATION__H -#define _OPENGATE_STATION__H - -#include "Entity.h" -#include "BaseObject.h" -#include "SectorObject.h" - -#include <OgrePrerequisites.h> -#include <OgreMesh.h> - -namespace OpenGate{ - -class Station; -class Pad; -class StationPad; -class BeaconPad; -class StationObject; -class BeaconObject; - -void readSubEntity( Ogre::SubEntity * entity, std::vector< Ogre::Vector3 > & verts, std::vector< Triangle > & tris ); - -class Pad : public BaseObject { -public: - /*! Constructor, with a name, */ - Pad( const std::string & name, SectorObject * parent, Ogre::SubEntity * padSubEntity ); - /*! Destructor */ - virtual ~Pad( ); - - /*! Return runtime type information */ - virtual long rtti() const { return STATIONPAD_RTTI; } - - virtual std::string collisionClass() const { return "DockPad"; } - - /*! What happen on collision */ - virtual void collide( BaseObject * object ){} - - /*! Update the pad in each frame */ - virtual bool update( Ogre::Real elapsedTime ){ return true; } - - /*! Position for the pad center in local coordinates. */ - Ogre::Vector3 position( ) const { return position_; } - - /*! Direction for the pad in local coordinates. */ - Ogre::Vector3 direction( ) const{ return direction_; } - - /*! Radius of the pad */ - Ogre::Real radius() const { return radius_; } - - Ogre::SceneNode * padNode(){ return mainNode_; } - - virtual Ogre::Entity * entity( ) { return padEntity_; } - -protected: - SectorObject * parent_; - //Ogre::SceneNode * padNode_; - Ogre::ManualObject * padManualObject_; - Ogre::MeshPtr padMesh_; - Ogre::Entity * padEntity_; - - Ogre::Vector3 position_; - Ogre::Vector3 direction_; - Ogre::Real radius_; -}; - -/*! A station pad is a plain area where vessel dock or launch */ -class StationPad : public Pad { -public: - /*! Constructor, with a name, */ - StationPad( const std::string & name, StationObject * station, Ogre::SubEntity * padSubEntity, - bool docking = false ); - /*! Destructor */ - virtual ~StationPad( ); - - /*! What to do on collision */ - void collide( BaseObject * object ); - -protected: - bool docking_; -}; - -//** derive from dockable so sector can handle set of dockables -class StationObject : public SectorObject{ -public: - StationObject( Station & station, Sector * sector ); - - virtual ~StationObject( ); - - virtual long rtti() const { return STATION_RTTI; } - - virtual std::string collisionClass() const { return "Station"; } - - void collide( BaseObject * object ); - - //** taking default arg here, breaks pythonogre-generation, leads to TypeError: No to_python (by-value) converter found for C++ type: Ogre::Vector3 - void createRings( const Ogre::Vector3 & position, Ogre::Real rMin, const Ogre::Vector3 & direction ); - - inline void createRings( const Ogre::Vector3 & position, Ogre::Real rMin ) { return createRings( position, rMin, Ogre::Vector3::ZERO ); } - - /*! Show or hide the dockingrings */ - void showRings( bool show ); - - void createFlashLights( Ogre::SubEntity * entity ); - - /*! Add observer. Derived from SectorObject, but show docking rings if the obj is the avatar */ - virtual void addObserver( SectorObject * obj ); - - /*! Remove observer. Derived from SectorObject, but hide docking rings if the obj is the avatar */ - virtual void delObserver( SectorObject * obj ); - - Ogre::Vector3 launchPadPosition() const; - - Ogre::Vector3 launchPadDirection() const ; - - /*! Return the world coordinate of the docking pad */ - Ogre::Vector3 dockPadPosition() const; - - /*! Return the world direction of the docking pad */ - Ogre::Vector3 dockPadDirection() const; - - /*! Docking rings start position*/ - Ogre::Vector3 dockingRingStart( ) const; - - /*! Docking rings end position respectively outer position of the dockingtube*/ - Ogre::Vector3 dockingRingEnd( ) const ; - -protected: - Station * station_; - Ogre::SceneNode * ringNode_; - //Ogre::SceneNode * dockPadNode_; - //Ogre::SceneNode * launchPadNode_; - - Ogre::ManualObject * ringEntity_; - - Ogre::BillboardSet * flashLights_; - StationPad * dockPad_; - StationPad * launchPad_; - //StationDockPad * dockPad_; -}; - - -/*! A station pad is a plain area where vessel dock or launch */ -class BeaconPad : public Pad{ -public: - /*! Constructor, with a name, */ - BeaconPad( const std::string & name, BeaconObject * station, Ogre::SubEntity * padSubEntity ); - - /*! Destructor */ - virtual ~BeaconPad( ); - - /*! What happen on collision */ - void collide( BaseObject * object ); - - void changeEntity( const std::string & meshname ); - -protected: -}; - -class BeaconObject : public SectorObject { -public: - BeaconObject( Sector * sector ); - - virtual ~BeaconObject( ); - - /*! Return entrance position in world coordinates */ - Ogre::Vector3 entrancePosition() const; - - /*! Return exit position in world coordinates */ - Ogre::Vector3 exitPosition() const; - -protected: - BeaconPad * entryPad_; - BeaconPad * exitPad_; -}; - -} // namespace OpenGate - -#endif //_OPENGATE_STATION__H - - Modified: trunk/src/UnDockedState.cpp =================================================================== --- trunk/src/UnDockedState.cpp 2009-02-15 14:10:46 UTC (rev 1039) +++ trunk/src/UnDockedState.cpp 2009-02-15 15:27:03 UTC (rev 1040) @@ -23,25 +23,24 @@ #include "AiManager.h" #include "AiObject.h" #include "Avatar.h" +#include "Console.h" +#include "ConfigDialog.h" +#include "GameStateManager.h" #include "Hud.h" -#include "GameStateManager.h" -#include "Sector.h" #include "networkProtocol.h" #include "networkClient.h" #include "InputManager.h" -#include "Console.h" -#include "ConfigDialog.h" #include "KeyMap.h" #include "OpenALSoundManager.h" #include "RadarObject.h" +#include "Sector.h" #include "SectorAvatarObject.h" #include "SectorEnvironmentObject.h" #include "SectorStationObject.h" #include "EntityManager.h" -#include "Station.h" #include "OpcodeWrapper.h" #include <iostream> @@ -1110,12 +1109,12 @@ for ( ; it != itmax; it ++ ){ std::cout << " found " << (*it)->name() << std::endl; } - //std::find( se.begin(), se.end(), ( std::mem_fun( &SectorEnvironmentObject::name ) == "Planet" ) ); -// boost::bind( std::equal_to< std::string >(), -// Login->Token.c_str(), -// boost::bind( &Player::mGetToken, _1 ) ) ); +// std::find_if( c.begin(),c.end(), std::compose1( std::mem_fun( &class::meth ), std::bind2nd( std::equal_to< T>(), Tcomp ) ) ); +// std::find_if( c.begin(),c.end(), boost::bind( std::equal_to< T >(), Tcomp, boost::bind( &class::meth, _1 ) ) ); +// std::find_if( c.begin(),c.end(), boost::bind( &class::meth, _1 ) == Tcomp ); - it = std::find_if( se.begin(), se.end(), boost::bind( std::equal_to< std::string >(), "planet", boost::bind(&SectorEnvironmentObject::name,_1 ) ) ); + //it = std::find_if( se.begin(), se.end(), boost::bind( std::equal_to< std::string >(), "planet", boost::bind(&SectorEnvironmentObject::name,_1 ) ) ); + it = std::find_if( se.begin(), se.end(), boost::bind( &SectorEnvironmentObject::name, _1 ) == "planet" ); std::cout << "search planet" << std::endl; if ( it != itmax ){ std::cout << " scale cloud 1.005 " << std::endl; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <spo...@us...> - 2009-02-15 14:10:50
|
Revision: 1039 http://opengate.svn.sourceforge.net/opengate/?rev=1039&view=rev Author: spom_spom Date: 2009-02-15 14:10:46 +0000 (Sun, 15 Feb 2009) Log Message: ----------- add temporary DEV key G/Shift-G that de/increase the size of planet cloud Modified Paths: -------------- trunk/src/GameStateManager.cpp trunk/src/KeyMap.cpp trunk/src/Sector.h trunk/src/SectorEnvironmentObject.cpp trunk/src/SectorEnvironmentObject.h trunk/src/SectorMissileObject.cpp trunk/src/UnDockedState.cpp trunk/src/UnDockedState.h Modified: trunk/src/GameStateManager.cpp =================================================================== --- trunk/src/GameStateManager.cpp 2009-02-15 11:49:35 UTC (rev 1038) +++ trunk/src/GameStateManager.cpp 2009-02-15 14:10:46 UTC (rev 1039) @@ -420,7 +420,7 @@ shutdownRequest_ = false; changeGameState( state ); } - +//mRoot->startRendering(); while ( !shutdownRequest_ ){ if ( resources_.inputManager ) resources_.inputManager->capture(); @@ -440,7 +440,7 @@ } } } -#endif +#endif resources_.ogreRoot()->renderOneFrame( ); } } Modified: trunk/src/KeyMap.cpp =================================================================== --- trunk/src/KeyMap.cpp 2009-02-15 11:49:35 UTC (rev 1038) +++ trunk/src/KeyMap.cpp 2009-02-15 14:10:46 UTC (rev 1039) @@ -93,6 +93,9 @@ unDockedActionMap_[ keycode( OIS::KC_F7 ) ] = &UnDockedState::keyActionSpawnAi_DEV; unDockedActionMap_[ keycode( OIS::KC_I, KEY_CONTROL ) ] = &UnDockedState::keyActionShowInfos_DEV; unDockedActionMap_[ keycode( OIS::KC_E, KEY_SHIFT ) ] = &UnDockedState::keyActionShowEcliptic_DEV; + + unDockedActionMap_[ keycode( OIS::KC_G, KEY_SHIFT ) ] = &UnDockedState::keyActionTmpUp_DEV; + unDockedActionMap_[ keycode( OIS::KC_G ) ] = &UnDockedState::keyActionTmpDown_DEV; } bool(UnDockedState::*KeyMap::unDockedKeyAction( const OIS::KeyEvent & e ))(bool) { Modified: trunk/src/Sector.h =================================================================== --- trunk/src/Sector.h 2009-02-15 11:49:35 UTC (rev 1038) +++ trunk/src/Sector.h 2009-02-15 14:10:46 UTC (rev 1039) @@ -57,6 +57,8 @@ const std::set< SectorMeshObject * > & sectorMeshObjects() const { return sectorMeshObjects_; } const std::set< SectorStationObject * > & sectorStationObjects() const { return sectorStations_; } + + const std::set< SectorEnvironmentObject * > & sectorEnvironment() const { return sectorEnvironment_; } /*! Return handle to the avatarObject */ inline SectorAvatarObject * avatarObject() { return avatar_; } Modified: trunk/src/SectorEnvironmentObject.cpp =================================================================== --- trunk/src/SectorEnvironmentObject.cpp 2009-02-15 11:49:35 UTC (rev 1038) +++ trunk/src/SectorEnvironmentObject.cpp 2009-02-15 14:10:46 UTC (rev 1039) @@ -49,8 +49,6 @@ } - - SectorPlanetObject::SectorPlanetObject( const std::string & name, Sector * sector, Ogre::SceneNode * parentNode ) : SectorEnvironmentObject( name, sector, parentNode ){ Modified: trunk/src/SectorEnvironmentObject.h =================================================================== --- trunk/src/SectorEnvironmentObject.h 2009-02-15 11:49:35 UTC (rev 1038) +++ trunk/src/SectorEnvironmentObject.h 2009-02-15 14:10:46 UTC (rev 1039) @@ -51,6 +51,8 @@ /*! Update loop for the environment */ virtual bool update( Ogre::Real elapsedTime ); + inline Ogre::SceneNode * cloudNode() { return cloudNode_; } + protected: //** taken from ogre wiki: http://www.ogre3d.org/wiki/index.php/ManualSphereMeshes void createSphere_( const std::string & name, const float r, const int nRings, const int nSegments ); Modified: trunk/src/SectorMissileObject.cpp =================================================================== --- trunk/src/SectorMissileObject.cpp 2009-02-15 11:49:35 UTC (rev 1038) +++ trunk/src/SectorMissileObject.cpp 2009-02-15 14:10:46 UTC (rev 1039) @@ -34,12 +34,46 @@ SectorMissileObject::SectorMissileObject( const std::string & name, Sector * sector, Missile * missile ) : SectorMovableObject( name, sector, missile ), thrustTrailNode_( NULL ) { reset(); + + thrustTrailNode_ = sector_->sceneManager()->getRootSceneNode()->createChildSceneNode(); + thrustTrail_ = sector_->sceneManager()->createRibbonTrail( name_ + "_RibbonTrail" ); + thrustTrail_->setMaterialName( "BeamGreen" ); + thrustTrail_->setNumberOfChains( 1 ); + thrustTrail_->setMaxChainElements( 200 ); + thrustTrail_->setTrailLength( 1000 ); + thrustTrail_->setColourChange( 0, Ogre::ColourValue( 0.0, 0.0, 0.0, 0.3 ) ); + thrustTrail_->setInitialWidth( 0, 1.0 ); + thrustTrail_->setWidthChange( 0, 0.3 ); + thrustTrail_->addNode( mainNode_ ); } SectorMissileObject::~SectorMissileObject( ){ + if ( thrustTrailNode_ ){ + thrustTrail_->removeNode( mainNode_ ); + sector_->sceneManager()->destroyRibbonTrail( thrustTrail_ ); + sector_->sceneManager()->getRootSceneNode()->removeAndDestroyChild( thrustTrailNode_->getName() ); + thrustTrailNode_ = NULL; + thrustTrail_ = NULL; + } } -Missile * SectorMissileObject::missile() { +void SectorMissileObject::activate_(){ + if ( thrustTrailNode_ ){ + thrustTrailNode_->attachObject( thrustTrail_ ); + thrustTrailNode_->setPosition( mainNode_->getPosition() ); + thrustTrailNode_->setVisible( true ); + } +} + +void SectorMissileObject::deactivate_(){ + if ( thrustTrailNode_ ) { + std::cout << "SectorMissileObject::deactivate_ " << name_ << std::endl; + thrustTrailNode_->setVisible( false ); + thrustTrailNode_->detachObject( thrustTrail_ ); +// thrustTrail_->clearAllChains( ); + } +} + Missile * SectorMissileObject::missile() { return dynamic_cast < Missile * > ( movable_ ); } @@ -123,41 +157,6 @@ return SectorMovableObject::update( elapsedTime ); } -void SectorMissileObject::activate_(){ - if ( !thrustTrailNode_ ){ - thrustTrailNode_ = sector_->sceneManager()->getRootSceneNode()->createChildSceneNode(); - thrustTrail_ = sector_->sceneManager()->createRibbonTrail( name_ + "_RibbonTrail" ); - thrustTrail_->setMaterialName( "BeamGreen" ); - thrustTrail_->setNumberOfChains( 1 ); - thrustTrail_->setMaxChainElements( 200 ); - thrustTrail_->setTrailLength( 1000 ); - thrustTrail_->setColourChange( 0, Ogre::ColourValue( 0.0, 0.0, 0.0, 0.3 ) ); - thrustTrail_->setInitialWidth( 0, 1.0 ); - thrustTrail_->setWidthChange( 0, 0.3 ); - thrustTrail_->addNode( mainNode_ ); - } - thrustTrailNode_->attachObject( thrustTrail_ ); - thrustTrailNode_->setPosition( mainNode_->getPosition() ); - thrustTrailNode_->setVisible( true ); -} - -void SectorMissileObject::deactivate_(){ - if ( thrustTrailNode_ ) { -/* std::cout << "SectorMissileObject::deactivate_ " << name_ << std::endl; - thrustTrail_->removeNode( mainNode_ ); - thrustTrailNode_->detachObject( thrustTrail_ ); - sector_->sceneManager()->getRootSceneNode()->removeAndDestroyChild( thrustTrailNode_->getName() ); - sector_->sceneManager()->destroyRibbonTrail( thrustTrail_ ); - thrustTrailNode_ = NULL; - thrustTrail_ = NULL;*/ - thrustTrailNode_->setVisible( false ); - thrustTrailNode_->detachObject( thrustTrail_ ); - thrustTrail_->clearAllChains( ); - //thrustTrail_->removeNode( mainNode_ ); - - } -} - void SectorMissileObject::launch(){ //maxLifetime_ = 1.0; Modified: trunk/src/UnDockedState.cpp =================================================================== --- trunk/src/UnDockedState.cpp 2009-02-15 11:49:35 UTC (rev 1038) +++ trunk/src/UnDockedState.cpp 2009-02-15 14:10:46 UTC (rev 1039) @@ -37,6 +37,7 @@ #include "OpenALSoundManager.h" #include "RadarObject.h" #include "SectorAvatarObject.h" +#include "SectorEnvironmentObject.h" #include "SectorStationObject.h" #include "EntityManager.h" @@ -44,6 +45,8 @@ #include "OpcodeWrapper.h" #include <iostream> +#include <functional> +#include <boost/bind.hpp> #include <OgreEntity.h> #include <OgreFontManager.h> @@ -1100,6 +1103,49 @@ return true; } +bool UnDockedState::keyActionTmpUp_DEV( bool pressed ){ + if ( pressed ){ + std::set< SectorEnvironmentObject * > se( sector_->sectorEnvironment() ); + std::set< SectorEnvironmentObject * >::iterator it= se.begin(), itmax=se.end(); + for ( ; it != itmax; it ++ ){ + std::cout << " found " << (*it)->name() << std::endl; + } + //std::find( se.begin(), se.end(), ( std::mem_fun( &SectorEnvironmentObject::name ) == "Planet" ) ); +// boost::bind( std::equal_to< std::string >(), +// Login->Token.c_str(), +// boost::bind( &Player::mGetToken, _1 ) ) ); + + it = std::find_if( se.begin(), se.end(), boost::bind( std::equal_to< std::string >(), "planet", boost::bind(&SectorEnvironmentObject::name,_1 ) ) ); + std::cout << "search planet" << std::endl; + if ( it != itmax ){ + std::cout << " scale cloud 1.005 " << std::endl; + dynamic_cast< SectorPlanetObject * >(*it)->cloudNode()->scale( 1.005, 1.005, 1.005 ) ; + } + //std::equal_to< std::string >( "a" ); +// find_if(v.begin(), v.end(), +// compose1(bind2nd(equal_to<int>(),42),mem_fun_ref(&Event::getType))); + } + return true; +} + +bool UnDockedState::keyActionTmpDown_DEV( bool pressed ){ + if ( pressed ){ + std::set< SectorEnvironmentObject * > se( sector_->sectorEnvironment() ); + std::set< SectorEnvironmentObject * >::iterator it= se.begin(), itmax=se.end(); + for ( ; it != itmax; it ++ ){ + std::cout << " found " << (*it)->name() << std::endl; + } + it = std::find_if( se.begin(), se.end(), boost::bind( std::equal_to< std::string >(), "planet", boost::bind(&SectorEnvironmentObject::name,_1 ) ) ); + std::cout << "search planet" << std::endl; + if ( it != itmax ){ + std::cout << " scale cloud 1/1.005 " << std::endl; + dynamic_cast< SectorPlanetObject * >(*it)->cloudNode()->scale( 1./ 1.005, 1./1.005, 1./1.005 ) ; + } + + } + return true; +} + bool UnDockedState::maximiseConsole( ){ if ( overlayRootWindow_ ){ CEGUI::WindowManager::getSingleton().getWindow( (CEGUI::utf8*)"UnDocked/MainWindow/ConsoleFrame")-> Modified: trunk/src/UnDockedState.h =================================================================== --- trunk/src/UnDockedState.h 2009-02-15 11:49:35 UTC (rev 1038) +++ trunk/src/UnDockedState.h 2009-02-15 14:10:46 UTC (rev 1039) @@ -136,6 +136,8 @@ bool keyActionShowInfos_DEV( bool pressed = true ); bool keyActionShowEcliptic_DEV( bool pressed = true ); + bool keyActionTmpUp_DEV( bool pressed = true ); + bool keyActionTmpDown_DEV( bool pressed = true ); protected: UnDockedState( ); virtual ~UnDockedState( ){} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <eg...@us...> - 2009-02-15 12:55:44
|
Revision: 1037 http://opengate.svn.sourceforge.net/opengate/?rev=1037&view=rev Author: egore Date: 2009-02-15 11:48:46 +0000 (Sun, 15 Feb 2009) Log Message: ----------- Convert from Wings3D to blender Added Paths: ----------- templates/data/ships/octavius/condor/condor.blend Removed Paths: ------------- templates/data/ships/octavius/condor/condor.wings Added: templates/data/ships/octavius/condor/condor.blend =================================================================== (Binary files differ) Property changes on: templates/data/ships/octavius/condor/condor.blend ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Deleted: templates/data/ships/octavius/condor/condor.wings =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <eg...@us...> - 2009-02-15 12:55:25
|
Revision: 1038 http://opengate.svn.sourceforge.net/opengate/?rev=1038&view=rev Author: egore Date: 2009-02-15 11:49:35 +0000 (Sun, 15 Feb 2009) Log Message: ----------- drop duplicated Wings3D version Removed Paths: ------------- templates/data/ships/octavius/phoenix/phoenix.wings Deleted: templates/data/ships/octavius/phoenix/phoenix.wings =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <spo...@us...> - 2009-02-15 01:08:34
|
Revision: 1036 http://opengate.svn.sourceforge.net/opengate/?rev=1036&view=rev Author: spom_spom Date: 2009-02-15 01:08:24 +0000 (Sun, 15 Feb 2009) Log Message: ----------- add cfg file Added Paths: ----------- branches/viewCEGUI/resources_viewCEGUI.cfg Added: branches/viewCEGUI/resources_viewCEGUI.cfg =================================================================== --- branches/viewCEGUI/resources_viewCEGUI.cfg (rev 0) +++ branches/viewCEGUI/resources_viewCEGUI.cfg 2009-02-15 01:08:24 UTC (rev 1036) @@ -0,0 +1,7 @@ +[viewCEGUI] +FileSystem=./data/gui/ +FileSystem=./data/gui/schemes/ +FileSystem=./data/gui/layouts/ +FileSystem=./data/gui/imagesets/ +FileSystem=./data/gui/fonts/ +FileSystem=./data/gui/looknfeel/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <spo...@us...> - 2009-02-15 00:47:58
|
Revision: 1035 http://opengate.svn.sourceforge.net/opengate/?rev=1035&view=rev Author: spom_spom Date: 2009-02-15 00:47:48 +0000 (Sun, 15 Feb 2009) Log Message: ----------- some very small changes Modified Paths: -------------- branches/viewCEGUI/ExampleApplication.h branches/viewCEGUI/Makefile branches/viewCEGUI/viewCEGUI.cpp Added Paths: ----------- branches/viewCEGUI/plugins.cfg Removed Paths: ------------- branches/viewCEGUI/resources.cfg Modified: branches/viewCEGUI/ExampleApplication.h =================================================================== --- branches/viewCEGUI/ExampleApplication.h 2009-02-15 00:34:21 UTC (rev 1034) +++ branches/viewCEGUI/ExampleApplication.h 2009-02-15 00:47:48 UTC (rev 1035) @@ -216,7 +216,7 @@ { // Load resource paths from config file ConfigFile cf; - cf.load(mResourcePath + "resources.cfg"); + cf.load(mResourcePath + "resources_viewCEGUI.cfg"); // Go through all sections & settings in the file ConfigFile::SectionIterator seci = cf.getSectionIterator(); Modified: branches/viewCEGUI/Makefile =================================================================== --- branches/viewCEGUI/Makefile 2009-02-15 00:34:21 UTC (rev 1034) +++ branches/viewCEGUI/Makefile 2009-02-15 00:47:48 UTC (rev 1035) @@ -4,8 +4,8 @@ default: viewCEGUI -viewCEGUI: viewCEGUI.cpp - g++ $(INCS) -o viewCEGUI viewCEGUI.cpp $(LIBS) -lCEGUIOgreRenderer +viewCEGUI: viewCEGUI.cpp ExampleApplication.h ExampleFrameListener.h + g++ -g $(INCS) -o viewCEGUI viewCEGUI.cpp $(LIBS) -lCEGUIOgreRenderer clean: - rm -rf *~ + rm -rf *~ viewCEGUI Added: branches/viewCEGUI/plugins.cfg =================================================================== --- branches/viewCEGUI/plugins.cfg (rev 0) +++ branches/viewCEGUI/plugins.cfg 2009-02-15 00:47:48 UTC (rev 1035) @@ -0,0 +1,10 @@ +# Defines plugins to load + +# Define plugin folder +PluginFolder=/usr/lib/OGRE + +# Define D3D rendering implementation plugin +Plugin=RenderSystem_GL.so +Plugin=Plugin_ParticleFX.so +Plugin=Plugin_CgProgramManager.so + Deleted: branches/viewCEGUI/resources.cfg =================================================================== --- branches/viewCEGUI/resources.cfg 2009-02-15 00:34:21 UTC (rev 1034) +++ branches/viewCEGUI/resources.cfg 2009-02-15 00:47:48 UTC (rev 1035) @@ -1,7 +0,0 @@ -[viewCEGUI] -FileSystem=./data/gui/ -FileSystem=./data/gui/schemes/ -FileSystem=./data/gui/layouts/ -FileSystem=./data/gui/imagesets/ -FileSystem=./data/gui/fonts/ -FileSystem=./data/gui/looknfeel/ Modified: branches/viewCEGUI/viewCEGUI.cpp =================================================================== --- branches/viewCEGUI/viewCEGUI.cpp 2009-02-15 00:34:21 UTC (rev 1034) +++ branches/viewCEGUI/viewCEGUI.cpp 2009-02-15 00:47:48 UTC (rev 1035) @@ -101,7 +101,9 @@ ceguiRenderer_ = new CEGUI::OgreCEGUIRenderer(mWindow, Ogre::RENDER_QUEUE_OVERLAY, false, 3000, mSceneMgr); ceguiSystem_ = new CEGUI::System( ceguiRenderer_ ); CEGUI::Logger::getSingleton().setLoggingLevel( CEGUI::Insane ); + CEGUI::SchemeManager::getSingleton().loadScheme((CEGUI::utf8*)"opengate.scheme"); + ceguiSystem_->setDefaultMouseCursor((CEGUI::utf8*)"opengateCursor", (CEGUI::utf8*)"Cursor1"); ceguiSystem_->setDefaultFont((CEGUI::utf8*)"BlueHighway-12"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <spo...@us...> - 2009-02-15 00:34:29
|
Revision: 1034 http://opengate.svn.sourceforge.net/opengate/?rev=1034&view=rev Author: spom_spom Date: 2009-02-15 00:34:21 +0000 (Sun, 15 Feb 2009) Log Message: ----------- Fixed a bug that sometimes lead to segfault on shutdown Modified Paths: -------------- trunk/src/BaseDialog.cpp trunk/src/BaseDialog.h trunk/src/ConfigDialog.cpp trunk/src/ConfigDialog.h trunk/src/Console.cpp trunk/src/DockedState.cpp trunk/src/Entity.cpp trunk/src/GameState.h trunk/src/GameStateManager.cpp trunk/src/Opengate.h trunk/src/ShipConfigDialog.cpp trunk/src/UnDockedState.cpp trunk/src/UnDockedState.h trunk/src/opengateclient.cpp Modified: trunk/src/BaseDialog.cpp =================================================================== --- trunk/src/BaseDialog.cpp 2009-02-14 23:14:07 UTC (rev 1033) +++ trunk/src/BaseDialog.cpp 2009-02-15 00:34:21 UTC (rev 1034) @@ -75,14 +75,20 @@ : rootWindow_( CEGUI::WindowManager::getSingleton().loadWindowLayout( layout ) ), resources_( ResourceManager::getSingletonPtr() ), visible_( false ) { hide(); + //** attach this window if parent is valid +// if ( resources_->guiSystem ){ +// if ( resources_->guiSystem->getGUISheet() ){ +// resources_->guiSystem->getGUISheet()->addChildWindow( rootWindow_ ); +// } +// } } BaseDialog::~BaseDialog(){ - if ( resources_->guiSystem ){ - if ( resources_->guiSystem->getGUISheet() ){ - resources_->guiSystem->getGUISheet()->removeChildWindow( rootWindow_ ); - } - } +// if ( resources_->guiSystem ){ +// if ( resources_->guiSystem->getGUISheet() ){ +// resources_->guiSystem->getGUISheet()->removeChildWindow( rootWindow_ ); +// } +// } CEGUI::WindowManager::getSingleton().destroyWindow( rootWindow_ ); } Modified: trunk/src/BaseDialog.h =================================================================== --- trunk/src/BaseDialog.h 2009-02-14 23:14:07 UTC (rev 1033) +++ trunk/src/BaseDialog.h 2009-02-15 00:34:21 UTC (rev 1034) @@ -21,19 +21,12 @@ #ifndef _OPENGATE_BASEDIALOG__H #define _OPENGATE_BASEDIALOG__H -//#include "GameState.h" +#include "Opengate.h" #include <string> -namespace CEGUI{ -class Window; -class String; -} - namespace OpenGate{ -class ResourceManager; - void renameClonedWindows( const CEGUI::Window * parent, const CEGUI::String & namePrefix ); void fitWindowToImage( const std::string & name, CEGUI::Window * win ); float windowHeight( const CEGUI::Window * child ); Modified: trunk/src/ConfigDialog.cpp =================================================================== --- trunk/src/ConfigDialog.cpp 2009-02-14 23:14:07 UTC (rev 1033) +++ trunk/src/ConfigDialog.cpp 2009-02-15 00:34:21 UTC (rev 1034) @@ -21,6 +21,7 @@ #include "ConfigDialog.h" #include "common.h" #include "GameStateManager.h" +#include <CEGUI/CEGUIWindowManager.h> #include <CEGUI/elements/CEGUIPushButton.h> #include <CEGUI/elements/CEGUIListbox.h> #include <CEGUI/elements/CEGUIListboxTextItem.h> Modified: trunk/src/ConfigDialog.h =================================================================== --- trunk/src/ConfigDialog.h 2009-02-14 23:14:07 UTC (rev 1033) +++ trunk/src/ConfigDialog.h 2009-02-15 00:34:21 UTC (rev 1034) @@ -21,13 +21,9 @@ #ifndef _OPENGATE_CONFIGDIALOG__H #define _OPENGATE_CONFIGDIALOG__H +#include "Opengate.h" #include "BaseDialog.h" -namespace CEGUI{ - class Listbox; - class EventArgs; -} - namespace OpenGate{ class ConfigDialog : public BaseDialog{ Modified: trunk/src/Console.cpp =================================================================== --- trunk/src/Console.cpp 2009-02-14 23:14:07 UTC (rev 1033) +++ trunk/src/Console.cpp 2009-02-15 00:34:21 UTC (rev 1034) @@ -31,6 +31,7 @@ #include "KeyMap.h" #include <OgreRenderWindow.h> +#include <CEGUI/CEGUIWindowManager.h> #include <CEGUI/elements/CEGUIEditbox.h> #include <CEGUI/elements/CEGUIListbox.h> #include <CEGUI/elements/CEGUIListboxTextItem.h> Modified: trunk/src/DockedState.cpp =================================================================== --- trunk/src/DockedState.cpp 2009-02-14 23:14:07 UTC (rev 1033) +++ trunk/src/DockedState.cpp 2009-02-15 00:34:21 UTC (rev 1034) @@ -31,6 +31,9 @@ #include <OgreRenderWindow.h> #include <OgreManualObject.h> #include <OgreCEGUITexture.h> + +#include <CEGUI/CEGUIImageset.h> +#include <CEGUI/CEGUIWindowManager.h> #include <CEGUI/elements/CEGUIPushButton.h> @@ -57,8 +60,6 @@ // camera->setAspectRatio( (Ogre::Real)resources_->renderWindow->getViewport( 0 )->getActualWidth() / // (Ogre::Real)resources_->renderWindow->getViewport( 0 )->getActualHeight() ); - overlayRootWindow_ = CEGUI::WindowManager::getSingleton().loadWindowLayout((CEGUI::utf8*)"opengateDocked.layout"); - cursorFrame_ = 1; cursorMaxFrames_ = CEGUI::ImagesetManager::getSingleton().getImageset( "opengateCursor" )->getImageCount(); lastCursorFrameTime_ = 0.0f; @@ -84,6 +85,7 @@ backgroundNode->setPosition( Ogre::Vector3( 0.0, 0.0, -1650 ) ); backgroundNode->pitch( Ogre::Degree( 180 ) ); + overlayRootWindow_ = CEGUI::WindowManager::getSingleton().loadWindowLayout((CEGUI::utf8*)"opengateDocked.layout"); shipConfigDialog_ = new ShipConfigDialog( sceneMgr_ ); overlayRootWindow_->addChildWindow( shipConfigDialog_->rootWindow() ); marketDialog_ = new MarketDialog( ); @@ -97,22 +99,23 @@ } void DockedState::destroyContent(){ - if ( shipConfigDialog_ ) delete shipConfigDialog_; - if ( marketDialog_ ) delete marketDialog_; + if ( shipConfigDialog_ ) delete shipConfigDialog_; + if ( marketDialog_ ) delete marketDialog_; - OpenALSoundManager::getSingleton().destroySoundSource( backgroundSound_ ); - OpenALSoundManager::getSingleton().destroySoundSource( clickSound_ ); + OpenALSoundManager::getSingleton().destroySoundSource( backgroundSound_ ); + OpenALSoundManager::getSingleton().destroySoundSource( clickSound_ ); - sceneMgr_->destroyManualObject( "BackgroundObject" ); - sceneMgr_->getRootSceneNode()->removeAndDestroyChild( "Background" ); - sceneMgr_->destroyCamera( "StationCamera" ); + sceneMgr_->destroyManualObject( "BackgroundObject" ); + sceneMgr_->getRootSceneNode()->removeAndDestroyChild( "Background" ); + sceneMgr_->destroyCamera( "StationCamera" ); - CEGUI::WindowManager::getSingleton().destroyWindow( overlayRootWindow_ ); - resources_->ogreRoot()->destroySceneManager( sceneMgr_ ); + CEGUI::WindowManager::getSingleton().destroyWindow( overlayRootWindow_ ); + resources_->ogreRoot()->destroySceneManager( sceneMgr_ ); } void DockedState::enter( ) { log_->info("Entering " + this->name() ); + resources_->guiRenderer->setTargetSceneManager( sceneMgr_ ); resources_->guiSystem->setGUISheet( overlayRootWindow_ ); overlayRootWindow_->show(); @@ -144,13 +147,19 @@ CEGUI::WindowManager::getSingleton().getWindow( (CEGUI::utf8*)"Config/BackButton" )->removeEvent( CEGUI::PushButton::EventClicked ); - overlayRootWindow_->hide(); resources_->console->stop(); CEGUI::MouseCursor::getSingleton().hide(); resources_->renderWindow->removeAllViewports(); + resources_->inputManager->removeKeyListener( "DockedStateKeyListener" ); resources_->inputManager->removeMouseListener( "DockedStateMouseListener" ); + + overlayRootWindow_->hide(); + resources_->guiRenderer->setTargetSceneManager( NULL ); +// resources_->guiRenderer->setTargetSceneManager( sceneMgr_ ); + // resources_->guiSystem->removeGUISheet( overlayRootWindow_ ); + } void DockedState::changeToUnDockedState(){ Modified: trunk/src/Entity.cpp =================================================================== --- trunk/src/Entity.cpp 2009-02-14 23:14:07 UTC (rev 1033) +++ trunk/src/Entity.cpp 2009-02-15 00:34:21 UTC (rev 1034) @@ -105,20 +105,22 @@ } bool Entity::initialiseImage( const std::string & imageName, const std::string & targetName, bool verbose ){ - bool fail = false; - CEGUI::Texture * texture = NULL; + bool fail = true; + CEGUI::Texture * texture = NULL; - try { - texture = dynamic_cast< CEGUI::OgreCEGUIRenderer * >( ResourceManager::getSingleton().guiRenderer )->createTexture( imageName, "Opengate"); - } catch( CEGUI::Exception & e ){ - if ( verbose ) LogManager::getSingleton().warn( e.getMessage().c_str() ); - fail = true; - } catch( Ogre::Exception & e ){ - if ( verbose ) LogManager::getSingleton().warn( e.what() ); - fail = true; - } catch( ... ){ - if ( verbose ) LogManager::getSingleton().warn( "Unknown exception" ); - } + try { + texture = dynamic_cast< CEGUI::OgreCEGUIRenderer * >( ResourceManager::getSingleton().guiRenderer )->createTexture( imageName, "Opengate"); + fail = false; + } catch( CEGUI::Exception & e ){ + LogManager::getSingleton().warn( e.getMessage().c_str() ); + fail = true; + } catch( Ogre::Exception & e ){ + LogManager::getSingleton().warn( e.what() ); + fail = true; + } catch( ... ){ + LogManager::getSingleton().warn( "Unknown exception" ); + fail = true; + } if ( !fail && texture ){ CEGUI::Imageset * imageSet = CEGUI::ImagesetManager::getSingleton().createImageset( targetName, texture ); Modified: trunk/src/GameState.h =================================================================== --- trunk/src/GameState.h 2009-02-14 23:14:07 UTC (rev 1033) +++ trunk/src/GameState.h 2009-02-15 00:34:21 UTC (rev 1034) @@ -21,25 +21,24 @@ #ifndef _OPENGATE_GAMESTATELISTENER__H #define _OPENGATE_GAMESTATELISTENER__H -// Necessary hack for CEGUI -//#include <OgreNoMemoryMacros.h> #include <CEGUI/CEGUIImageset.h> #include <CEGUI/CEGUISystem.h> #include <CEGUI/CEGUILogger.h> #include <CEGUI/CEGUISchemeManager.h> #include <CEGUI/CEGUIWindowManager.h> #include <CEGUI/CEGUIWindow.h> -#include "OgreCEGUIRenderer.h" -#include "OgreCEGUIResourceProvider.h" -//regular mem handler -//#include <OgreMemoryMacros.h> +// #include "OgreCEGUIRenderer.h" +// #include "OgreCEGUIResourceProvider.h" -#include <OgreFrameListener.h> +#include "Opengate.h" -#include <string> #include "ResourceManager.h" #include "InputManager.h" +#include <OgreFrameListener.h> + +#include <string> + namespace OpenGate{ /*! @@ -152,7 +151,7 @@ return CEGUI::LeftButton; } } - + CEGUI::Window * rootWindow() { return overlayRootWindow_; } protected: Modified: trunk/src/GameStateManager.cpp =================================================================== --- trunk/src/GameStateManager.cpp 2009-02-14 23:14:07 UTC (rev 1033) +++ trunk/src/GameStateManager.cpp 2009-02-15 00:34:21 UTC (rev 1034) @@ -48,6 +48,9 @@ #include <OgreRoot.h> #include <OgreWindowEventUtilities.h> +#include <OgreCEGUIRenderer.h> +#include <CEGUIExceptions.h> + namespace OpenGate { class NetworkClient; @@ -98,10 +101,12 @@ delete resources_.soundManager; resources_.soundManager = NULL; } + if ( resources_.guiRenderer ) { log_->info( "Shutdown CEGUI manager." ); delete resources_.guiSystem; - //delete resources_.guiRenderer; + // resources_.guiRenderer->setTargetSceneManager( NULL ); + delete resources_.guiRenderer; } if ( resources_.inputManager ) { log_->info( "Shutdown inputmanager." ); Modified: trunk/src/Opengate.h =================================================================== --- trunk/src/Opengate.h 2009-02-14 23:14:07 UTC (rev 1033) +++ trunk/src/Opengate.h 2009-02-15 00:34:21 UTC (rev 1034) @@ -31,6 +31,9 @@ } namespace CEGUI{ class Window; + class String; + class EventArgs; + class Listbox; } namespace OpenGate{ Modified: trunk/src/ShipConfigDialog.cpp =================================================================== --- trunk/src/ShipConfigDialog.cpp 2009-02-14 23:14:07 UTC (rev 1033) +++ trunk/src/ShipConfigDialog.cpp 2009-02-15 00:34:21 UTC (rev 1034) @@ -42,24 +42,6 @@ #include <CEGUIImageset.h> #include <CEGUI/elements/CEGUIPushButton.h> - -namespace CEGUI{ -//** dont know why, but these two functions are not defined in libCEUGUOgreRenderer.so ?????? -void OgreCEGUITexture::freeOgreTexture(void){ - if ((!d_ogre_texture.isNull()) && !d_isLinked) { - Ogre::TextureManager::getSingleton().remove(d_ogre_texture->getHandle()); - } - d_ogre_texture.setNull(); -} -void OgreCEGUITexture::setOgreTexture(Ogre::TexturePtr& texture){ - freeOgreTexture(); - d_ogre_texture = texture; - d_width = d_ogre_texture->getWidth(); - d_height = d_ogre_texture->getHeight(); - d_isLinked = true; -} -} - namespace OpenGate{ ShipConfigDialog::ShipConfigDialog( Ogre::SceneManager * sceneMgr ) @@ -75,12 +57,12 @@ updateShipView( true ); - //** attach this window if parent is valid - if ( resources_->guiSystem ){ - if ( resources_->guiSystem->getGUISheet() ){ - resources_->guiSystem->getGUISheet()->addChildWindow( rootWindow_ ); - } - } +// //** attach this window if parent is valid +// if ( resources_->guiSystem ){ +// if ( resources_->guiSystem->getGUISheet() ){ +// resources_->guiSystem->getGUISheet()->addChildWindow( rootWindow_ ); +// } +// } populateEquipmentButtons( ); updateEquipmentView(); @@ -96,7 +78,6 @@ //resources_->guiRenderer->destroyTexture( ceguiTex_ ); - } void ShipConfigDialog::setupEventHandlers(){ Modified: trunk/src/UnDockedState.cpp =================================================================== --- trunk/src/UnDockedState.cpp 2009-02-14 23:14:07 UTC (rev 1033) +++ trunk/src/UnDockedState.cpp 2009-02-15 00:34:21 UTC (rev 1034) @@ -55,6 +55,8 @@ #include <OgreTextAreaOverlayElement.h> #include <OgreMaterialManager.h> +#include <OgreCEGUIRenderer.h> + #include <CEGUI/elements/CEGUIPushButton.h> namespace OpenGate{ @@ -80,7 +82,7 @@ //** initialise collosion Manager resources_->collisionManager->init( sceneMgr_ ); - + //** create cameras mainCamera_ = sceneMgr_->createCamera( "MainCamera" ); mainCamera_->setNearClipDistance( 1 ); @@ -89,14 +91,17 @@ secondCamera_ = sceneMgr_->createCamera( "SecondCamera" ); secondCamera_->setNearClipDistance( 1 ); + overlayRootWindow_ = CEGUI::WindowManager::getSingleton().loadWindowLayout((CEGUI::utf8*)"opengateUnDocked.layout"); + //** this should be directly associated to the sector, MOVE this soundBackround_ = OpenALSoundManager::getSingleton().createSoundSourceFromRessource( "sounds/undocked/defaultMusic", "sectorBackground", true, true ); } void UnDockedState::destroyContent( ){ - //** remove backward all stuff that is created within UnDockedState::createContent( ) + //! remove backward all stuff that is created within UnDockedState::createContent( ) OpenALSoundManager::getSingleton().destroySoundSource( soundBackround_ ); + CEGUI::WindowManager::getSingleton().destroyWindow( overlayRootWindow_ ); sceneMgr_->destroyAllCameras(); resources_->collisionManager->free( ); root_->destroySceneManager( sceneMgr_ ); @@ -106,7 +111,7 @@ log_->info( "Entering " + this->name() ); try { //** load CEGUI-HUD layout - overlayRootWindow_ = CEGUI::WindowManager::getSingleton().loadWindowLayout((CEGUI::utf8*)"opengateUnDocked.layout"); + resources_->guiRenderer->setTargetSceneManager( sceneMgr_ ); if ( overlayRootWindow_ ){ resources_->guiSystem->setGUISheet( overlayRootWindow_ ); @@ -177,7 +182,7 @@ schemeIdx_ = 0; setScheme_(); aniso_ = 1; - filtering_ = Ogre::TFO_BILINEAR; + // filtering_ = Ogre::TFO_BILINEAR; if ( resources_->console ){ CEGUI::WindowManager::getSingleton().getWindow( (CEGUI::utf8*)"ConsoleList__auto_vscrollbar__")->hide(); @@ -243,7 +248,11 @@ if ( hud_ ) { delete hud_; hud_ = NULL; } if ( sector_ ) { delete sector_; sector_ = NULL; } - if ( overlayRootWindow_ ) CEGUI::WindowManager::getSingleton().destroyWindow( overlayRootWindow_ ); + + overlayRootWindow_->hide(); + resources_->guiRenderer->setTargetSceneManager( NULL ); +// resources_->guiRenderer->setTargetSceneManager( sceneMgr_ ); +// resources_->guiSystem->setGUISheet( overlayRootWindow_ ); log_->info("Exiting finished." ); } @@ -281,7 +290,6 @@ bool UnDockedState::frameEnded( const Ogre::FrameEvent & evt ){ if ( enterDockedState_ ) { - std::cout << "UnDockedState::frameEnded( const Ogre::FrameEvent & evt ){" << std::endl; parent_->changeGameState( parent_->findByName( "DockedState" ) ); return false; } @@ -976,24 +984,24 @@ bool UnDockedState::keyActionToggleFiltering_DEV( bool pressed ){ if ( pressed ){ - switch( filtering_ ) { - case Ogre::TFO_BILINEAR: - filtering_ = Ogre::TFO_TRILINEAR; - aniso_ = 1; - break; - case Ogre::TFO_TRILINEAR: - filtering_ = Ogre::TFO_ANISOTROPIC; - aniso_ = 8; - break; - case Ogre::TFO_ANISOTROPIC: - filtering_ = Ogre::TFO_BILINEAR; - aniso_ = 1; - break; - default: - break; - } - Ogre::MaterialManager::getSingleton().setDefaultTextureFiltering( filtering_ ); - Ogre::MaterialManager::getSingleton().setDefaultAnisotropy( aniso_ ); +// switch( filtering_ ) { +// case Ogre::TFO_BILINEAR: +// filtering_ = Ogre::TFO_TRILINEAR; +// aniso_ = 1; +// break; +// case Ogre::TFO_TRILINEAR: +// filtering_ = Ogre::TFO_ANISOTROPIC; +// aniso_ = 8; +// break; +// case Ogre::TFO_ANISOTROPIC: +// filtering_ = Ogre::TFO_BILINEAR; +// aniso_ = 1; +// break; +// default: +// break; +// } +// Ogre::MaterialManager::getSingleton().setDefaultTextureFiltering( filtering_ ); +// Ogre::MaterialManager::getSingleton().setDefaultAnisotropy( aniso_ ); } return true; } Modified: trunk/src/UnDockedState.h =================================================================== --- trunk/src/UnDockedState.h 2009-02-14 23:14:07 UTC (rev 1033) +++ trunk/src/UnDockedState.h 2009-02-15 00:34:21 UTC (rev 1034) @@ -24,6 +24,8 @@ #include "GameState.h" #include "LogManager.h" + +#include <OgreVector2.h> namespace OpenGate{ /*! @@ -195,7 +197,7 @@ int schemeIdx_; double timeZoom_; - Ogre::TextureFilterOptions filtering_; + // Ogre::TextureFilterOptions filtering_; int aniso_; OpenALSoundSource * soundBackround_; Modified: trunk/src/opengateclient.cpp =================================================================== --- trunk/src/opengateclient.cpp 2009-02-14 23:14:07 UTC (rev 1033) +++ trunk/src/opengateclient.cpp 2009-02-15 00:34:21 UTC (rev 1034) @@ -35,6 +35,7 @@ #include "metaserver.h" #include <getopt.h> +#include <OgreException.h> int main( int argc, char * argv[ ] ) { int option_dialog = 0; @@ -189,7 +190,7 @@ } try { - bool withIntro = false; + bool withIntro = true; OpenGate::GameStateManager gameStateMgr( nw, option_dialog ); if ( withIntro ){ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <eg...@us...> - 2009-02-14 23:14:10
|
Revision: 1033 http://opengate.svn.sourceforge.net/opengate/?rev=1033&view=rev Author: egore Date: 2009-02-14 23:14:07 +0000 (Sat, 14 Feb 2009) Log Message: ----------- commit a bunch of autotools changes I had sitting on my harddisk Modified Paths: -------------- trunk/Makefile.am trunk/configure.ac Added Paths: ----------- trunk/m4/as-compiler-flag.m4 Modified: trunk/Makefile.am =================================================================== --- trunk/Makefile.am 2009-02-14 19:11:43 UTC (rev 1032) +++ trunk/Makefile.am 2009-02-14 23:14:07 UTC (rev 1033) @@ -1,12 +1,13 @@ -AUTOMAKE_OPTIONS = dist-bzip2 +# Copyright 2008 Christoph Brill -SUBDIRS = src \ - data +AUTOMAKE_OPTIONS = foreign +SUBDIRS = src data ACLOCAL_AMFLAGS = -I m4 EXTRA_DIST = \ - autogen.sh + autogen.sh \ + m4/as-compiler-flag.m4 distclean: maintainer-clean rm -rf *~ Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2009-02-14 19:11:43 UTC (rev 1032) +++ trunk/configure.ac 2009-02-14 23:14:07 UTC (rev 1033) @@ -1,19 +1,26 @@ -dnl Process this file with autoconf to produce a configure script. -dnl Created by Anjuta application wizard. +# Copyright 2008 Christoph Brill. -AC_PREREQ(2.59) +AC_PREREQ([2.59]) AC_INIT([opengate], [0.0.1], [http://sourceforge.net/projects/opengate/]) -AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION, [dist-bzip2]) -AM_CONFIG_HEADER(config.h) +AC_CONFIG_SRCDIR([Makefile.am]) +AC_CONFIG_AUX_DIR(.) AC_CONFIG_MACRO_DIR([m4]) +AM_INIT_AUTOMAKE([dist-bzip2]) + AM_MAINTAINER_MODE -AM_INIT_AUTOMAKE(opengate, 0.0.1) +AM_CONFIG_HEADER([config.h]) + +dnl set compiler warnings based on http://blogs.gnome.org/otte/2008/12/22/warning-options/ +AS_COMPILER_FLAGS(GLOBAL_CFLAGS, "-Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -Wredundant-decls -Wmissing-noreturn -Wpointer-arith -Wcast-align -Wwrite-strings -Winline -Wformat-nonliteral -Wformat-security -Wswitch-enum -Wswitch-default -Winit-self -Wmissing-include-dirs -Wundef -Waggregate-return -Wmissing-format-attribute -Wunsafe-loop-optimizations -Wpacked -Winvalid-pch -Wsync-nand") + +# Checks for programs. AC_ISC_POSIX AC_LANG_CPLUSPLUS AC_PROG_CXX AM_PROG_CC_STDC +AC_PROG_LIBTOOL AC_HEADER_STDC AM_PROG_CC_C_O AC_C_CONST @@ -39,8 +46,7 @@ # Check for defines AC_CHECK_TYPES([ptrdiff_t]) -AM_PROG_LIBTOOL - +# Checks for pkg-config packages PKG_CHECK_MODULES(OGRE, [OGRE >= 1.4.0]) AC_SUBST(OGRE_CFLAGS) AC_SUBST(OGRE_LIBS) @@ -91,15 +97,6 @@ [AC_MSG_ERROR([*** boost_system library not found!])] ) -# no more needed cause of boost-1.36 deps -# TODO: fix this part -#AC_CHECK_HEADER([asio.hpp],, -#[ -# echo "Can't find asio headers-0.3.8. Please install the asio development packages." -# echo "You can get them from http://sourceforge.net/projects/asio/" -# exit 1 -#],[]) - AC_OUTPUT([ Makefile data/Makefile Added: trunk/m4/as-compiler-flag.m4 =================================================================== --- trunk/m4/as-compiler-flag.m4 (rev 0) +++ trunk/m4/as-compiler-flag.m4 2009-02-14 23:14:07 UTC (rev 1033) @@ -0,0 +1,62 @@ +dnl as-compiler-flag.m4 0.1.0 + +dnl autostars m4 macro for detection of compiler flags + +dnl David Schleef <ds...@sc...> + +dnl $Id: as-compiler-flag.m4,v 1.1 2005/12/15 23:35:19 ds Exp $ + +dnl AS_COMPILER_FLAG(CFLAGS, ACTION-IF-ACCEPTED, [ACTION-IF-NOT-ACCEPTED]) +dnl Tries to compile with the given CFLAGS. +dnl Runs ACTION-IF-ACCEPTED if the compiler can compile with the flags, +dnl and ACTION-IF-NOT-ACCEPTED otherwise. + +AC_DEFUN([AS_COMPILER_FLAG], +[ + AC_MSG_CHECKING([to see if compiler understands $1]) + + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $1" + + AC_TRY_COMPILE([ ], [], [flag_ok=yes], [flag_ok=no]) + CFLAGS="$save_CFLAGS" + + if test "X$flag_ok" = Xyes ; then + m4_ifvaln([$2],[$2]) + true + else + m4_ifvaln([$3],[$3]) + true + fi + AC_MSG_RESULT([$flag_ok]) +]) + +dnl AS_COMPILER_FLAGS(VAR, FLAGS) +dnl Tries to compile with the given CFLAGS. + +AC_DEFUN([AS_COMPILER_FLAGS], +[ + list=$2 + flags_supported="" + flags_unsupported="" + AC_MSG_CHECKING([for supported compiler flags]) + for each in $list + do + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $each" + AC_TRY_COMPILE([ ], [], [flag_ok=yes], [flag_ok=no]) + CFLAGS="$save_CFLAGS" + + if test "X$flag_ok" = Xyes ; then + flags_supported="$flags_supported $each" + else + flags_unsupported="$flags_unsupported $each" + fi + done + AC_MSG_RESULT([$flags_supported]) + if test "X$flags_unsupported" != X ; then + AC_MSG_WARN([unsupported compiler flags: $flags_unsupported]) + fi + $1="$$1 $flags_supported" +]) + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <spo...@us...> - 2009-02-14 19:11:58
|
Revision: 1032 http://opengate.svn.sourceforge.net/opengate/?rev=1032&view=rev Author: spom_spom Date: 2009-02-14 19:11:43 +0000 (Sat, 14 Feb 2009) Log Message: ----------- Forgot 2 files Added Paths: ----------- trunk/src/SectorEnvironmentObject.cpp trunk/src/SectorEnvironmentObject.h Added: trunk/src/SectorEnvironmentObject.cpp =================================================================== --- trunk/src/SectorEnvironmentObject.cpp (rev 0) +++ trunk/src/SectorEnvironmentObject.cpp 2009-02-14 19:11:43 UTC (rev 1032) @@ -0,0 +1,332 @@ +/*************************************************************************** + * Copyright (C) 2009 by OpenGate development team * + * spo...@us... * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include "SectorEnvironmentObject.h" + +#include "LogManager.h" +#include "Sector.h" + +#include <OgreEntity.h> +#include <OgreLight.h> +#include <OgreManualObject.h> +#include <OgreMeshManager.h> +#include <OgreSceneManager.h> +#include <OgreSceneNode.h> +#include <OgreSubMesh.h> +#include <OgreVector3.h> + + +namespace OpenGate{ + +SectorEnvironmentObject::SectorEnvironmentObject( const std::string & name, Sector * sector, Ogre::SceneNode * parentNode ) + : SectorBaseObject( name, sector, parentNode ){ + +} + +SectorEnvironmentObject::~SectorEnvironmentObject( ){ + +} + +bool SectorEnvironmentObject::update( Ogre::Real elapsedTime ){ + return true; +} + + + + +SectorPlanetObject::SectorPlanetObject( const std::string & name, Sector * sector, Ogre::SceneNode * parentNode ) + : SectorEnvironmentObject( name, sector, parentNode ){ + + cloudNode_ = NULL; + cloudEntity_ = NULL; + + //planet_->lighting( true ); + createSphere_( name + "/Mesh", 15000.0f, 64, 64 ); + + entity_ = sector_->sceneManager()->createEntity( name, name + "/Mesh" ); + entity_->setMaterialName( "Planet" ); + + mainNode_->attachObject( entity_ ); + mainNode_->setPosition( Ogre::Vector3( 0000.0, 0000.0, 50000 ) ); + //planetNode_->pitch( Ogre::Degree(30) ); + + cloudNode_ = mainNode_->createChildSceneNode( mainNode_->getName() + "/cloud" ); + + cloudEntity_ = entity_->clone( cloudNode_->getName() ); + cloudEntity_->setMaterialName( "Planet/Cloud" ); + + cloudNode_->attachObject( cloudEntity_ ); + cloudNode_->scale(1.015, 1.015, 1.015); + + light_ = sector_->sceneManager()->createLight( name + "-light"); + light_->setDiffuseColour( 0.1, 0.1, 0.1 ); + light_->setSpecularColour( 0.4, 0.4, 0.4 ); + mainNode_->attachObject( light_ ); + light_->setVisible( true ); + +} + +SectorPlanetObject::~SectorPlanetObject( ){ + mainNode_->detachObject( light_ ); + sector_->sceneManager()->destroyLight( light_->getName() ); + + if ( cloudNode_ ){ + if ( cloudEntity_ ){ + cloudNode_->detachObject( cloudEntity_ ); + sector_->sceneManager()->destroyEntity( cloudEntity_ ); + } + mainNode_->removeAndDestroyChild( cloudNode_->getName() ); + } + + Ogre::MeshManager::getSingleton().remove( name_ + "/Mesh" ); + mainNode_->detachObject( entity_ ); + sector_->sceneManager()->destroyEntity( entity_ ); + +} + +bool SectorPlanetObject::update( Ogre::Real elapsedTime ){ + mainNode_->yaw( Ogre::Degree( 0.2 * elapsedTime ) ); + cloudNode_->yaw( Ogre::Degree( 0.1 * elapsedTime ) ); + return true; +} + +void SectorPlanetObject::createSphere_( const std::string & name, const float r, const int nRings, const int nSegments ){ + Ogre::MeshPtr pSphere = Ogre::MeshManager::getSingleton().createManual( name, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME ); + Ogre::SubMesh *pSphereVertex = pSphere->createSubMesh(); + + pSphere->sharedVertexData = new Ogre::VertexData(); + Ogre::VertexData* vertexData = pSphere->sharedVertexData; + + // define the vertex format + Ogre::VertexDeclaration * vertexDecl = vertexData->vertexDeclaration; + size_t currOffset = 0; + // positions + vertexDecl->addElement(0, currOffset, Ogre::VET_FLOAT3, Ogre::VES_POSITION); + currOffset += Ogre::VertexElement::getTypeSize(Ogre::VET_FLOAT3); + // normals + vertexDecl->addElement(0, currOffset, Ogre::VET_FLOAT3, Ogre::VES_NORMAL); + currOffset += Ogre::VertexElement::getTypeSize(Ogre::VET_FLOAT3); + // two dimensional texture coordinates + vertexDecl->addElement(0, currOffset, Ogre::VET_FLOAT2, Ogre::VES_TEXTURE_COORDINATES, 0); + currOffset += Ogre::VertexElement::getTypeSize(Ogre::VET_FLOAT2); + + // allocate the vertex buffer + vertexData->vertexCount = (nRings + 1) * (nSegments+1); + Ogre::HardwareVertexBufferSharedPtr vBuf = Ogre::HardwareBufferManager::getSingleton().createVertexBuffer( + vertexDecl->getVertexSize(0), vertexData->vertexCount, + Ogre::HardwareBuffer::HBU_STATIC_WRITE_ONLY, false); + Ogre::VertexBufferBinding* binding = vertexData->vertexBufferBinding; + binding->setBinding(0, vBuf); + float * pVertex = static_cast<float*>(vBuf->lock(Ogre::HardwareBuffer::HBL_DISCARD)); + + // allocate index buffer + pSphereVertex->indexData->indexCount = 6 * nRings * (nSegments + 1); + pSphereVertex->indexData->indexBuffer = Ogre::HardwareBufferManager::getSingleton().createIndexBuffer( + Ogre::HardwareIndexBuffer::IT_16BIT, pSphereVertex->indexData->indexCount, + Ogre::HardwareBuffer::HBU_STATIC_WRITE_ONLY, false); + Ogre::HardwareIndexBufferSharedPtr iBuf = pSphereVertex->indexData->indexBuffer; + unsigned short* pIndices = static_cast<unsigned short*>(iBuf->lock(Ogre::HardwareBuffer::HBL_DISCARD)); + + float fDeltaRingAngle = (Ogre::Math::PI / nRings); + float fDeltaSegAngle = (2.0 * Ogre::Math::PI / nSegments); + unsigned short wVerticeIndex = 0 ; + + //! Generate the group of rings for the sphere + for ( int ring = 0; ring <= nRings; ring++ ) { + float r0 = r * sinf (ring * fDeltaRingAngle); + float y0 = r * cosf (ring * fDeltaRingAngle); + + //! Generate the group of segments for the current ring + for (int seg = 0; seg <= nSegments; seg++) { + float x0 = r0 * sinf(seg * fDeltaSegAngle); + float z0 = r0 * cosf(seg * fDeltaSegAngle); + + //! Add one vertex to the strip which makes up the sphere + *pVertex++ = x0; + *pVertex++ = y0; + *pVertex++ = z0; + + Ogre::Vector3 vNormal = Ogre::Vector3(x0, y0, z0).normalisedCopy(); + *pVertex++ = vNormal.x; + *pVertex++ = vNormal.y; + *pVertex++ = vNormal.z; + + *pVertex++ = (float) seg / (float) nSegments; + *pVertex++ = (float) ring / (float) nRings; + + if (ring != nRings) { + //! each vertex (except the last) has six indices pointing to it + *pIndices++ = wVerticeIndex + nSegments + 1; + *pIndices++ = wVerticeIndex; + *pIndices++ = wVerticeIndex + nSegments; + *pIndices++ = wVerticeIndex + nSegments + 1; + *pIndices++ = wVerticeIndex + 1; + *pIndices++ = wVerticeIndex; + wVerticeIndex ++; + } + } //! end for seg + } //! end for ring + + vBuf->unlock(); + iBuf->unlock(); + + //! Generate face list + pSphereVertex->useSharedVertices = true; + + //! the original code was missing this line: + pSphere->_setBounds( Ogre::AxisAlignedBox( Ogre::Vector3(-r, -r, -r), Ogre::Vector3(r, r, r) ), false ); + pSphere->_setBoundingSphereRadius( r ); + //! this line makes clear the mesh is loaded (avoids memory leaks) + pSphere->load(); + + Ogre::MeshPtr pMesh = Ogre::MeshManager::getSingleton().load( name, + Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, + Ogre::HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY, + Ogre::HardwareBuffer::HBU_STATIC_WRITE_ONLY, + true, true); + unsigned short src, dest; + + if ( !pMesh->suggestTangentVectorBuildParams( Ogre::VES_TANGENT, src, dest) ) { + pMesh->buildTangentVectors( Ogre::VES_TANGENT, src, dest ); + } +} + +SectorEclipticObject::SectorEclipticObject( Sector * sector, Ogre::SceneNode * parentNode ) + : SectorEnvironmentObject( "Ecliptic", sector, parentNode ){ + + createGrid_(); +} + +SectorEclipticObject::~SectorEclipticObject(){ + mainNode_->detachObject( entity_ ); + sector_->sceneManager()->destroyManualObject( entity_ ); +} + +bool SectorEclipticObject::update( Ogre::Real elapsedTime ){ + return true; +} + +void SectorEclipticObject::createGrid_(){ + entity_ = sector_->sceneManager()->createManualObject( name_ + "/ManualObject" ); + Ogre::Real thickness = 15.0; // Of course this must be less than the radius value. + Ogre::Real nx = 20, nz = 20; + Ogre::Real dx = 1000, dz = 1000; + + unsigned point_index = 0; + + entity_->begin( "shader/gradient", Ogre::RenderOperation::OT_TRIANGLE_LIST); + entity_->getSection( 0 )->setCustomParameter( 0, Ogre::Vector4( 0.0, 0.0, 1.0, 0.2 ) ); + entity_->getSection( 0 )->setCustomParameter( 1, Ogre::Vector4( nx * dx, 0.0, 0.0, 0.0 ) ); + + for ( int i = 0; i < nx+1; i ++ ){ + entity_->position( -nx * dx / 2, 0.0, -nx * dx / 2 + i * dx - thickness ); + entity_->position( nx * dx / 2, 0.0, -nx * dx / 2 + i * dx - thickness ); + entity_->position( nx * dx / 2, 0.0, -nx * dx / 2 + i * dx + thickness ); + entity_->position( -nx * dx / 2, 0.0, -nx * dx / 2 + i * dx + thickness ); + point_index = (i * 4); + entity_->quad( point_index + 0, point_index + 1, point_index + 2, point_index + 3 ); + } + entity_->end(); + + entity_->begin( "shader/gradient", Ogre::RenderOperation::OT_TRIANGLE_LIST); + entity_->getSection( 1 )->setCustomParameter( 0, Ogre::Vector4( 0.0, 0.0, 1.0, 0.2 ) ); + entity_->getSection( 1 )->setCustomParameter( 1, Ogre::Vector4( nz * dz, 0.0, 0.0, 0.0 ) ); + + for ( int i = 0; i < nz+1; i ++ ){ + entity_->position( -nz * dz / 2 + i * dx + thickness, 0.0, -nz * dz / 2 ); + entity_->position( -nz * dz / 2 + i * dx + thickness, 0.0, nz * dz / 2 ); + entity_->position( -nz * dz / 2 + i * dx - thickness, 0.0, nz * dz / 2 ); + entity_->position( -nz * dz / 2 + i * dx - thickness, 0.0, -nz * dz / 2 ); + point_index = (i * 4); + entity_->quad( point_index + 0, point_index + 1, point_index + 2, point_index + 3 ); + } + entity_->end(); + + entity_->begin( "shader/gradient", Ogre::RenderOperation::OT_TRIANGLE_LIST); + entity_->getSection( 2 )->setCustomParameter( 0, Ogre::Vector4( 0.0, 1.0, 0.0, 0.2 ) ); + entity_->getSection( 2 )->setCustomParameter( 1, Ogre::Vector4( nx * dx, 0.0, 0.0, 0.0 ) ); + + for ( int i = 0; i < nx+1; i ++ ){ + entity_->position( -nx * dx / 2, 0.0, -nx * dx / 2 + i * dx - thickness ); + entity_->position( nx * dx / 2, 0.0, -nx * dx / 2 + i * dx - thickness ); + entity_->position( nx * dx / 2, 0.0, -nx * dx / 2 + i * dx + thickness ); + entity_->position( -nx * dx / 2, 0.0, -nx * dx / 2 + i * dx + thickness ); + point_index = (i * 4); + entity_->quad( point_index + 3, point_index + 2, point_index + 1, point_index + 0 ); + } + entity_->end(); + + entity_->begin( "shader/gradient", Ogre::RenderOperation::OT_TRIANGLE_LIST); + entity_->getSection( 3 )->setCustomParameter( 0, Ogre::Vector4( 0.0, 1.0, 0.0, 0.2 ) ); + entity_->getSection( 3 )->setCustomParameter( 1, Ogre::Vector4( nz * dz, 0.0, 0.0, 0.0 ) ); + + for ( int i = 0; i < nz+1; i ++ ){ + entity_->position( -nz * dz / 2 + i * dx + thickness, 0.0, -nz * dz / 2 ); + entity_->position( -nz * dz / 2 + i * dx + thickness, 0.0, nz * dz / 2 ); + entity_->position( -nz * dz / 2 + i * dx - thickness, 0.0, nz * dz / 2 ); + entity_->position( -nz * dz / 2 + i * dx - thickness, 0.0, -nz * dz / 2 ); + point_index = (i * 4); + entity_->quad( point_index + 3, point_index + 2, point_index + 1, point_index + 0 ); + } + entity_->end(); + + mainNode_->attachObject( entity_ ); +} + + +// if ( !1 ) { +// planetNode_ = sceneMgr_->getRootSceneNode()->createChildSceneNode( "PlanetNode" ); +// +// Ogre::ManualObject * planet = sceneMgr_->createManualObject( "Planet" ); +// // planet->setUseIdentityProjection( true ); +// // planet->setUseIdentityView( true ); +// +// planet->begin( "OpenGate/RedPlanet", Ogre::RenderOperation::OT_TRIANGLE_LIST); +// planet->position( Ogre::Vector3( -1.0, -1.0, 200.0 ) ); +// planet->textureCoord( 0, 0 ); +// planet->position( Ogre::Vector3( 1.0, -1.0, 200.0 ) ); +// planet->textureCoord( 1, 0 ); +// planet->position( Ogre::Vector3( 1.0, 1.0, 200.0 ) ); +// planet->textureCoord( 1, 1 ); +// planet->position( Ogre::Vector3( -1.0, 1.0, 200.0 ) ); +// planet->textureCoord( 0, 1 ); +// planet->quad( 0, 1, 2, 3 ); +// planet->end(); +// Ogre::AxisAlignedBox aabInf; aabInf.setInfinite(); +// planet->setBoundingBox( aabInf ); +// planetNode_->attachObject( planet ); +// planetNode_->scale( 20000, 20000, 1 ); +// planetNode_->setPosition( Ogre::Vector3( 20000.0, 10000.0, 50000 ) ); +// } +// if ( planetNode_ ){ // updateLoop +// Ogre::Vector3 src = planetNode_->getWorldOrientation() * Ogre::Vector3::UNIT_Z; +// src.normalise(); +// +// Ogre::Vector3 target( avatar_->mainNode()->getPosition() - planetNode_->getWorldPosition() ); +// target.normalise(); +// +// Ogre::Quaternion rot = src.getRotationTo( target ); +// rot.normalise(); +// +// planetNode_->setPosition( Ogre::Vector3( 20000.0, 10000.0, 50000 ) + avatar_->mainNode()->getPosition() ); +// planetNode_->rotate( rot, Ogre::Node::TS_PARENT ); +// } + +} Added: trunk/src/SectorEnvironmentObject.h =================================================================== --- trunk/src/SectorEnvironmentObject.h (rev 0) +++ trunk/src/SectorEnvironmentObject.h 2009-02-14 19:11:43 UTC (rev 1032) @@ -0,0 +1,91 @@ +/*************************************************************************** + * Copyright (C) 2009 by OpenGate development team * + * spo...@us... * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef _OPENGATE_SECTORENVIRONMENT__H +#define _OPENGATE_SECTORENVIRONMENT__H + +#include "Opengate.h" +#include "SectorBaseObject.h" + +namespace OpenGate{ + +/*! Baseclass for space environment elements without collision*/ +class SectorEnvironmentObject : public SectorBaseObject { +public: + SectorEnvironmentObject( const Ogre::String & name, Sector * sector, Ogre::SceneNode * parentNode = NULL ); + + virtual ~SectorEnvironmentObject( ); + + virtual int rtti( ) const { return SECTOR_ENVIRONMENT_OBJECT_RTTI; } + + /*! Update loop for the environment */ + virtual bool update( Ogre::Real elapsedTime ); + +protected: + +}; + +class SectorPlanetObject : public SectorEnvironmentObject{ +public: + SectorPlanetObject( const Ogre::String & name, Sector * sector, Ogre::SceneNode * parentNode = NULL ); + + virtual ~SectorPlanetObject(); + + /*! Update loop for the environment */ + virtual bool update( Ogre::Real elapsedTime ); + +protected: + //** taken from ogre wiki: http://www.ogre3d.org/wiki/index.php/ManualSphereMeshes + void createSphere_( const std::string & name, const float r, const int nRings, const int nSegments ); + + Ogre::SceneNode * cloudNode_; + Ogre::Entity * cloudEntity_; + Ogre::Entity * entity_; + Ogre::Light * light_; +}; + +class SectorEclipticObject : public SectorEnvironmentObject{ +public: + SectorEclipticObject( Sector * sector, Ogre::SceneNode * parentNode = NULL ); + + ~SectorEclipticObject(); + + virtual bool update( Ogre::Real elapsedTime ); + +protected: + void createGrid_(); + + Ogre::ManualObject * entity_; +}; +// class SectorStarfieldObject : public SectorEnvironmentObject{ +// }; +// class SectorSpaceDustObject : public SectorEnvironmentObject{ +// }; +// class SectorSpaceDecorationObject : public SectorEnvironmentObject{ +// }; + + + + +} //namespace OpenGate + +#endif //_OPENGATE_SECTORENVIRONMENT__H + + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <spo...@us...> - 2009-02-14 19:11:11
|
Revision: 1031 http://opengate.svn.sourceforge.net/opengate/?rev=1031&view=rev Author: spom_spom Date: 2009-02-14 19:11:02 +0000 (Sat, 14 Feb 2009) Log Message: ----------- fixed a couple of mem-leaks, deactivate soundmanager, add planet and ecliptic plane Modified Paths: -------------- trunk/data/materials/gradientshader.cg trunk/src/AiManager.cpp trunk/src/Entity.cpp trunk/src/Entity.h trunk/src/GameStateManager.cpp trunk/src/KeyMap.cpp trunk/src/KeyMap.h trunk/src/Makefile.am trunk/src/OpcodeWrapper.cpp trunk/src/OpenALSoundManager.cpp trunk/src/OpenALSoundManager.h trunk/src/Opengate.h trunk/src/Sector.cpp trunk/src/Sector.h trunk/src/SectorBaseObject.h trunk/src/UnDockedState.cpp trunk/src/UnDockedState.h trunk/src/Vessel.cpp trunk/src/Vessel.h trunk/src/opengateclient.cpp Removed Paths: ------------- trunk/src/Planet.cpp trunk/src/Planet.h Modified: trunk/data/materials/gradientshader.cg =================================================================== --- trunk/data/materials/gradientshader.cg 2009-02-12 00:47:47 UTC (rev 1030) +++ trunk/data/materials/gradientshader.cg 2009-02-14 19:11:02 UTC (rev 1031) @@ -12,6 +12,7 @@ ) { // Get the custom parameters + //float objectradius = sqrt(customParamRadius.x*customParamRadius.x*+ customParamRadius.y*customParamRadius.y+customParamRadius.z*customParamRadius.z); float objectradius = customParamRadius.x; // calculate output position Modified: trunk/src/AiManager.cpp =================================================================== --- trunk/src/AiManager.cpp 2009-02-12 00:47:47 UTC (rev 1030) +++ trunk/src/AiManager.cpp 2009-02-14 19:11:02 UTC (rev 1031) @@ -113,6 +113,7 @@ AiObject * ai = createAiObject( name ); + //** please ensure delete of the vessel after cleaning this code SectorVesselObject * obj = dynamic_cast < UnDockedState *>(resources_->gameStateRoot->activeState() )->sector()->createVesselObject( new Vessel( *resources_->entityManager->vessel( "apteryx" ) ) ); Modified: trunk/src/Entity.cpp =================================================================== --- trunk/src/Entity.cpp 2009-02-12 00:47:47 UTC (rev 1030) +++ trunk/src/Entity.cpp 2009-02-14 19:11:02 UTC (rev 1031) @@ -54,6 +54,10 @@ setFactionName_( ResourceManager::getSingleton().factionName( factionID_ ) ); } +Entity::~Entity(){ + +} + void Entity::readPropertiesFromXML( TiXmlHandle & hRoot ){ readXMLNode< std::string >( hRoot, "name_"+ ResourceManager::getSingleton().languageSuffix() + " name_en name", this, &OpenGate::Entity::setName, true ); @@ -142,7 +146,9 @@ baseScale_ = 0.0; } -MeshEntity::~MeshEntity(){} +MeshEntity::~MeshEntity(){ + if ( !pMesh_.isNull() ) Ogre::MeshManager::getSingleton().unload( pMesh_->getName() ); +} void MeshEntity::readPropertiesFromXML( TiXmlHandle & hRoot ){ Entity::readPropertiesFromXML( hRoot ); Modified: trunk/src/Entity.h =================================================================== --- trunk/src/Entity.h 2009-02-12 00:47:47 UTC (rev 1030) +++ trunk/src/Entity.h 2009-02-14 19:11:02 UTC (rev 1031) @@ -72,7 +72,7 @@ public: Entity(); - virtual ~Entity(){ } + virtual ~Entity(); virtual EntityType entityType() const { return rtti_; } Modified: trunk/src/GameStateManager.cpp =================================================================== --- trunk/src/GameStateManager.cpp 2009-02-12 00:47:47 UTC (rev 1030) +++ trunk/src/GameStateManager.cpp 2009-02-14 19:11:02 UTC (rev 1031) @@ -63,9 +63,6 @@ } GameStateManager::~GameStateManager( ){ -// delete resources_->guiSystem; -// delete resources_->guiRenderer; - while ( !stateStack_.empty() ){ cleanup_( stateStack_.back() ); stateStack_.back()->exit(); @@ -75,51 +72,60 @@ states_.back().state->destroy(); states_.pop_back(); } - - if ( resources_.aiManager ) { - log_->info( "Shutdown ai manager." ); - delete resources_.aiManager; - resources_.aiManager = NULL; - } - if ( resources_.console ){ - log_->info( "Shutdown console." ); - delete resources_.console; - resources_.console = NULL; - } - if ( resources_.entityManager ){ - log_->info( "Shutdown entitymanager." ); - delete resources_.entityManager; - resources_.entityManager = NULL; - } - if ( resources_.soundManager ) { - log_->info( "Shutdown soundmanager." ); -// delete resources_.soundManager; -// resources_.soundManager = NULL; - } - if ( resources_.inputManager ) { - log_->info( "Shutdown inputmanager." ); - delete resources_.inputManager; - resources_.inputManager = NULL; - } - - log_->info( "Shutdown renderWindow." ); - if ( resources_.renderWindow ) delete resources_.renderWindow; - log_->info( "Shutdown ogreRoot." ); - //** segfault caused by destroying ShipConfigDialog::ceguiTex_ - // if ( resources_.ogreRoot ) delete resources_.ogreRoot; + if ( resources_.avatar ) delete resources_.avatar; + + if ( resources_.collisionManager ) delete resources_.collisionManager; + + if ( configDialog_ ) delete configDialog_; + + if ( resources_.aiManager ) { + log_->info( "Shutdown ai manager." ); + delete resources_.aiManager; + resources_.aiManager = NULL; + } + if ( resources_.console ){ + log_->info( "Shutdown console." ); + delete resources_.console; + resources_.console = NULL; + } + if ( resources_.entityManager ){ + log_->info( "Shutdown entitymanager." ); + delete resources_.entityManager; + resources_.entityManager = NULL; + } + if ( resources_.soundManager ) { + log_->info( "Shutdown soundmanager." ); + delete resources_.soundManager; + resources_.soundManager = NULL; + } + if ( resources_.guiRenderer ) { + log_->info( "Shutdown CEGUI manager." ); + delete resources_.guiSystem; + //delete resources_.guiRenderer; + } + if ( resources_.inputManager ) { + log_->info( "Shutdown inputmanager." ); + delete resources_.inputManager; + resources_.inputManager = NULL; + } + if ( resources_.ogreRoot() ) { + log_->info( "Shutdown ogreRoot." ); + Ogre::Root * root = resources_.ogreRoot(); + delete root; + } } bool GameStateManager::initialiseBootstrap( bool dialog ){ - resources_.setOgreRoot( *new Ogre::Root ); - resources_.gameStateRoot = this; + resources_.setOgreRoot( *new Ogre::Root ); + resources_.gameStateRoot = this; - if ( !initialiseOgreEngine_( dialog ) ) { - log_->fatal( "Cannot initialize ogre engine." ); - return false; - } - initialiseBootstrapResources(); - initLoadingVector(); - return true; + if ( !initialiseOgreEngine_( dialog ) ) { + log_->fatal( "Cannot initialize ogre engine." ); + return false; + } + initialiseBootstrapResources(); + initLoadingVector(); + return true; } bool GameStateManager::initialiseOgreEngine_( bool dialog ){ @@ -262,7 +268,7 @@ } bool GameStateManager::initialiseSoundManager(){ - resources_.soundManager = new OpenALSoundManager( ); + resources_.soundManager = new OpenALSoundManager( true ); resources_.soundManager->loadRessourceNames( resources_.findFullFileName( "sounds.xml" ) ); return true; } Modified: trunk/src/KeyMap.cpp =================================================================== --- trunk/src/KeyMap.cpp 2009-02-12 00:47:47 UTC (rev 1030) +++ trunk/src/KeyMap.cpp 2009-02-14 19:11:02 UTC (rev 1031) @@ -28,6 +28,9 @@ KeyMap::KeyMap() : modifier_( KEY_NONE ){ } +KeyMap::~KeyMap(){ +} + void KeyMap::setDefaults(){ /*! Actions for undocked state */ unDockedActionMap_[ keycode( 70 ) ] = &UnDockedState::keyActionSwitchMinMaxConsole; @@ -89,6 +92,7 @@ unDockedActionMap_[ keycode( OIS::KC_F8 ) ] = &UnDockedState::keyActionAvatarSelfDestruct_DEV; unDockedActionMap_[ keycode( OIS::KC_F7 ) ] = &UnDockedState::keyActionSpawnAi_DEV; unDockedActionMap_[ keycode( OIS::KC_I, KEY_CONTROL ) ] = &UnDockedState::keyActionShowInfos_DEV; + unDockedActionMap_[ keycode( OIS::KC_E, KEY_SHIFT ) ] = &UnDockedState::keyActionShowEcliptic_DEV; } bool(UnDockedState::*KeyMap::unDockedKeyAction( const OIS::KeyEvent & e ))(bool) { Modified: trunk/src/KeyMap.h =================================================================== --- trunk/src/KeyMap.h 2009-02-12 00:47:47 UTC (rev 1030) +++ trunk/src/KeyMap.h 2009-02-14 19:11:02 UTC (rev 1031) @@ -21,8 +21,8 @@ #ifndef _OPENGATE_KEYMAP__H #define _OPENGATE_KEYMAP__H -#include "Opengate.h" - +#include "Opengate.h" + #include <map> #include <sys/types.h> //#include "InputManager.h" @@ -37,9 +37,10 @@ class KeyMap{ public: + KeyMap(); + + ~KeyMap(); - KeyMap(); - void setDefaults(); bool (UnDockedState::*unDockedKeyAction( const OIS::KeyEvent & e ))( bool ); Modified: trunk/src/Makefile.am =================================================================== --- trunk/src/Makefile.am 2009-02-12 00:47:47 UTC (rev 1030) +++ trunk/src/Makefile.am 2009-02-14 19:11:02 UTC (rev 1031) @@ -70,8 +70,6 @@ Opengate.h \ OpenALSoundManager.h \ OpenALSoundManager.cpp \ - Planet.h \ - Planet.cpp \ Projectile.h \ Projectile.cpp \ RadarObject.h \ @@ -92,6 +90,8 @@ SectorChildObject.cpp \ SectorCollisionObject.h \ SectorCollisionObject.cpp \ + SectorEnvironmentObject.h \ + SectorEnvironmentObject.cpp \ SectorExplosionObject.h \ SectorExplosionObject.cpp \ SectorMeshObject.h \ Modified: trunk/src/OpcodeWrapper.cpp =================================================================== --- trunk/src/OpcodeWrapper.cpp 2009-02-12 00:47:47 UTC (rev 1030) +++ trunk/src/OpcodeWrapper.cpp 2009-02-14 19:11:02 UTC (rev 1031) @@ -137,7 +137,6 @@ if ( obj && active_ ){ OgreOpcode::ICollisionShape * shape = obj->getShape(); collideInSectorContext_->destroyObject( obj ); - collisionManager_->detachShape( shape ); collisionManager_->destroyShape( shape ); } } Modified: trunk/src/OpenALSoundManager.cpp =================================================================== --- trunk/src/OpenALSoundManager.cpp 2009-02-12 00:47:47 UTC (rev 1030) +++ trunk/src/OpenALSoundManager.cpp 2009-02-14 19:11:02 UTC (rev 1031) @@ -44,6 +44,7 @@ #define STREAM_BUFFER_SIZE (4096 * 100) namespace OpenGate{ + void OpenALSoundSourceDummy::showInfos(){ LogManager::getSingleton().info( "Audio info: dummy " + name_ + " installed " ); } @@ -452,47 +453,47 @@ template<> OpenALSoundManager * Ogre::Singleton< OpenALSoundManager >::ms_Singleton = 0; -OpenALSoundManager::OpenALSoundManager( ){ - maxSources_ = 128; - listener_ = NULL; - oggVorbisExtension_ = false; - mp3Extension_ = false; +OpenALSoundManager::OpenALSoundManager( bool dummy ){ + maxSources_ = 128; + listener_ = NULL; + oggVorbisExtension_ = false; + mp3Extension_ = false; - log_ = LogManager::getSingletonPtr(); - haveSoundDevice_ = true; + log_ = LogManager::getSingletonPtr(); + haveSoundDevice_ = true; - init(); - Ogre::Root::getSingleton().addFrameListener( this ); + init( dummy ); + Ogre::Root::getSingleton().addFrameListener( this ); } OpenALSoundManager::~OpenALSoundManager(){ - Ogre::Root::getSingleton().removeFrameListener( this ); + Ogre::Root::getSingleton().removeFrameListener( this ); - for ( std::map< std::string, OpenALSoundSource * >::iterator it = mapSoundSources_.begin(); it != mapSoundSources_.end(); ){ - destroySoundSource( it++->second ); - } + for ( std::map< std::string, OpenALSoundSource * >::iterator it = mapSoundSources_.begin(); it != mapSoundSources_.end(); ){ + destroySoundSource( it++->second ); + } - if ( listener_ ) delete listener_; + if ( listener_ ) delete listener_; - if ( haveSoundDevice_ ){ - ALCcontext *context = alcGetCurrentContext(); - ALCdevice *device = alcGetContextsDevice( context ); - alcMakeContextCurrent( NULL ); - alcDestroyContext( context ); - alcCloseDevice( device ); - } + if ( haveSoundDevice_ ){ + ALCcontext *context = alcGetCurrentContext(); + ALCdevice *device = alcGetContextsDevice( context ); + alcMakeContextCurrent( NULL ); + alcDestroyContext( context ); + alcCloseDevice( device ); + } } bool OpenALSoundManager::frameStarted( const Ogre::FrameEvent & evt ){ - for ( std::map< std::string, OpenALSoundSource * >::iterator it = mapSoundSources_.begin(); - it != mapSoundSources_.end(); it++){ - it->second->update(); - } - return true; + for ( std::map< std::string, OpenALSoundSource * >::iterator it = mapSoundSources_.begin(); + it != mapSoundSources_.end(); it++){ + it->second->update(); + } + return true; } -bool OpenALSoundManager::init(){ - log_->info( "Initialize Soundmanager ..." ); +bool OpenALSoundManager::init( bool dummy ){ + log_->info( "Initialize Soundmanager ..." ); // if ( alIsExtensionPresent( "AL_EXT_vorbis" ) == AL_TRUE ){ // oggVorbisExtension_ = true; @@ -544,36 +545,36 @@ // } // deviceSpecifiers += strlen( deviceSpecifiers ) + 1; // } -bool disable_ = false; -ALCdevice * device = NULL; - if ( !disable_ ){ - device = alcOpenDevice( NULL ); - // Device = alcOpenDevice((ALubyte*)"DirectSound3D"); - } + + ALCdevice * device = NULL; + if ( !dummy ){ + device = alcOpenDevice( NULL ); + // Device = alcOpenDevice((ALubyte*)"DirectSound3D"); + } - if ( !device ){ - log_->warn( "No sound device detected." ); - haveSoundDevice_ = false; - } + if ( !device ){ + log_->warn( "No sound device detected." ); + haveSoundDevice_ = false; + } - if ( haveSoundDevice_ ){ - log_->info( "Choosing: " + Ogre::String( alcGetString( device, ALC_DEVICE_SPECIFIER) ) ); - ALCcontext * context = alcCreateContext( device, NULL ); + if ( haveSoundDevice_ ){ + log_->info( "Choosing: " + Ogre::String( alcGetString( device, ALC_DEVICE_SPECIFIER) ) ); + ALCcontext * context = alcCreateContext( device, NULL ); - if ( !context ){ - log_->warn( "Can not create sound context." ); - return false; - } + if ( !context ){ + log_->warn( "Can not create sound context." ); + return false; + } - alcMakeContextCurrent( context ); - if ( checkOpenALError( "OpenALSoundManager::init::alcMakeContextCurrent" ) ) return false; + alcMakeContextCurrent( context ); + if ( checkOpenALError( "OpenALSoundManager::init::alcMakeContextCurrent" ) ) return false; - maxSources_ = getMaxSources_(); - } + maxSources_ = getMaxSources_(); + } - listener_ = new OpenALListener( this, !haveSoundDevice_ ); + listener_ = new OpenALListener( this, !haveSoundDevice_ ); - return true; + return true; } void OpenALSoundManager::loadRessourceNames( const std::string & fileName ){ @@ -616,28 +617,28 @@ OpenALSoundSource * OpenALSoundManager::createSoundSource( const std::string & fileName, const std::string & name, bool loop, bool stream ){ - OpenALSoundSource * sound = NULL; + OpenALSoundSource * sound = NULL; - if ( mapSoundSources_.count( name ) ){ - log_->warn( "Sound with name: " + name + " allready registered." ); - mapSoundSources_[ name ]; - } + if ( mapSoundSources_.count( name ) ){ + log_->warn( "Sound with name: " + name + " allready registered." ); + mapSoundSources_[ name ]; + } - if ( haveSoundDevice_ ){ - if ( stream ){ - log_->info( "create sound stream: " + name ); - sound = new OpenALOggStreamSource( this, name ); + if ( haveSoundDevice_ ){ + if ( stream ){ + log_->info( "create sound stream: " + name ); + sound = new OpenALOggStreamSource( this, name ); + } else { + sound = new OpenALSoundSource( this, name ); + } } else { - sound = new OpenALSoundSource( this, name ); + sound = new OpenALSoundSourceDummy( this, name ); } - } else { - sound = new OpenALSoundSourceDummy( this, name ); - } - sound->open( fileName ); - sound->showInfos( ); - mapSoundSources_[ name ] = sound; - return sound; + sound->open( fileName ); + sound->showInfos( ); + mapSoundSources_[ name ] = sound; + return sound; } OpenALSoundSource * OpenALSoundManager::createSoundSourceFromRessource( const std::string & ressourceName, @@ -647,20 +648,20 @@ } void OpenALSoundManager::destroySoundSource( OpenALSoundSource * sound ){ - if ( sound ){ - if ( sound->release() ){ - mapSoundSources_.erase( sound->name() ); - delete sound; + if ( sound ){ + if ( sound->release() ){ + mapSoundSources_.erase( sound->name() ); + delete sound; + } } - } } void OpenALSoundManager::destroySoundSource( const std::string & name ){ - if ( mapSoundSources_.count( name ) ) { - destroySoundSource( mapSoundSources_[ name ] ); - } else { - log_->warn( "OpenALSoundManager::destroySoundSource: ressource with name " + name + " does not exist." ); - } + if ( mapSoundSources_.count( name ) ) { + destroySoundSource( mapSoundSources_[ name ] ); + } else { + log_->warn( "OpenALSoundManager::destroySoundSource: ressource with name " + name + " does not exist." ); + } } bool OpenALSoundManager::checkOpenAlutError( const std::string & str ){ Modified: trunk/src/OpenALSoundManager.h =================================================================== --- trunk/src/OpenALSoundManager.h 2009-02-12 00:47:47 UTC (rev 1030) +++ trunk/src/OpenALSoundManager.h 2009-02-14 19:11:02 UTC (rev 1031) @@ -24,9 +24,9 @@ #include <string> #include <iostream> #include <map> - -#include "Opengate.h" +#include "Opengate.h" + #include <OgreVector3.h> #include <OgreSingleton.h> #include <OgreFrameListener.h> @@ -174,28 +174,28 @@ /*! OpenALListener, there is just one. YOU! respectivly your avatar. */ class OpenALListener{ public: - OpenALListener( OpenALSoundManager * soundMgr, bool dummy = false); - ~OpenALListener(); + OpenALListener( OpenALSoundManager * soundMgr, bool dummy = false); + ~OpenALListener(); - bool setPosition( float x, float y, float z ); - bool setPosition( const Ogre::Vector3 & pos); + bool setPosition( float x, float y, float z ); + bool setPosition( const Ogre::Vector3 & pos); - bool setVelocity( float x, float y, float z ); - bool setVelocity( const Ogre::Vector3 & vel); + bool setVelocity( float x, float y, float z ); + bool setVelocity( const Ogre::Vector3 & vel); - bool setOrientation( float xf, float yf, float zf, float xu, float yu, float zu ); - bool setOrientation( const Ogre::Vector3 & front, const Ogre::Vector3 & up); + bool setOrientation( float xf, float yf, float zf, float xu, float yu, float zu ); + bool setOrientation( const Ogre::Vector3 & front, const Ogre::Vector3 & up); - void reset( ); + void reset( ); protected: - OpenALSoundManager * soundMgr_; - Ogre::Vector3 position_; - Ogre::Vector3 velocity_; - Ogre::Vector3 directionFront_; - Ogre::Vector3 directionUp_; - float orientation_[ 6 ]; - bool dummy_; + OpenALSoundManager * soundMgr_; + Ogre::Vector3 position_; + Ogre::Vector3 velocity_; + Ogre::Vector3 directionFront_; + Ogre::Vector3 directionUp_; + float orientation_[ 6 ]; + bool dummy_; }; @@ -209,13 +209,13 @@ class OpenALSoundManager : public Ogre::FrameListener, public Ogre::Singleton< OpenALSoundManager >{ public: - OpenALSoundManager( ); + OpenALSoundManager( bool dummy = false ); virtual ~OpenALSoundManager(); virtual bool frameStarted( const Ogre::FrameEvent & evt ); - bool init(); + bool init( bool dummy ); void loadRessourceNames( const std::string & fileName ); Modified: trunk/src/Opengate.h =================================================================== --- trunk/src/Opengate.h 2009-02-12 00:47:47 UTC (rev 1030) +++ trunk/src/Opengate.h 2009-02-14 19:11:02 UTC (rev 1031) @@ -41,15 +41,16 @@ #define SECTOR_BEACON_PAD_OBJECT_RTTI 4 #define SECTOR_CHILD_OBJECT_RTTI 5 #define SECTOR_COLLISION_OBJECT_RTTI 6 -#define SECTOR_EXPLOSION_OBJECT_RTTI 7 -#define SECTOR_MESH_OBJECT_RTTI 8 -#define SECTOR_MISSILE_OBJECT_RTTI 9 -#define SECTOR_MOVABLE_OBJECT_RTTI 10 -#define SECTOR_PAD_OBJECT_RTTI 11 -#define SECTOR_PROJECTILE_OBJECT_RTTI 12 -#define SECTOR_STATION_OBJECT_RTTI 13 -#define SECTOR_STATION_PAD_OBJECT_RTTI 14 -#define SECTOR_VESSEL_OBJECT_RTTI 15 +#define SECTOR_ENVIRONMENT_OBJECT_RTTI 7 +#define SECTOR_EXPLOSION_OBJECT_RTTI 8 +#define SECTOR_MESH_OBJECT_RTTI 9 +#define SECTOR_MISSILE_OBJECT_RTTI 10 +#define SECTOR_MOVABLE_OBJECT_RTTI 11 +#define SECTOR_PAD_OBJECT_RTTI 12 +#define SECTOR_PROJECTILE_OBJECT_RTTI 13 +#define SECTOR_STATION_OBJECT_RTTI 14 +#define SECTOR_STATION_PAD_OBJECT_RTTI 15 +#define SECTOR_VESSEL_OBJECT_RTTI 16 #define SECTOROBJECTENVIRONMENT_RTTI 1000010 #define PROJECTILE_RTTI 100001 @@ -68,9 +69,9 @@ class AiManager; class Avatar; -class BaseObject; +class BaseObject; class Console; -class DockedState; +class DockedState; class UnDockedState; class Gun; @@ -96,11 +97,14 @@ class SectorBeaconPadObject; class SectorChildObject; class SectorCollisionObject; +class SectorEclipticObject; +class SectorEnvironmentObject; class SectorExplosionObject; class SectorMeshObject; class SectorMissileObject; class SectorMovableObject; class SectorPadObject; +class SectorPlanetObject; class SectorProjectileObject; class SectorStationObject; class SectorStationPadObject; @@ -128,31 +132,31 @@ class NetworkClient; class Vessel; - -template < class Class, typename ReturnType, typename Parameter > class SingularCallBack{ -public: - typedef ReturnType ( Class::*Method )( Parameter ); - SingularCallBack( Class * class_instance, Method method ) : class_instance_( class_instance ), method_( method ) { } - - ReturnType operator()( Parameter parameter ) { return ( class_instance_->*method_ )( parameter ); } - ReturnType execute( Parameter parameter ){ return operator()( parameter ); } -private: - Class * class_instance_; - Method method_; -}; - -template < class Object, typename returnT, typename Args > class memberBind { -public: - typedef returnT( Object::*F )( Args ); - memberBind( F function, Object * object) : function_( function ), object_( object ) {} - - returnT operator()( Args args ) const { return ( object_->*function_ )( args ); } -protected: - F function_; - Object object_; -}; - +template < class Class, typename ReturnType, typename Parameter > class SingularCallBack{ +public: + typedef ReturnType ( Class::*Method )( Parameter ); + SingularCallBack( Class * class_instance, Method method ) : class_instance_( class_instance ), method_( method ) { } + + ReturnType operator()( Parameter parameter ) { return ( class_instance_->*method_ )( parameter ); } + ReturnType execute( Parameter parameter ){ return operator()( parameter ); } +private: + Class * class_instance_; + Method method_; +}; + +template < class Object, typename returnT, typename Args > class memberBind { +public: + typedef returnT( Object::*F )( Args ); + memberBind( F function, Object * object) : function_( function ), object_( object ) {} + + returnT operator()( Args args ) const { return ( object_->*function_ )( args ); } +protected: + F function_; + Object object_; +}; + + } // namespace OpenGate #endif // _OPENGATE_OPENGATE__H Deleted: trunk/src/Planet.cpp =================================================================== --- trunk/src/Planet.cpp 2009-02-12 00:47:47 UTC (rev 1030) +++ trunk/src/Planet.cpp 2009-02-14 19:11:02 UTC (rev 1031) @@ -1,238 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006-2007 by OpenGate development team * - * spo...@us... * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ - -#include "Planet.h" - -#include <OgreSceneManager.h> -#include <OgreEntity.h> -#include <OgreSceneNode.h> -#include <OgreMeshManager.h> -#include <OgreSubMesh.h> -#include <OgreVector3.h> -#include <OgreLight.h> - -namespace OpenGate{ - -Planet::Planet( const std::string & name, Ogre::SceneManager * SceneMgr, const Ogre::Vector3 & relPos, - Ogre::Real radius, int segments ) - : name_( name ), sceneMgr_( SceneMgr ){ - - planetNode_ = NULL; - planetCloudNode_ = NULL; - planetCloudEntity_ = NULL; - planetEntity_ = NULL; - light_ = NULL; - - createSphere_( name + "/Mesh", radius, segments, segments ); - planetNode_ = sceneMgr_->getRootSceneNode()->createChildSceneNode(name); - - planetEntity_ = sceneMgr_->createEntity( name, name + "/Mesh" ); - planetEntity_->setMaterialName( "Planet" ); - - planetNode_->attachObject( planetEntity_ ); - planetNode_->setPosition( relPos ); - //planetNode_->pitch( Ogre::Degree(30) ); - - planetCloudNode_ = planetNode_->createChildSceneNode( planetNode_->getName() + "/cloud" ); - - planetCloudEntity_ = planetEntity_->clone( planetCloudNode_->getName() ); - planetCloudEntity_->setMaterialName( "Planet/Cloud" ); - - planetCloudNode_->attachObject( planetCloudEntity_ ); - planetCloudNode_->scale(1.015, 1.015, 1.015); - - light_ = sceneMgr_->createLight( name + "-light"); - light_->setDiffuseColour( 0.1, 0.1, 0.1 ); - light_->setSpecularColour( 0.4, 0.4, 0.4 ); - planetNode_->attachObject( light_ ); - - this->lighting( false ); -} - -Planet::~Planet( ){ - if ( planetNode_ ) { - if ( light_ ){ - planetNode_->detachObject( light_ ); - sceneMgr_->destroyLight( light_->getName() ); - } - if ( planetCloudNode_ ){ - if ( planetCloudEntity_ ){ - planetCloudNode_->detachObject( planetCloudEntity_ ); - sceneMgr_->destroyEntity( planetCloudEntity_ ); - } - planetNode_->removeAndDestroyChild( planetCloudNode_->getName() ); - } - if ( planetEntity_ ){ - Ogre::MeshManager::getSingleton().remove( name_ + "/Mesh" ); - planetNode_->detachObject( planetEntity_ ); - sceneMgr_->destroyEntity( planetEntity_ ); - } - sceneMgr_->getRootSceneNode()->removeAndDestroyChild( planetNode_->getName() ); - } -} - -void Planet::update( float elapsedTime ){ - planetNode_->yaw( Ogre::Degree( 0.2 * elapsedTime ) ); - planetCloudNode_->yaw( Ogre::Degree( 0.1 * elapsedTime ) ); -} - -void Planet::lighting( bool on ){ - light_->setVisible( on ); -} - -void Planet::createSphere_( const std::string & strName, const float r, const int nRings, const int nSegments ){ - Ogre::MeshPtr pSphere = Ogre::MeshManager::getSingleton().createManual(strName, - Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME); - Ogre::SubMesh *pSphereVertex = pSphere->createSubMesh(); - - pSphere->sharedVertexData = new Ogre::VertexData(); - Ogre::VertexData* vertexData = pSphere->sharedVertexData; - - // define the vertex format - Ogre::VertexDeclaration* vertexDecl = vertexData->vertexDeclaration; - size_t currOffset = 0; - // positions - vertexDecl->addElement(0, currOffset, Ogre::VET_FLOAT3, Ogre::VES_POSITION); - currOffset += Ogre::VertexElement::getTypeSize(Ogre::VET_FLOAT3); - // normals - vertexDecl->addElement(0, currOffset, Ogre::VET_FLOAT3, Ogre::VES_NORMAL); - currOffset += Ogre::VertexElement::getTypeSize(Ogre::VET_FLOAT3); - // two dimensional texture coordinates - vertexDecl->addElement(0, currOffset, Ogre::VET_FLOAT2, Ogre::VES_TEXTURE_COORDINATES, 0); - currOffset += Ogre::VertexElement::getTypeSize(Ogre::VET_FLOAT2); - - // allocate the vertex buffer - vertexData->vertexCount = (nRings + 1) * (nSegments+1); - Ogre::HardwareVertexBufferSharedPtr vBuf = Ogre::HardwareBufferManager::getSingleton().createVertexBuffer( vertexDecl->getVertexSize(0), vertexData->vertexCount, - Ogre::HardwareBuffer::HBU_STATIC_WRITE_ONLY, false); - Ogre::VertexBufferBinding* binding = vertexData->vertexBufferBinding; - binding->setBinding(0, vBuf); - float* pVertex = static_cast<float*>(vBuf->lock(Ogre::HardwareBuffer::HBL_DISCARD)); - - // allocate index buffer - pSphereVertex->indexData->indexCount = 6 * nRings * (nSegments + 1); - pSphereVertex->indexData->indexBuffer = Ogre::HardwareBufferManager::getSingleton().createIndexBuffer( - Ogre::HardwareIndexBuffer::IT_16BIT, pSphereVertex->indexData->indexCount, - Ogre::HardwareBuffer::HBU_STATIC_WRITE_ONLY, false); - Ogre::HardwareIndexBufferSharedPtr iBuf = pSphereVertex->indexData->indexBuffer; - unsigned short* pIndices = static_cast<unsigned short*>(iBuf->lock(Ogre::HardwareBuffer::HBL_DISCARD)); - - float fDeltaRingAngle = (Ogre::Math::PI / nRings); - float fDeltaSegAngle = (2.0 * Ogre::Math::PI / nSegments); - unsigned short wVerticeIndex = 0 ; - - // Generate the group of rings for the sphere - for ( int ring = 0; ring <= nRings; ring++ ) { - float r0 = r * sinf (ring * fDeltaRingAngle); - float y0 = r * cosf (ring * fDeltaRingAngle); - - // Generate the group of segments for the current ring - for (int seg = 0; seg <= nSegments; seg++) { - float x0 = r0 * sinf(seg * fDeltaSegAngle); - float z0 = r0 * cosf(seg * fDeltaSegAngle); - - // Add one vertex to the strip which makes up the sphere - *pVertex++ = x0; - *pVertex++ = y0; - *pVertex++ = z0; - - Ogre::Vector3 vNormal = Ogre::Vector3(x0, y0, z0).normalisedCopy(); - *pVertex++ = vNormal.x; - *pVertex++ = vNormal.y; - *pVertex++ = vNormal.z; - - *pVertex++ = (float) seg / (float) nSegments; - *pVertex++ = (float) ring / (float) nRings; - - if (ring != nRings) { - // each vertex (except the last) has six indices pointing to it - *pIndices++ = wVerticeIndex + nSegments + 1; - *pIndices++ = wVerticeIndex; - *pIndices++ = wVerticeIndex + nSegments; - *pIndices++ = wVerticeIndex + nSegments + 1; - *pIndices++ = wVerticeIndex + 1; - *pIndices++ = wVerticeIndex; - wVerticeIndex ++; - } - }; // end for seg - } // end for ring - - // Unlock - vBuf->unlock(); - iBuf->unlock(); - // Generate face list - pSphereVertex->useSharedVertices = true; - - // the original code was missing this line: - pSphere->_setBounds( Ogre::AxisAlignedBox( Ogre::Vector3(-r, -r, -r), Ogre::Vector3(r, r, r) ), false ); - pSphere->_setBoundingSphereRadius( r ); - // this line makes clear the mesh is loaded (avoids memory leaks) - pSphere->load(); - - Ogre::MeshPtr pMesh = Ogre::MeshManager::getSingleton().load( strName, - Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, - Ogre::HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY, - Ogre::HardwareBuffer::HBU_STATIC_WRITE_ONLY, true, true); - unsigned short src, dest; - - if ( !pMesh->suggestTangentVectorBuildParams( Ogre::VES_TANGENT, src, dest) ) { - pMesh->buildTangentVectors( Ogre::VES_TANGENT, src, dest ); - } -} - -} // namespace OpenGate - -// if ( !1 ) { -// planetNode_ = sceneMgr_->getRootSceneNode()->createChildSceneNode( "PlanetNode" ); -// -// Ogre::ManualObject * planet = sceneMgr_->createManualObject( "Planet" ); -// // planet->setUseIdentityProjection( true ); -// // planet->setUseIdentityView( true ); -// -// planet->begin( "OpenGate/RedPlanet", Ogre::RenderOperation::OT_TRIANGLE_LIST); -// planet->position( Ogre::Vector3( -1.0, -1.0, 200.0 ) ); -// planet->textureCoord( 0, 0 ); -// planet->position( Ogre::Vector3( 1.0, -1.0, 200.0 ) ); -// planet->textureCoord( 1, 0 ); -// planet->position( Ogre::Vector3( 1.0, 1.0, 200.0 ) ); -// planet->textureCoord( 1, 1 ); -// planet->position( Ogre::Vector3( -1.0, 1.0, 200.0 ) ); -// planet->textureCoord( 0, 1 ); -// planet->quad( 0, 1, 2, 3 ); -// planet->end(); -// Ogre::AxisAlignedBox aabInf; aabInf.setInfinite(); -// planet->setBoundingBox( aabInf ); -// planetNode_->attachObject( planet ); -// planetNode_->scale( 20000, 20000, 1 ); -// planetNode_->setPosition( Ogre::Vector3( 20000.0, 10000.0, 50000 ) ); -// } -// if ( planetNode_ ){ // updateLoop -// Ogre::Vector3 src = planetNode_->getWorldOrientation() * Ogre::Vector3::UNIT_Z; -// src.normalise(); -// -// Ogre::Vector3 target( avatar_->mainNode()->getPosition() - planetNode_->getWorldPosition() ); -// target.normalise(); -// -// Ogre::Quaternion rot = src.getRotationTo( target ); -// rot.normalise(); -// -// planetNode_->setPosition( Ogre::Vector3( 20000.0, 10000.0, 50000 ) + avatar_->mainNode()->getPosition() ); -// planetNode_->rotate( rot, Ogre::Node::TS_PARENT ); -// } Deleted: trunk/src/Planet.h =================================================================== --- trunk/src/Planet.h 2009-02-12 00:47:47 UTC (rev 1030) +++ trunk/src/Planet.h 2009-02-14 19:11:02 UTC (rev 1031) @@ -1,54 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006-2007 by OpenGate development team * - * spo...@us... * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ - -#ifndef _OPENGATE_PLANET__H -#define _OPENGATE_PLANET__H - -#include "Opengate.h" - -namespace OpenGate{ - -class Planet { -public: - - Planet( const std::string & name, Ogre::SceneManager * SceneMgr, const Ogre::Vector3 & relPos, Ogre::Real radius, int segments ); - ~Planet( ); - void lighting( bool on ); - void update( float elapsedTime ); - -protected: - - //** taken from ogre wiki: http://www.ogre3d.org/wiki/index.php/ManualSphereMeshes - void createSphere_( const std::string & strName, const float r, const int nRings, const int nSegments ); - - std::string name_; - Ogre::SceneManager * sceneMgr_; - - Ogre::SceneNode * planetNode_; - Ogre::SceneNode * planetCloudNode_; - Ogre::Entity * planetCloudEntity_; - Ogre::Entity * planetEntity_; - Ogre::Light * light_; -}; - -} // namespace OpenGate - - -#endif // _OPENGATE_SECTOR__H Modified: trunk/src/Sector.cpp =================================================================== --- trunk/src/Sector.cpp 2009-02-12 00:47:47 UTC (rev 1030) +++ trunk/src/Sector.cpp 2009-02-14 19:11:02 UTC (rev 1031) @@ -36,6 +36,7 @@ #include "SectorBeaconObject.h" #include "SectorCollisionObject.h" #include "SectorExplosionObject.h" +#include "SectorEnvironmentObject.h" #include "SectorMeshObject.h" #include "SectorMissileObject.h" #include "SectorProjectileObject.h" @@ -60,11 +61,14 @@ avatar_ = NULL; childIDCounter_ = 0; + ecliptic_ = new SectorEclipticObject( this ); + sectorEnvironment_.insert( ecliptic_ ); + showEcliptic( false ); createKoordAxis( ); - } Sector::~Sector( ){ + for_each( sectorEnvironment_.begin(), sectorEnvironment_.end(), deletePtr() ); for_each( sectorCollObjects_.begin(), sectorCollObjects_.end(), deletePtr() ); for_each( sectorMeshObjects_.begin(), sectorMeshObjects_.end(), deletePtr() ); @@ -85,6 +89,9 @@ ResourceManager::getSingleton().collisionManager->update( elapsedTime ); } + for ( std::set< SectorEnvironmentObject * >::iterator it = sectorEnvironment_.begin(); it != sectorEnvironment_.end(); it++ ){ + (*it)->update( elapsedTime ); + } for ( std::set< SectorCollisionObject * >::iterator it = sectorCollObjects_.begin(); it != sectorCollObjects_.end(); ){ if ( !(*it)->update( elapsedTime ) ) { destructCollObject_( (*it++) ); @@ -122,6 +129,9 @@ delete( obj ); obj = NULL; break; + case SECTOR_VESSEL_OBJECT_RTTI: + objectHeap_[ dynamic_cast< SectorVesselObject * >( obj )->vessel()->name() ].push_back( obj ); + break; case SECTOR_MISSILE_OBJECT_RTTI: objectHeap_[ dynamic_cast< SectorMissileObject * >( obj )->missile()->name() ].push_back( obj ); break; @@ -361,8 +371,14 @@ } else{ std::cerr << "no entity found for sectorobject: " << name << std::endl; } - } + } //! for all sectorobject + //! create Planet + SectorPlanetObject *planet = new SectorPlanetObject( "planet", this ); + //, Ogre::Vector3( 0000.0, 0000.0, 50000 ), 15000.0f, 64 ); + //planet_->lighting( true ); + sectorEnvironment_.insert( planet ); + return; } @@ -370,6 +386,14 @@ sceneMgr_->setSkyBox( true, name, 10000 ); } +void Sector::showEcliptic( bool show ){ + if ( ecliptic_ ) ecliptic_->mainNode()->setVisible( show ); +} + +void Sector::flipShowEcliptic( ) { + if ( ecliptic_ ) ecliptic_->mainNode()->flipVisibility( ); +} + void Sector::createKoordAxis( ){ koordAxisNode_ = sceneMgr_->getRootSceneNode()->createChildSceneNode( "axisnode" ); koordAxisMO_ = sceneMgr_->createManualObject( koordAxisNode_->getName()+ "/manualObject" ); Modified: trunk/src/Sector.h =================================================================== --- trunk/src/Sector.h 2009-02-12 00:47:47 UTC (rev 1030) +++ trunk/src/Sector.h 2009-02-14 19:11:02 UTC (rev 1031) @@ -95,6 +95,10 @@ void setSkyBox( const std::string & name ); void createKoordAxis( ); + + void showEcliptic( bool show ); + + void flipShowEcliptic( ); protected: /*! do not destruct objects manualy, let them send false during update loop */ @@ -128,7 +132,7 @@ std::set< SectorCollisionObject * > sectorCollObjects_; /*! Hold all stuff that makes the sector looking nice */ - //std::set< SectorEnvironmentObject * > sectorEnvironment_; + std::set< SectorEnvironmentObject * > sectorEnvironment_; /*! Hold all stuff that makes the sector looking nice */ std::set< SectorStationObject * > sectorStations_; @@ -139,6 +143,8 @@ Ogre::SceneNode * koordAxisNode_; Ogre::ManualObject * koordAxisMO_; + + SectorEclipticObject * ecliptic_; }; #else Modified: trunk/src/SectorBaseObject.h =================================================================== --- trunk/src/SectorBaseObject.h 2009-02-12 00:47:47 UTC (rev 1030) +++ trunk/src/SectorBaseObject.h 2009-02-14 19:11:02 UTC (rev 1031) @@ -68,22 +68,7 @@ bool destroyRequest_; }; - /*! Sectorobject that represent space environment without collision*/ - class SectorEnvironmentObject : public SectorBaseObject { - SectorEnvironmentObject( const Ogre::String & name, Sector * sector ); - }; - - - /*class SectorPlanetObject : public SectorEnvironmentObject{ - }; - class SectorStarfieldObject : public SectorEnvironmentObject{ - }; - class SectorSpaceDustObject : public SectorEnvironmentObject{ - }; - class SectorSpaceDecorationObject : public SectorEnvironmentObject{ - };*/ - } //namespace OpenGate #endif //_OPENGATE_SECTORBASEOBJECT__H Modified: trunk/src/UnDockedState.cpp =================================================================== --- trunk/src/UnDockedState.cpp 2009-02-12 00:47:47 UTC (rev 1030) +++ trunk/src/UnDockedState.cpp 2009-02-14 19:11:02 UTC (rev 1031) @@ -890,12 +890,12 @@ } bool UnDockedState::keyActionSelectTextTarget( bool pressed ){ - // if ( pressed ) setTarget( sector_->nextTarget() ); - return true; + if ( pressed ) radar_->findNextTarget(); + return true; } bool UnDockedState::keyActionSelectPreviousTarget( bool pressed ){ - // if ( pressed ) setTarget( sector_->prevTarget() ); + if ( pressed ) radar_->findPrevTarget(); return true; } @@ -1085,6 +1085,13 @@ return true; } +bool UnDockedState::keyActionShowEcliptic_DEV( bool pressed ){ + if ( pressed ) { + sector_->flipShowEcliptic( ); + } + return true; +} + bool UnDockedState::maximiseConsole( ){ if ( overlayRootWindow_ ){ CEGUI::WindowManager::getSingleton().getWindow( (CEGUI::utf8*)"UnDocked/MainWindow/ConsoleFrame")-> Modified: trunk/src/UnDockedState.h =================================================================== --- trunk/src/UnDockedState.h 2009-02-12 00:47:47 UTC (rev 1030) +++ trunk/src/UnDockedState.h 2009-02-14 19:11:02 UTC (rev 1031) @@ -132,6 +132,7 @@ bool keyActionAvatarSelfDestruct_DEV( bool pressed = true ); bool keyActionSpawnAi_DEV( bool pressed = true ); bool keyActionShowInfos_DEV( bool pressed = true ); + bool keyActionShowEcliptic_DEV( bool pressed = true ); protected: UnDockedState( ); Modified: trunk/src/Vessel.cpp =================================================================== --- trunk/src/Vessel.cpp 2009-02-12 00:47:47 UTC (rev 1030) +++ trunk/src/Vessel.cpp 2009-02-14 19:11:02 UTC (rev 1031) @@ -50,6 +50,10 @@ capacitor_ = NULL; } +Vessel::~Vessel(){ + +} + std::vector < Ogre::Vector3 > findMountPoints( TiXmlHandle * hRoot, const std::string & key ){ std::vector < Ogre::Vector3 > mountPoints; TiXmlElement * pElem; @@ -75,14 +79,14 @@ readXMLNode< int >( hRoot, "ecmsize maximum_ECM_size", this, &OpenGate::Vessel::setEcmSize, false ); for ( int i = 1; i < 7; i ++ ){ - std::vector < Ogre::Vector3 > guns = findMountPoints( &hRoot, "gun_slot_size_" + toStr( i ) ); + std::vector < Ogre::Vector3 > guns = findMountPoints( &hRoot, "gun_slot_size_" + toStr( i ) ); if ( guns.size() > 0 ){ this->setGunMountPoints( i, guns ); } } for ( int i = 1; i < 7; i ++ ){ - std::vector < Ogre::Vector3 > engines = findMountPoints( &hRoot, "engine_slot_size_" + toStr( i ) ); + std::vector < Ogre::Vector3 > engines = findMountPoints( &hRoot, "engine_slot_size_" + toStr( i ) ); if ( engines.size() > 0 ){ this->setEngineMountPoints( i, engines ); break; @@ -135,12 +139,12 @@ } void Vessel::setGunMountPoints( int size, std::vector < Ogre::Vector3 > & mountPoints ){ - gunMountPoints_[ size ] = mountPoints; + gunMountPoints_[ size ] = mountPoints; } void Vessel::setEngineMountPoints( int size, std::vector < Ogre::Vector3 > & mountPoints ){ - engineSize_ = size; - engineMountPoints_ = mountPoints; + engineSize_ = size; + engineMountPoints_ = mountPoints; } bool Vessel::setPowerPlant( PowerPlant * item ){ Modified: trunk/src/Vessel.h =================================================================== --- trunk/src/Vessel.h 2009-02-12 00:47:47 UTC (rev 1030) +++ trunk/src/Vessel.h 2009-02-14 19:11:02 UTC (rev 1031) @@ -64,7 +64,7 @@ Vessel(); /*! Desctructor */ - virtual ~Vessel(){} + virtual ~Vessel(); virtual void readPropertiesFromXML( TiXmlHandle & hRoot ); @@ -103,10 +103,10 @@ Uint32 capacity() const; void setGunMountPoints( int size, std::vector < Ogre::Vector3 > & mountPoints ); - std::map < int, std::vector < Ogre::Vector3 > > gunMountPoints() const { return gunMountPoints_; } + const std::map < int, std::vector < Ogre::Vector3 > > & gunMountPoints() const { return gunMountPoints_; } void setEngineMountPoints( int size, std::vector < Ogre::Vector3 > & mountPoints ); - std::vector < Ogre::Vector3 > engineMountPoints() const { return engineMountPoints_; } + const std::vector < Ogre::Vector3 > & engineMountPoints() const { return engineMountPoints_; } inline int amountEngines( ) const { return engineMountPoints_.size(); } inline void setAmountModX( int amount ){ amountModX_ = amount; } Modified: trunk/src/opengateclient.cpp =================================================================== --- trunk/src/opengateclient.cpp 2009-02-12 00:47:47 UTC (rev 1030) +++ trunk/src/opengateclient.cpp 2009-02-14 19:11:02 UTC (rev 1031) @@ -188,32 +188,29 @@ log->info( "Offline mode." ); } - try { - bool withIntro = true; - OpenGate::GameStateManager gameStateMgr( nw, option_dialog ); + try { + bool withIntro = false; + OpenGate::GameStateManager gameStateMgr( nw, option_dialog ); - if ( withIntro ){ - OpenGate::InitState::create( &gameStateMgr, "InitState" ); - gameStateMgr.start( gameStateMgr.findByName( "InitState" ) ) ; - } else { - gameStateMgr.initialiseAllResources(); - //gameStateMgr.start( gameStateMgr.findByName( "DockedState" ) ) ; - gameStateMgr.start( gameStateMgr.findByName( "UnDockedState" ) ) ; - } - - } catch( Ogre::Exception& e ) { - + if ( withIntro ){ + OpenGate::InitState::create( &gameStateMgr, "InitState" ); + gameStateMgr.start( gameStateMgr.findByName( "InitState" ) ) ; + } else { + gameStateMgr.initialiseAllResources(); + gameStateMgr.start( gameStateMgr.findByName( "DockedState" ) ) ; + //gameStateMgr.start( gameStateMgr.findByName( "UnDockedState" ) ) ; + } + } catch( Ogre::Exception& e ) { #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 - MessageBox( NULL, e.getFullDescription().c_str(), + MessageBox( NULL, e.getFullDescription().c_str(), "An exception has occured!", MB_OK | MB_ICONERROR | MB_TASKMODAL); #else - log->fatal( std::string("An exception has occured: ") + e.getFullDescription().c_str() ); + log->fatal( std::string("An exception has occured: ") + e.getFullDescription().c_str() ); #endif - } + } + nw.close(); - nw.close(); + delete log; - delete log; - - return EXIT_SUCCESS; + return EXIT_SUCCESS; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <spo...@us...> - 2009-02-12 00:47:54
|
Revision: 1030 http://opengate.svn.sourceforge.net/opengate/?rev=1030&view=rev Author: spom_spom Date: 2009-02-12 00:47:47 +0000 (Thu, 12 Feb 2009) Log Message: ----------- win compatibility commit, client should work now, press F7 to see a bot auto-docking, right and middle MB spams missiles Modified Paths: -------------- trunk/win32/ogsectorclient/ogreopcode.dll trunk/win32/ogsectorclient/ogsectorclient.exe trunk/win32/ogsectorclient/opcode.dll trunk/win32/ogsectorclient/resources.cfg trunk/win32/ogsectorclient/vorbis.dll trunk/win32/ogsectorclient/vorbisfile.dll Added Paths: ----------- trunk/win32/ogsectorclient/mingwm10.dll Added: trunk/win32/ogsectorclient/mingwm10.dll =================================================================== (Binary files differ) Property changes on: trunk/win32/ogsectorclient/mingwm10.dll ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: trunk/win32/ogsectorclient/ogreopcode.dll =================================================================== --- trunk/win32/ogsectorclient/ogreopcode.dll 2009-02-12 00:39:55 UTC (rev 1029) +++ trunk/win32/ogsectorclient/ogreopcode.dll 2009-02-12 00:47:47 UTC (rev 1030) @@ -1,13 +1,22 @@ MZ\x90 |
From: <spo...@us...> - 2009-02-12 00:39:57
|
Revision: 1029 http://opengate.svn.sourceforge.net/opengate/?rev=1029&view=rev Author: spom_spom Date: 2009-02-12 00:39:55 +0000 (Thu, 12 Feb 2009) Log Message: ----------- revive evil bee (usefull for tpoc) Added Paths: ----------- trunk/data/missiles/bee.xml trunk/data/missiles/bee_big.png trunk/data/missiles/bee_small.png Added: trunk/data/missiles/bee.xml =================================================================== --- trunk/data/missiles/bee.xml (rev 0) +++ trunk/data/missiles/bee.xml 2009-02-12 00:39:55 UTC (rev 1029) @@ -0,0 +1,29 @@ +<?xml version="1.0"?> + +<container> + <object_id>10002</object_id> + <name_de>Bee</name_de> + <name_en>Bee</name_en> + <category_id>13</category_id> + <faction_id>2</faction_id> + <production_center>Quantar Core</production_center> + <production_center>Quantar TriPoint</production_center> + <production_center>Quantar Corridor</production_center> + <manufacturer>Cromforge Enterprises</manufacturer> + <required_rank>12</required_rank> + <size>1</size> + <mass>50</mass> + <thrust>82000</thrust> + <pitch>97</pitch> + <yaw>97</yaw> + <drag_factor>0.11</drag_factor> + <damage>1250</damage> + <life_time>18</life_time> + <required_component>iron</required_component> + <required_component>CPUs</required_component> + <required_component>fuel cells</required_component> + <required_component>explosives</required_component> + <required_component>carbon</required_component> + <required_political_status>28</required_political_status> + <mesh>firefly</mesh> +</container> Added: trunk/data/missiles/bee_big.png =================================================================== (Binary files differ) Property changes on: trunk/data/missiles/bee_big.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/data/missiles/bee_small.png =================================================================== (Binary files differ) Property changes on: trunk/data/missiles/bee_small.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <spo...@us...> - 2009-02-11 23:59:13
|
Revision: 1028 http://opengate.svn.sourceforge.net/opengate/?rev=1028&view=rev Author: spom_spom Date: 2009-02-11 23:59:10 +0000 (Wed, 11 Feb 2009) Log Message: ----------- internal entity names are now case insensitive, removed some debug msgs. Modified Paths: -------------- trunk/data/gui/config.ini trunk/data/gui/fonts/BlueHighway-12.font trunk/data/gui/fonts/BlueHighway-14.font trunk/data/gui/fonts/BlueHighway-16.font trunk/src/EntityManager.cpp trunk/src/GameStateManager.cpp trunk/src/Moveable.cpp trunk/src/Moveable.h trunk/src/OpenALSoundManager.cpp trunk/src/UnDockedState.cpp Modified: trunk/data/gui/config.ini =================================================================== --- trunk/data/gui/config.ini 2009-02-11 23:50:17 UTC (rev 1027) +++ trunk/data/gui/config.ini 2009-02-11 23:59:10 UTC (rev 1028) @@ -1,5 +1,5 @@ [user] -username: -password: +username: testuser +password: test1 [display] -show startup video: true \ No newline at end of file +show startup video: false \ No newline at end of file Modified: trunk/data/gui/fonts/BlueHighway-12.font =================================================================== --- trunk/data/gui/fonts/BlueHighway-12.font 2009-02-11 23:50:17 UTC (rev 1027) +++ trunk/data/gui/fonts/BlueHighway-12.font 2009-02-11 23:59:10 UTC (rev 1028) @@ -1,2 +1,2 @@ <?xml version="1.0" ?> -<Font Name="BlueHighway-12" Filename="BlueHighway.ttf" Type="FreeType" Size="12" NativeHorzRes="1024" NativeVertRes="768" AutoScaled="true" /> +<Font Name="BlueHighway-12" Filename="BlueHighway.ttf" Type="FreeType" Size="12" NativeHorzRes="1024" NativeVertRes="768" AutoScaled="false" AntiAlias="true" /> Modified: trunk/data/gui/fonts/BlueHighway-14.font =================================================================== --- trunk/data/gui/fonts/BlueHighway-14.font 2009-02-11 23:50:17 UTC (rev 1027) +++ trunk/data/gui/fonts/BlueHighway-14.font 2009-02-11 23:59:10 UTC (rev 1028) @@ -1,2 +1,2 @@ <?xml version="1.0" ?> -<Font Name="BlueHighway-14" Filename="BlueHighway.ttf" Type="FreeType" Size="14" NativeHorzRes="1024" NativeVertRes="768" AutoScaled="true" /> +<Font Name="BlueHighway-14" Filename="BlueHighway.ttf" Type="FreeType" Size="14" NativeHorzRes="1024" NativeVertRes="768" AutoScaled="false" AntiAlias="true" /> Modified: trunk/data/gui/fonts/BlueHighway-16.font =================================================================== --- trunk/data/gui/fonts/BlueHighway-16.font 2009-02-11 23:50:17 UTC (rev 1027) +++ trunk/data/gui/fonts/BlueHighway-16.font 2009-02-11 23:59:10 UTC (rev 1028) @@ -1,2 +1,2 @@ <?xml version="1.0" ?> -<Font Name="BlueHighway-16" Filename="BlueHighway.ttf" Type="FreeType" Size="16" NativeHorzRes="1024" NativeVertRes="768" AutoScaled="true" /> +<Font Name="BlueHighway-16" Filename="BlueHighway.ttf" Type="FreeType" Size="16" NativeHorzRes="1024" NativeVertRes="768" AutoScaled="false" AntiAlias="true"/> Modified: trunk/src/EntityManager.cpp =================================================================== --- trunk/src/EntityManager.cpp 2009-02-11 23:50:17 UTC (rev 1027) +++ trunk/src/EntityManager.cpp 2009-02-11 23:59:10 UTC (rev 1028) @@ -107,8 +107,8 @@ } Entity * EntityManager::entity( const std::string & name ) { - if ( templatesByName_.count( name ) ){ - return templatesByName_[ name ]; + if ( templatesByName_.count( strCopyToLowerCase( name ) ) ){ + return templatesByName_[ strCopyToLowerCase( name ) ]; } else { LogManager::getSingleton().warn( "No entity named: " + name + " registered." ); return NULL; @@ -166,8 +166,9 @@ Ogre::StringVectorPtr files = pArch->find( "*.xml", true, false); for ( unsigned int i = 0; i < (*files).size(); i ++ ){ - if ( (*files)[ i ].rfind( ".mesh.xml" ) == std::string::npos ){ - log_->fout( std::string( "Found ressource: " ) + (*files)[ i ] ); + if ( (*files)[ i ].rfind( ".mesh.xml" ) == std::string::npos && + (*files)[ i ].rfind( ".xml~" ) == std::string::npos ){ + //log_->fout( std::string( "Found ressource: " ) + (*files)[ i ] ); loadAndCreate( (*resourcePaths.begin()) + "/" + resourceName + "/" + (*files)[ i ] ); } } @@ -176,7 +177,7 @@ } Entity * EntityManager::loadAndCreate( const std::string & fileName ){ - log_->fout( "Read equipment: " + fileName ); + //log_->fout( "Read equipment: " + fileName ); TiXmlDocument doc( fileName ); bool loadOkay = doc.LoadFile(); @@ -252,8 +253,8 @@ return NULL; } - if ( templatesByName_.count( entity->name() ) == 0 ){ - templatesByName_[ entity->name() ] = entity; + if ( templatesByName_.count( strCopyToLowerCase( entity->name() ) ) == 0 ){ + templatesByName_[ strCopyToLowerCase( entity->name() ) ] = entity; templatesByID_[ entity->id() ] = entity; factions_.insert( entity->factionName() ); } else { Modified: trunk/src/GameStateManager.cpp =================================================================== --- trunk/src/GameStateManager.cpp 2009-02-11 23:50:17 UTC (rev 1027) +++ trunk/src/GameStateManager.cpp 2009-02-11 23:59:10 UTC (rev 1028) @@ -93,8 +93,8 @@ } if ( resources_.soundManager ) { log_->info( "Shutdown soundmanager." ); - delete resources_.soundManager; - resources_.soundManager = NULL; +// delete resources_.soundManager; +// resources_.soundManager = NULL; } if ( resources_.inputManager ) { log_->info( "Shutdown inputmanager." ); @@ -122,6 +122,24 @@ return true; } +bool GameStateManager::initialiseOgreEngine_( bool dialog ){ + if ( !fileExist( "ogre.cfg" ) ) { + dialog = true; + } + + if ( !dialog ){ + resources_.ogreRoot()->restoreConfig(); + resources_.renderWindow = resources_.ogreRoot()->initialise( true, "OpenGate" ); + return true; + } else { + if ( resources_.ogreRoot()->showConfigDialog() ) { + resources_.renderWindow = resources_.ogreRoot()->initialise( true, "OpenGate" ); + return true; + } + } + return false; +} + bool GameStateManager::initialiseBootstrapResources( ) { log_->info( "load bootstrap resources." ); Ogre::ConfigFile cf; cf.load( "resources.cfg" ); @@ -307,24 +325,6 @@ return true; } -bool GameStateManager::initialiseOgreEngine_( bool dialog ){ - if ( !fileExist( "ogre.cfg" ) ) { - dialog = true; - } - - if ( !dialog ){ - resources_.ogreRoot()->restoreConfig(); - resources_.renderWindow = resources_.ogreRoot()->initialise( true, "OpenGate" ); - return true; - } else { - if ( resources_.ogreRoot()->showConfigDialog() ) { - resources_.renderWindow = resources_.ogreRoot()->initialise( true, "OpenGate" ); - return true; - } - } - return false; -} - bool GameStateManager::initialiseOgreResources( ) { // Load resource paths from config file Ogre::ConfigFile cf; cf.load( "resources.cfg" ); @@ -352,12 +352,11 @@ } Ogre::ResourceGroupManager::getSingleton().initialiseResourceGroup( "Opengate" ); - std::cout << "Ogre::ResourceGroupManager::getSingleton().initialiseResourceGroup( Opengate ); " << std::endl; Ogre::ResourceGroupManager::ResourceDeclarationList li = Ogre::ResourceGroupManager::getSingleton().getResourceDeclarationList( "Opengate" ); - std::cout << li.size() << std::endl; +/* std::cout << li.size() << std::endl; for ( std::list<Ogre::ResourceGroupManager::ResourceDeclaration>::iterator it = li.begin(); it != li.end(); it ++ ){ std::cout << (*it).resourceName << std::endl; - } + }*/ return true; } Modified: trunk/src/Moveable.cpp =================================================================== --- trunk/src/Moveable.cpp 2009-02-11 23:50:17 UTC (rev 1027) +++ trunk/src/Moveable.cpp 2009-02-11 23:59:10 UTC (rev 1028) @@ -35,9 +35,9 @@ void Movable::readPropertiesFromXML( TiXmlHandle & hRoot ){ MeshEntity::readPropertiesFromXML( hRoot ); - readXMLNode< float >( hRoot, "yaw", this, &OpenGate::Movable::setYaw, false ); - readXMLNode< float >( hRoot, "pitch", this, &OpenGate::Movable::setPitch, false ); - readXMLNode< float >( hRoot, "roll", this, &OpenGate::Movable::setRoll, false ); + readXMLNode< float >( hRoot, "yaw maximum_yaw", this, &OpenGate::Movable::setYaw, false ); + readXMLNode< float >( hRoot, "pitch maximum_pitch", this, &OpenGate::Movable::setPitch, false ); + readXMLNode< float >( hRoot, "roll maximum_roll", this, &OpenGate::Movable::setRoll, false ); readXMLNode< Uint32 >( hRoot, "armor", this, &OpenGate::Movable::setArmor, false ); readXMLNode< float >( hRoot, "dragfactor drag_factor", this, &OpenGate::Movable::setDragFactor, false ); } Modified: trunk/src/Moveable.h =================================================================== --- trunk/src/Moveable.h 2009-02-11 23:50:17 UTC (rev 1027) +++ trunk/src/Moveable.h 2009-02-11 23:59:10 UTC (rev 1028) @@ -36,7 +36,7 @@ inline void setArmor( Uint32 armor ){ armor_ = armor * 1000; } inline Uint32 armor( ) const { return armor_; } - //** degree /second + /*! degree /second */ inline void setYaw( float yaw ){ yaw_ = yaw; if ( yaw_ < 1.0 ) yaw_ = 1000.0 * ( 180.0 * yaw_ ) / 3.141592; } @@ -50,6 +50,7 @@ inline void setRoll( float roll ){ roll_ = roll; if ( roll_ < 1.0 ) roll_ = 1000.0 * ( 180.0 * roll_ ) / 3.141592; } + inline float roll( ) const { return roll_; } inline void setDragFactor( float drag ){ dragFactor_ = drag; } Modified: trunk/src/OpenALSoundManager.cpp =================================================================== --- trunk/src/OpenALSoundManager.cpp 2009-02-11 23:50:17 UTC (rev 1027) +++ trunk/src/OpenALSoundManager.cpp 2009-02-11 23:59:10 UTC (rev 1028) @@ -281,7 +281,7 @@ stop(); empty_(); - alDeleteSources(1, & source_ ); +// alDeleteSources(1, & source_ ); //** valgrind says:; // Invalid read of size 4 // ==10954== at 0x6129E42: (within /usr/lib64/libopenal.so.0.0.0) Modified: trunk/src/UnDockedState.cpp =================================================================== --- trunk/src/UnDockedState.cpp 2009-02-11 23:50:17 UTC (rev 1027) +++ trunk/src/UnDockedState.cpp 2009-02-11 23:59:10 UTC (rev 1028) @@ -459,13 +459,13 @@ if ( !configMode_ ){ if ( sector_->avatarObject() != NULL ){ switch ( id ){ - case 0: + case OIS::MB_Left: sector_->avatarObject()->setFirePressed( true ); break; - case 1: + case OIS::MB_Middle: sector_->avatarObject()->fireMissile( ResourceManager::getSingleton().entityManager->missile( "Firefly" ), radar_->target() ); break; - case 2: + case OIS::MB_Right: sector_->avatarObject()->fireMissile( ResourceManager::getSingleton().entityManager->missile( "bee" ), radar_->target() ); break; default: @@ -481,7 +481,7 @@ bool UnDockedState::mouseReleased( const OIS::MouseEvent &e , OIS::MouseButtonID id ){ if ( !configMode_ ){ if ( sector_->avatarObject() != NULL ){ - if ( id == 0 ){ + if ( id == OIS::MB_Left ){ sector_->avatarObject()->setFirePressed( false); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <spo...@us...> - 2009-02-11 23:50:29
|
Revision: 1027 http://opengate.svn.sourceforge.net/opengate/?rev=1027&view=rev Author: spom_spom Date: 2009-02-11 23:50:17 +0000 (Wed, 11 Feb 2009) Log Message: ----------- Add mandatory infos about vessel size, gun and engine slots Modified Paths: -------------- trunk/data/ships/octavius/apteryx/apteryx.xml Modified: trunk/data/ships/octavius/apteryx/apteryx.xml =================================================================== --- trunk/data/ships/octavius/apteryx/apteryx.xml 2009-02-11 22:20:22 UTC (rev 1026) +++ trunk/data/ships/octavius/apteryx/apteryx.xml 2009-02-11 23:50:17 UTC (rev 1027) @@ -23,9 +23,16 @@ <maximum_capacitor_size>2</maximum_capacitor_size> <cargo_hold>1</cargo_hold> <armor>9000</armor> - <maximum_yaw>80</maximum_yaw> <drag_factor>12.96</drag_factor> + <maximum_yaw>80</maximum_yaw> <maximum_pitch>90</maximum_pitch> <maximum_roll>70</maximum_roll> - <base_yaw>-90</base_yaw> -</container> \ No newline at end of file + + <base_yaw>-90</base_yaw> + <length>12.2</length> + <width>10.2</width> + <height>2.8</height> + <gun_slot_size_1>-14.4454225 -0.463915 -3.6021025</gun_slot_size_1> + <gun_slot_size_1>-14.4454225 -0.463915 3.602345</gun_slot_size_1> + <engine_slot_size_3>12.851 1.335 0.0</engine_slot_size_3> +</container> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |