Jump to content

Shard

Members
  • Posts

    293
  • Joined

  • Last visited

Everything posted by Shard

  1. I've been trying to integrate the LETheora library into my project and play the bunny video. It all complies fine and everything until I go to use the manager to create a clip when I get this error: //Media.h Media { TheoraVideoClip *clip; TheoraVideoManager *manager; float w; float h; float tw; float th; TBuffer testbuffer; TTexture testtexture; TMaterial testmaterial; }; //Media Init void Media::Initialize() { manager = new TheoraVideoManager(); } //Play Video void Media::PlayVideo(string &nonAbstractFileName) { nonAbstractFileName = "abstract::" + nonAbstractFileName; nonAbstractFileName = AbstractPath(str(nonAbstractFileName.c_str())); this->clip = manager->createVideoClip(nonAbstractFileName, TH_RGB, 0, 1); //<-----breaks here, note that the file name is perfectly fine and finds the video without a problem. this->clip->setAutoRestart(false); float w=clip->getWidth(),h=clip->getHeight(); float tw=nextPow2(w),th=nextPow2(h); testbuffer = CreateBuffer(tw,th,BUFFER_COLOR); testtexture = CreateTexture(tw,th,TEXTURE_RGB); testmaterial = LoadMaterial("abstract::video.mat"); TextureFilter(testtexture, TEXFILTER_PIXEL); SetMaterialTexture(testmaterial, testtexture); .... } The error seems to occur when I go into the CreateClip function. Can anyone make a guess as to whats going on? Do I need to upload a copy of a simple version of this for you to test out? (It'll take a little bit but it can be done)
  2. I have searched all the interwebs and I can't find a single converter that can convert an to an .ogg format with video. All of them do audio only. I'm trying to use LETheora and it only works with ogg files. Can someone help me out here?
  3. When I shoot the gun, I need to check if I hit a Character type object. Unfortunately, I can't compare the returned entity to check if I hit a Character object or a Vehicle object because it is a byte*. How do you guys determine what you have hit? Example; //Character class Character { TMesh mesh = LoadMesh("abstract::player.gmf"); SetEntityUserData(this); }; [/code ]//Shoot Function [code]void Character::Shoot() { if(currentWeapon->canShoot) { currentWeapon->canShoot = false; TPick target; if(user->isPlayer) EntityPick(&target,frameWork->GetMain().GetCamera(),range); else EntityPick(&target,user->head,range); if(target.entity != NULL) { Character *hitTarget = (Character*) GetEntityUserData(target.entity); //<------- How do I check if I'm hitting a character object or just an object casted to a character type? } } } A friend of mine suggested that I compare the sizeof(Character) to the sizeof(hitTarget). I thought this would work at first, but then I realized that since I'm casting to a character type from byte*, the size of hitTarget would always be the same as a Character type. What do I do here?
  4. Thanks. I tried all of these but none of them worked. Basically the code break to here in leoFramework.h inline void Framework::Update() const { ::leUpdateFramework(); //Here } Saying:
  5. What is ANIM_SPEED? And is GetSpeed the same as AppSpeed()?
  6. For our trigger system I have created a fairly straight forward method. A trigger object hold all the values that we need, like speech, music, scripts, etc. I set the collision callback and when I collide it goes off successfully and correctly. However the player is still colliding with it, causing it to go off again. And again. And again. So I figured that I would free the collision body so that collision callback wouldn't occur. This leads to a new problem: the collision callback still occurs but all GetEntityUserData returns garbage and the trigger still tries to activate with garbage data resulting in an error. How do I stop collision callback once I'm done with it? //Trigger struct Trigger { TVec3 pos; TSound music; TSound *speech; string scene; TBody body; static Level *level; int usable; int characterLoadID; Trigger() { this->music = NULL; this->speech = NULL; usable = 1; } }; //Init Trigger *trigger = new Trigger; trigger->pos = objectPosition; //Music if(music != "") { music = "abstract::" + music; //trigger->music = new TSound; //(*trigger->music) = LoadSound(str(music.c_str())); trigger->music = LoadSound(str(music.c_str())); } //Body TVec6 box = GetEntityAABB(entity); float depth = box.Z1 - box.Z0; float height = box.Y1 - box.Y0; float width = box.X1 - box.X0; trigger->body = CreateBodyBox(width,height,depth); PositionEntity(trigger->body,objectPosition); RotateEntity(trigger->body,objectRotation); EntityType(trigger->body,4); SetEntityUserData(trigger->body,(byte*)trigger); //Data type to trigger SetEntityCallback(trigger->body,(byte*)TriggerCollision,ENTITYCALLBACK_COLLISION); //Collision callback function trigger->level = this->level; //Collision Callback void _stdcall TriggerCollision( TEntity triggerBody, TEntity entity, byte* position, byte* normal, byte* force, flt speed ) { if(GetEntityType(entity) == 1) { Trigger *trigger = (Trigger*) GetEntityUserData(triggerBody); trigger->level->ActivateTrigger(*trigger); } } //Level::ActivateTrigger void Level::ActivateTrigger(Trigger &trigger) { if(trigger.usable > 0) { if(trigger.music != NULL) PlaySound(trigger.music); //Music HideEntity(trigger.body); //Not working FreeEntity(trigger.body); //Not working trigger.usable--; } } Also, this thread should probably be moved to the C++ forums. >,>
  7. For our reloading animation, I need it to reload once per call, which means that it needs to play from its start frame of 0 to its end frame of 100 and then stop until the reload animation is called again. So far, I haven't managed to figure out how to properly do the reload animation so that it starts and stops at the correct times. The code I have below usually stops the animation at the right time, but sometimes it does it three or four times over before it stops. The animation also generally starts in the middle, around 30 or 40 and sometimes near the end like 95. //Animation Code - Reloading Case case reload: aniStart = weapon->reloadStart; aniEnd = weapon->reloadEnd; //DOF frameWork->GetRenderer().SetFarDOFRange(Vec2(0,50)); frameWork->GetRenderer().SetFarDOFStrength(200); frameWork->GetRenderer().SetFarDOF( true ); frame=AppTime()/30.0; frame=fmodf(frame,aniEnd-aniStart)+aniStart; if(frame <= aniEnd-1) { (bodyMesh,frame,1.0,0,true); } else wepState = idleUp; break; }
  8. I'm looking into purchasing a 3D Character generation software (with animation) and I'm wondering how well LE supports these softwares. Of course these softwares can output into multiple formats that can then be converted into gmf's but I know that our team has had problems with the way a model is skinned, etc. Also, I tried to export an obj into a gmf, but the program disappeared (the process was still running but it just took up massive amounts of CPU time and did nothing, I had to end the process) If someone could explain this quickly, as Smith Micro is having a deal on Poser till the 31st of this month (half price, $250 instead of $500) I would be rather grateful. Edit: Has anyone had experience with such software? Would you recommend one over the others?
  9. Done. Please note that I didn't include the solution files because I'm using VS2010 and I was unsure if you were using 2010. I have however included the the Main.cpp Also, please note that the movement and camera controls are inverted. This is due to a bug in our art and no related to the disappearing model problem. (Upload to LE failed twice): http://www.3rdinitiative.com/system/content/LE_Bug.zip
  10. This is a good possibility, but how did you fix it? 1. Possibility, I'll look into it. 2. How? 3. No, everything is visible in all the frames. It only disappears when its up too close.
  11. Well I figured as much What about when parenting? And rotating? And moving? How does that work?
  12. Could someone please explain global flags and what they are meant to do? The wiki says nothing about them. Ex. Get/Set Rotation Get/Set Position
  13. Yes I set it to near zero (0.0000001) with no effect). Also note, its all rigid objects that disappear, if that has any relevance.
  14. So I have a (large) problem with Leadwerks 2.31 and 2.32. We have a player model, with arms and a gun and armor. Unfortunately when I parent the camera to head and play the game, the gun doesn't show up. So I did several tests to see if the gun would show up and it seems to show up if the camera is further away, but in some screenshots it doesn't show it when looking at specific places (generally at the horizon). The same goes for the armor, which seems to disappear and appear as I look around. This issue came up with the update to Leadwerks 2.31 but at the time, I thought I was doing something wrong in code. After having gone back and tested all posibilities (with 2.3, 2.31 and 2.32) I firmly believe that its an issue with 2.32. Has anyone had this issue? How have you solved it? How do I solve it? Help? //Init Code EntityParent(bodyMesh,frameWork->GetMain().GetCamera()); RotateEntity(this->bodyMesh, Vec3(0,180,0)); TVec3 pos = EntityPosition(body); pos.X -= .125; pos.Y -= 2.125; pos.Z += .5; PositionEntity(bodyMesh,pos); //Update Code //Rotate camera camRotation.X = Clamp(camRotation.X + controller->GetViewY()/10, -90,60); camRotation.Y = camRotation.Y - controller->GetViewX()/10; RotateEntity(frameWork->GetMain().GetCamera(),camRotation); //Reset Mouse Position MoveMouse(GraphicsWidth()/2,GraphicsHeight()/2); float move = controller->Move(); float runSpeed = controller->Run(); //if(move > 0 && player->state != reload) move *= controller->Run(); //Update Player UpdateController(player->body,camRotation.Y,move*10,(controller->Strafe())*10, controller->Jump()*player->jumpHeight, 10000, 20); //Position the camera playerPos = EntityPosition(player->body); cameraPos = EntityPosition(frameWork->GetMain().GetCamera()); cameraPos = Vec3(playerPos.X,cameraPos.Y,playerPos.Z); cameraPos.Y = Curve(playerPos.Y+1.75,cameraPos.Y,2.0); PositionEntity(frameWork->GetMain().GetCamera(),cameraPos);
  15. Shard

    Maximum FPS

    Thats kinda the point. You want this piece of code to only run once a second, there for running as the same time as all the other copies of the game on other computers. The engine is created so that the AppTime is done at a specific speed across all computers, which is one second per second. My code will increment until reaches the one second mark which will be a result of AppSpeed * 60. Again if your monitor refresh rate is that high, the AppSpeed value is higher until it matches one second.
  16. As stated before, I don't need scaling of physics, just the mesh itself which I will parse in code, so that method works. For now.
  17. Are you sure about that? Pixel has created an AStar tool with Leadwerks.
  18. Shard

    Maximum FPS

    According to the wiki, Flip(1) just makes it refresh at the rate of the computer screen. What happens when someones monitor refreshes faster than others? And god forbid someone is playing on a 3D capable monitor at 120Hz I would personally suggest doing something like this: int value = 0; if(value >= AppSpeed()*60) { //Do Stuff value = 0; } else value++; AppSpeed checks the refresh rate and returns a normalized value. So if the refresh rate is 120, it will return 0.5 if its 30 it will return 2. When multiplied by a multiple of 60 (one second) you get that many seconds. So if you want a refresh rate of every 2 seconds, do AppSpeed()*120;
  19. This would be really nice to know for Leadwerks based tool creation. Also, how does picture in picture work with multiple cameras rendering to the same screen?
  20. Well I was told to download Theora and I did. I placed it in the Leadwerks SDK Folder and included them. Now I get this warning: warning C4251: 'TheoraVideoClip::mName' : class 'std::basic_string<_Elem,_Traits,_Ax>' needs to have dll-interface to be used by clients of class 'TheoraVideoClip' 1> with 1> [ 1> _Elem=char, 1> _Traits=std::char_traits<char>, 1> _Ax=std::allocator<char> 1> ] Also, in LETheora.cpp, it can't locate #include "lua.h" #include "lualib.h" #include "lauxlib.h" Also, how am I supposed to link things non statically anyways? Could someone just explain the process of linking the library?
  21. That includes fine. Its the #include "TheoraVideoManager.h" and #include "TheoraVideoFrame.h" that don't work because they don't exist.
  22. Seems like I was mixing variable types: TFramework and Framework Framework works but TFramework doesn't but the wiki makes references to it. :angry: What is the difference between the two?
  23. Ok so now my code has broken. I had several pointers all over my code to Framewerk so that all the different classes could access it. I changed all my Framewerk variables to Framework variables and I get several errors. Compile Error >d:\source code control\appiled project\current version\zero hour\zero hour\hud.cpp(66): error C2228: left of '.SetFarDOFStrength' must have class/struct/union 1>d:\source code control\appiled project\current version\zero hour\zero hour\hud.cpp(68): error C2227: left of '->GetRenderer' must point to class/struct/union/generic type 1> type is 'TFramework *' VS2010 Underlining Error Message Error: expression must have pointer to class type My usage is as below Main.cpp Framework *frameWork = new Framework; frameWork->Create(); frameWork->SetStats(2); Hud.h TFramework *frameWerk; //this is set to point to the frameWork variable initialized in main Hud.cpp frameWork->GetRenderer().SetNearDOFStrength(.7); With our project being this close to the due date, I might just have to revert to 2.31 which is a shame since I was expecting to do so much out of 2.23.
×
×
  • Create New...