Jump to content
  • Advertisement

howie_007

Member
  • Content Count

    316
  • Joined

  • Last visited

  1. Yeah, that's what I thought. I'll just comment out the assert since it's just a map holding an std::string and an int which is all self cleaning. Thanks for your help!
  2. That did not work. I have the script engine in a singleton so that as my script components come in and out of existence, they can draw from and return to the context pool in the singleton. My design assumes the context can be freed regardless of if the script engine has freed itself. When the game exits, the script components that are still around, they just free the contexts they are currently holding.
  3. angelscript/add_on/scriptstdstring/scriptstdstring.cpp:39: virtual CStdStringFactory::~CStdStringFactory(): Assertion `stringCache.size() == 0' failed. The above error happens when I quit out my application. I'm developing on Linux. I'm not sure why the stringCache still has strings in it. Shouldn't the destructor just clean-up the left over strings instead of asserting?
  4. howie_007

    Killing Room

    Looks cool!
  5. That helps because I didn't know what the tangent was for.   I've analyzed the code and simplified it. Below is the final modified version. Let's look at it line by line.   First useless line. const float pi = 4.0f*atanf(1.0f); All this does is give us the value of PI. math.h has a #define you can use so this is unnecessary. As you'll see in the finial code, many things were unnecessary.   Next line. const float aspect = (float)(m_renderbufferWidth) / (float)(m_renderbufferHeight); This give us the aspect ratio of the screen. Not sure why this is needed for the x coordinate and not the y. I think it's magic.   Next Two lines. const float fx = 2.0f * ((float)(x) / (float)(m_renderbufferWidth - 1)) - 1.0f; const float fy = 2.0f * ((float)(y) / (float)(m_renderbufferHeight - 1)) - 1.0f; This converts screen coordinates from a top/left orientation to a center screen coordinates but there's a little more to this then that. 1) Subtracting the width and height by one. The reason you do this is because resolution sizes are usually all even numbers. For example, a resolution of 1280x720 there is no center pixel or a pixel at 0. The other reason this could be is that you need a value of base 0, as if this was an array and w/h represents the total number of elements. 2) x/y divied by w/h. This gives you a normalize value of the point on your screen. In other words, a value from 0 to 1. 3) 2.0f *; not entirely sure what this is doing and why it is needed. 4) The last - 1.0f flips the sign.   Second useless line const float y_fov = pi/4; // pi/4 radians = 45 degrees This takes PI and divides it by 4 to give us 45 degrees in radians. This is unnecessary.   Modified line. const float tangent = tan(y_fov / 2.0f); This divides the 45 degrees by 2 to give use 22.5 degrees in radians. This can be simplified by plopping a number in tan.   I know what the rest is doing, I just don't understand why it works. /************************************************************************ * desc: Convert 2d screen coordinates to 3D perspective space ************************************************************************/ void Convert2Dto3D( float & destX, float & destY, float x, float y, float width, float height ) { const float aspect = width / height; // Convert upper left 0,0 to center screen 0,0 coordinates const float fx = (2.0f * (x / (width - 1))) - 1.0f; const float fy = (2.0f * (y / (height - 1))) - 1.0f; // (pi/4 radians = 45 degrees / 2) or ((pi/4) / 2)) const float tangent = tan( 0.392699082 ); // Project x,y to a z plane of 1 destX = aspect * tangent* fx; destY = -tangent * fy; } // Convert2Dto3D
  6. done! You have your up vote.   I wish I could look at this code and know what it's doing. If anyone can explain it, please do.
  7. Thank you guys for your help!   Taby, thank you for posting the code. It works GREAT!   All I had to do was multiply the final X and Y values by a positive z order.   I couldn't be more happy! There's no way I would have been able to write that code. Taby, you are Awesome!
  8. I want to be able to click on the screen and place a box at that spot in perspective 3D space. I would need to give the box the offsets in world view. The camera is at 0,0,0. In addition to the screen coordinates where 0,0 is the center of the screen, I also know the z order of where I want to box to go. Say -150   I've been struggling with this problem for a day now and google searches are not helping. Thought I could solve it with simple tri which is all I'm good at.   Can anyone solve this?  
  9. As a side note, std::future will not build on armeabi but will build on armeabi-v7a.   I'm trying to use std::packaged_task but it breaks my build in an odd way. My app will run on the phone but will lockup before it even gets near the code using the std::packaged_task. I can tell this because there is a graphic that will show before getting into the main game loop and if I put a delay as the first line in main, I'll never see the graphic. Even if I put a break point on the below code, it never get's hit.   Below is some example code that will cause the build to lock up before the code reached that point. Just the fact that the code is present somewhere seems to cause this problem.   std::packaged_task not ready for prime time on NDK 10? void CMenu::DoTransform() { if( m_visible ) { // Test code auto task = [this] { this->Transform(); }; std::packaged_task<void()> package( task ); package(); //Transform();
  10. As far as I know, the possible native build options in Application.mk are APP_ABI := armeabi armeabi-v7a x86   Do you really need to build all three? Will one do for all Android phones?
  11.   Saying the camera is at 0,0,0 is a bit misleading. In computer graphics, everything is a vector and vector math requires that the origin be 0. It's no more complicated then that. The camera, which is nothing more then a matrix, is the translation and rotation from 0,0,0.
  12. I'd post some code but my stuff is optimized so it wouldn't make any sense. I'm sure there's examples online (and DirectX SDK) for this but here's the over view in a nut shell.   First you want to compute a bell curve based on the number of samples that you want to use for your blur. You can use hard coded numbers for this but computing your own bell curve will allow you fine tune it to your needs. All we care about is half the bell curve because this is your target pixel and the number of samples taken. These values are your weights. Target pixel plus half the number of samples. We can now reused these samples for the other side of the target pixel. X = target pixel.   +++++X+++++ = 1.0   In the example above, there is 11 weights. If you were to add them all up, they would equal 1.0. You use the same array of weights to do the horizontal and vertical blur pass. At this point you simply multiply the sampled pixels by their respective weights to calculate the new color of the target pixel.   As stated above, this is a two step process and you'll need one additional buffer to complete the process. This assumes you're using a back buffer. Otherwise you'll need two buffers depending on how you are implementing it.   First pass - horizontal: Sample the values from the back buffer and write the new pixel value to the extra buffer. Second pass - vertical: Sample the values from the extra buffer and write the new pixel value to the back buffer.   That's it in a nut shell. There's optimizations you can do like use two smaller buffers to do the blurring. Scale it down to a smaller buffer, blur between the two buffers, scale back up to the original size.
  13. I tried messing with it again and now the __android_log_print is working. these tools...
  14. I'm trying to send log messages so that I can see the output in LogCat via Eclipse. I tried it with the Android and SDL call but nothing shows up in Log Cat. I set the filter to "verbos" or "debug" but none of the information is displayed.   Is there a trick to this or am I doing something wrong.   Had to apply a fix to Eclipse so that it would show all the LogCat tabs so I do see all the info. void CStatCounter::IncCycle( SDL_Window * m_pWindow ) { // These counters are incremeented each game loop cycle so they can // be placed here in this function because this function is also called // each game loop cycle m_elapsedFPSCounter += CHighResTimer::Instance().GetFPS(); ++m_cycleCounter; // update the stats every 500 miliseconds if( m_statsDisplayTimer.Expired(CTimer::RESTART_ON_EXPIRE) ) { // Show the output #if defined(__ANDROID__) __android_log_print(ANDROID_LOG_DEBUG, "Lap Cat Games", "%s", "Test Message"); #else if( !CSettings::Instance().GetFullScreen() ) SDL_SetWindowTitle( m_pWindow, GetStatString().c_str() ); #endif // Now that the stats are displayed, we can reset out counters. ResetCounters(); } } // HasCycleCompleted or void CStatCounter::IncCycle( SDL_Window * m_pWindow ) { // These counters are incremeented each game loop cycle so they can // be placed here in this function because this function is also called // each game loop cycle m_elapsedFPSCounter += CHighResTimer::Instance().GetFPS(); ++m_cycleCounter; // update the stats every 500 miliseconds if( m_statsDisplayTimer.Expired(CTimer::RESTART_ON_EXPIRE) ) { // Show the output #if defined(__IPHONEOS__) || defined(__ANDROID__) SDL_LogDebug( SDL_LOG_CATEGORY_RENDER, "%s", GetStatString().c_str() ); #else if( !CSettings::Instance().GetFullScreen() ) SDL_SetWindowTitle( m_pWindow, GetStatString().c_str() ); #endif // Now that the stats are displayed, we can reset out counters. ResetCounters(); } } // HasCycleCompleted
  • 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!