cgkit-commits Mailing List for Python Computer Graphics Kit
Brought to you by:
mbaas
You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(54) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(40) |
Feb
(69) |
Mar
(43) |
Apr
(81) |
May
(92) |
Jun
(56) |
Jul
(35) |
Aug
(59) |
Sep
(41) |
Oct
(26) |
Nov
(15) |
Dec
(12) |
2006 |
Jan
(20) |
Feb
(23) |
Mar
(47) |
Apr
(87) |
May
(43) |
Jun
(7) |
Jul
(20) |
Aug
(5) |
Sep
(29) |
Oct
(83) |
Nov
(34) |
Dec
(16) |
2007 |
Jan
(11) |
Feb
|
Mar
|
Apr
|
May
(4) |
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2008 |
Jan
(3) |
Feb
(24) |
Mar
(2) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
(4) |
Sep
(8) |
Oct
(2) |
Nov
(1) |
Dec
|
2009 |
Jan
(8) |
Feb
(22) |
Mar
(5) |
Apr
(10) |
May
(9) |
Jun
(8) |
Jul
(2) |
Aug
(13) |
Sep
(10) |
Oct
|
Nov
|
Dec
(1) |
2010 |
Jan
(3) |
Feb
(1) |
Mar
(4) |
Apr
(2) |
May
(3) |
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
(2) |
May
|
Jun
|
Jul
|
Aug
(2) |
Sep
|
Oct
|
Nov
(7) |
Dec
|
2012 |
Jan
|
Feb
|
Mar
|
Apr
(3) |
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
(1) |
Nov
(4) |
Dec
(5) |
2013 |
Jan
|
Feb
(5) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
|
|
1
|
2
|
3
(1) |
4
|
5
|
6
(6) |
7
|
8
(2) |
9
(1) |
10
(6) |
11
(2) |
12
|
13
(2) |
14
(1) |
15
(4) |
16
(3) |
17
(2) |
18
|
19
(3) |
20
(9) |
21
|
22
(3) |
23
|
24
(5) |
25
(1) |
26
|
27
(10) |
28
(8) |
|
|
|
|
|
From: Matthias B. <mb...@us...> - 2005-02-28 17:00:07
|
Update of /cvsroot/cgkit/cgkit2/doc/tex In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1610/tex Modified Files: bvh.tex eventmanager.tex render.tex slots.tex viewer.tex Log Message: Updates Index: eventmanager.tex =================================================================== RCS file: /cvsroot/cgkit/cgkit2/doc/tex/eventmanager.tex,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** eventmanager.tex 12 Dec 2004 14:31:45 -0000 1.1.1.1 --- eventmanager.tex 28 Feb 2005 16:59:57 -0000 1.2 *************** *** 50,59 **** \end{methoddesc} ! \begin{methoddesc}{connect}{name, receiver, system=False} Connect a function or method to an event type. Whenever an event of type \var{name} occurs the event handler specified by \var{receiver} is called. \var{receiver} can either be a callable such as a function or a method or it can be an instance of a class that must implement an ! \code{on{\em name}()} method. The argument \var{system} specifies if the connection is system wide or not. --- 50,61 ---- \end{methoddesc} ! \begin{methoddesc}{connect}{name, receiver, priority=1, system=False} Connect a function or method to an event type. Whenever an event of type \var{name} occurs the event handler specified by \var{receiver} is called. \var{receiver} can either be a callable such as a function or a method or it can be an instance of a class that must implement an ! \code{on{\em name}()} method. \var{priority} determines the order in ! which the receivers are invoked. Receivers with lower values (=high priority) ! are invoked first. The argument \var{system} specifies if the connection is system wide or not. Index: bvh.tex =================================================================== RCS file: /cvsroot/cgkit/cgkit2/doc/tex/bvh.tex,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** bvh.tex 17 Feb 2005 09:02:46 -0000 1.2 --- bvh.tex 28 Feb 2005 16:59:57 -0000 1.3 *************** *** 3,7 **** \declaremodule{extension}{cgkit.bvh} ! \modulesynopsis{Reading BioVision Hierarchical (BVH) motion capture files} This module contains the \class{BVHReader} class which can be used as a base --- 3,7 ---- \declaremodule{extension}{cgkit.bvh} ! \modulesynopsis{Reading Biovision Hierarchical (BVH) motion capture files} This module contains the \class{BVHReader} class which can be used as a base Index: render.tex =================================================================== RCS file: /cvsroot/cgkit/cgkit2/doc/tex/render.tex,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** render.tex 12 Dec 2004 14:31:52 -0000 1.1.1.1 --- render.tex 28 Feb 2005 16:59:57 -0000 1.2 *************** *** 81,82 **** --- 81,86 ---- \end{description} + + {\bf Events:} + + The render tool does not generate any user input events. Index: viewer.tex =================================================================== RCS file: /cvsroot/cgkit/cgkit2/doc/tex/viewer.tex,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** viewer.tex 9 Jan 2005 20:13:07 -0000 1.2 --- viewer.tex 28 Feb 2005 16:59:57 -0000 1.3 *************** *** 25,29 **** \begin{description} \item[\code{-f<int>} / \code{--fps=<int>}] ! Specifies the frame rate that should tried to be maintained while playing back the scene (default: 30). --- 25,29 ---- \begin{description} \item[\code{-f<int>} / \code{--fps=<int>}] ! Specifies the frame rate that should be tried to maintain while playing back the scene (default: 30). *************** *** 119,120 **** --- 119,162 ---- \end{description} + + {\bf Events:} + + The viewer tool generates the following user input events (see the + module \refmodule{cgkit.events} for more details about these events): + + \begin{itemize} + \item \code{KEY_PRESS} + \item \code{KEY_RELEASE} + \item \code{LEFT_DOWN} + \item \code{MIDDLE_DOWN} + \item \code{RIGHT_DOWN} + \item \code{MOUSE_BUTTON_DOWN} + \item \code{LEFT_UP} + \item \code{MIDDLE_UP} + \item \code{RIGHT_UP} + \item \code{MOUSE_BUTTON_UP} + \item \code{MOUSE_WHEEL} + \item \code{MOUSE_MOVE} + \item \code{JOYSTICK_AXIS} + \item \code{JOYSTICK_BALL} + \item \code{JOYSTICK_HAT} + \item \code{JOYSTICK_BUTTON_DOWN} + \item \code{JOYSTICK_BUTTON_UP} + \item \code{SPACE_MOTION} + \item \code{SPACE_BUTTON_DOWN} + \item \code{SPACE_BUTTON_UP} + \item \code{SPACE_BUTTON_ZERO} + \item \code{TABLET} + \end{itemize} + + {\bf Timing:} + + The operations per frame are as follows (in this order): + + \begin{enumerate} + \item Render and display the current scene at time $t$ + \item Handle events + \item Step frame (i.e. increase the time by $\Delta t$ and signal the + \code{STEP_FRAME} event) + \item Sync to the specified framerate + \end{enumerate} Index: slots.tex =================================================================== RCS file: /cvsroot/cgkit/cgkit2/doc/tex/slots.tex,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** slots.tex 22 Feb 2005 15:42:51 -0000 1.1 --- slots.tex 28 Feb 2005 16:59:57 -0000 1.2 *************** *** 147,150 **** --- 147,151 ---- \begin{methoddesc}{resize}{size} Resize the array slot so that it can carry \var{size} elements. + The values in the array are not modified by this operation. \end{methoddesc} *************** *** 189,210 **** % getValue \begin{methoddesc}{getValue}{index} ! Return one item of the array slot. This method should only be used on ! array slots of multiplicity 1. ! \end{methoddesc} ! ! % setValue ! \begin{methoddesc}{setValue}{index, val} ! Set one item to a new value. This method should only be used on array ! slots of multiplicity 1. ! \end{methoddesc} ! ! % getValues ! \begin{methoddesc}{getValues}{index} ! Return one item of the array slot. \end{methoddesc} % setValue ! \begin{methoddesc}{setValues}{index, vals} ! Set one item to a new value. \end{methoddesc} --- 190,203 ---- % getValue \begin{methoddesc}{getValue}{index} ! Return one item of the array slot. If the multiplicity of the slot is 1 ! then return value is just an individual value, otherwise it's a tuple ! containing the values. \end{methoddesc} % setValue ! \begin{methoddesc}{setValue}{index, value} ! Set one item to a new value. If the multiplicity of the slot is 1 \var{value} ! has to be one single value, otherwise it must be a sequence containing ! \var{multiplicity} elements. \end{methoddesc} |
From: Matthias B. <mb...@us...> - 2005-02-28 16:50:18
|
Update of /cvsroot/cgkit/cgkit2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31503 Modified Files: viewer.py changelog.txt Log Message: Modified the order of operation within a frame. The scene is now rendered first. Index: changelog.txt =================================================================== RCS file: /cvsroot/cgkit/cgkit2/changelog.txt,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** changelog.txt 28 Feb 2005 13:17:48 -0000 1.17 --- changelog.txt 28 Feb 2005 16:50:04 -0000 1.18 *************** *** 6,9 **** --- 6,11 ---- New features: + - EventManager: When connecting to an event you can now specify a priority + which determines the calling order. - The GL light sources now also have an "ambient" color attribute - Instead of a single material you can now also pass a sequence of materials *************** *** 30,33 **** --- 32,38 ---- Bug fixes/enhancements: + - viewer: The order of operation within a frame has changed. The scene is + now displayed at the beginning of the frame (so that processing events + and the STEP_FRAME event are together). - GnuPlotter: There seems to be a bug in Gnuplot.py that produces an exception when only one data item is being plotted. The GnuPlotter component now Index: viewer.py =================================================================== RCS file: /cvsroot/cgkit/cgkit2/viewer.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** viewer.py 20 Jan 2005 10:36:19 -0000 1.6 --- viewer.py 28 Feb 2005 16:50:03 -0000 1.7 *************** *** 254,258 **** if self.options.disable_spacedevice: ! self.enable_spacedevice = False if self.options.disable_wintab: self.enable_wintab = False --- 254,259 ---- if self.options.disable_spacedevice: ! self.enable_spacedevice = True # temporarily invert the meaning of -X ! # self.enable_spacedevice = False if self.options.disable_wintab: self.enable_wintab = False *************** *** 397,400 **** --- 398,406 ---- timer.startClock() while self.running: + # Display the scene + self.draw(self.cam, width, height) + pygame.display.flip() + + # Handle events events = pygame.event.get() self.handleEvents(events) *************** *** 403,414 **** self.handleWintabEvents() - # srf = pygame.display.get_surface() - # w = srf.get_width() - # h = srf.get_height() - # print w,h - self.draw(self.cam, width, height) - - pygame.display.flip() - if self.time_end!=None and timer.time>self.time_end+1E-10: active = False --- 409,412 ---- *************** *** 417,423 **** if self.options.save!=None: self.saveScreenshot(srf) ! timer.step() clk.tick(fps) cnt+=1 --- 415,423 ---- if self.options.save!=None: self.saveScreenshot(srf) ! ! # Step time timer.step() + # Sync clk.tick(fps) cnt+=1 |
From: Matthias B. <mb...@us...> - 2005-02-28 16:46:31
|
Update of /cvsroot/cgkit/cgkit2/cgkit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30460/cgkit Modified Files: eventmanager.py Log Message: When connecting to an event you can now specify a priority which determines the calling order. Index: eventmanager.py =================================================================== RCS file: /cvsroot/cgkit/cgkit2/cgkit/eventmanager.py,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** eventmanager.py 12 Dec 2004 14:31:00 -0000 1.1.1.1 --- eventmanager.py 28 Feb 2005 16:46:16 -0000 1.2 *************** *** 24,28 **** ## Contains the EventManager class. ! import sys, types # EventManager --- 24,57 ---- ## Contains the EventManager class. ! import sys, types, bisect ! ! # Receiver ! class _Receiver: ! """Stores a receiver (=callable) and a priority. ! ! This class defines a comparison operator (that's why this class is ! used instead of a tuple (priority, receiver)). ! """ ! def __init__(self, receiver, priority=1): ! self.receiver = receiver ! self.priority = priority ! ! ! def __str__(self): ! # If the receiver is an instance method, then obtain the corresponding ! # class name ! cls = getattr(self.receiver, "im_class") ! if cls!=None: ! s = getattr(cls, "__name__")+"." ! else: ! s = "" ! s += getattr(self.receiver, "__name__", "<unnamed>") ! return "(%d, %s)"%(self.priority, s) ! ! __repr__ = __str__ ! ! def __cmp__(self, other): ! return self.priority-other.priority ! # EventManager *************** *** 38,46 **** """Constructor.""" ! # System wide connections. Key: Event name - Value: List of receivers self.system_connections = {} ! # Scene wide connections. Key: Event name - Value: List of receivers self.scene_connections = {} # event def event(self, name, *params, **keyargs): --- 67,97 ---- """Constructor.""" ! # System wide connections. ! # Key: Event name - Value: Sorted list of _Receivers self.system_connections = {} ! # Scene wide connections. ! # Key: Event name - Value: Sorted list of _Receivers self.scene_connections = {} + def __str__(self): + s = 70*"-"+"\n" + s += "System events\n" + s += 70*"-"+"\n" + for event in self.system_connections: + s+='Event: "%s"\n'%event + for rec in self.system_connections[event]: + s+=" %s\n"%rec + s+="\n" + + s += 70*"-"+"\n" + s += "Scene events\n" + s += 70*"-"+"\n" + for event in self.scene_connections: + s+='Event: "%s"\n'%event + for rec in self.scene_connections[event]: + s+=" %s\n"%rec + return s + + # event def event(self, name, *params, **keyargs): *************** *** 57,61 **** receivers = self.system_connections.get(name, []) for rec in receivers: ! if rec(*params, **keyargs): stop_flag = True --- 108,112 ---- receivers = self.system_connections.get(name, []) for rec in receivers: ! if rec.receiver(*params, **keyargs): stop_flag = True *************** *** 66,70 **** receivers = self.scene_connections.get(name, []) for rec in receivers: ! if rec(*params, **keyargs): stop_flag = True --- 117,121 ---- receivers = self.scene_connections.get(name, []) for rec in receivers: ! if rec.receiver(*params, **keyargs): stop_flag = True *************** *** 72,81 **** # connect ! def connect(self, name, receiver, system=False): """Connect a function or method to an event. \param name (\c str) Name of the event. \param receiver The receiving function or method, or an instance of a class that must implement an on<Event>() method. \param system (\c bool) Specifies if the connection is system wide or not (default: \c False). --- 123,136 ---- # connect ! def connect(self, name, receiver, priority=10, system=False): """Connect a function or method to an event. + The priority determines the calling order when the corresponding + event is emitted. Receivers with a smaller priority are invoked first. + \param name (\c str) Name of the event. \param receiver The receiving function or method, or an instance of a class that must implement an on<Event>() method. + \param priority (\c int) Priority of the receiver \param system (\c bool) Specifies if the connection is system wide or not (default: \c False). *************** *** 95,104 **** connections = self.scene_connections # Has the event already any connections? then add the new receiver if connections.has_key(name): ! connections[name].append(receiver) # otherwise create a new list else: ! connections[name] = [receiver] return (name,receiver) --- 150,161 ---- connections = self.scene_connections + rec = _Receiver(receiver, priority) # Has the event already any connections? then add the new receiver if connections.has_key(name): ! bisect.insort(connections[name], rec) ! # connections[name].append(receiver) # otherwise create a new list else: ! connections[name] = [rec] return (name,receiver) *************** *** 136,144 **** # Try to remove the connection ! try: ! connections[name].remove(receiver) ! except ValueError: raise KeyError, 'Receiver is not connected to event "%s"'%name # disconnectAll def disconnectAll(self, system=False): --- 193,209 ---- # Try to remove the connection ! # try: ! # connections[name].remove(receiver) ! # except ValueError: ! # raise KeyError, 'Receiver is not connected to event "%s"'%name ! ! for i,rec in enumerate(connections[name]): ! if rec.receiver==receiver: ! break ! else: raise KeyError, 'Receiver is not connected to event "%s"'%name + del connections[i] + # disconnectAll def disconnectAll(self, system=False): |
From: Matthias B. <mb...@us...> - 2005-02-28 13:18:55
|
Update of /cvsroot/cgkit/cgkit2/wrappers In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3888/wrappers Modified Files: py_slot.h Log Message: Removed a warning under Linux Index: py_slot.h =================================================================== RCS file: /cvsroot/cgkit/cgkit2/wrappers/py_slot.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** py_slot.h 24 Feb 2005 15:14:58 -0000 1.3 --- py_slot.h 28 Feb 2005 13:18:38 -0000 1.4 *************** *** 61,65 **** .def("__str__", &ArraySlotWrapper<stype>::__str__) \ .def("__iter__", &ArraySlotWrapper<stype>::__iter__, return_value_policy<manage_new_object>()) ! // .def("onValueChanged", &ArraySlotWrapper<stype>::base_onValueChanged) \ // .def("getValue", &ArraySlotWrapper<stype>::getValue, // return_value_policy<copy_const_reference>()) --- 61,65 ---- .def("__str__", &ArraySlotWrapper<stype>::__str__) \ .def("__iter__", &ArraySlotWrapper<stype>::__iter__, return_value_policy<manage_new_object>()) ! // .def("onValueChanged", &ArraySlotWrapper<stype>::base_onValueChanged) // .def("getValue", &ArraySlotWrapper<stype>::getValue, // return_value_policy<copy_const_reference>()) |
From: Matthias B. <mb...@us...> - 2005-02-28 13:18:02
|
Update of /cvsroot/cgkit/cgkit2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3344 Modified Files: changelog.txt Log Message: Update Index: changelog.txt =================================================================== RCS file: /cvsroot/cgkit/cgkit2/changelog.txt,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** changelog.txt 27 Feb 2005 20:07:24 -0000 1.16 --- changelog.txt 28 Feb 2005 13:17:48 -0000 1.17 *************** *** 26,32 **** --- 26,37 ---- Acclaim Skeleton File Definition (ASF) files and Acclaim Motion Capture Data (AMC) files. + - OGRE-Viewer: New functionality for swapping scene graphs Bug fixes/enhancements: + - GnuPlotter: There seems to be a bug in Gnuplot.py that produces an exception + when only one data item is being plotted. The GnuPlotter component now + contains a workaround. + - Expression: When a user variable was called 'v' the expression didn't work. - ArraySlots: Array access wasn't range checked which could lead to a crash. This is fixed now + some additional type checking. *************** *** 46,49 **** --- 51,55 ---- the order. NOTE: This also affects other classes such as the Joint class or the EulerAdapter. + - OGRE-Viewer: Various bug fixes. ---------------------------------------------------------------------- |
From: Matthias B. <mb...@us...> - 2005-02-28 13:16:38
|
Update of /cvsroot/cgkit/cgkit2/cgkit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3006/cgkit Modified Files: gnuplotter.py Log Message: Workaround for a possible bug in Gnuplot.py which resulted in an exception being thrown when only one data item was plotted. Index: gnuplotter.py =================================================================== RCS file: /cvsroot/cgkit/cgkit2/cgkit/gnuplotter.py,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** gnuplotter.py 12 Dec 2004 14:31:04 -0000 1.1.1.1 --- gnuplotter.py 28 Feb 2005 13:16:25 -0000 1.2 *************** *** 119,123 **** a = [] for pd in self.plot_data: ! data = Gnuplot.Data(pd.data, title=pd.title) a.append(data) self.gp.plot(*a) --- 119,129 ---- a = [] for pd in self.plot_data: ! data = pd.data ! # There seems to be a bug in Gnuplot.py 1.7 that prevents ! # data arrays with only one item to be displayed. So the ! # following is a workaround (the point is just duplicated). ! if len(data)==1: ! data = 2*data ! data = Gnuplot.Data(data, title=pd.title) a.append(data) self.gp.plot(*a) |
From: Matthias B. <mb...@us...> - 2005-02-28 13:15:44
|
Update of /cvsroot/cgkit/cgkit2/cgkit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2786/cgkit Modified Files: expression.py Log Message: When a user variable was called 'v' the expression didn't work. Index: expression.py =================================================================== RCS file: /cvsroot/cgkit/cgkit2/cgkit/expression.py,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** expression.py 12 Dec 2004 14:31:00 -0000 1.1.1.1 --- expression.py 28 Feb 2005 13:15:33 -0000 1.2 *************** *** 148,153 **** def outProc(self): ! for v in self.vars: ! exec "%s = self.%s_slot.getValue()"%(v, v) return eval("%s(%s)"%(self.exprtype, self.expr)) --- 148,153 ---- def outProc(self): ! for _v in self.vars: ! exec "%s = self.%s_slot.getValue()"%(_v, _v) return eval("%s(%s)"%(self.exprtype, self.expr)) *************** *** 160,165 **** """Try to execute the stored expression and return the output type. """ ! for v in self.vars: ! exec "%s = self.%s_slot.getValue()"%(v, v) out = eval(self.expr) T = type(out) --- 160,165 ---- """Try to execute the stored expression and return the output type. """ ! for _v in self.vars: ! exec "%s = self.%s_slot.getValue()"%(_v, _v) out = eval(self.expr) T = type(out) |
From: ocil <oc...@us...> - 2005-02-28 08:43:49
|
Update of /cvsroot/cgkit/cgkit2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20422 Modified Files: viewerOgre.py Log Message: input issues under linux solved Index: viewerOgre.py =================================================================== RCS file: /cvsroot/cgkit/cgkit2/viewerOgre.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** viewerOgre.py 17 Dec 2004 15:23:42 -0000 1.3 --- viewerOgre.py 28 Feb 2005 08:43:41 -0000 1.4 *************** *** 154,158 **** worldroot = scene.worldRoot() myOgre = OgreCore() ! # signature: worldRoot, width, height, fullscreen?, shadows?, use OpenGL?, materialPath --- 154,158 ---- worldroot = scene.worldRoot() myOgre = OgreCore() ! #myOgre.setAmbient(0,0,0) # signature: worldRoot, width, height, fullscreen?, shadows?, use OpenGL?, materialPath *************** *** 193,196 **** --- 193,197 ---- #print kd if (kd[i+1] == 1): + #myOgre.rebuildOgreTree(worldroot) running = 0 code = self.keydict.get(kd[i+1], kd[i+1]) *************** *** 208,212 **** code = self.keydict.get(kd[i+1], kd[i+1]) mods = self.convertMods( kd[i+2] ) ! eventmanager.event( KEY_PRESS, KeyEvent(kd[i], code, mods) ) i = i+3 --- 209,213 ---- code = self.keydict.get(kd[i+1], kd[i+1]) mods = self.convertMods( kd[i+2] ) ! eventmanager.event( KEY_RELEASE, KeyEvent(kd[i], code, mods) ) i = i+3 |
From: Matthias B. <mb...@us...> - 2005-02-27 20:17:10
|
Update of /cvsroot/cgkit/cgkit2/doc/tutorials/renderman In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11735/renderman Modified Files: rm_viewer.jpg Log Message: Updated to a somewhat antialiased version Index: rm_viewer.jpg =================================================================== RCS file: /cvsroot/cgkit/cgkit2/doc/tutorials/renderman/rm_viewer.jpg,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 Binary files /tmp/cvs3AUZCh and /tmp/cvsSY2gGe differ |
From: Matthias B. <mb...@us...> - 2005-02-27 20:15:51
|
Update of /cvsroot/cgkit/cgkit2/doc/tutorials/code_examples In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11110 Modified Files: shownormals.txt Log Message: Fixed a typo Index: shownormals.txt =================================================================== RCS file: /cvsroot/cgkit/cgkit2/doc/tutorials/code_examples/shownormals.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** shownormals.txt 19 Dec 2004 21:22:47 -0000 1.1 --- shownormals.txt 27 Feb 2005 20:15:32 -0000 1.2 *************** *** 126,130 **** N = mesh.geom.slot("N") Nfaces = mesh.geom.slot("Nfaces") ! # Iterate overt the faces and normal faces... for face, Nface in zip(mesh.faces, Nfaces): i,j,k = face --- 126,130 ---- N = mesh.geom.slot("N") Nfaces = mesh.geom.slot("Nfaces") ! # Iterate over the faces and normal faces... for face, Nface in zip(mesh.faces, Nfaces): i,j,k = face |
From: Matthias B. <mb...@us...> - 2005-02-27 20:12:29
|
Update of /cvsroot/cgkit/cgkit2/doc/tutorials In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10154 Modified Files: build.py Log Message: Only rebuild tutorials if they were modified Index: build.py =================================================================== RCS file: /cvsroot/cgkit/cgkit2/doc/tutorials/build.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** build.py 19 Dec 2004 21:25:44 -0000 1.2 --- build.py 27 Feb 2005 20:12:21 -0000 1.3 *************** *** 1,5 **** # Build tutorials ! import sys, os, os.path # build --- 1,16 ---- # Build tutorials ! import sys, os, os.path, stat ! ! # isNewer ! def isNewer(file1, file2): ! """Check if file1 is newer than file2. ! ! Returns True if file1 is newer than file2 or if file2 doesn't exist. ! file1 must be an existing file. ! """ ! if not os.path.exists(file2): ! return True ! return os.stat(file1)[stat.ST_MTIME]>os.stat(file2)[stat.ST_MTIME] # build *************** *** 8,14 **** n,ext = os.path.splitext(name) dest = n+".html" ! cmd = "rst2html %s %s --stylesheet=%s"%(name, dest, stylesheet) ! print cmd ! os.system(cmd) ###################################################################### --- 19,26 ---- n,ext = os.path.splitext(name) dest = n+".html" ! if isNewer(name, dest): ! cmd = "rst2html %s %s --stylesheet=%s"%(name, dest, stylesheet) ! print cmd ! os.system(cmd) ###################################################################### *************** *** 20,23 **** --- 32,36 ---- #build("index.txt", stylesheet="default.css") build("first_steps/first_steps.txt") + build("materials/materials.txt") build("animation/animation.txt") build("renderman/renderman.txt") |
From: Matthias B. <mb...@us...> - 2005-02-27 20:07:36
|
Update of /cvsroot/cgkit/cgkit2/cgkit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8677/cgkit Modified Files: glfreedistantlight.py glfreespotlight.py glpointlight.py gltargetdistantlight.py gltargetspotlight.py Log Message: Added ambient attribute Index: glfreedistantlight.py =================================================================== RCS file: /cvsroot/cgkit/cgkit2/cgkit/glfreedistantlight.py,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** glfreedistantlight.py 12 Dec 2004 14:31:03 -0000 1.1.1.1 --- glfreedistantlight.py 27 Feb 2005 20:07:26 -0000 1.2 *************** *** 51,54 **** --- 51,55 ---- enabled=True, intensity=1.0, + ambient=None, diffuse=None, specular=None, *************** *** 67,70 **** --- 68,73 ---- self.enabled = enabled self.intensity = intensity + if ambient!=None: + self.ambient = vec3(ambient) if diffuse!=None: self.diffuse = vec3(diffuse) Index: gltargetspotlight.py =================================================================== RCS file: /cvsroot/cgkit/cgkit2/cgkit/gltargetspotlight.py,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** gltargetspotlight.py 12 Dec 2004 14:31:04 -0000 1.1.1.1 --- gltargetspotlight.py 27 Feb 2005 20:07:26 -0000 1.2 *************** *** 52,55 **** --- 52,56 ---- enabled=True, intensity=1.0, + ambient=None, diffuse=None, specular=None, *************** *** 80,83 **** --- 81,86 ---- self.enabled = enabled self.intensity = intensity + if ambient!=None: + self.ambient = vec3(ambient) if diffuse!=None: self.diffuse = vec3(diffuse) Index: gltargetdistantlight.py =================================================================== RCS file: /cvsroot/cgkit/cgkit2/cgkit/gltargetdistantlight.py,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** gltargetdistantlight.py 12 Dec 2004 14:31:04 -0000 1.1.1.1 --- gltargetdistantlight.py 27 Feb 2005 20:07:26 -0000 1.2 *************** *** 52,55 **** --- 52,56 ---- enabled=True, intensity=1.0, + ambient=None, diffuse=None, specular=None, *************** *** 75,78 **** --- 76,81 ---- self.enabled = enabled self.intensity = intensity + if ambient!=None: + self.ambient = vec3(ambient) if diffuse!=None: self.diffuse = vec3(diffuse) Index: glfreespotlight.py =================================================================== RCS file: /cvsroot/cgkit/cgkit2/cgkit/glfreespotlight.py,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** glfreespotlight.py 12 Dec 2004 14:31:03 -0000 1.1.1.1 --- glfreespotlight.py 27 Feb 2005 20:07:26 -0000 1.2 *************** *** 51,54 **** --- 51,55 ---- enabled=True, intensity=1.0, + ambient=None, diffuse=None, specular=None, *************** *** 72,75 **** --- 73,78 ---- self.enabled = enabled self.intensity = intensity + if ambient!=None: + self.ambient = vec3(ambient) if diffuse!=None: self.diffuse = vec3(diffuse) Index: glpointlight.py =================================================================== RCS file: /cvsroot/cgkit/cgkit2/cgkit/glpointlight.py,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** glpointlight.py 12 Dec 2004 14:31:04 -0000 1.1.1.1 --- glpointlight.py 27 Feb 2005 20:07:26 -0000 1.2 *************** *** 47,50 **** --- 47,51 ---- enabled=True, intensity=1.0, + ambient=None, diffuse=None, specular=None, *************** *** 66,69 **** --- 67,72 ---- self.enabled = enabled self.intensity = intensity + if ambient!=None: + self.ambient = vec3(ambient) if diffuse!=None: self.diffuse = vec3(diffuse) |
From: Matthias B. <mb...@us...> - 2005-02-27 20:07:36
|
Update of /cvsroot/cgkit/cgkit2/doc/tex In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8677/doc/tex Modified Files: glfreedistantlight.tex glfreespotlight.tex glpointlight.tex gltargetdistantlight.tex gltargetspotlight.tex Log Message: Added ambient attribute Index: glfreedistantlight.tex =================================================================== RCS file: /cvsroot/cgkit/cgkit2/doc/tex/glfreedistantlight.tex,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** glfreedistantlight.tex 12 Dec 2004 14:31:46 -0000 1.1.1.1 --- glfreedistantlight.tex 27 Feb 2005 20:07:26 -0000 1.2 *************** *** 6,9 **** --- 6,10 ---- \begin{classdesc}{GLFreeDistantLight}{name = ''GLFreeDistantLight'',\\ intensity = 1.0,\\ + ambient = None,\\ diffuse = None,\\ specular = None,\\ Index: gltargetspotlight.tex =================================================================== RCS file: /cvsroot/cgkit/cgkit2/doc/tex/gltargetspotlight.tex,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** gltargetspotlight.tex 12 Dec 2004 14:31:46 -0000 1.1.1.1 --- gltargetspotlight.tex 27 Feb 2005 20:07:26 -0000 1.2 *************** *** 6,9 **** --- 6,10 ---- \begin{classdesc}{GLTargetSpotLight}{name = ''GLTargetSpotLight'',\\ intensity = 1.0,\\ + ambient = None,\\ diffuse = None,\\ specular = None,\\ Index: glpointlight.tex =================================================================== RCS file: /cvsroot/cgkit/cgkit2/doc/tex/glpointlight.tex,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** glpointlight.tex 12 Dec 2004 14:31:46 -0000 1.1.1.1 --- glpointlight.tex 27 Feb 2005 20:07:26 -0000 1.2 *************** *** 6,9 **** --- 6,10 ---- \begin{classdesc}{GLPointLight}{name = ''GLPointLight'',\\ intensity = 1.0,\\ + ambient = None,\\ diffuse = None,\\ specular = None,\\ Index: gltargetdistantlight.tex =================================================================== RCS file: /cvsroot/cgkit/cgkit2/doc/tex/gltargetdistantlight.tex,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** gltargetdistantlight.tex 12 Dec 2004 14:31:46 -0000 1.1.1.1 --- gltargetdistantlight.tex 27 Feb 2005 20:07:26 -0000 1.2 *************** *** 6,9 **** --- 6,10 ---- \begin{classdesc}{GLTargetDistantLight}{name = ''GLTargetDistantLight'',\\ intensity = 1.0,\\ + ambient = None,\\ diffuse = None,\\ specular = None,\\ Index: glfreespotlight.tex =================================================================== RCS file: /cvsroot/cgkit/cgkit2/doc/tex/glfreespotlight.tex,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** glfreespotlight.tex 12 Dec 2004 14:31:46 -0000 1.1.1.1 --- glfreespotlight.tex 27 Feb 2005 20:07:26 -0000 1.2 *************** *** 6,9 **** --- 6,10 ---- \begin{classdesc}{GLFreeSpotLight}{name = ''GLFreeSpotLight'',\\ intensity = 1.0,\\ + ambient = None,\\ diffuse = None,\\ specular = None,\\ |
From: Matthias B. <mb...@us...> - 2005-02-27 20:07:35
|
Update of /cvsroot/cgkit/cgkit2/supportlib/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8677/supportlib/src Modified Files: gldistantlight.cpp glpointlight.cpp glspotlight.cpp Log Message: Added ambient attribute Index: glpointlight.cpp =================================================================== RCS file: /cvsroot/cgkit/cgkit2/supportlib/src/glpointlight.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** glpointlight.cpp 12 Dec 2004 14:32:31 -0000 1.1.1.1 --- glpointlight.cpp 27 Feb 2005 20:07:25 -0000 1.2 *************** *** 33,36 **** --- 33,37 ---- GLPointLight::GLPointLight() : LightSource(), + ambient(vec3d(0,0,0), 0), diffuse(vec3d(1,1,1), 0), specular(vec3d(1,1,1), 0), *************** *** 39,42 **** --- 40,44 ---- quadratic_attenuation(0.0, 0) { + addSlot("ambient", ambient); addSlot("diffuse", diffuse); addSlot("specular", specular); *************** *** 48,51 **** --- 50,54 ---- GLPointLight::GLPointLight(string aname) : LightSource(aname), + ambient(vec3d(0,0,0), 0), diffuse(vec3d(1,1,1), 0), specular(vec3d(1,1,1), 0), *************** *** 54,57 **** --- 57,61 ---- quadratic_attenuation(0.0, 0) { + addSlot("ambient", ambient); addSlot("diffuse", diffuse); addSlot("specular", specular); *************** *** 81,84 **** --- 85,92 ---- glLightfv(glidx, GL_POSITION, c); + const vec3d& ac = ambient.getValue(); + c[0] = GLfloat(I*ac.x); + c[1] = GLfloat(I*ac.y); + c[2] = GLfloat(I*ac.z); glLightfv(glidx, GL_AMBIENT, c); Index: gldistantlight.cpp =================================================================== RCS file: /cvsroot/cgkit/cgkit2/supportlib/src/gldistantlight.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** gldistantlight.cpp 12 Dec 2004 14:32:30 -0000 1.1.1.1 --- gldistantlight.cpp 27 Feb 2005 20:07:25 -0000 1.2 *************** *** 33,39 **** --- 33,41 ---- GLDistantLight::GLDistantLight() : LightSource(), + ambient(vec3d(0,0,0), 0), diffuse(vec3d(1,1,1), 0), specular(vec3d(1,1,1), 0) { + addSlot("ambient", ambient); addSlot("diffuse", diffuse); addSlot("specular", specular); *************** *** 42,48 **** --- 44,52 ---- GLDistantLight::GLDistantLight(string aname) : LightSource(aname), + ambient(vec3d(0,0,0), 0), diffuse(vec3d(1,1,1), 0), specular(vec3d(1,1,1), 0) { + addSlot("ambient", ambient); addSlot("diffuse", diffuse); addSlot("specular", specular); *************** *** 65,74 **** glLightf(glidx, GL_SPOT_CUTOFF, 180.0); - glLightfv(glidx, GL_AMBIENT, c); - c[2] = -1; c[3] = 0; glLightfv(glidx, GL_POSITION, c); const vec3d& dc = diffuse.getValue(); c[0] = GLfloat(I*dc.x); --- 69,82 ---- glLightf(glidx, GL_SPOT_CUTOFF, 180.0); c[2] = -1; c[3] = 0; glLightfv(glidx, GL_POSITION, c); + const vec3d& ac = ambient.getValue(); + c[0] = GLfloat(I*ac.x); + c[1] = GLfloat(I*ac.y); + c[2] = GLfloat(I*ac.z); + glLightfv(glidx, GL_AMBIENT, c); + const vec3d& dc = diffuse.getValue(); c[0] = GLfloat(I*dc.x); Index: glspotlight.cpp =================================================================== RCS file: /cvsroot/cgkit/cgkit2/supportlib/src/glspotlight.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** glspotlight.cpp 12 Dec 2004 14:32:32 -0000 1.1.1.1 --- glspotlight.cpp 27 Feb 2005 20:07:25 -0000 1.2 *************** *** 33,36 **** --- 33,37 ---- GLSpotLight::GLSpotLight() : LightSource(), + ambient(vec3d(0,0,0), 0), diffuse(vec3d(1,1,1), 0), specular(vec3d(1,1,1), 0), *************** *** 41,44 **** --- 42,46 ---- cutoff(45.0, 0) { + addSlot("ambient", ambient); addSlot("diffuse", diffuse); addSlot("specular", specular); *************** *** 52,55 **** --- 54,58 ---- GLSpotLight::GLSpotLight(string aname) : LightSource(aname), + ambient(vec3d(0,0,0), 0), diffuse(vec3d(1,1,1), 0), specular(vec3d(1,1,1), 0), *************** *** 60,63 **** --- 63,67 ---- cutoff(45.0, 0) { + addSlot("ambient", ambient); addSlot("diffuse", diffuse); addSlot("specular", specular); *************** *** 90,99 **** glLightfv(glidx, GL_POSITION, c); - glLightfv(glidx, GL_AMBIENT, c); - // Direction is always along positive local Z axis c[2]=1; glLightfv(glidx, GL_SPOT_DIRECTION, c); const vec3d& dc = diffuse.getValue(); c[0] = GLfloat(I*dc.x); --- 94,107 ---- glLightfv(glidx, GL_POSITION, c); // Direction is always along positive local Z axis c[2]=1; glLightfv(glidx, GL_SPOT_DIRECTION, c); + const vec3d& ac = ambient.getValue(); + c[0] = GLfloat(I*ac.x); + c[1] = GLfloat(I*ac.y); + c[2] = GLfloat(I*ac.z); + glLightfv(glidx, GL_AMBIENT, c); + const vec3d& dc = diffuse.getValue(); c[0] = GLfloat(I*dc.x); |
From: Matthias B. <mb...@us...> - 2005-02-27 20:07:35
|
Update of /cvsroot/cgkit/cgkit2/wrappers In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8677/wrappers Modified Files: py_gldistantlight.cpp py_glpointlight.cpp py_glspotlight.cpp Log Message: Added ambient attribute Index: py_gldistantlight.cpp =================================================================== RCS file: /cvsroot/cgkit/cgkit2/wrappers/py_gldistantlight.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** py_gldistantlight.cpp 12 Dec 2004 14:32:43 -0000 1.1.1.1 --- py_gldistantlight.cpp 27 Feb 2005 20:07:25 -0000 1.2 *************** *** 9,12 **** --- 9,23 ---- using namespace support3d; + // get/set for "ambient" property + vec3d getAmbient(GLDistantLight* self) + { + return self->ambient.getValue(); + } + + void setAmbient(GLDistantLight* self, vec3d c) + { + self->ambient.setValue(c); + } + // get/set for "diffuse" property vec3d getDiffuse(GLDistantLight* self) *************** *** 35,38 **** --- 46,51 ---- class_<GLDistantLight, bases<LightSource> >("GLDistantLight") .def(init<string>()) + .def_readonly("ambient_slot", &GLDistantLight::ambient) + .add_property("ambient", &getAmbient, &setAmbient) .def_readonly("diffuse_slot", &GLDistantLight::diffuse) .add_property("diffuse", &getDiffuse, &setDiffuse) Index: py_glspotlight.cpp =================================================================== RCS file: /cvsroot/cgkit/cgkit2/wrappers/py_glspotlight.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** py_glspotlight.cpp 12 Dec 2004 14:32:44 -0000 1.1.1.1 --- py_glspotlight.cpp 27 Feb 2005 20:07:25 -0000 1.2 *************** *** 9,12 **** --- 9,23 ---- using namespace support3d; + // get/set for "ambient" property + vec3d getAmbient(GLSpotLight* self) + { + return self->ambient.getValue(); + } + + void setAmbient(GLSpotLight* self, vec3d c) + { + self->ambient.setValue(c); + } + // get/set for "diffuse" property vec3d getDiffuse(GLSpotLight* self) *************** *** 91,94 **** --- 102,107 ---- class_<GLSpotLight, bases<LightSource> >("GLSpotLight") .def(init<string>()) + .def_readonly("ambient_slot", &GLSpotLight::ambient) + .add_property("ambient", &getAmbient, &setAmbient) .def_readonly("diffuse_slot", &GLSpotLight::diffuse) .add_property("diffuse", &getDiffuse, &setDiffuse) Index: py_glpointlight.cpp =================================================================== RCS file: /cvsroot/cgkit/cgkit2/wrappers/py_glpointlight.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** py_glpointlight.cpp 12 Dec 2004 14:32:44 -0000 1.1.1.1 --- py_glpointlight.cpp 27 Feb 2005 20:07:25 -0000 1.2 *************** *** 9,12 **** --- 9,23 ---- using namespace support3d; + // get/set for "ambient" property + vec3d getAmbient(GLPointLight* self) + { + return self->ambient.getValue(); + } + + void setAmbient(GLPointLight* self, vec3d c) + { + self->ambient.setValue(c); + } + // get/set for "diffuse" property vec3d getDiffuse(GLPointLight* self) *************** *** 69,72 **** --- 80,85 ---- class_<GLPointLight, bases<LightSource> >("GLPointLight") .def(init<string>()) + .def_readonly("ambient_slot", &GLPointLight::ambient) + .add_property("ambient", &getAmbient, &setAmbient) .def_readonly("diffuse_slot", &GLPointLight::diffuse) .add_property("diffuse", &getDiffuse, &setDiffuse) |
From: Matthias B. <mb...@us...> - 2005-02-27 20:07:35
|
Update of /cvsroot/cgkit/cgkit2/supportlib/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8677/supportlib/include Modified Files: gldistantlight.h glpointlight.h glspotlight.h Log Message: Added ambient attribute Index: gldistantlight.h =================================================================== RCS file: /cvsroot/cgkit/cgkit2/supportlib/include/gldistantlight.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** gldistantlight.h 12 Dec 2004 14:32:07 -0000 1.1.1.1 --- gldistantlight.h 27 Feb 2005 20:07:25 -0000 1.2 *************** *** 38,41 **** --- 38,43 ---- { public: + /// Ambient color + Slot<vec3d> ambient; /// Diffuse color Slot<vec3d> diffuse; Index: glspotlight.h =================================================================== RCS file: /cvsroot/cgkit/cgkit2/supportlib/include/glspotlight.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** glspotlight.h 12 Dec 2004 14:32:08 -0000 1.1.1.1 --- glspotlight.h 27 Feb 2005 20:07:25 -0000 1.2 *************** *** 38,41 **** --- 38,43 ---- { public: + /// Ambient color + Slot<vec3d> ambient; /// Diffuse color Slot<vec3d> diffuse; Index: glpointlight.h =================================================================== RCS file: /cvsroot/cgkit/cgkit2/supportlib/include/glpointlight.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** glpointlight.h 12 Dec 2004 14:32:08 -0000 1.1.1.1 --- glpointlight.h 27 Feb 2005 20:07:25 -0000 1.2 *************** *** 38,41 **** --- 38,43 ---- { public: + /// Ambient color + Slot<vec3d> ambient; /// Diffuse color Slot<vec3d> diffuse; |
From: Matthias B. <mb...@us...> - 2005-02-27 20:07:33
|
Update of /cvsroot/cgkit/cgkit2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8677 Modified Files: changelog.txt Log Message: Added ambient attribute Index: changelog.txt =================================================================== RCS file: /cvsroot/cgkit/cgkit2/changelog.txt,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** changelog.txt 24 Feb 2005 15:14:57 -0000 1.15 --- changelog.txt 27 Feb 2005 20:07:24 -0000 1.16 *************** *** 6,9 **** --- 6,12 ---- New features: + - The GL light sources now also have an "ambient" color attribute + - Instead of a single material you can now also pass a sequence of materials + into the constructor of the world objects - New polyhedron geometry - Python import: The directory where the input file is located is added |
From: Matthias B. <mb...@us...> - 2005-02-27 20:06:37
|
Update of /cvsroot/cgkit/cgkit2/cgkit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8313/cgkit Modified Files: worldobject.py Log Message: The material parameter can now also contain a sequence of materials Index: worldobject.py =================================================================== RCS file: /cvsroot/cgkit/cgkit2/cgkit/worldobject.py,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** worldobject.py 12 Dec 2004 14:31:30 -0000 1.1.1.1 --- worldobject.py 27 Feb 2005 20:06:27 -0000 1.2 *************** *** 83,87 **** \param parent (\c WorldObject or \c str) Parent object or None \param mass (\c float) Total mass ! \param material (\c Material) Material class \param visible (\c Bool) Visibility flag \param linearvel (\c vec3) Linear velocity --- 83,87 ---- \param parent (\c WorldObject or \c str) Parent object or None \param mass (\c float) Total mass ! \param material (\c Material) Material class (or a sequence of materials) \param visible (\c Bool) Visibility flag \param linearvel (\c vec3) Linear velocity *************** *** 180,184 **** self.mass = mass if material!=None: ! self.setMaterial(material) if linearvel!=None: self.linearvel = vec3(linearvel) --- 180,192 ---- self.mass = mass if material!=None: ! try: ! # Check if material is a sequence or not. If it is not a ! # sequence the following line will raise an exception. ! len(material) ! except: ! material = [material] ! self.setNumMaterials(len(material)) ! for i,mat in enumerate(material): ! self.setMaterial(mat, i) if linearvel!=None: self.linearvel = vec3(linearvel) |
From: ocil <oc...@us...> - 2005-02-25 14:35:36
|
Update of /cvsroot/cgkit/cgkit2/wrappers/ogre In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26167/wrappers/ogre Modified Files: OgreCore.cpp OgreCore.h OgreWrap.cpp Log Message: linking issues solved; added functionality for sampling the framebuffer from python side Index: OgreWrap.cpp =================================================================== RCS file: /cvsroot/cgkit/cgkit2/wrappers/ogre/OgreWrap.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** OgreWrap.cpp 24 Feb 2005 13:04:56 -0000 1.8 --- OgreWrap.cpp 25 Feb 2005 14:35:27 -0000 1.9 *************** *** 20,24 **** ======================================================================*/ ! #include <boost/python.hpp> #include "worldobject.h" #include "OgreCore.h" --- 20,24 ---- ======================================================================*/ ! #include <boost/python.hpp> #include "worldobject.h" #include "OgreCore.h" *************** *** 41,44 **** --- 41,47 ---- .def("setAmbient", &OgreCore::setAmbient) .def("rebuildOgreTree", &OgreCore::rebuildOgreTree) + .def("setCaptureFrameBuffer", &OgreCore::setCaptureFrameBuffer) + .def("captureFrameBuffer", &OgreCore::captureFrameBuffer) + .def("setRenderOverlay", &OgreCore::setRenderOverlay) ; } Index: OgreCore.h =================================================================== RCS file: /cvsroot/cgkit/cgkit2/wrappers/ogre/OgreCore.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** OgreCore.h 24 Feb 2005 13:04:56 -0000 1.8 --- OgreCore.h 25 Feb 2005 14:35:27 -0000 1.9 *************** *** 100,105 **** OgreCore(); ~OgreCore(); ! OgreCore(const OgreCore&); ! OgreCore& operator=(const OgreCore&); void initialize(support3d::WorldObject& root, unsigned int windowW, unsigned int windowH, bool fullscr, bool shadows, bool opengl, const char * materialpath, int dm); --- 100,105 ---- OgreCore(); ~OgreCore(); ! //OgreCore(const OgreCore&); ! //OgreCore& operator=(const OgreCore&); void initialize(support3d::WorldObject& root, unsigned int windowW, unsigned int windowH, bool fullscr, bool shadows, bool opengl, const char * materialpath, int dm); *************** *** 112,117 **** --- 112,120 ---- int rebuildOgreTree(support3d::WorldObject& VisumRoot); Mesh* getMeshFromCgKit(support3d::TriMeshGeom *trigeom, const char *name); + void captureFrameBuffer(); Mesh* getFlatMeshFromCgKit(support3d::TriMeshGeom *trigeom, const char *name); void setupData(support3d::WorldObject& camera, float nearclip, float farclip, float fov); + int setCaptureFrameBuffer(std::string whichMaterial, int width, int height, unsigned short whichTechnique, unsigned short whichPass ); + void setRenderOverlay(std::string overlayMaterial); boost::python::list pumpKeyDowns(); boost::python::list pumpMotions(); *************** *** 121,124 **** --- 124,128 ---- private: + Overlay* mpOverlay; int mDebugMode; MyMouseListener* mpMoti; *************** *** 127,130 **** --- 131,136 ---- EventProcessor * mpEvpro; bool mHaveToParse; + bool mIsCaptureFrameBuffer; + RenderTexture* mpRenderTexture; char* mpBuffer; Index: OgreCore.cpp =================================================================== RCS file: /cvsroot/cgkit/cgkit2/wrappers/ogre/OgreCore.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** OgreCore.cpp 24 Feb 2005 13:04:55 -0000 1.8 --- OgreCore.cpp 25 Feb 2005 14:35:27 -0000 1.9 *************** *** 385,408 **** { Resource* theMaterial = 0; - if (mHaveToParse) { MaterialManager::getSingleton().parseAllSources(); mHaveToParse = false; } - try { theMaterial = MaterialManager::getSingleton().getByName(newMaterial); - - DEBUGOUT("the Material: ", theMaterial) - if (theMaterial != 0) { theMaterial->load(); (mpSceneMgr->getEntity(entityName))->setMaterialName( newMaterial ); - - DEBUGOUT("the Entity: ", mpSceneMgr->getEntity(entityName) ) - } else --- 385,401 ---- { Resource* theMaterial = 0; if (mHaveToParse) { + cout << "FORC: Not all materials loaded, have to Parse, therefore sloooooow" << endl; MaterialManager::getSingleton().parseAllSources(); mHaveToParse = false; } try { theMaterial = MaterialManager::getSingleton().getByName(newMaterial); if (theMaterial != 0) { theMaterial->load(); (mpSceneMgr->getEntity(entityName))->setMaterialName( newMaterial ); } else *************** *** 865,868 **** --- 858,862 ---- void OgreCore::initialize(support3d::WorldObject& VisumRoot, unsigned int windowW, unsigned int windowH, bool fullscr, bool shadows,bool opengl, const char * materialpath, int dm) { + mIsCaptureFrameBuffer = false; mDebugMode = dm; try { *************** *** 1109,1112 **** --- 1103,1204 ---- /////////////////////// + // set ambient lights + int OgreCore::setCaptureFrameBuffer(std::string whichMaterial, + int width, + int height, + unsigned short whichTechnique, + unsigned short whichPass ) + { + if (mpSceneMgr !=0) + { + + if (mHaveToParse) + { + cout << "FORC: Not all materials loaded, have to Parse, therefore sloooooow" << endl; + MaterialManager::getSingleton().parseAllSources(); + mHaveToParse = false; + } + + // vorbereiten + mpRenderTexture = 0; + mpRenderTexture = mpRoot->getRenderSystem()->createRenderTexture("FrameBuffer", width, height); + mpRenderTexture ->setAutoUpdated(false); + Viewport* p_texture_vp = mpRenderTexture ->addViewport(mpCamera); + + try + { + mpSceneMgr->getMaterial(whichMaterial)->getTechnique(whichTechnique)->getPass(whichPass) \ + ->createTextureUnitState("FrameBuffer"); + } catch(...) + { + cout << "FORC: Material does not exist" << whichMaterial << endl; + } + + // whichMaterial now contains an additional TexUnit rpresentating the Framebuffer, available for sampling + // its best not to use this material when capturing the actual frame buffer of course ... + + mIsCaptureFrameBuffer = true; + return 1; + } + else + { + return -1; + } + } + + /////////////////////// + ////// /////// + ////// // // /////// + ////// /////// + ////// ////// /////// + ////// /////// + /////////////////////// + + // render an Overlay? + void OgreCore::setRenderOverlay(std::string overlayMaterial) + { + if (mHaveToParse) + { + cout << "FORC: Not all materials loaded, have to Parse, therefore sloooooow" << endl; + MaterialManager::getSingleton().parseAllSources(); + mHaveToParse = false; + } + + // todo: check if successful + mpOverlay = dynamic_cast<Overlay*>(OverlayManager::getSingletonPtr()->create("Overlay")); + GuiContainer* panel = dynamic_cast<GuiContainer*>(GuiManager::getSingletonPtr()->createGuiElement("Panel", "FramePanel")); + panel->setMaterialName(overlayMaterial); + panel->setPosition(0.0, 0.0); + panel->setHeight(1); + panel->setWidth(1); + panel->setParameter("tiling", "0 1.0 1.0"); + panel->setParameter("transparent", "false"); + + mpOverlay->show(); + } + + /////////////////////// + ////// /////// + ////// // // /////// + ////// /////// + ////// ////// /////// + ////// /////// + /////////////////////// + + // framebuffer speichern + void OgreCore::captureFrameBuffer() + { + if (mIsCaptureFrameBuffer) + mpRenderTexture->update(); + } + + /////////////////////// + ////// /////// + ////// // // /////// + ////// /////// + ////// ////// /////// + ////// /////// + /////////////////////// + // rendern void OgreCore::renderTree() |
From: Matthias B. <mb...@us...> - 2005-02-24 15:15:54
|
Update of /cvsroot/cgkit/cgkit2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15696 Modified Files: changelog.txt Log Message: Added checks so that invalid array slot usage doesn't crash Python Index: changelog.txt =================================================================== RCS file: /cvsroot/cgkit/cgkit2/changelog.txt,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** changelog.txt 22 Feb 2005 07:41:30 -0000 1.14 --- changelog.txt 24 Feb 2005 15:14:57 -0000 1.15 *************** *** 26,29 **** --- 26,31 ---- Bug fixes/enhancements: + - ArraySlots: Array access wasn't range checked which could lead to a crash. + This is fixed now + some additional type checking. - CamControl: Camera control doesn't raise an exception anymore when used with a FreeCamera. However, the control might not be usable in all |
From: Matthias B. <mb...@us...> - 2005-02-24 15:15:43
|
Update of /cvsroot/cgkit/cgkit2/unittests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15696/unittests Modified Files: all.py test_boundingbox.py test_component.py test_worldobject.py Added Files: test_arrayslots.py Log Message: Added checks so that invalid array slot usage doesn't crash Python Index: test_worldobject.py =================================================================== RCS file: /cvsroot/cgkit/cgkit2/unittests/test_worldobject.py,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** test_worldobject.py 12 Dec 2004 14:32:42 -0000 1.1.1.1 --- test_worldobject.py 24 Feb 2005 15:14:58 -0000 1.2 *************** *** 6,10 **** ! class TestConstructor(unittest.TestCase): def testStandardConstructor(self): --- 6,10 ---- ! class TestWOConstructor(unittest.TestCase): def testStandardConstructor(self): Index: all.py =================================================================== RCS file: /cvsroot/cgkit/cgkit2/unittests/all.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** all.py 12 Dec 2004 17:20:15 -0000 1.1 --- all.py 24 Feb 2005 15:14:58 -0000 1.2 *************** *** 5,9 **** # A list of module names that should be ignored ! ignore = ["test_vec3_"] # Import all test_*.py files --- 5,9 ---- # A list of module names that should be ignored ! ignore = [] # Import all test_*.py files Index: test_component.py =================================================================== RCS file: /cvsroot/cgkit/cgkit2/unittests/test_component.py,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** test_component.py 12 Dec 2004 14:32:37 -0000 1.1.1.1 --- test_component.py 24 Feb 2005 15:14:58 -0000 1.2 *************** *** 6,10 **** ! class TestConstructor(unittest.TestCase): def testStandardConstructor(self): --- 6,10 ---- ! class TestCompConstructor(unittest.TestCase): def testStandardConstructor(self): *************** *** 19,23 **** self.assertEqual(c.numSlots(), 0) ! class TestGetSetName(unittest.TestCase): def testGetSetName(self): --- 19,23 ---- self.assertEqual(c.numSlots(), 0) ! class TestCompGetSetName(unittest.TestCase): def testGetSetName(self): *************** *** 26,30 **** self.assertEqual(c.name, "NewName") ! class TestHasSlot(unittest.TestCase): def testHasSlot1(self): --- 26,30 ---- self.assertEqual(c.name, "NewName") ! class TestCompHasSlot(unittest.TestCase): def testHasSlot1(self): *************** *** 38,42 **** self.assertEqual(c.hasSlot("foo"), 1) ! class TestSlot(unittest.TestCase): def testSlot(self): --- 38,42 ---- self.assertEqual(c.hasSlot("foo"), 1) ! class TestCompSlot(unittest.TestCase): def testSlot(self): *************** *** 54,58 **** self.assertRaises(KeyError, lambda: c.slot("bar")) ! class TestAddSlot(unittest.TestCase): def testAddSlot(self): --- 54,58 ---- self.assertRaises(KeyError, lambda: c.slot("bar")) ! class TestCompAddSlot(unittest.TestCase): def testAddSlot(self): *************** *** 75,79 **** self.assertRaises(KeyError, lambda: c.addSlot("foo", e)) ! class TestRemoveSlot(unittest.TestCase): def testRemoveSlot1(self): --- 75,79 ---- self.assertRaises(KeyError, lambda: c.addSlot("foo", e)) ! class TestCompRemoveSlot(unittest.TestCase): def testRemoveSlot1(self): *************** *** 114,118 **** self.assertRaises(KeyError, lambda: c.removeSlot("bar")) ! class TestSlotIterator(unittest.TestCase): def testSlotIterator(self): --- 114,118 ---- self.assertRaises(KeyError, lambda: c.removeSlot("bar")) ! class TestCompSlotIterator(unittest.TestCase): def testSlotIterator(self): *************** *** 130,134 **** self.assertEqual(names, ["double", "matrix", "vector"]) ! class TestDeallocation(unittest.TestCase): def testDeallocation(self): --- 130,134 ---- self.assertEqual(names, ["double", "matrix", "vector"]) ! class TestCompDeallocation(unittest.TestCase): def testDeallocation(self): --- NEW FILE: test_arrayslots.py --- # Test the array slots import unittest from cgkit import _core from cgkit import * class TestArraySlot(unittest.TestCase): def testConstructor(self): as = _core.DoubleArraySlot(1) # array size==0? self.assertEqual(as.size(), 0) # multiplicity==1? self.assertEqual(as.multiplicity(), 1) self.assertEqual(list(as), []) self.assertEqual(as.getController(), None) as = _core.DoubleArraySlot() # array size==0? self.assertEqual(as.size(), 0) # multiplicity==1? self.assertEqual(as.multiplicity(), 1) self.assertEqual(list(as), []) as = _core.DoubleArraySlot(3) # array size==0? self.assertEqual(as.size(), 0) # multiplicity==3? self.assertEqual(as.multiplicity(), 3) self.assertEqual(list(as), []) def testResize(self): as = _core.DoubleArraySlot(1) # Create 8 elements as.resize(8) self.assertEqual(as.size(), 8) self.assertEqual(list(as), 8*[0]) # Set values for i in range(8): as[i]=i+1 # Check if the values were properly set self.assertEqual(list(as), range(1,9)) # Enlarge the array as.resize(20) self.assertEqual(as.size(), 20) # Check if the values were properly copied self.assertEqual(list(as), range(1,9)+12*[0]) # Shrink the array as.resize(4) # Check if the values were properly copied self.assertEqual(list(as), range(1,5)) # Negastive size must equal 0 as.resize(-2) self.assertEqual(as.size(), 0) def testGetSetMult1(self): # Multiplicity 1 as = _core.Vec3ArraySlot(1) as.resize(10) for i in range(10): as.setValue(i, vec3(i+1)) for i in range(10): self.assertEqual(as.getValue(i), vec3(i+1)) for i in range(10): self.assertEqual(as[i], vec3(i+1)) def testGetSetMultn(self): # Multiplicity 3 as = _core.IntArraySlot(3) as.resize(10) for i in range(10): as.setValue(i, (i, i+1, i+2)) for i in range(10): self.assertEqual(as.getValue(i), (i,i+1,i+2)) for i in range(10): self.assertEqual(as[i], (i,i+1,i+2)) def testController(self): # Controller slot ctrl = _core.Vec3ArraySlot() ctrl.resize(10) for i in range(10): ctrl[i] = vec3(i+1) # "Target" slot as = _core.Vec3ArraySlot() as.setController(ctrl) self.assertEqual(as.size(), 10) for i in range(10): self.assertEqual(as[i], vec3(i+1)) # Change an item in the controller... ctrl[1]=vec3(-1,-2,-3) # ...and see if the target also has changed for i in range(10): if i==1: self.assertEqual(as[i], vec3(-1,-2,-3)) else: self.assertEqual(as[i], vec3(i+1)) # Disconnect as.setController(None) # modify an element as[1] = vec3(2,2,2) # and check if ctrl and target are separate for i in range(10): if i==1: self.assertEqual(ctrl[i], vec3(-1,-2,-3)) else: self.assertEqual(ctrl[i], vec3(i+1)) for i in range(10): self.assertEqual(as[i], vec3(i+1)) def testExceptions(self): as = _core.DoubleArraySlot(1) as.resize(8) self.assertRaises(IndexError, lambda: as[8]) self.assertRaises(IndexError, lambda: as.getValue(8)) self.assertRaises(IndexError, lambda: as.setValue(8,0)) self.assertRaises(TypeError, lambda: as.setValue(0,vec3())) as = _core.DoubleArraySlot(2) as.resize(8) self.assertRaises(IndexError, lambda: as[8]) self.assertRaises(IndexError, lambda: as.getValue(8)) self.assertRaises(IndexError, lambda: as.setValue(8,(1,2))) self.assertRaises(ValueError, lambda: as.setValue(0,5)) ###################################################################### if __name__=="__main__": unittest.main() Index: test_boundingbox.py =================================================================== RCS file: /cvsroot/cgkit/cgkit2/unittests/test_boundingbox.py,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** test_boundingbox.py 12 Dec 2004 14:32:37 -0000 1.1.1.1 --- test_boundingbox.py 24 Feb 2005 15:14:58 -0000 1.2 *************** *** 7,11 **** # aufgerufen wird. ! class TestConstructor(unittest.TestCase): def testStandardConstructor(self): --- 7,11 ---- # aufgerufen wird. ! class TestBBConstructor(unittest.TestCase): def testStandardConstructor(self): |
From: Matthias B. <mb...@us...> - 2005-02-24 15:15:43
|
Update of /cvsroot/cgkit/cgkit2/supportlib/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15696/supportlib/include Modified Files: arrayslot.h Log Message: Added checks so that invalid array slot usage doesn't crash Python Index: arrayslot.h =================================================================== RCS file: /cvsroot/cgkit/cgkit2/supportlib/include/arrayslot.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** arrayslot.h 21 Dec 2004 10:22:50 -0000 1.2 --- arrayslot.h 24 Feb 2005 15:14:57 -0000 1.3 *************** *** 152,155 **** --- 152,159 ---- } } + else + { + size = 0; + } // Delete the old array if (data_ptr!=0) *************** *** 490,502 **** --- 494,540 ---- ////////////////////////////////////////////////////////////////////// + /** + Return the value at a particular index. + + This method returns the value at position \a index. This method should + only be used when multiplicity is 1. Use getValues() if the multiplicity + is greater than 1. + The index may be negative to count from the end of the array. If the + index is out of range, an EIndexError exception is thrown. + + \param index Array index (0-based). May be negative. + \return Value at position \a index. + */ template<class T> const T& ArraySlot<T>::getValue(int index) { + if (index<0) + index = size()+index; + if ((index<0) || (index>=size())) + throw EIndexError(); + return values[index]; } + /** + Set a new value a particular index. + + This method sets a new value at position \a index. It should + only be used when multiplicity is 1. Use setValues() if the multiplicity + is greater than 1. + The index may be negative to count from the end of the array. If the + index is out of range, an EIndexError exception is thrown. + + \param index Array index (0-based). May be negative. + \param val New value + */ template<class T> void ArraySlot<T>::setValue(int index, const T& val) { + if (index<0) + index = size()+index; + if ((index<0) || (index>=size())) + throw EIndexError(); + if (controller!=0) { *************** *** 510,519 **** --- 548,584 ---- } + /** + Return the array value at a particular index. + + This method returns a pointer to the value at position \a index and + it is intended for array slots with a multiplicity that's greater than 1. + The pointer actually points to the array at position \a index. + The index negative to count from the end of the array. If the index is + out of range, an EIndexError exception is thrown. + + \param index Array index (0-based). May be negative. + \return Pointer to the array at position \a index. + */ template<class T> const T* ArraySlot<T>::getValues(int index) { + if (index<0) + index = size()+index; + if ((index<0) || (index>=size())) + throw EIndexError(); return &(values[index]); } + /** + Set a new array value. + + This method sets a new value at position \a index and + it is intended for array slots with a multiplicity that's greater than 1. + The index negative to count from the end of the array. If the index is + out of range, an EIndexError exception is thrown. + + \param index Array index (0-based). May be negative. + \param vals New value (array) + */ template<class T> void ArraySlot<T>::setValues(int index, const T* vals) *************** *** 525,528 **** --- 590,598 ---- else { + if (index<0) + index = size()+index; + if ((index<0) || (index>=size())) + throw EIndexError(); + T* ptr = &(values[index]); for(int i=0; i<values.multiplicity(); i++) |
From: Matthias B. <mb...@us...> - 2005-02-24 15:15:19
|
Update of /cvsroot/cgkit/cgkit2/wrappers In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15696/wrappers Modified Files: py_slot.h Log Message: Added checks so that invalid array slot usage doesn't crash Python Index: py_slot.h =================================================================== RCS file: /cvsroot/cgkit/cgkit2/wrappers/py_slot.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** py_slot.h 19 Feb 2005 17:21:34 -0000 1.2 --- py_slot.h 24 Feb 2005 15:14:58 -0000 1.3 *************** *** 57,68 **** .def("__getitem__", &ArraySlotWrapper<stype>::__getitem__) \ .def("__setitem__", &ArraySlotWrapper<stype>::__setitem__) \ ! .def("getValue", &ArraySlotWrapper<stype>::getValue, \ ! return_value_policy<copy_const_reference>()) \ ! .def("setValue", &ArraySlotWrapper<stype>::setValue) \ ! .def("getValues", &ArraySlotWrapper<stype>::getValues_wrap) \ ! .def("setValues", &ArraySlotWrapper<stype>::setValues_wrap) \ ! .def("onValueChanged", &ArraySlotWrapper<stype>::base_onValueChanged) \ .def("__str__", &ArraySlotWrapper<stype>::__str__) \ .def("__iter__", &ArraySlotWrapper<stype>::__iter__, return_value_policy<manage_new_object>()) --- 57,70 ---- .def("__getitem__", &ArraySlotWrapper<stype>::__getitem__) \ .def("__setitem__", &ArraySlotWrapper<stype>::__setitem__) \ ! .def("getValue", &ArraySlotWrapper<stype>::__getitem__) \ ! .def("setValue", &ArraySlotWrapper<stype>::__setitem__) \ .def("__str__", &ArraySlotWrapper<stype>::__str__) \ .def("__iter__", &ArraySlotWrapper<stype>::__iter__, return_value_policy<manage_new_object>()) + // .def("onValueChanged", &ArraySlotWrapper<stype>::base_onValueChanged) \ + // .def("getValue", &ArraySlotWrapper<stype>::getValue, + // return_value_policy<copy_const_reference>()) + // .def("setValue", &ArraySlotWrapper<stype>::setValue) + // .def("getValues", &ArraySlotWrapper<stype>::getValues_wrap) + // .def("setValues", &ArraySlotWrapper<stype>::setValues_wrap) *************** *** 311,323 **** static object __getitem__(ArraySlot<T>* self, int index) { - if (index<0) - { - index = self->size()+index; - } - if ((index<0) || (index>=self->size())) - { - throw EPyIndexError("array index out of range"); - } - if (self->multiplicity()==1) { --- 313,316 ---- *************** *** 326,336 **** else { ! list res; ! const T* ptr = self->getValues(index); ! for(int i=0; i<self->multiplicity(); i++) ! { ! res.append(ptr[i]); ! } ! return tuple(res); } } --- 319,323 ---- else { ! return getValues_py(self, index); } } *************** *** 338,350 **** static void __setitem__(ArraySlot<T>* self, int index, object value) { - if (index<0) - { - index = self->size()+index; - } - if ((index<0) || (index>=self->size())) - { - throw EPyIndexError("array index out of range"); - } - if (self->multiplicity()==1) { --- 325,328 ---- *************** *** 354,366 **** else { ! T* vals = new T[self->multiplicity()]; ! for(int i=0; i<self->multiplicity(); i++) ! { ! object py = value.attr("__getitem__")(i); ! T v = extract<T>(py); ! vals[i] = v; ! } ! self->setValues(index, vals); ! delete [] vals; } } --- 332,336 ---- else { ! setValues_py(self, index, value); } } *************** *** 377,386 **** from Python and is actually not an ArraySlotWrapper class). */ ! static object getValues_wrap(ArraySlot<T>* self, int index) { - if (index>=self->size()) - { - throw EPyIndexError("array index out of range"); - } list res; const T* ptr = self->getValues(index); --- 347,352 ---- from Python and is actually not an ArraySlotWrapper class). */ ! static object getValues_py(ArraySlot<T>* self, int index) { list res; const T* ptr = self->getValues(index); *************** *** 389,408 **** res.append(ptr[i]); } ! return res; } ! static void setValues_wrap(ArraySlot<T>* self, int index, object pyvalues) { ! if (index>=self->size()) ! { ! throw EPyIndexError("array index out of range"); ! } T* vals = new T[self->multiplicity()]; for(int i=0; i<self->multiplicity(); i++) { ! object py = pyvalues.attr("__getitem__")(i); ! T v = extract<T>(py); ! vals[i] = v; } self->setValues(index, vals); delete [] vals; --- 355,398 ---- res.append(ptr[i]); } ! return tuple(res); } ! static void setValues_py(ArraySlot<T>* self, int index, object pyvalues) { ! // Convert the input for setValues() from Python to C++... T* vals = new T[self->multiplicity()]; for(int i=0; i<self->multiplicity(); i++) { ! object py; ! ! // Get the i. Python value... ! try ! { ! py = pyvalues.attr("__getitem__")(i); ! } ! catch(error_already_set&) ! { ! delete [] vals; ! // Clear the already generated exception (which is an AttributeError ! // because __getitem__ is not available or an IndexError because i ! // is out of range) ! PyErr_Clear(); ! // Throw a more descriptive ValueError ! boost::python::object msg = "The values have to be given as a %d-sequence."%make_tuple(self->multiplicity()); ! throw EValueError(PyString_AsString(msg.ptr())); ! } ! // ...and convert it to the corresponding C++ value ! try ! { ! T v = extract<T>(py); ! vals[i] = v; ! } ! catch(error_already_set&) ! { ! delete [] vals; ! throw_error_already_set(); ! } } + // Call the C++ setValues() method self->setValues(index, vals); delete [] vals; *************** *** 410,414 **** // this method is called when onValueChanged() is called from C++ code ! void onValueChanged(int start, int end) { // cout<<"SlotWrapper<T>::onValueChanged()"<<endl; --- 400,404 ---- // this method is called when onValueChanged() is called from C++ code ! /* void onValueChanged(int start, int end) { // cout<<"SlotWrapper<T>::onValueChanged()"<<endl; *************** *** 421,425 **** // cout<<"SlotWrapper<T>::base_onValueChanged"<<endl; ArraySlot<T>::onValueChanged(start, end); ! } // This class has a dedicated __str__() method, so that no copy of the --- 411,415 ---- // cout<<"SlotWrapper<T>::base_onValueChanged"<<endl; ArraySlot<T>::onValueChanged(start, end); ! }*/ // This class has a dedicated __str__() method, so that no copy of the |
From: ocil <oc...@us...> - 2005-02-24 13:05:30
|
Update of /cvsroot/cgkit/cgkit2/wrappers/ogre In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13892/wrappers/ogre Modified Files: OgreCore.cpp OgreCore.h OgreWrap.cpp Log Message: new functionality for swapping scene graphs Index: OgreWrap.cpp =================================================================== RCS file: /cvsroot/cgkit/cgkit2/wrappers/ogre/OgreWrap.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** OgreWrap.cpp 31 Jan 2005 16:15:11 -0000 1.7 --- OgreWrap.cpp 24 Feb 2005 13:04:56 -0000 1.8 *************** *** 37,41 **** .def("insertToTree", &OgreCore::insertToTree) .def("pumpKeyUps", &OgreCore::pumpKeyUps) ! .def("pumpMouseButtons", &OgreCore::pumpMouseButtons) ; } --- 37,44 ---- .def("insertToTree", &OgreCore::insertToTree) .def("pumpKeyUps", &OgreCore::pumpKeyUps) ! .def("pumpMouseButtons", &OgreCore::pumpMouseButtons) ! .def("changeMaterial", &OgreCore::changeMaterial) ! .def("setAmbient", &OgreCore::setAmbient) ! .def("rebuildOgreTree", &OgreCore::rebuildOgreTree) ; } Index: OgreCore.h =================================================================== RCS file: /cvsroot/cgkit/cgkit2/wrappers/ogre/OgreCore.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** OgreCore.h 31 Jan 2005 16:15:10 -0000 1.7 --- OgreCore.h 24 Feb 2005 13:04:56 -0000 1.8 *************** *** 57,68 **** using namespace Ogre; ! // using namespace support3d; // tststststs! ! ! // ......................................................................... ! // ......................................................................... ! // ......................................................................... ! // ......................................................................... ! // ......................................................................... ! // ......................................................................... class OgreDependent : public support3d::Dependent --- 57,67 ---- using namespace Ogre; ! /////////////////////// ! ////// /////// ! ////// // // /////// ! ////// /////// ! ////// ////// /////// ! ////// /////// ! /////////////////////// class OgreDependent : public support3d::Dependent *************** *** 71,96 **** public: // attribute ! bool isPointLight; ! bool isSpotLight; ! bool isDistantLight; ! bool isCamera; ! OgreDependent(support3d::WorldObject* wo, SceneNode* sn); ! ~OgreDependent(); ! SceneNode* nodi; ! Light* theLight; ! Camera* theCamera; ! support3d::WorldObject* transi; // methoden void onValueChanged(); }; ! // ......................................................................... ! // ......................................................................... ! // ......................................................................... ! // ......................................................................... ! // ......................................................................... ! // ......................................................................... class OgreCore --- 70,97 ---- public: // attribute ! bool mIsPointLight; ! bool mIsSpotLight; ! bool mIsDistantLight; ! bool mIsCamera; ! ! SceneNode* mpNodi; ! Light* mpTheLight; ! Camera* mpTheCamera; ! support3d::WorldObject* mpTransi; // methoden void onValueChanged(); + OgreDependent(support3d::WorldObject* wo, SceneNode* sn); + ~OgreDependent(); }; ! /////////////////////// ! ////// /////// ! ////// // // /////// ! ////// /////// ! ////// ////// /////// ! ////// /////// ! /////////////////////// class OgreCore *************** *** 99,107 **** --- 100,114 ---- OgreCore(); ~OgreCore(); + OgreCore(const OgreCore&); + OgreCore& operator=(const OgreCore&); + void initialize(support3d::WorldObject& root, unsigned int windowW, unsigned int windowH, bool fullscr, bool shadows, bool opengl, const char * materialpath, int dm); void renderTree(); void clock(unsigned int fps); void insertToTree(support3d::WorldObject& newObject, support3d::WorldObject& fatherObject, int hasFather); + void changeMaterial(std::string newMaterial, std::string entityName); void buildTree(support3d::WorldObject& VisumRoot, SceneNode * snode); + int setAmbient(float x, float y, float z); + int rebuildOgreTree(support3d::WorldObject& VisumRoot); Mesh* getMeshFromCgKit(support3d::TriMeshGeom *trigeom, const char *name); Mesh* getFlatMeshFromCgKit(support3d::TriMeshGeom *trigeom, const char *name); *************** *** 112,151 **** boost::python::list pumpMouseButtons(); std::vector<OgreDependent*> dependents; ! int debugmode; private: ! MyMouseListener* moti; ! MyListener* listi; ! MyMouseButtonListener* buti; ! EventProcessor * evpro; ! bool haveToParse; ! int _k; ! char* buffer; ! std::string myString; ! std::string myStringLight; ! std::string myMaterialName; ! Mesh *myMesh; ! Viewport* vp; boost::shared_ptr< support3d::Material > sptrMaterial; ! Resource * myMaterial; ! //Entity * ent; ! bool shadowsEnabled; ! Light* myLight; ! Root *root; ! RenderWindow *window; ! Timer *mTimer; ! Camera* camera; ! SceneNode* camsnode; ! SceneManager *sceneMgr; ! Material * mat; bool setRenderSystem(Root *root, const char *name); Mesh* createCube(float width, float height, float length, const char *name); }; - // ......................................................................... - // ......................................................................... - // ......................................................................... - // ......................................................................... - // ......................................................................... - // ......................................................................... - #endif --- 119,151 ---- boost::python::list pumpMouseButtons(); std::vector<OgreDependent*> dependents; ! private: ! int mDebugMode; ! MyMouseListener* mpMoti; ! MyListener* mpListi; ! MyMouseButtonListener* mpButi; ! EventProcessor * mpEvpro; ! bool mHaveToParse; ! ! char* mpBuffer; ! std::string mMyString; ! std::string mMyStringLight; ! std::string mMyMaterialName; ! Viewport* mpVp; ! boost::shared_ptr< support3d::Material > sptrMaterial; ! ! Resource* mpMyMaterial; ! bool mShadowsEnabled; ! Light* mpMyLight; ! Root *mpRoot; ! RenderWindow *mpWindow; ! Timer *mpTimer; ! Camera* mpCamera; ! SceneManager *mpSceneMgr; ! bool setRenderSystem(Root *root, const char *name); Mesh* createCube(float width, float height, float length, const char *name); }; #endif Index: OgreCore.cpp =================================================================== RCS file: /cvsroot/cgkit/cgkit2/wrappers/ogre/OgreCore.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** OgreCore.cpp 31 Jan 2005 16:15:10 -0000 1.7 --- OgreCore.cpp 24 Feb 2005 13:04:55 -0000 1.8 *************** *** 20,59 **** ======================================================================*/ // DEBUG Makro ! #define DEBUGOUT(stri, integ) if (debugmode==1) cout << "DEBUG: " << stri << " " << integ << endl; ! #define DEBUGVECTOROUT(stri, integ1,integ2,integ3) if (debugmode==1) cout << "DEBUG: " << stri << " " << integ1 << " " << integ2 << " " << integ3 << endl; #include "OgreCore.h" ! // ................................................................................. ! // ................................................................................. [...2344 lines suppressed...] *** 1825,1829 **** } - DEBUGOUT("**************", 0); } --- 1608,1611 ---- *************** *** 1915,1919 **** mesh->_setBounds(AxisAlignedBox(min.x, min.y, min.z, max.x, max.y, max.z)); ! if (shadowsEnabled) { cout << "FORC: Building Edge List for OGRE" << endl; --- 1697,1701 ---- mesh->_setBounds(AxisAlignedBox(min.x, min.y, min.z, max.x, max.y, max.z)); ! if (mShadowsEnabled) { cout << "FORC: Building Edge List for OGRE" << endl; |
From: Matthias B. <mb...@us...> - 2005-02-22 15:43:03
|
Update of /cvsroot/cgkit/cgkit2/doc/tex In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30881/tex Modified Files: cgkit.tex Added Files: slots.tex Log Message: Initial slot documentation added Index: cgkit.tex =================================================================== RCS file: /cvsroot/cgkit/cgkit2/doc/tex/cgkit.tex,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** cgkit.tex 17 Feb 2005 09:02:46 -0000 1.8 --- cgkit.tex 22 Feb 2005 15:42:36 -0000 1.9 *************** *** 117,120 **** --- 117,121 ---- \section{\module{preferences} --- } \section{\module{undo} --- } + \input{slots.tex} %--- --- NEW FILE: slots.tex --- \section{\module{slots} --- Slot classes} \declaremodule{extension}{cgkit.slots} \modulesynopsis{Slot classes} % ------------------------------------------------- \subsection{Dependent class} \begin{classdesc}{Dependent}{} \end{classdesc} \begin{methoddesc}{onValueChanged}{} Normal/array \end{methoddesc} \begin{methoddesc}{onResize}{} \end{methoddesc} % ------------------------------------------------- \subsection{Slot classes} There are the following standard slots: \begin{itemize} \item DoubleSlot \item IntSlot \item BoolSlot \item StrSlot \item PySlot \item Vec3Slot \item Vec4Slot \item Mat3Slot \item Mat4Slot \item QuatSlot \end{itemize} \begin{classdesc}{Slot}{[value, flags]} Create a slot that initially carries the specified value. Todo: Describe the flags argument. \end{classdesc} %\begin{memberdesc}{_value} %The current slot value. %\end{memberdesc} % isSlotCompatible \begin{methoddesc}{isSlotCompatible}{slot} Return \code{True} if \var{slot} is compatible with this slot. Two slots are compatible if they hold the same type of value. Only compatible slots can be connected to each other. But note that even when this method returns true, it can happen that the slots can {\it not} be connected. This is the case whenever the target just doesn't accept input connections (for example, because it's computing its output value procedurally). \end{methoddesc} % typeName \begin{methoddesc}{typeName}{} Return a string containing the name of the stored type. This name can be used to display the type of the slot to the user. The name should be chosen so that if two slots cannot be connected to each other then they should also return different names (however, if two slots have different names it is still possible that they can be connected to each other). \end{methoddesc} % getController \begin{methoddesc}{getController}{} Return the associated controlling slot or \code{None}. \end{methoddesc} % setController \begin{methoddesc}{setController}{slot} Set or remove a controller for this slot. The current controller is replaced with \var{slot} which may also be \code{None} to remove the current controller only. If the controller is not compatible with this slot an \exception{EIncompatibleSlotTypes} exception is thrown. \end{methoddesc} % getValue \begin{methoddesc}{getValue}{} Return the current slot value. \end{methoddesc} % setValue \begin{methoddesc}{setValue}{val} Set a new value. If the slot has a controller the new value is propagated up to the controller. It is then up to the controller how this new value influences the actual output value. So it is not guaranteed that the output of the slot is really the new value. When the value really changes this method triggers the onValueChanged() method on all dependent objects. \end{methoddesc} % connect \begin{methoddesc}{connect}{slot} Connect the output of this slot with the input of \var{slot}. Calling this method is equivalent to calling \code{slot.setController(self)}. \end{methoddesc} % addDependent \begin{methoddesc}{addDependent}{d} Establish a dependency between this slot and another object \var{d}. The argument \var{d} is added to the list of dependent objects. This means that \var{d} somehow depends on the value of this slot and that \var{d} has to be notified whenever the value of this slot changes. The actual notification is done by calling \method{notifyDependents()} which in turn calls \method{onValueChanged()} on all dependent objects. Todo: C++ warning! \end{methoddesc} % removeDependent \begin{methoddesc}{removeDependent}{d} Remove the dependency between this slot and another object \var{d}. \end{methoddesc} % notifyDependents \begin{methoddesc}{notifyDependents}{} Notify all dependent slots about a value change. This method calls the \method{onValueChanged()} method of all slots whose value depends on the value of this slot. \end{methoddesc} % computeValue \begin{methoddesc}{computeValue}{} This method is used to compute a new value whenever \method{getValue()} is called and the cache is invalid. It should only be implemented on procedural slots. \end{methoddesc} % ------------------------------------------------- \subsection{ArraySlot classes} \begin{classdesc}{ArraySlot}{multiplicity=1} Create an array slot. \end{classdesc} % size \begin{methoddesc}{size}{} Return the number of elements in this array slot. \end{methoddesc} % resize \begin{methoddesc}{resize}{size} Resize the array slot so that it can carry \var{size} elements. \end{methoddesc} % multiplicity \begin{methoddesc}{multiplicity}{} Return the multiplicity of the array slot. \end{methoddesc} % isSlotCompatible \begin{methoddesc}{isSlotCompatible}{slot} Return \code{True} if \var{slot} is compatible with this slot. Two slots are compatible if they hold the same type of value. Only compatible slots can be connected to each other. But note that even when this method returns true, it can happen that the slots can {\it not} be connected. This is the case whenever the target just doesn't accept input connections (for example, because it's computing its output value procedurally). \end{methoddesc} % typeName \begin{methoddesc}{typeName}{} Return a string containing the name of the stored type. This name can be used to display the type of the slot to the user. The name should be chosen so that if two slots cannot be connected to each other then they should also return different names (however, if two slots have different names it is still possible that they can be connected to each other). \end{methoddesc} % getController \begin{methoddesc}{getController}{} Return the associated controlling slot or \code{None}. \end{methoddesc} % setController \begin{methoddesc}{setController}{slot} Set or remove a controller for this slot. The current controller is replaced with \var{slot} which may also be \code{None} to remove the current controller only. If the controller is not compatible with this slot an \exception{EIncompatibleSlotTypes} exception is thrown. \end{methoddesc} % getValue \begin{methoddesc}{getValue}{index} Return one item of the array slot. This method should only be used on array slots of multiplicity 1. \end{methoddesc} % setValue \begin{methoddesc}{setValue}{index, val} Set one item to a new value. This method should only be used on array slots of multiplicity 1. \end{methoddesc} % getValues \begin{methoddesc}{getValues}{index} Return one item of the array slot. \end{methoddesc} % setValue \begin{methoddesc}{setValues}{index, vals} Set one item to a new value. \end{methoddesc} % connect \begin{methoddesc}{connect}{slot} Connect the output of this slot with the input of \var{slot}. Calling this method is equivalent to calling \code{slot.setController(self)}. \end{methoddesc} % addDependent \begin{methoddesc}{addDependent}{d} Establish a dependency between this slot and another object \var{d}. The argument \var{d} is added to the list of dependent objects. This means that \var{d} somehow depends on the value of this slot and that \var{d} has to be notified whenever the value of this slot changes. The actual notification is done by calling \method{notifyDependents()} which in turn calls \method{onValueChanged()} on all dependent objects. Todo: C++ warning! \end{methoddesc} % removeDependent \begin{methoddesc}{removeDependent}{d} Remove the dependency between this slot and another object \var{d}. \end{methoddesc} % notifyDependents %\begin{methoddesc}{notifyDependents}{} %Notify all dependent slots about a value change. This method calls the %\method{onValueChanged()} method of all slots whose value depends on the %value of this slot. %\end{methoddesc} % ------------------------------------------------- \subsection{Procedural slots} There are the following standard procedural slots: \begin{itemize} \item ProceduralDoubleSlot \item ProceduralIntSlot \item ProceduralVec3Slot \item ProceduralVec4Slot \item ProceduralMat3Slot \item ProceduralMat4Slot \item ProceduralQuatSlot \end{itemize} % ------------------------------------------------- \subsection{NotificationForwarder class} A \class{NotificationForwarder} object can be used to forward slot events from one particular slot to an arbitrary method instead of the \method{onValueChanged()} or \method{onResize()} method. To accomplish this the \class{NotificationForwarder} object is added as a dependent object of the slot. This means, whenever the value of the slot changes, the \method{onValueChanged()} method of the \class{NotificationForwarder} object is called which in turn calls an arbitrary other function or method. \begin{classdesc}{NotificationForwarder}{callable} \var{callable} is an arbitrary callable object that is invoked whenever a {\em value changed} event has occured. \end{classdesc} Example: \begin{verbatim} >>> from cgkit import * >>> def myCallback(): print "Something has happened" ... >>> s=Sphere() >>> n=NotificationForwarder(myCallback) >>> s.radius_slot.addDependent(n) Something has happened >>> s.radius=5 Something has happened >>> s.radius=2 Something has happened \end{verbatim} |