Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 22 Oct 2008
Offline Last Active Oct 17 2016 04:35 PM

#5178607 GOTO, why are you adverse to using it

Posted by on 06 September 2014 - 05:04 PM

I will post a snippet from my parser which is one of the routines I needed goto the most...

	if(DBFIO.IsPastEOS()==true) goto ex;
	DBFIO.ParseCmdLineF(spl); // splits up line
	if(spl.Cmd=="") goto lp; // empty line

And further down in the parsing stage...

	if(md==true) {
		if(rv==true) goto lp;
		goto unkcmd;
	if(obj==true) {
		if(rv==true) goto lp;
		goto unkcmd;
	if(dyn==true) {
		if(rv==true) goto lp;
		goto unkcmd;
	if(lt==true) {
		if(rv==true) goto lp;
		goto unkcmd;

At at the end of the routine is the final cleanup/error reporting...

	if(fcts==true) {
		if(rv==true) goto lp;
		goto unkcmd;
	goto unkcmd;
	return rv;
	ts.Format("Parser : Overflow detected -> %s in line %u",spl.Cmd,CurLnCnt);
	goto lp;
	ts.Format("Parser : Unknown command '%s' at line #%u in '%s'",spl.Cmd,CurLnCnt,CurFlnm);
	goto lp;
	ts.Format("Parser : Unknown section '%s' at line #%u in '%s'",spl.Cmd,CurLnCnt,CurFlnm);
	goto lp;
synerr:	// syntax error
	ts.Format("Parser : Syntax error : '%s' at line #%u in '%s'",spl.Cmd,CurLnCnt,CurFlnm);
	goto lp;

#5178207 GOTO, why are you adverse to using it

Posted by on 04 September 2014 - 09:34 PM

I am an old school programmer, did many stints in assembly (6502,6510,68000,68030,486,586), basic, fortran, pascal, extended languages, c++, c# etc... I use goto on a regular basis to exit out of routines, skipping many lines of code and only incurring a single cache hit. In over 30+ years I know when the proper use of the command is needed, it's no worse than BREAK or CONTINUE for a loop, actually less in fact. What is your aversion to using that command, is it your workplace or your training? I can skip a thousand lines of code with a single command and a single cache hit. Do you have to jump through hoops to get out of a routine? With my experience I know when to use it and not to use it. I want to hear from the professionals why it's such a bad command to use. My typical use is goto ex; which is jump to the exit routine, everything is done, clean up and get out. I'm not a pro by any means (mid-south US, no programming jobs here), just wondering about all the hate on goto is about, it's a very useful command...

#5177258 Why are their bumps in my shadow mapping?

Posted by on 31 August 2014 - 01:24 PM

I would suspect the dark area behind the cube is beyond the edge of your shadow map. I had an issue like that, I simply did a range test for the edge and didn't render the shadow beyond that. Later on I will go back and see if it's possible to adjust texture clipping to nullify the need for the range test. Just an idea of what it may be...

#5172990 Can't solve problems without googling?

Posted by on 11 August 2014 - 08:21 PM

I've been programming over 30 years now and didn't have the advantages you have now (started on a Vic 20). As Frob said, use both, I could have really used the extra help all those years ago, hehe, a stone age programmer I know. Any time I want to create a new feature I now google it first to see if it's been figured out by someone smarter than myself. It's not cheating, it's smart thinking and time saving on your end.

#5170745 GTX 750 problem - SOLVED

Posted by on 31 July 2014 - 06:22 PM

Update to the above problem, I managed to track down the problem. Seems the 750 doesn't like the wrapping mode for models. I did a full debug trace on the renderer and it kept hanging at Present. After disabling all shaders except deferred, it stopped crashing, It locked up again after enabling the sky shader. After checking it turned out the starting scene uses a sphere map and the main menu uses a cube map. Since both use the same code with a few if's to select which to use, there was just 4 lines of code difference. Cube - no wrap, sphere wrap U. Disable wrapping and it worked fine. Just thought I would do a follow up for anyone having this problem with DX 9 since I had no luck finding a solution using Google.

#5083491 Calculating Tangent and Binormal

Posted by on 06 August 2013 - 03:14 AM

Have you tried dropping the tangent and binormal and see if it renders? If it doesn't then you have other issues... Even if it doesn't generate the TBN properly with the above code, you will see the model in-game, it would just look like the dot product is incorrect. Unless you post how you render the model and your shader, there is no telling what the issue is. I wrote up a completely new renderer for my HP editor in 2 days that uses the above code and it works fine.


No offense, I have seen tons of posts by you lately and i get the feeling you are rushing your coding without understanding what your code does. Break it down into small parts so you can eliminate what your problem is. I've been programming over 30 years and I still do this for any new code. That way I can enable/disable parts until I can track down any bugs fairly easily. Once it's working perfectly then I combine it into one routine (if need be, sometimes it isn't needed). So post your code and let us dig through your code for errors, some members here are pretty proficient at it. The code you posted for generating the TBN looks totally correct to me anyways and would work fine in my game engine, it points to that you are having other problems elsewhere in your render code. This is not a rant, just being straight-forward with you.

#5078269 Casting between different sized integer references

Posted by on 16 July 2013 - 03:34 PM

If you are sizing it up use the & to clean out the upper bits. Also you don't have to use reinterpret_cast, takes longer to type out than simply using v=(uint32_t)variable, which will do the exact same thing.


uint32_t largerThanOriginalRef = ((uint32_t)originalInt)&0xFFFF;

#5048211 Mesh seriously deformed after export

Posted by on 29 March 2013 - 09:08 PM

Once you load up your animation file in the motion tab, look directly underneath the load icon and you should see 'Display and Modes'. Click on the + sysmbol to open it up. In there you will see a circle in a circle (In Place Mode). Click it to turn it on. Now resave your animation BIP file. That will clean all X/Y movement from the animation. Then reload you model without the anim and reload the BIP file you just saved.


For free rigged models, simply use google with this search term

allintext:free rigged characters max


Here is a good site for pre-rigged models


#5047910 Mesh seriously deformed after export

Posted by on 29 March 2013 - 01:24 AM

Max is notorious at screwing up animations when dealing with DX files. If you want a good export for DX file you have to do the following...


Load a model with a physique

Apply BIP file

Export to DX model, I use the Pandasoft exporter for that


If you load a model with animations and try to export it to a .X file, it will be totally screwed up. Always save your model without anims if you plan on adding additional anims to it. For some reason Max doesn't save the physique with anims properly, it's an extra step that isn't necessary but if your dealing with DX anims it is.

#5047370 Point Light's Effect On A Rotating Pyramid

Posted by on 27 March 2013 - 02:23 PM

It will be smooth if you do your lighting calculations in the pixel shader (it's called per-pixel lighting).

#5045071 Drawing sprites without a texture

Posted by on 20 March 2013 - 05:56 PM

AFAIK you are required to use a texture with DXSprites. Simply make a 1x1 white texture as mentioned by CC Ricers above. In the Sprite->Draw function you have a setting to change it to any color you want (last parameter).




CONST RECT * pSrcRect,


CONST D3DXVECTOR3 * pPosition,



#4887516 ModelFX

Posted by on 24 November 2011 - 10:29 PM

Well it maps the texture wrong. Don't know for sure if its an export problem or if its the viewers problem. The DX viewer is no help since it cant even render it properly.

The left pic is in the modeller, ModelFX image is on the right. This is made from the Dude.fbx model used for alot of XNA demos. Also, it would be helpful to either have an auto-centering feature or be able to move the model around in the X/Y plane with the arrow keys.

Posted ImagePosted Image

Thanks for such a good program though...

#4887103 ModelFX

Posted by on 23 November 2011 - 09:35 PM

Works good for me, any chance you could add a speed control for the animations? They all play way too slow. I see it does support skin anims which very few other programs work with properly, a bit of a UV mapping glitch though... Thanks for the tool, Im sure I will be using it in the future for my game engine model tests.

#4838084 Frustum corners from view projection

Posted by on 20 July 2011 - 12:26 PM

If you are looking for a DirectX implementation, the following link provides an explanation and source code...