Jump to content

  • Log In with Google      Sign In   
  • Create Account


MarlboroKing

Member Since 16 Nov 2010
Offline Last Active Apr 21 2014 09:56 AM
-----

Topics I've Started

Exactly what's the point of 'int32_t', etc.

17 March 2014 - 12:07 PM

I see very little point of using the 'int32_t' compared to 'signed int'. The project irrLicht actually shows one valid example for it in .\irrTypes.h:

#if defined(_MSC_VER) || ((__BORLANDC__ >= 0x530) && !defined(__STRICT_ANSI__))
typedef unsigned __int64            u64;
#elif __GNUC__
#if __WORDSIZE == 64
typedef unsigned long int           u64;
#else
__extension__ typedef unsigned long long    u64;
#endif
#else
typedef unsigned long long          u64;
#endif

MSDN writes little about the 'fixed size' data types it supports, such as __int32:
"The types __int8__int16, and __int32 are synonyms for the ANSI types that have the same size, and are useful for writing portable code that behaves identically across multiple platforms" -- Great, it's "ANSI principle", I suppose.

 

I guess my point is; why does MSVC declare the data types prefixed with "__" a fixed size, yet \most\ other compilers determine the globally used "int"(etc.) as a fixed size? Is there any scenario that I should dread about a non-fixed size integer?

 

Edit: I am aware that 'int' on a x86 build is 32 bits, yet should be 64 bits on a x64 build.


Moving object based on camera direction

05 February 2013 - 12:59 AM

