Jump to content

ArBuZ

Members
  • Posts

    164
  • Joined

  • Last visited

Posts posted by ArBuZ

  1. Roland the error occurs in the main loop and not in the end of program. But I had such problems as you described and solved it as you pointed. Thanks.

     

    Rick, you are absolutly right about push_back command. Pointers solved my problem. :)

     

    Lumooja I like to use pointers but need to be more cearefull. And I dont see -> sign is so ugly :) I can live with it.

  2. First thanks for your time.

     

    Well, if I change it to Sound& myClass::GetSound(void) const then nothing plays at all.

     

    But!!! If I use TSound instead of LEO::Sound then everything works very fine! :)

     

    So I guess its LEO issue, isn't it?

  3. Hi!

    I have some problems with using vectors. And for showing my problem, Ive made some simple example.

     

    I have my own class "myClass" This class has Sound attribute as protected member:

     

    class myClass
    {
    protected: 
    Sound sound;
    public:
    
    myClass(std::string soundPath);
    myClass();
    ~myClass(void);
    
    Sound GetSound();
    };
    
    myClass::myClass(std::string soundPath)
    {
    sound.Load(soundPath);
    }
    
    myClass::~myClass(void)
    {
    sound.Free();
    }
    
    Sound myClass::GetSound()
    {
    return sound;
    }
    

     

    In main loop I try to collect "myClass" objects to a vector and access the sound for creating source via the vector.

    Here is the code:

     

    int WINAPI WinMain( HINSTANCE hInstance,
    				HINSTANCE hPrevInstance,
    				LPSTR lpCmdLine,
    				int nShowCmd ) 
    {
    Engine engine( "VectorTest", 800, 600 ) ;
    Engine::SetAbstractPath( "C:/Leadwerks Engine SDK" ) ;
    Engine::SetFilters() ;
    
    World world( CREATENOW ) ;
    if( !world.IsValid() ) 
    {
    	MessageBoxA(0,"Error","Failed to create world.",MB_OK);
    	return engine.Free() ;
    }
    
    Buffer gbuffer( Engine::GetWidth(), Engine::GetHeight() );
    
    Camera camera( CREATENOW );
    camera.SetPosition( 0, 0, -2 );
    
    Material material("abstract::cobblestones.mat") ;
    Cube	 mesh( CREATENOW ) ;
    mesh.Paint( material ) ;
    
    Cube ground( CREATENOW ) ;
    ground.SetScale( 10, 1, 10 );
    ground.SetPosition( 0, -2, 0 );
    ground.Paint( material ) ;
    
    DirectionalLight light( CREATENOW ) ;
    light.SetRotation( 45 , 45, 45 );
    
    Source source;
    
    myClass myC("abstract::gunshot.ogg");
    myClass myC2("abstract::reload.ogg");
    
    std::vector <myClass> vec;
    vec.push_back(myC);
    vec.push_back(myC2);
    
    // Game loop
    while( !Keyboard::I****() && !Engine::IsTerminated() )
    {
    	if( !Engine::IsSuspended() ) // We are not in focus!
    	{
    		if (Keyboard::I****(KEY_SPACE))
    		{
    			if (source.IsValid())
    				source.Free();
    			source.Create(vec[0].GetSound(),EAX);
    			source.Play();
    		}
    		// Rotate cube
    		mesh.Turn( Vec3( 0.5f*AppSpeed() ) ) ;
    
    		// Update timing and world
    		Engine::UpdateTime();
    		World::Update( Engine::GetSpeed()) ;
    
    		// Render
    		gbuffer.Set();
    		World::Render() ;
    		Engine::GetBackBuffer().Set() ;
    		World::RenderLights(gbuffer);
    
    		// Send to screen
    		Engine::Flip(0) ;
    	}
    }
    
    // Done
    return engine.Free() ;
    }
    
    

     

    This code gives me error on leFreeSound() command that I don't call.

    If I don't use vectors, and just get sound of any object it works fine.

     

    Please help me with this issue. Thanks in advanced.

     

    PS I know that Lumooja is a fan of vectors :P So please, I need your help :)

  4. It returns an int, I think you haven't updated your LEO files since 2.27.

    Hmm, Im quet sure I have LE 2.31 now (At least I used updater to get it). Maybe it has been fixed for 2.32. I havent downloaded it yet.

  5. Hi. Just tried new LE version. The zone is great!

     

    The one thing that Iv noticed is some problem with lights. When I look at some light and then turn out from it the light switches off. And when I turn back to the light its turned off for a second or less and then it turns on. As I understand its some kind of optimization, but this is very noticeable.

     

    Also only with this scene I finally could see the bloom and HDR effects in action. And actually I can't understand how does it exactly works. Is there any info to read about them?

  6. one more way to calculate frame is calculate it based on animation speed in fps. For example you have animation that is made as 30 fps animation. Then frame will be:

     

    frame+=30*(Engine::GetTime()-prevAnimTime)/1000.0;
    Animate(frame);
    prevAnimTime=Engine::GetTime();
    

     

    Then your animation will always be played 30 frames per second.

  7. 1. Being able to drag many different model formats into the editor and having it automatically convert to gmf behind the scenes would be nice.

     

    Converting models is a such specific process. If you want to get really nice quality you have to work on each asset you want to see in the scene. Adjust materials number of surfaces, animations etc. I wouldnt leave this to default scene converter. But this is my opinion :)

     

    I'd really like to have Material editor in LE Editor. Ability to assign and adjust all materials of the models in the scene in real time.

  8. Yes, you are right. After rotating and scaling it a few minutes I saw strange behavior.

    But itis not sudden changes. The child get smoothly distorted and back to normal shape while rotating (by the way I use LE 2.31)

     

    Any way Im glad that you've paid attention to this problem and now you know that it exists :)

    Hope this problem will be solved :)

  9. I don't want waste your time, but could you try this code in main loop:

    if (Keyboard::IsDown(KEY_T))
    		{
    			//Axis2.SetRotation(Axis2.GetRotation().X+0.1, Axis2.GetRotation().Y, Axis2.GetRotation().Z);
    			//Axis2.Turn(0.1,0,0);
    			RotateEntityLocalM(Axis2,0.01,0,0);
    		}
    		if (Keyboard::IsDown(KEY_Y))
    		{
    			//Axis2.SetMatrix(matrixMult(Axis2.GetMatrix(),GetTurnMatrix(0,0.01,0)));
    			//Axis2.Turn(0,0.1,0);
    			RotateEntityLocalM(Axis2,0,0.01,0);
    		}
    		if (Keyboard::IsDown(KEY_U))
    		{
    			//Axis2.SetMatrix(matrixMult(Axis2.GetMatrix(),GetTurnMatrix(0,0,0.01)));
    			//Axis2.Turn(0,0,0.1);
    			RotateEntityLocalM(Axis2,0,0,0.01);
    		}
    
    
    
    		if (Keyboard::IsDown(KEY_G))
    		{
    			//Axis1.SetRotation(Axis1.GetRotation(GLOBAL).X+0.1, Axis1.GetRotation(GLOBAL).Y, Axis1.GetRotation(GLOBAL).Z,GLOBAL);
    			//Axis1.Turn(0.1,0,0);
    			RotateEntityLocalQ(Axis1,0.01,0,0);
    
    		}
    		if (Keyboard::IsDown(KEY_H))
    		{
    			//Axis1.SetRotation(Axis1.GetRotation(GLOBAL).X, Axis1.GetRotation(GLOBAL).Y+0.1, Axis1.GetRotation(GLOBAL).Z,GLOBAL);
    			//Axis1.Turn(0,0.1,0);
    			RotateEntityLocalM(Axis1,0,0.01,0);
    		}
    		if (Keyboard::IsDown(KEY_J))
    		{
    			//Axis1.SetRotation(Axis1.GetRotation(GLOBAL).X, Axis1.GetRotation(GLOBAL).Y, Axis1.GetRotation(GLOBAL).Z+0.1,GLOBAL);
    			//Axis1.Turn(0,0,0.1);
    			RotateEntityLocalM(Axis1,0,0,0.01);
    		}
    
    
    		if (Keyboard::IsDown(KEY_)
    		{
    
    			Axis1.SetScale(Axis1.GetScale().X-0.01,Axis1.GetScale().Y,Axis1.GetScale().Z);
    
    
    		}
    		if (Keyboard::IsDown(KEY_N))
    		{
    			Axis1.SetScale(Axis1.GetScale().X, Axis1.GetScale().Y-0.01,Axis1.GetScale().Z);
    		}
    		if (Keyboard::IsDown(KEY_M))
    		{
    			Axis1.SetScale(Axis1.GetScale().X, Axis1.GetScale().Y, Axis1.GetScale().Z-0.01);
    		}
    
    		MouseNavi(camera,0.8,0.1,0.8,0.1);
    
    
    		// Update timing and world
    		Engine::UpdateTime();
    		World::Update( Engine::GetSpeed()) ;
    
    		// Render
    		gbuffer.Set();
    		World::Render() ;
    		Engine::GetBackBuffer().Set() ;
    		World::RenderLights(gbuffer);
    
    
    		Draw::Text(10,10,"%f %f %f %f",Axis1.GetMatrix().A0,Axis1.GetMatrix().A1,Axis1.GetMatrix().A2,Axis1.GetMatrix().A3);
    		Draw::Text(10,20,"%f %f %f %f",Axis1.GetMatrix().B0,Axis1.GetMatrix().B1,Axis1.GetMatrix().B2,Axis1.GetMatrix().B3);
    		Draw::Text(10,30,"%f %f %f %f",Axis1.GetMatrix().C0,Axis1.GetMatrix().C1,Axis1.GetMatrix().C2,Axis1.GetMatrix().C3);
    		Draw::Text(10,40,"%f %f %f %f",Axis1.GetMatrix().D0,Axis1.GetMatrix().D1,Axis1.GetMatrix().D2,Axis1.GetMatrix().D3);
    
    		// Send to screen
    		Engine::Flip(0) ;
    
    

     

    It works for me as expected.

     

    [EDIT]

    Last year I spent a week to solve this issue :) You can not control biped made with 3ds max with this bug.

  10. Ive been having this problem in LE 2.2 (http://forum.leadwerks.com/viewtopic.php?f=37&t=3044)

     

    I guess the problem appears again. But it only appears if parent entity is scaled.

     

    As I remember the problem was in GetEntetyQuat function. It returned wrong data if the object has a parent.

     

    Here is the project that demonstrates the problem in detail:

     

     

    Keys:

    WASD - cam control

    T,Y,U - turn child entity

    G,H,J - turn parent entity

    B,N,M - scale parent entity

    Q - create helper

    SPACE - reset all rotations

     

    Also there is Rotations.cpp file. There is some math functions that Ive made by myself:

    TurnEntityLocalQ and TurnEntityLocalM - first uses entity's quaternions for rotation calculations, second uses matrices.

    Only second works as expected.

     

    Im sure that problem is in GetQuat function.

  11. Hi all!

    So, we can load animation sequences and retrieve it's index. But is there any way to remove only indexed animation from the entity? It would be very handy.

    And by the way, does anybody know how long does it take to load animation? Is there any noticeable delay?

     

    And one more thing (I guess only Josh can answer) If I load one animation file several times on one entity, will it be loaded only once and will be index same?

  12. Hi!

    I want to make controller to move to some point. PointEntity doesn't work with controller. But UpdateController() has angle parameter. So how can I calculate angle parameter?

    Thanks in advance.

    Best regards, Alex.

  13. Hi everybody!

    As it sad in the topic I can't make it to work. I even tried LE solder.

    Here is the code I use. Maybe someone have made it to work properly:

    
    Model mainModel
    mainModel.Load("abstract::soldier.gmf");
    mainModel.LoadAnimation("abstract::anim_soldier_idle.gmf");
    
    float frame=0;
    
    
    while(1)
    {
    frame+=ANIM_SPEED*Engine::GetSpeed();
    if (frame>mainModel.GetAnimationLength(1))
    frame=0;
    mainModel.Animate(frame,1.0,1,RECURSIVE);
    }
    

     

    If anybody know what is the problem, please tell me.

     

    Thanks in advance.

  14. Hi Gilmer.

    The code should look something like this:

     

    Entity myEntity("abstract::myEntity.gmf");
    Mesh myMesh=myMesh.FindChild("myMesh");
    Material myMat=myEntity.GetSurface(1).GetMaterial();
    
    Texture tex;
    tex=buffer.GetColor();
    myMat.SetTexture(tex);
    
    

     

    This is how I did it. Hope it will help.

×
×
  • Create New...