Jump to content

  • Log In with Google      Sign In   
  • Create Account


Josh Klint

Member Since 09 Jan 2011
Offline Last Active Apr 14 2014 09:14 AM
*****

#5066792 Tessellation Trouble

Posted by Josh Klint on 01 June 2013 - 08:02 PM

When all else fails, make sure you are attaching your shader objects to your program.  :P




#5059213 Remove any items from a list while iterating

Posted by Josh Klint on 04 May 2013 - 11:28 AM

Here's what I came up with. The hardest situation is breaking from the loop without doing any kind of cleanup on the iterator. I tried doing some smart pointer stuff, but I generally stay away from stuff like that:
List list;
        Link* link[3];
        ListIterator it;
        int i;
 
        //============================================
        // Test: Remove first element
        //============================================
 
        i=0;
 
        link[0] = list.AddLast(1);
        link[1] = list.AddLast(2);
        link[2] = list.AddLast(3);
 
        it = list.Begin();
 
        for (it = list.Begin(); it != list.End(); it++)
        {
                System::Print(it.link->value);
                if (link[i])
                {
                        link[i]->Release();
                        link[i]=NULL;
                }
        }
 
        //Check
        for (i=0; i<3; i++)
        {
                if (link[i]) Debug::Assert(link[i]->refcount==1);
        }
 
        list.Clear();
 
        //============================================
        // Test: Remove second element
        //============================================
 
        i=1;
 
        link[0] = list.AddLast(1);
        link[1] = list.AddLast(2);
        link[2] = list.AddLast(3);
 
        it = list.Begin();
 
        for (it = list.Begin(); it != list.End(); it++)
        {
                System::Print(it.link->value);
                if (link[i])
                {
                        link[i]->Release();
                        link[i]=NULL;
                }
        }
 
        it = ListIterator();
 
        //Check
        for (i=0; i<3; i++)
        {
                if (link[i]) Debug::Assert(link[i]->refcount==1);
        }
 
        list.Clear();
       
        //============================================
        // Test: Remove third element
        //============================================
 
        i=2;
 
        link[0] = list.AddLast(1);
        link[1] = list.AddLast(2);
        link[2] = list.AddLast(3);
 
        it = list.Begin();
 
        for (it = list.Begin(); it != list.End(); it++)
        {
                System::Print(it.link->value);
                if (link[i])
                {
                        link[i]->Release();
                        link[i]=NULL;
                }
        }
       
        //Check
        for (i=0; i<3; i++)
        {
                if (link[i]) Debug::Assert(link[i]->refcount==1);
        }
 
        list.Clear();
 
        //============================================
        // Test: Break during loop
        //============================================
 
        i=2;
 
        link[0] = list.AddLast(1);
        link[1] = list.AddLast(2);
        link[2] = list.AddLast(3);
 
        it = list.Begin();
 
        for (it = list.Begin(); it != list.End(); it++)
        {
                break;
        }
        it = ListIterator();
       
        //Check
        for (i=0; i<3; i++)
        {
                if (link[i]) Debug::Assert(link[i]->refcount==1);
        }
 
        list.Clear();
However, there are a lot of problems you can cause unless that code above isn't followed strictly. rip-off's suggestion was probably the best. Still, this strikes me as a really fundamental problem that ought to have a good solution.


#4989018 Euler to Quaternion and back, with rotation order yaw, pitch, roll

Posted by Josh Klint on 11 October 2012 - 02:19 AM

Well, I ended up just converting the Quaternion to a Mat4, then getting the yaw, when the pitch is high or low. Then I reduced that code to only the lines I needed and put it all in the same function. Problem solved.


#4816214 Squirrel, why is it not getting traction???

Posted by Josh Klint on 26 May 2011 - 04:59 PM

Your problem was with LuaBind please can you stop this FUD. It seems to me that you opened this six year old thread to vent off some of your anger, I do hope your Teddy is OK :)

I came across this thread while doing research on the Squirrel programming language, and I described the main reason I decided against it.


#4815144 Squirrel, why is it not getting traction???

Posted by Josh Klint on 24 May 2011 - 09:12 AM

Squirrel is probably designed more for integration with a C++ application, which is a big advantage over Lua, which definitely was not. When you use Lua, you are usually relying on another third party binding library, which all seem to be abandoned, and may or may not work. We attempted to use LuaBind, and found severe problems with basic functionality no one knew the answer to.

Don't listen to the people who say it should have x command built-in. I don't see why a scripting language should have any built-in commands. That's idiotic.

However, Lua has the excellent LuaJIT, which compiles Lua files into actual machine code. This makes compiled Lua execution something like 200 times faster than interpreted Lua, in some benchmarks. Therefore, Squirrel is a scripting language competing against a compiled language, the speed of which it will never match, unless they wrote their own JIT compiler from the start.


#4803378 Raycast with thickness

Posted by Josh Klint on 26 April 2011 - 09:51 PM

I ended up turning the math into a 2D problem and solving it by determining which section of an expanded triangle the ray origin is in. I believe my method is mathematically perfect. I have it all worked out except for the 3D adjustment of the intersection point for some cases. Will post my findings when I finish.

I am surprised at how challenging this turned out to be, but it's been a really fun problem to solve!


PARTNERS