This one is a pickle. Basically, I am trying to keep a 3D object in the center of the camera. I figured the easy way would be to invert the view matrix, add 5 to the mat.Forward member and everything would be O.K. Well, now I don't even see it. My previous attempts were fiddling with the UpDown / LeftRight rotations, they worked for the most part but couldn't get it corrected without really hardcoding the issue (and even then didn't work properly). Been stuck on this for the past 3 or 4 days, really not much else I can think of.

 

if( nType != EItemType.None )
{
    Matrix matWorld = Matrix.Invert( m_Player.m_Camera.View );
    matWorld.Translation += (matWorld.Forward * 5);

    m_Effect.World = matWorld;
    m_Effect.View = m_Player.m_Camera.View;
    m_Effect.Projection = m_Player.m_Camera.Projection;
    m_Effect.TextureEnabled = true;
    m_Effect.Texture = m_Texture;

    foreach( EffectPass pass in m_Effect.CurrentTechnique.Passes ) 
    {
        pass.Apply();

        m_GraphicsDevice.BlendState = BlendState.AlphaBlend;

        m_GraphicsDevice.DrawUserPrimitives<VertexPositionTexture>( PrimitiveType.TriangleList,    m_Verts.ToArray(), 0, 2 );

    }
}

 

 

-Edit- For the most part, this works:

Matrix matWorld = Matrix.Identity *
					Matrix.CreateScale( 2f ) *
					Matrix.CreateRotationZ( -m_Player.m_Camera.UpDownRot ) *
					Matrix.CreateRotationY( m_Player.m_Camera.LeftRightRot - MathHelper.PiOver2 ) *
					Matrix.CreateTranslation( m_Player.Position + (m_Player.LookVector * 0.3f) );

 

 

I thought I introduced tearing, but nope. Was able to angle my camera just right and noticed it was my item. Fixed!


Simple rotation

09 January 2013 - 10:22 AM

I'm attempting to rotate a code-defined model, however it appears to be moving instead of rotating. I've looked all over, even copy/pasting, but to no avail.

 

Edit- This current code shows me using a custom effect, however, I'm basing all this off my previous edits (that being, using the BasicEffect)!

			m_GraphicsDevice.BlendState = BlendState.Opaque;
			m_GraphicsDevice.DepthStencilState = DepthStencilState.Default;

			m_Effect.Parameters["View"].SetValue( m_Camera.View );
			m_Effect.Parameters["Projection"].SetValue( m_Camera.Projection );
			m_Effect.Parameters["CameraPosition"].SetValue( m_Camera.Position );
			m_Effect.Parameters["Texture1"].SetValue( m_TextureAtlas );
			
			foreach( EffectPass pass in m_Effect.CurrentTechnique.Passes )
			{
				foreach( Item item in m_World.ItemMap.Values )
				{
					if( item == null || !item.BoundingBox.Intersects( frustum ) )
						continue;

					Matrix matWorld = Matrix.CreateRotationY( fRROT );
					m_Effect.Parameters["World"].SetValue( matWorld );
					pass.Apply();

					m_GraphicsDevice.SetVertexBuffer( item.m_VertexBuffer );
					m_GraphicsDevice.Indices = item.m_IndexBuffer;

					m_GraphicsDevice.DrawIndexedPrimitives( PrimitiveType.TriangleList, 0, 0,
						item.m_VertexBuffer.VertexCount, 0, item.m_IndexBuffer.IndexCount / 3 );

I've tried using Matrix.CreateFromAxisAngle which did rotate, just not anywhere near the axis I want - even when defining just that axis.

My other attempt was Matrix.CreateRotationY(..) * Matrix.CreateTranslation(..) and still seemed to move.

 

Further information:

m_VertexBuffer = VertexPositionTexture

m_Effect = BasicEffect

ItemMap only contains 1 value for the time being.

I know Quanternations is better for this since it holds the rotation, but I'd like to avoid that route..


What culling method would be best for cube land?

20 September 2012 - 10:28 AM

Cube land.. Lol. I'm 'immitating' Minecraft, like everybody else. I'm debating against the two: Occlusion Culling & Ray Casting.
http://lodev.org/cgtutor/raycasting.html
http://http.developer.nvidia.com/GPUGems/gpugems_ch29.html

At the moment, I'm using this as a helper (and some code too...!): http://codeflow.org/entries/2010/dec/09/minecraft-like-rendering-experiments-in-opengl-4/

I tried using the LPDIRECT3DQUERY9 interface for occlusion culling but my scene rendered extremely slowly (screw up on my part...?). I usually got 15 FPS for drawing 6963 cubes and the 12 faces it has. I read that an Octree would be a good choice to help determine what the 'neighbors' are of a certain cube, but at the same time, I don't think an Octree would be good for a game that already splits its world? Or is this question/statement just complete jibberish.?

Occlusion Culling (or just this method I used? not sure lol) seems to be aimed for more pixel-perfect culling, which I believe would NOT be necessary for a game such as this. Ray Casting, I haven't looked too much into so I can't really output an opinion and/or a stupid opinion about it.

I'm basically running back and forth between the two (Well, three: Occ-culling, Ray Casting & implementing an Octree) from various websites where others are discussing -semi- the same thing and reading mixed (biased?) opinions about it all.

Using tilesets quickly and effeciently for maps

14 March 2012 - 01:57 AM

Alright, so I want to jump into the big leage. I am attempting to create a 2D Role Playing Game, using existing external data (sounds/graphics/etc. from previous game titles). However I am kinda stumped on a suffecient way of loading tiles based from a tilesheet.

My first implementation was INCREDIBLY slow on parsing, which of course, was XML. The file reached 7984 tiles based on 32x32-each-tile (from 1 tilesheet, fyi, so this is a no go). My previous idea was just to cut out the area of the 32x32 tile I need and then store the raw binary data into the file while the map was being made. I received quite some negative feedback about this, so I am trying to find a new way. But this is my exact problem, I can't think of a new way. I mean, I COULD just store the "owner name" (file name) and x/y pos of the tile, but that is resource heavy and is a deffenent no go.

So, I guess what I am asking is, what would be a good solution for this?
(I've been up for about 49 hours, I'm sorry if there's any spelling mistakes :])

Edit; thought I was in the Game Programming section, sorry! If this could be moved to their, I'd greately appreciate it.

PARTNERS