Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Everything posted by AsOne

  1. AsOne

    What IDE are YOU using?

    Vim... arrow keys? A mouse? Are you guys crazy? But honestly, mostly vim with a terminal emulator. Sometimes Eclipse for Java related work and Carbide.c++ (I guess really Eclipse) for Symbian development. Most work done on Linux (Ubuntu and Arch), some on Windows XP (usually virtualized).
  2. If a textured quad is clipped so it forms a polygon, how can the texture be applied to the triangles of the polygon, so the polygon's texture looks the same as it did on the quad? I am writing code to load a Quake 3 map file and I want to implement the same type of texture mapping. I have limited experience with OpenGL, and I'm thinking I'm going to need more than just: glTexCoord2f... Ideas?
  3. AsOne

    Hilarity In Video Games

    Quote:Original post by Mike.Popoloski "Do a barrel role!" Haha, was that the original StarFox or the 64 one?
  4. AsOne

    Texture Mapping Triangles

    I think I gave a bad explanation. I'm actually loading a non-compiled map file (map extension). Each brush is given as a series of intersecting planes and I am generating triangles from this data. What I meant about the quad is that, to generate the triangles I create a quad on the surface of one of the planes and then clip it against all the other planes in the brush generating a face. What I don't know how to do is apply a texture to the face (some number of triangles) after it's been clipped so the texture is correct. JuNC: It sounds like I need to be computing the texture co-ordinates while clipping each quad, and not figure them out during rendering, is this correct? [Edited by - AsOne on September 6, 2007 3:10:57 PM]
  5. Hello, I am attempting to load the geomtry from a Quake 3 MAP file. I have decided this since it is very easy parse. However, primitives are described as plane intersections and I don't know how I should go about creating triangles from this data. This for instance describes a 1x1x1 cube, with one corner at (0,0,0) // entity 0 { "classname" "worldspawn" // brush 0 { ( 112 56 2 ) ( 112 16 2 ) ( 64 56 2 ) NULL 16 16 0 0.5 0.5 0 0 0 ( 80 2 87 ) ( 32 2 87 ) ( 80 2 -41 ) NULL 16 46 0 0.5 0.5 0 0 0 ( 66 39 96 ) ( 66 39 -32 ) ( 66 -1 96 ) NULL 18 0 0 0.5 0.5 0 0 0 ( 64 8 0 ) ( 112 8 0 ) ( 64 48 0 ) NULL 16 0 0 0.5 0.5 0 0 0 ( 40 0 -32 ) ( 40 0 96 ) ( 88 0 -32 ) NULL 0 0 0 0.5 0.5 0 0 0 ( 64 8 -32 ) ( 64 48 -32 ) ( 64 8 96 ) NULL 0 -0 0 0.5 0.5 0 0 0 } } The only thing I can think of is finding the intersection of each plane with the other planes and come up with a bunch of lines. Then intersect these lines with each other to get a bunch of points. From these points generate the required triangles. Ideas? [Edited by - AsOne on August 19, 2007 6:04:13 PM]
  6. AsOne

    Hash Map implementation

    This may be of some help: Perfect Hashing
  7. AsOne

    Precision stop in FMOD

    Once you begin playing a sound: FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, sound, 0, &channel); You can stop the sound by using: FMOD_Channel_Stop(channel); Nearly the same using the C++ API as well.
  8. AsOne

    Why Linux?

    apt-get (Debian)
  9. AsOne

    PI * 13.37

    Well I knew that they had to be integers for PI to be rational, I just find it strange that this means that the circumference or diameter is irrational. It would seem that the circumference is most likely the one that is not rational. i.e. there can't be a perfect circle, or maybe I'm completely wrong.
  10. AsOne

    X-Games and Extreme Sports!!

    That was ridiculous! I have never seen a skateboarding bail that big.
  11. AsOne

    PI * 13.37

    OK, this is probably going to sound stupid, maybe a bit off topic, but... PI is an irrational number; however, we all know it's the ratio of the circumference of a circle to its diameter. PI = c / d But isn't any number that can be expressed as a fraction a rational number? Does this mean that the circumference or the diameter of a circle isn't a rational number? No one has ever explained this to me.
  12. AsOne

    lisp and large arrays

    Ah, no wonder it wasn't working. Those should obviously be i's and j's. Thanks.
  13. AsOne

    lisp and large arrays

    OK, This is set-color defun set-color (image j i blue green red) (setf (aref (bitmap-buffer image) (+ (* j 3) (* (bitmap-image-height image) i) 0)) blue) (setf (aref (bitmap-buffer image) (+ (* j 3) (* (bitmap-image-height image) i) 1)) green) (setf (aref (bitmap-buffer image) (+ (* j 3) (* (bitmap-image-height image) i) 2)) red)) I am hoping I did this correctly. In C, each pixel was a structure of 3 bytes. In Lisp I didn't know if a large array of structures would be very efficient so I did this instead. Maybe not such a good idea. Here is the bulk of the code that would be causing the problems, my Lisp style is probably bad so I apologize in advance ;) (defun filter (image modifier selector) "apply a filter to a bitmap" (let* ((buffer (bitmap-buffer image)) (image-width (bitmap-image-width image)) (image-height (bitmap-image-height image)) (out-image (make-bitmap :buffer (make-array (* image-width image-height 3) :element-type '(unsigned-byte 8) :fill-pointer nil) :image-width image-width :image-height image-height))) (loop for j from 0 to image-width by 1 do (loop for i from 0 to image-height by 1 do (if (and (or (eq selector nil) (funcall selector buffer j i)) (not (eq modifier nil))) (multiple-value-bind (b g r) (funcall modifier image j i) (set-color out-image j i b g r)) (Multiple-value-bind (b g r) (get-color image j i) (set-color out-image j i b g r))))) out-image)) ; return (defun modifier-average () "blur pixel modifier" (lambda (image j i) (let ((buffer (bitmap-buffer image)) (image-width (bitmap-image-width image)) (image-height (bitmap-image-height image)) (blue 0) (green 0) (red 0) (count 0)) (loop for y from (if (/= i 0) (1- i) i) to (if (/= i (1- image-height)) (1+ image-height) i) by 1 do (loop for x from (if (/= j 0) (1- j) j) to (if (/= j (1- image-width)) (1+ image-width) j) by 1 do (multiple-value-bind (b g r) (get-color image j i) (setq blue (+ blue b)) (setq green (+ green g)) (setq red (+ red r))) (setq count (1+ count)))) (setq blue (/ blue count)) (setq green (/ green count)) (setq red (/ red count)) (values (floor blue) (floor green) (floor red))))) This is used like this: (setq image2 (filter image1 (modifier-average) nil))
  14. AsOne

    'Must have' tools

    Anything free is good. For Windows: - Crimson Editor - Basic text editing features, syntax highlighting, standard stuff. It lets you customize color schemes really easily including changing what keywords get highlighted what. I tried to customize my color scheme in VS and gave up after 10 minutes. For Linux: - Emacs I first hated Emacs, but I recently started doing work with Lisp and now I can't live without it. The odd key combinations become second nature fairly quickly. Lots of choices for color schemes. - KATE (KDE Advanced Text Editor) Probably THE best basic text editing tool there is IMO. Others: - apt-get - gcc - KDevelop
  15. AsOne

    Pointer table

    You can bust out the void**, but it's dangerous! void **table = malloc(sizeof(void*) * TABLE_SIZE); int a = 10; float b = 20; table[0] = (void*)(&a); table[1] = (void*)(&b); printf("a = %d\n", *((int*)table[0])); printf("b = %f\n", *((float*)table[1])); free(table); This is scary though because you may not know how to cast each table entry to retrieve something meaningful. If you are using C++ it would be better to use std::vector like the poster above.
  16. AsOne

    How is this possible?

    I'm using g++ to compile, the output is the same regardless of what optimization level used. The address of i remains the same even after the object is deleted. Thus, the data is just being overwritten. What's interesting is if I change main to this: int main() { TSmart<C> x; x->foo(); x.~TSmart<C>(); x->foo(); C *p = new C; x->foo(); return 0; } The output becomes: C::foo 100 ~TSmart() C::foo 1 C::foo 100 ~TSmart() However, if I throw in some random allocations before the last x->foo() then I get a segmentation fault. I guess the original code worked just because there were no allocations to erase the data from the C object.
  17. AsOne

    How is this possible?

    OK that makes sense, I should have realized before that when deleting a pointer the actual data isn't being erased. However, this runs without problem. struct C { C() : i(99) {} void foo() { i++; std::cout << "C::foo\n"; std::cout << i << "\n"; } int i; }; int main() { TSmart<C> x; x->foo(); x.~TSmart<C>(); x->foo(); x->foo(); return 0; } The output is: C::foo 100 ~TSmart() C::foo 1 C::foo 2 ~TSmart() Would have been stranger if 101 and 102 were present. Is this just because the memory location where i is isn't being overwritten since the time of deletion?
  18. AsOne

    Transformation of co-ordinate system.

    Alright got it to work! Thanks for the help.
  19. AsOne

    Transformation of co-ordinate system.

    Alright, almost got it to work. I have been able to place my person in the correct position as to have their feet at the proper angle (sort of). However, when I calculate the transformation matrix of the surface I want to put the person on, the rotation around the normal of that surface seems to be arbitrary and seems to change randomly between different triangles on the mesh. Is there a way to eliminate the rotation around the normal of the surface using the rotation matrix? For instance if the person is on flatground the rotation around the Y axis (vertical) changes between a couple of seemingly random values. On flatground rotation around the Y should be 0 (not counting the direction the person is facing). This is easy to fix on flatground, but how would I change this rotation around the normal to zero on nonflat ground? Currently the calculation to find the persons rotation around each axis (Euler angles or really Tait-Bryan angles) is as follows: - Find normal vector, right vector, and forward vector. - Build transformation matrix containing rotation information. - Multiply this matrix with the rotation matrix of the person (person will always have 0 rotation around X and Z axis on flatground). - Get angles from the matrix product and set persons rotations to these values. EDIT: I should note the reason I'm just calculating the rotation matrix is because I am using the Irrlicht engine and as far as I know I can't change the absolute transformation of a scene node directly. So once I calculate the rotation matrix I can then extract the corresponding angles of rotation about each axis and then set the scene node to have these rotations. [Edited by - AsOne on May 29, 2007 7:02:43 PM]
  20. AsOne

    Transformation of co-ordinate system.

    OK, that helps, I'm still stuck at one part though. For what I am doing, the only information of the surface I have is it's normal (the normal of an arbitrary triangle of a mesh to be exact). I understand once I have the rotation matrix I can multiply the rotation matrix of my person to obtain the correct orientation. The problem is I don't know how to obtain the rotation matrix of the triangle (surface in the example) from it's normal vector.
  21. AsOne

    Verizon failed fifth grade math.

    Wow. My favorite part is when they recognize the difference of one dollar and one cent, half a dollar and half a cent, but then can't make the distinction between 0.002 dollars and 0.002 cents. I doubt these people even know what multiplication or division are.
  22. Thank you! I was missing the development files. Stupid mistake.
  23. AsOne

    Funny videos: YouTube, Google. whatever

    ^^^ That's gonna be a classic.
  24. AsOne

    Building Projects From Anjuta.

    Apparently the paths of libraries can be encoded into the binaries (rpath). I found this page clicky and was able to fix the problem by simply using -R <path to library> as a linker option. Well it all works now thankfully.
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!