• Create Account

# Moe

Member Since 24 Jan 2000
Offline Last Active Mar 25 2016 05:50 PM

### C++ macro return? (converting C++ macro to C# code)

23 January 2014 - 07:07 PM

First of all, please forgive me, as my C++ is really quite rusty. It's been... seven years or so since I've really had to use it.

I"m in the process of converting some C++ code to C# (in particular some code for checking an axis-aligned bounding box against a triangle, in 3D).  The original source in question can be found here.

The particular portion that I'm having a bit of trouble is this:

```#define AXISTEST_X01(a, b, fa, fb)			   \

p0 = a*v0[Y] - b*v0[Z];			       	   \

p2 = a*v2[Y] - b*v2[Z];			       	   \

if(p0<p2) {min=p0; max=p2;} else {min=p2; max=p0;} \

rad = fa * boxhalfsize[Y] + fb * boxhalfsize[Z];   \

```

Now from what I remember, I thought C++ macros were basically pre-processor bits that get substituted in at compile time.  The thing I'm perplexed at is the return statement in the macro.  In this case, what happens if min < rad?  Does the statement still return any sort of value, or is there some sort of default return value on a macro that I'm not aware of?

Here's what the rough C# equivalent is, as far as I have been able to figure:

```	//Assume variables are declared/initialized properly.  Unlike what I've done here...
float p0;
float p2;
Vector3 v0;
Vector3 v1;
Vector3 v2;
Vector3 boxHalfSize;
float min;
float max;

private int AXISTEST_X01(float a, float b, float fa, float fb)
{
p0 = a * v0.Y - b * v0.Z;
p2 = a * v2.Y - b * v2.Z;

if (p0 > p2)
{
min = p0;
max = p2;
}
else
{
min = p2;
max = p2;
}

float rad = fa * boxHalfSize.Y + fb * boxHalfSize.Z;

{
return 0;
}

//Otherwise... return something else?
return 0;
}
```

Any thoughts/ideas on how it should actually look?  I can't say I've ever dealt much with macros, and this one has me a bit stumped.

### Looking for a Blu-ray player...

04 April 2012 - 10:38 PM

I finally caved and bought my first Blu-ray disk ...well, set of disks... they had Star Wars on Blu-ray for reasonably cheap, and since I don't own a DVD copy of it, I picked it up.

This now means I'll be needing a Blu-ray player. It'd be nice to get something that could handle 3D in the even that I get around to getting a 3D TV in the future.

Is the PS3 still only the really decent Blu-ray player out there that won't be terribly outdated/deprecated, or is your average unit decent enough these days? I remember all the kerfuffle that happened when Blu-ray was coming out with regards to network compatibility and copy protection - certain cheaper Blu-ray players were not able to receive updates and thus wouldn't play newer disks (or something like that). Is this still an issue?

I was hoping to get something reasonably priced, and the PS3 is still a bit more than what I'd like to pay. If it is the only decent machine, I'll wait another few months then pick one up. I don't really care that it is a gaming machine, but it does seem to be one of the better options out there as a decent Blu-ray player.

### Have I missed anything?

26 March 2012 - 10:31 PM

It's been a few months since I have been around these parts of the intertubes. Have I missed much GDNet in the past few months? Has anyone actually made a Hockey MMO using HTML, or managed to stop goblin genocide?

### Deus Ex: Human Revolution?

24 August 2011 - 12:46 PM

I'm curious to know what the GDNet masses think of Deus Ex: Human Revolution, which came out a day ago or so. I'm wanting to pick it up, but haven't had the chance yet (and was waiting for a DisplayPort cable for my third monitor Eyefinity setup).

So for anyone who has picked it up, how does it compare to the original Deus Ex and Deus Ex: Invisible War? So far any reviews I've seen of it have been quite positive, the only downside being that you are forced into the boss battles which breaks immersion for those that have been playing all sneaky-like and not killing people. I'm quite curious to hear some stories about the abnormal usage of objects. (One such story I've heard in a review was the player was man-handling a pop machine off the rooftop, and dropped it to try and create a distraction. It didn't end up working, but still sounded entertaining).

Oh, and if you have been playing it, you might want to use spoiler tags as necessary.

### Thinking about a cheap drawing tablet...

08 March 2011 - 03:03 PM

A little while ago I noticed these cheap drawing tablets over at Monoprice*:

http://www.monoprice.com/products/subdepartment.asp?c_id=108&cp_id=10841

(in particular, this one: http://www.monoprice.com/products/product.asp?c_id=108&cp_id=10841&cs_id=1084101&p_id=6251&seq=1&format=2 )

I've done a little bit of digging and it appears that they are made by a company called UC-logic. Reviews seem fairly solid. I know getting a tablet won't make my drawings really any better, but I figured it could be kind of fun to toy around with, as opposed to one of those little Wacom Bamboo tablets that normally run for more than twice the price for a much smaller sized tablet (4"x6"). I have used one of those before and found it pretty fun to play with.

Anyone here have any experience with these or seen one of these before?

*Monoprice is seriously the place to get any sort of cable. I'm always amazed at the price and the quality of their cables that I have ordered have been top notch.

PARTNERS