• Content count

  • Joined

  • Last visited

Community Reputation

168 Neutral

About JBS103

  • Rank
  1. Ray Tracer Camera

    Quote:Original post by MJP What you want is a "view transform", which is typically a 4x4 matrix that is the result of one or more rotations and translations. Typically this matrix is then applied to all the objects you're rendering, which "brings them" to the camera's position and orientation. If you want to create a view matrix in the same manner as gluLookAt, the docs show you how the matrix is constructed from the parameters. Thanks for the response. Would I then multiply the view transform matrix with the position vectors?
  2. Ray Tracer Camera

    I've implemented a basic ray tracer just for kicks and so far everything is working as expected. It's an interesting process. I am enjoying it. Anyway... Right now, I have a camera class, a buffer class, and a scene class, among others. The camera holds the position of the "eye" and thus the origin of the rays it shoots. The buffer holds the imaginary plane (or quad in this case as it isn't endless) that represents each pixel on the screen. This accepts a pixel and then determines the scene coordinates for later calculation. For example, my screen is 800 by 600 pixels. The plane is 8.0 units by 6.0 units and therefore the top-left most pixel is (-4, 3) and the bottom-right most pixel is (4, -3); it is centered at (0, 0, 0). (I do this so that I can position elements in the scene by a standard coordinate as opposed to using pixels values. Maybe my methodology is faulty?) Now I want to add another feature; the ability to move the camera (pre-render, not real-time of course). I'd like to give the camera location and the focal point (maybe an up vector a la gluLookAt()) and then have the buffer plane adjust its coordinates accordingly. Right now, by default, it sits on the xy plane (z = 0) with the camera positioned at (0, 0, -5) and looking down the z-axis. What if I want the camera to look down an arbitrary line, and not the z-axis? The numbers aren't as nice anymore. I've read about matrices and if I'm not mistaken, they can be used here. How do I represent my "plane" so I can easily adjust it? My initial thoughts were to take the camera position and subtract the focal point to get a "normal vector" for the screen plane. Then I could make up a quad perpendicular to said vector of X width and Y height. Sorry for being long-winded. It's difficult to convey a visual situation with words. I know it's clear in my head, but it probably isn't for someone who might be trying to understand me. Thanks in advance.
  3. 3D FPS Building Team Needed

    You May Want To Try The Help Wanted Forum. (And not capitalizing every word)
  4. Dock/Float Windows - C#

    Excellent! Works as expected. Thanks for your time.
  5. Dock/Float Windows - C#

    Quote:Original post by JamesLewis You need to use 3rd party libraries to do this kind of stuff otherwise it takes too much time. Try this: http://sourceforge.net/projects/dockpanelsuite/ There's more out there if you don't like that one. Thankfully I have no deadlines, no specific requirements, or any other outside pressure so I am free to pursue whatever I feel up to. For that reason, I'd like to figure out the most basic functionality on my own without relying on libraries. I understand reinventing the wheel is absolutely unnecessary, but in this case, I feel that I can accomplish what I am looking to do with a little help. I also believe that I will learn something getting through this little hang up and not just giving up. This may be a little bit silly but I am a "hobbyist" and nothing hangs in the balance of me finishing or not finishing. This pursuit is a very laid back "adventure". I'm looking for the means, not the ends. I appreciate the advice.
  6. Dock/Float Windows - C#

    Thanks for the response. Is there any good reading out there on control ownership? Any examples out there?. I'm relatively unfamiliar with a lot of techniques. Thanks again.
  7. Dock/Float Windows - C#

    I am working in Visual C# 2005 and was trying to figure out the best way to create a dockable or floatable window (similar to the solutions explorer, etc.). I have a basic idea down on how to make it possible, but was wondering if there was a cleaner or better way than what I have. I only want simple and specific functionality so I'm trying to avoid a huge library with all the bells and whistles. (Plus this is a good learning experience, anyway). So here is how I though it out... To be more specific, I want to use a treeview component. I stick the treeview inside a panel and listen to mouse clicks on that panel. When a click and drag is registered, I make a new instance of a specific form I've created (before hand) and then I hide the original panel. Then I copy the treeview on the main form into the treeview on the new form. When a double click on the title bar is registered, I hide the form and make the original panel visible. It seems like it would work decently (and I'm pretty sure I'd have no problem doing it), however, copying the tree back and forth seems to be a downside. When a treeview gets large, does this back and forth cause problems? Is it a downside at all? Can I improve this design any? Would this set up allow for more functionality down the road (hiding on the edge and reappearing on mouse over, etc)? I'm only a novice so I might be missing something. I appreciate any response in advance.
  8. C# Where

    Quote:Original post by Ezbez One minute of google-fu and this pops up. Go to the "Advanced Generics" header and read down a ways. Really, "C# keyword where" worked just fine for a google search for me. Sure, there were plenty of miss-fires, but the first one was that above link. Thank you.
  9. C# Where

    Would someone mind helping me out by explaining the where keyword in C# in simple terms? A link to some other article or tutorial about it would also suffice. I am beginning and I'm trying to get my head around the concept. I found the little tidbit on MSDN but its a little bit wordy for me. A simple example would also be appreciated. I apologize for having to make a thread, as I normally wouldn't. I'd love to google for something, but the word "where" doesn't lend itself to searching. Thanks.
  10. You had an 11 and a 5 and then you hit and received an 8. Because 11+5+8 is greater than 21, the 11 fell down to a 1 and you then had a total of 14. That is, at least if the code you were testing is using that strategy.
  11. Code Clean-up/Critique

    Haha, no tarot cards. ;) I just want something that will be *reasonably* flexible for an application with something very conventional (Blackjack or even Go Fish where suit is less important) to something like Hearts, Spades, and other variants where there is a trump suit and points to be had with certain combinations. However, a lot of that is way beyond the suit class, so I get what you are saying.
  12. Code Clean-up/Critique

    Wow! Thanks Zahlman. Thats a very interesting way of doing it and certainly something I wouldn't be capable of creating on my own. I'm not sure I follow the idea perfectly just yet, but I will definitely fiddle with it. How exactly would that be implemented to the card? Would I just create an instance of the Ruleset class and push_back structs right at the start of the program then create one instance of the Rank class or multiple? It is leagues better that what I have so I appreciate it! Would I do something for the Suit class? I know I didn't mention it in my previous post, but it was structured very much the same as the Rank class. Thanks for the check list Yadango, I will run through all those tips. If I do something strange it is probably because I misunderstood some sort of concept along the way. So if you see something out of the ordinary, that would explain why.
  13. Code Clean-up/Critique

    Sorry for the double post. The rank class I've created is really starting to throw wrenches into my code, at least it feels like. It seems awkward because of the static members. However, it does work. Can anyone else think of another way to do this, leaving an ability to change the card values while still being able to recognize the card under some sort of id? The reason I did it this way is because it makes for easy changing and string output. Is this the best/only way? Should I just switch it to something simpler like a single integer value? class Rank { public: Rank(); Rank(int index); bool operator== (Rank otherRank); bool operator< (Rank otherRank); bool operator> (Rank otherRank); static void setAceHigh(); static void setKingHigh(); static void setValue(int index, int value); static int getValue(int index); int getIndex(); int getValue(); char getSymbol(); string getName(); bool isSameAs(Rank otherRank); int compareTo(Rank otherRank); private: static string rankNames[]; static int rankValues[]; int index; };
  14. Code Clean-up/Critique

    Quote:Original post by Antheus *** Source Snippet Removed *** Until you show *how* you intend to use these classes, they are little more than random code. The fact that they look nice is mostly irrelevant when there is no functionality yet. It's possible to write poetically beatiful code, only to realize it allow you to do what you want, it's missing a crucial aspect or feature which cannot be added later or that the use of the code would require dirty hacks and workarounds to do what you want it to do. The alternative, to discuss the design, would be UML diagrams. Thanks Antheus and tstrimp. Will definitely get something simple up. Didn't mean the post to be some of the poetic non-sense you talked about. I just didn't want to get too far, burying myself in cruddy code. ussnewjersery: Thanks for the tips. I will work on some operator overloading to clean it up some. I'm still battling the rank class, I know. Your idea is something to keep in mind.
  15. Code Clean-up/Critique

    I've pretty much finished up the group of classes for a card game. Everything works fine, but now I'd like some help to clean it up stylistically and syntactically. There are a few things that I believe are bad practice (like my arrays) but I'm unsure of what to do with them. If anyone could point out some places where I can rewrite code to make it more precise/concise, that would be wonderful. Any other tips would be great. For example, I'm sure I could use more references as parameters than I am already. I'm also pretty sure I've over coded some of the sections, so any help cutting down would be nice. My goal is to make something that is very reusable and clean. Finally, any tips/functions that can be included to help debugging is appreciated. I'm unsure of how/where to include that in my source. And just to note: I had a hard time with the suit and the rank classes so there is a better way of doing what I did. I guess I could of just created an instance of each card right from the start and ignored all of the static members, but tips are appreciated. So to the code. The general idea is that the card class creates card objects composed of a rank instance and a suit instance. From there, the stack class controls the instances of each card. The player is simply a stack with a name, so it inherits from that. The source can be found here. I know I am asking a lot but I can't even begin to mention how helpful this kind of information is for me. I've asked a few questions before and have gotten spot on answers that have really helped me out. P.S. I also apologize for the lack of comments, but I believe most of it is self explanatory. Also, some of the tabbing came out a little off upon being uploaded, so ignore the minor inconsistencies.