gabrielauditore

Members
  • Content count

    14
  • Joined

  • Last visited

Community Reputation

100 Neutral

About gabrielauditore

  • Rank
    Member
  1. Visual Studio: regex find replace

    The code base will die once the product is shipped; no further updates will be made. BUT, the -> operator seems to be causing some slow downs in performance heavy areas of code (I don't know if it's just not optimal code generation or cache hit misses or what). Basically the final thing before the "game" ships will be to replace all -> with explicit dereferences but it's turning out to be quite a challenge to do so.
  2. Hi guys i'm trying to write a regex query for vs2008 that will convert m_pPointer->m_nVariable to (*m_pPointer).m_nVariable I can do that no problem, but the codebase i'm in has some nested / cryptic shit variable.p_subvar->x[y]->w[q].newvar->damn in which case i hope to run the query and convert it to (*(variable.p_subvar->x[y]->w[q].newvar)).damn This is my search query so far: {((:i)(\[:i\})*(.|-\>)*)*:i}-\>{:i} However it qualifies a whole line for some reason Any suggestions?
  3. 2D Articulated Animation

    wolfscaptain, Thanks for the reply that actually helped clear things up a lot. There is one last piece of this puzzle that i'm still not fully grasping. How could i go about setting an arbitrary rotation center for each node? At this point i think i would actually need two matrices, one to be the generic transform and one to be the offset rotation... I can't really figure this one out.
  4. 2D Articulated Animation

    Hi, The Magical Pot Thanks for the reply. I already have a pretty solid frame-based animation system in place. I'm looking for something that is articulated that is something with a skeleton and a hierarchy. The only tutorials i've been able to find are about 3D articulated animation, but i'd like to not use matrices. As far as programming language i'm working with C++ and rendering trough OpenGL, but the tutorial language doesn't matter, if there is something in javascript, ruby, c#, etc... i'll understand the code and be able to apply it. Thanks guys
  5. Hey guys, does anyone know a good book / tutirial on how to make a 2d artuculated animation system? I know it's avague question, but google turned up only graage results...
  6. [LUA] setenv is nill?

    Lua 5.2 no longer supports setfenv. It isntead has a _ENV variable
  7. [LUA] setenv is nill?

    Hi guys, i'm trying to make some easy lua encapsulation code, so far i have a base class [CODE] -- Auto generate begin BaseClass = {} function BaseClass:new(object) object = object or {} setmetatable(object, self) self.__index = self return object end setmetatable(_G, { __newindex = function(t, k, v) BaseClass[k] = v end, __index = function(t, k) return BaseClass[k] end }) -- Auto generate end function PrintX(self) setenv(1, self) print (x) end -- Auto generate begin setmetatable(_G, nil) -- Auto generate end [/CODE] and then a test file that uses it [CODE] variable1 = BaseClass:new() variable2 = BaseClass:new() variable1.x = 10 variable1:PrintX() variable2:PrintX() [/CODE] Basically anything within the --autogenerate comments would be written by a pre-processor macro, so end users could write code, and anything within a file would automatically be added to a class. if you take a look inside the printX function i'm trying to set the current global environment to self, that is while the function is executing x should reference self.x (The setenv function would be added by a pre-processor as well). However when i run this piece of code i get the following output [b]attempt to call global 'setenv' (a nil value)[/b] I think this is because instead of calling _G.setenv my code is actually calling BaseClass.setenv, but rawget(_G, "setenv") return nil Any ideas on how to solve this issue? [size=6]EDIT,[/size] 2 things First, i had a typo. It's setfenv not setenv. Second the following code fails (I'm using the command line interpreter from the lua site) [CODE] function test() local newgt = {} setmetatable(newgt, {__index = _G}) setfenv(1, newgt) end [/CODE]
  8. Classifying a 2D polygon as convex or concave

    Actually, one more question, is there an equally easy way to tell if said polygon is a square (or rectangle)?
  9. Classifying a 2D polygon as convex or concave

    Thanks for all the replies guys! I should have mentioned this is being used in a tool, so performance is not that big of an issue. I decided to go with japro's solution as it seemed to be the easiest to implement. Thanks for all the help again! If anyone is interested, here is my mock code (Tested and working) [code]#include <vector> typedef struct Touple2D_t { float x, y; Touple2D_t() : x(0.0f), y(0.0f) { } Touple2D_t(float _x, float _y) : x(_x), y(_y) { } Touple2D_t operator-(const Touple2D_t& t) { return Touple2D_t(x - t.x, y - t.y); } } Touple2D; typedef struct Poly2D_t { std::vector<Touple2D> verts; } Poly2D; float dot(Touple2D& l, Touple2D& r) { return (l.x * r.x + l.y * r.y); } Touple2D perp(Touple2D& t) { return Touple2D(-1.0f * t.y, t.x); } bool isConvex(Poly2D& p) { unsigned int size = p.verts.size(); if (size <= 2) return true; int sign = 0; for (unsigned int i = 1; i < size - 1; ++i) { float result = dot(p.verts[i] - p.verts[i-1], perp(p.verts[i + 1] - p.verts[i])); if (sign == 0) sign = ((result < 0)? -1 : 1); else if (sign != ((result < 0)? -1 : 1)) return false; } return true; }[/code]
  10. Hey guys, i have a 2D polygon object something along the lines of [code] typedef struct Poly2D_t { vector<Touple2D> verts; // vector of x, y pairs } Poly2D; [/code] I need a function to classify each polygon as convex or concave. Is there an algorithm for this? For some reason i can't seem to find the method to do so on google. All help is appriciated!
  11. Simple WinMain, Mouse not working

    Yeah, i just ran it on my work computer and it ran fine. Guess i'll chalk this one up to the shitty hp trackpad utility. Thanks for the reply!
  12. Hey guys. I have a pretty simple WinMain: http://pastebin.com/gpDi1kne It compiles runs, i get a window. When the window is active and i press a key, let's say R the mouse stops moving while the key is being held down. When the key is released i can start moving the mouse again. So far i've only tested this on a 32 bit windows 7 running on a laptop (using tracpad, not actual mouse). I have no idea why this is happening... All suggestions are appreciated!
  13. Use direct audio to populate IDirectSoundBuffer?

    I've found the WavDest filter on MSDN, [url="http://msdn.microsoft.com/en-us/library/windows/desktop/dd390969(v=vs.85).aspx"]http://msdn.microsoft.com/en-us/library/windows/desktop/dd390969(v=vs.85).aspx[/url] If i interpret it correctly this will take an mp3, convert it to a wav and write it to the disk. It's close, i just need the output to be re-drected to memory instead of a file...
  14. So i've read that i can use DirectShow to load mp3 files, and even found this nifty little piece of code [url="http://www.flipcode.com/archives/Playing_An_MP3_With_DirectShow.shtml"]http://www.flipcode....irectShow.shtml[/url] Which is great! Is it possible to use Direct Show to populate a IDirectSoundBuffer* ? All i would need to do this is the raw data inside of the loaded fle and the data to populate a WAVEFORMATEX structure. Is it possible to grab those elements? PS: I meant DirectShow for the topic title, but it's been a while since i slept... Making mistakes left and right!