Jump to content
  • Advertisement

wolverine

Member
  • Content Count

    346
  • Joined

  • Last visited

Everything posted by wolverine

  1. wolverine

    Linear interpolation of cube corner vals inside cube

    Hi. This is a common problem within volume rendering and isosurfacing: given a cube with 8 values at its vertices, what is the value at a point p within the cube. The usual approach is to use trilinear interpolation. There are a lot papers describing this. For example, see the beggining os section 2 of this paper.
  2. It seems that Carmack's 2008 keynote has just become available on-line: link
  3. wolverine

    generic containers in C

    Quote:Original post by Sneftel Indeed. If the line ends with a backslash, you'll need to put a space after it to keep the line break from being removed. Totally awesome, huh? Pretty much every thread about macros has this happen sooner or later. Yep, it worked :)
  4. wolverine

    generic containers in C

    Quote:Original post by LessBread Run some tests on those macros first. Iirc, there's an error in the generated code. I don't recall exactly where as it's been several years. Check your compiler specs for the command line switch that outputs preprocessor code. Instance those macros in your test file, then output the preprocessor results and review that code to locate the error. Quote:Original post by DevFred Quote:Original post by LessBread Check your compiler specs for the command line switch that outputs preprocessor code. gcc -E I've tried the code and made some changes. The changes were: * due to html, the operator "->" was posted as "-". I've replaced that on the code. * added "#define DEF_SIZE 2" since it was needed by the code (it assumed the value existed). However, it's easy to change the code to eliminate this need. * in the macro-function "int type##_AddElem(type##_Vector *pV, type Data)", I've replaced the first if from "if(pV-len = pV-size)" to "if(pV->len == pV->size)" * in the macro-function "type type##_GetElemAt(type##_Vector *pV, int pos)", I've replaced the if "if(pos = 0 && pos <= pV-len)" to "if(pos >= 0 && pos < pV->len)" Here's the modified code: #include <stdio.h> #include <stdlib.h> /*Macro definitions from http://www.flipcode.com/archives/Faking_Templates_In_C.shtml*/ #define DEF_SIZE 2 #define CREATE_VECTOR_TYPE_H(type) \ typedef struct _##type##_Vector{ \ type *pArray; \ type illegal; \ int size; \ int len; \ } type##_Vector; \ void type##_InitVector(type##_Vector *pV, type illegal); \ void type##_InitVectorEx(type##_Vector *pV, int size, type illegal); \ void type##_ClearVector(type##_Vector *pV); \ void type##_DeleteAll(type##_Vector *pV); \ void type##_EraseVector(type##_Vector *pV); \ int type##_AddElem(type##_Vector *pV, type Data); \ type type##_SetElemAt(type##_Vector *pV, int pos, type data); \ type type##_GetElemAt(type##_Vector *pV, int pos); #define CREATE_VECTOR_TYPE_C(type) \ void type##_InitVector(type##_Vector *pV, type illegal) \ { \ type##_InitVectorEx(pV, DEF_SIZE, illegal); \ } \ void type##_InitVectorEx(type##_Vector *pV, int size, type illegal) \ { \ pV->len = 0; \ pV->illegal = illegal; \ pV->pArray = malloc(sizeof(type) * size); \ pV->size = size; \ } \ void type##_ClearVector(type##_Vector *pV) \ { \ memset(pV->pArray, 0, sizeof(type) * pV->size); \ pV->len = 0; \ } \ void type##_EraseVector(type##_Vector *pV) \ { \ if(pV->pArray != NULL) \ free(pV->pArray); \ pV->len = 0; \ pV->size = 0; \ pV->pArray = NULL; \ } \ int type##_AddElem(type##_Vector *pV, type Data) \ { \ type *pTmp; \ if(pV->len == pV->size) \ { \ pTmp = malloc(sizeof(type) * pV->size * 2); \ if(pTmp == NULL) \ return -1; \ memcpy(pTmp, pV->pArray, sizeof(type) * pV->size); \ free(pV->pArray); \ pV->pArray = pTmp; \ pV->size *= 2; \ } \ pV->pArray[pV->len] = Data; \ return pV->len++; \ } \ type type##_SetElemAt(type##_Vector *pV, int pos, type data) \ { \ type old = pV->illegal; \ if(pos = 0 && pos <= pV->len) \ { \ old = pV->pArray[pos]; \ pV->pArray[pos] = data; \ } \ return old; \ } \ type type##_GetElemAt(type##_Vector *pV, int pos) \ { \ if(pos >= 0 && pos < pV->len) \ return pV->pArray[pos]; \ return pV->illegal; \ } /* this is supposed to go into an h file*/ CREATE_VECTOR_TYPE_H(int) CREATE_VECTOR_TYPE_H(double) /* this is supposed to go into an c file*/ CREATE_VECTOR_TYPE_C(int) CREATE_VECTOR_TYPE_C(double) /*main*/ int main() { // then you use the functions like int_Vector iv; double_Vector dv; int_InitVector(&iv, -1); // -1 is the illegal double_InitVector(&dv, -1.0); // -1 is the illegal int_AddElem(&iv, 10); int_AddElem(&iv, 11); int_AddElem(&iv, 12); /*cool, it grows*/ double_AddElem(&dv, 3.1415); printf("intvector at[%d]=%d [expected 10]\n",0,int_GetElemAt(&iv,0)); printf("intvector at[%d]=%d [expected 11]\n",1,int_GetElemAt(&iv,1)); printf("intvector at[%d]=%d [expected 12]\n",2,int_GetElemAt(&iv,2)); printf("intvector at[%d]=%d [expected -1]\n",3,int_GetElemAt(&iv,3)); printf("doublevector at[%d]=%e [expected 3.1415]\n",0,double_GetElemAt(&dv,0)); printf("doublevector at[%d]=%e [expected -1.0]\n",1,double_GetElemAt(&dv,1)); printf("doublevector at[%d]=%e [expected -1.0]\n",2,double_GetElemAt(&dv,2)); int_EraseVector(&iv); double_EraseVector(&dv); return 0; } I didn't had time to make extensive testing... I'll problably do it in a day or two and say something then. EDIT: ooooooops this code appears as strange here on gamedev... it's because of the macros :( EDIT2.1: Followed Sneftel sugestion and replaces the "\" by "\ ". If you copy and paste the code and try it, it will generate warnings on some compilers because of the space after the slash. Some other compilers, may even generate an error on this. If you have problems, just replace "\ " for "\" [Edited by - wolverine on August 20, 2008 4:16:54 PM]
  5. wolverine

    generic containers in C

    Quote:Original post by LessBread Faking Templates In C wow... Mighty cool :D
  6. wolverine

    generic containers in C

    Quote:Original post by Hodgman Quote:Original post by Gage64 What if I want to use a vector of ints and a vector of floats in the same program? in my example the structures would be named vector_int and vector_float. The vec_init and vec_push_back are overloaded for these two types. Whether we are considering real overload or not, it will not help you here. Both those functions are referring to the same ELEMENT_TYPE. The "user" would have to redefine the same ELEMENT_TYPE for int and for float which would be not so easy to deal with... Aditionally, if the sizes of the types are different, push_back may not work. [added: DevFred answered that first then me :)! he's fast :D ] The approach I've seen most used is the first one Quote:Original post by DevFred a) Implement a vector with element type pointer-to-void and do casting on the client side. Would it be possible to store integers directly as pointer-to-voids? Is (int)((void*)i) guaranteed to be i, assuming sizeof(void*) == sizeof(int)? Or could I only store pointers in such a vector? where you carry a structure for the vector arround in each function. Something in the lines of: typedef struct { int sizeOfEachElement; int maxCapacity; int numberOfElements; void *data; }GenericVector; void genericVector_Init(GenericVector *vector, int maxElems, int sizeOfEachElement) { vector->sizeOfEachElement = sizeOfEachElement; vector->maxCapacity = maxElems; vector->numberOfElements = 0; vector->data = malloc(sizeOfEachElement * maxElems); } int genericVector_PushElement(GenericVector *vector, void *element) { if(vector->numberOfElements >= vector->maxCapacity) { /*Error condition. vector is full.*/ return ERROR_CODE; } else { memcpy(); memcpy(vector->data + vector->numberOfElements, element, vector->sizeOfEachElement); vector->numberOfElements ++; return 0; } } void genericVector_Destroy() { vector->sizeOfEachElement = 0; vector->maxCapacity = 0; vector->numberOfElement = 0; free(vector->data); vector->data = NULL; } int main() { GenericVector intVect, doubleVect, elephantVect; genericVector_Init(&intVect, 10, sizeof(int)); genericVector_Init(&doubleVect, 20, sizeof(double)); genericVector_Init(&elephantVect, 10, sizeof(Elephant)); ... } [Edited by - wolverine on August 20, 2008 6:35:33 AM]
  7. wolverine

    software for exploring/developing ideas

    Quote:Original post by Sneftel Thanks for the links, everyone. VisualMind looked good, but the price was a bit extravagant. Misi's wiki linki led me to FreeMind, which seems great so far. Freemind is cool, it even allowd you to create links to docs in the nodes (which comes in handy for me). My only small complaint is that sometimes it's hard to control the exact display of the graph (for example, having all the child nodes at the left of the parent node). But it is excellent for a free product!
  8. wolverine

    Salaries in Holland

    Hi all, due to personal reasons, I'm considering going abroad to Holland. Can anyone help me finding out what's the average salary in Holland for someone with a degree in Computer Science with about 1,5 - 2 years of experience? Also, what's the average cost of everyday life over there (bedroom rent, food, transportation), particularly in the area of Amsterdam? Thxs
  9. wolverine

    Salaries in Holland

    Quote:Original post by Eelco It also depends. If you tailor your living situation to your commute, public transportation can work fine. If you dont pay any heed, you might end up having to do something like bus->train-&>bus, with 50 minutes of pure travel time and 30 of transfer time, even though you live right next to amsterdam. If your house or place of work is near a public transportation hub, thats a big plus. If you are lucky/clever you can go from work to your home in the next city in 15 minutes or so by train. Quote:Original post by WanMaster Within the city it's pretty good, although many prefer to use bikes. The western part of the Netherlands has a high density network of various types of public transport, but the other cities of the country are also well connected. Ok, thank you both. I will look into the public transportations and the wester part of the Netherlands :). txs
  10. wolverine

    Salaries in Holland

    Quote:Original post by Eelco Most figures here are gross, btw. Gross 3000 - net < 2000 sounds plausible for someone in your position id say. So, taxes are high... bummer :(. Looks like that if I really go I will have to do a lot of digging to find a good house/bedroom for a good price. Do public transportations work well? I mean... if you are far from Amsterdam, is it easy to enter the city in public transportations or do you take a lot of time to do it?
  11. wolverine

    Salaries in Holland

    Quote:Original post by PouyaCat Well... Amsterdam is BLOODY EXPENSIVE! Real question is; what is the Amsterdam area? I live about 1 hour away from the city center, and here things are affordable. Mind you, I live nearly on the other side of the country *laughs* Anyway, I'd say, expect 2000 ~ 2500 euro's a month (gross), provided you can do webdevelopment as well. Cost of living? For 700 ~ 1000 a month you can live nicely, depending on your comfort level (thinking about: car, appartment (2 bedroom), good food, and fun) EDIT: addendum: of course, depends on where you live. I spend less than 200 on my appartment. In Amsterdam, expect to pay around 800 to 1000! Thanks for the information... This was the kind of insight I needed. Maybe I can stay near Amsterdam.
  12. wolverine

    Salaries in Holland

    Quote:Original post by speciesUnknown "Personal reasons" hmm? Everybody thinks about permanently moving to Amsterdam at some point in their lives, and renting a cheap apartment in the red light areas. But the vast majority of us don't do it. lol. I can see it now... he codes during the day, he lives on the red light during the night.
  13. wolverine

    rendering techniques

    Hi By reading your post, I get the feeling that you aren't very updated on the subject... I would recomend that you get a serious reference on it (Real-Time Rendering is excellent). Also, Michael Abrash' Graphics Programming Black Book is quite old (*very* old , only discusses software rendering, but is free and *very* interesting) and on the last chapters he discusses several different algorithms that were considered to be used in the Quake engine which you may find interesting [Edited by - wolverine on January 28, 2008 1:30:00 PM]
  14. wolverine

    Stuck!!!

    Quote:Original post by Vanisher Man, gimme a break, I'm new. Ish. I'm not sure where i got SDL from I'll have to check. All i know is that it came in a zip with very poorly written instructions on how to install it on VC++ which didn't help at all because I'm using DEV-C++. Now I feel like a moron. If you follow the link given by rip-off you'll eventually get to this page: Setting up SDL in Dev C++
  15. I don't know if this has been posted before since the file has been posted 4 days ago, but I didn't found it in the search. So: Carmack's QuakeCon 2007 here's the question and answers: Carmack's QuakeCon 2007 Q&A [Edited by - wolverine on August 13, 2007 7:55:07 AM]
  16. Quote:Original post by OrangyTang Is there a transcript anywhere out there? I'd rather read some nice, small, text rather than spend ages for a video download. I've found this blog: live blog but it's not a transcript... just a "live blog" of the speech (as such, it doesn't have much extended info). P.S. I've added the Q&A video link at the 1st post.
  17. wolverine

    volume rendering

    Quote:Original post by Quat Sorry, for some reason I was thinking volume rendering was used mostly for medical imaging applications where they want to visualize, say, a slice of the brain or other soft tissue. But I can see for transparent objects why you'd have to go all the way. Even in medical imaging applications, you may have tranparent zones like tissues and stuff that basically help the viewer to "situate" what they are visualizing. For example, a few volume rendering images in medical applications with transparen zones after a google search: img1 img2
  18. wolverine

    Raycaster Perspective Problem

    Quote:Original post by mike_g Alright, I fixed it. I had to subtract pos_x from ray_x not map_x, the missing floating point remainder was causing trouble. Man that took me ages to figure out. lol. I shure know how that feels like!
  19. wolverine

    Raycaster Perspective Problem

    Hi. I haven't tried your code, since I don't have a Blitz Basic compiler, but I think you're getting a fisheye distortion. Try a google for it with raytracing (one of the search's result is a post here on gamedev: post on gamedev). Basically, you'll have to compensate each ray with the angle it makes with the center of the screen (but I haven't touched this for a long time :( meaning I could be wrong).
  20. wolverine

    Low level programming guidance

    Quote:Original post by JimmyDeemo Ok so I’ve got my eye on a programming job, but it requires the candidate to have some experience with low level programming. What i was wondering is, where does low level programming fit game programming as a whole? What situations would you apply low level programming and what are the benefits? Hi, I am by no means an expert in this sort of thing, but when I was doing my master thesis about computer graphics (not related to games, but I think the example still holds) there was a time when I started to use profilers to discover where most time was spent on the whole thing. I had a basic knowledge of assembly back then, but haven't really used it for years. Anyway, the most used function I had was something called _ftol / _ftol2 being called about a few million times per frame. After a few googling arround, I discovered that this function was called everytime you made a cast from a floating type to an integer type (and there were a lot of them). Worst, I discovered that this function was also pretty damn slow because it seemed to imply that the CPU had to change it's rounding state, perform the rounding and then restore the CPU's normal state... and this had to be done eveytime you called the function. It seems that the C standard requires that these operations be done everytime you make a C cast. After a few more diggings, I discovered some assembly alternatives to this, i.e, performing rounding without a call to _ftol. It was a question of a) not doing casts when I actually didn't need them and b) call these assembly alternatives when I had to. I think that low level stuff such as assembly optimization may be kind of like this... applicable to very specific areas of the code where you know it makes a difference. But that is just my 5 cents... Like I said, I don't know much about it. Anyway, maybe this link will help you get a more general idea about this stuff : Michael Abrash on Pixomatic It's about the work Michael Abrash has done on the Pixomatic software rasterizer.
  21. wolverine

    Access to thesis based in video games

    In my university I had access to the contents of the acm and i3e sites for searching/downloading papers... it was granted to all students as long as they were inside the campus. Your university will problably have these same conditions. A search on those sites may also help you (particularly sigraph/eurographics).
  22. wolverine

    SDL problem

    Hi bub. I've taken your code and compiled and gaved me the same result. The cause was that I was missing the two files: background.png lazy.ttf and because of that load_files() returned false and the program exits after the window is created. I went to the tutorial site and downloaded the zip file for lesson8 (I assumed it was that lesson) and copied those two files to the directory where my code is and it worked fine. So, just make shure your program can find those two files. If they are not in the same directory where your code is, try to give the absolute paths to them in load_files. <edit performed for typos> [Edited by - wolverine on January 26, 2007 8:41:26 AM]
  23. I was going to suggest using the Visitor design pattern in order to have all the drawing code isolated in one single visitor class, but Hexus suggestion seems more appropriate to the case at hands. In wikipedia you can find information about both the model-view-controller and the visitor (and other) design patterns.
  24. wolverine

    How do Opterons compare to desktop processors?

    Thanks for everybodys input. Also, thanks to daviangel for that link. And i've been around gamedev long enough to know about "homework" policys. In order to clarify thinks a bit... the work i've done was made targetting normal desktop computers. Period. The problem i had was in comparison bases. The previous work I had as reference for testing was conducted on Opterons... all the times presented were on these processors. The reason why someone used those processors is an unknown to me. Maybe it was the fastest computers they had access to and they decided to use them for time reporting in order to make their times faster. Who knows? Unfortunatelly, I had never even heard of Opterons before reading their work. I had no idea what they were before I googled a bit. What i couldnt find was some sort of comparison between "normal desktop" pcs and Opterons (and perhaps my google skills are a bit bad). So, I posted here as it was more likelly that someone knew much more about Opterons here than i could ever possibly know (which turned out to be the case). Again, thanks to all!
  25. Hi all. I need some advice from people that are more aware of this than I am. Does anyone know how does a dual 1.8Ghz AMD Opteron 246 compare to normal desktop Intel processors? For my thesis, i'm supposed to compare results from someone who used Opterons, but the only processors i have for testing are "normal everyday" Celeron 1.0Ghz, Celeron 2.0Ghz and one PentiumIV 3.0Ghz with dual core. I've tried doing some google searches on this, but Opterons seem to be used for servers and things of that kind and I couldnt find any comparison with more common processors. thxs in advanced.
  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!