Jump to content

Kazar

Members
  • Posts

    72
  • Joined

  • Last visited

Everything posted by Kazar

  1. I'm rather new to C-programming and I have mostly some php background. I'm struggling with variables inside functions. I have a function that, among other things, controls the banking of an airplane that is turning. Here's the short version of it: void HowToFly (TMesh airplane) { double blend; double frame,frameend,framebegin; TVec3 altitude = EntityPosition(airplane, 0); TVec3 meshrotation, meshrotation_old; // Turning animation meshrotation = EntityRotation (airplane,1); if ((meshrotation.Y > (meshrotation_old.Y+AppSpeed()*1.0)) && altitude.Y > 0.5) { // no banking when near the ground framebegin=80.0; // turning to left keyframes frameend=81.0; blend=blend+(AppSpeed()*0.05); } else if (((meshrotation.Y+AppSpeed()*1.0) < meshrotation_old.Y) && altitude.Y > 0.5) { // no banking when near the ground framebegin=60.0; // turning to right keyframes frameend=61.0; blend=blend+(AppSpeed()*0.05); } else { blend=blend-(AppSpeed()*0.025); } // level flight frame=AppTime()/10.0; frame=fmodf(frame,1.0-0.0)+0.0; Animate(airplane,frame,1.0,0,true); // blended animation frame=AppTime()/10.0; frame=fmodf(frame,frameend-framebegin)+framebegin; Animate(airplane,frame,blend,0,true); blend=max(blend,0.0); blend=min(blend,1.0); meshrotation_old = meshrotation; } Of course this worked as part of the main program with blend,frame,frameend,framebegin, etc. - variables initialized before the mainloop. I had to make a function out of it to control multiple plane's animation and this breaks it because all my variables are reset at the start of each loop. I have ran out of all ideas to make it work (except global variables but that really isn't good solution for tens of planes, I think) and I could really use a nudge in to the right direction. Oh, and sorry for the blatant crudeness of my code
  2. Oh ****, I replaced a broken graphics card for a client's computer at work and installed the newest (overheating) drivers.
  3. My project is only week old right now so I've already remade all my normal maps
  4. Might be slightly off-topic here but I tested today my pre-pre-pre-alpha of a game on a friend's computer and his Norton anti-virus said my exe "was suspicious" and decided to quarantine it. I uploaded the file on a website that checks files with around 40 different scanners and not one of them (inluding norton) found anything.
  5. While it may be so I think this should be mentioned somewhere in the wiki.
  6. Does this mean I need to invert the Y every time I make normal maps for LE? (in photoshop with Nvidia plugin in my case) Edit: I did some tests and yeah.. seems like I've got to redo all my normal maps I didn't spot this fact anywhere in the wiki.
  7. Does LE 2.28 include Framework? I'm getting 2.3 as soon as Josh processes my order.
  8. I saw the thread about the improved SSAO filter and decided to test out the old filter with the code (and assets) from the Post Processing tutorial. Alas, I ran into some errors so I edited the source a bit, like replacing exitapp with the method from 2.28 ProjectWizard and added RegisterAbstractPath to my SDK folder. What it all comes down to is this error: Unhandled exception at 0x00ccc9e8 in PostProcessing_test-Debug.exe: 0xC0000005: Access violation reading location 0x00000068. The app hangs at BindTexture -> CXX0030: Error: expression cannot be evaluated. Here is the source: #include "engine.h" int main(int argc, char** argv) { Initialize(); RegisterAbstractPath("D:/Leadwerks"); //Create a graphics context Graphics(800,600); //Create a world TWorld world=CreateWorld(); if (!world) { MessageBoxA(0,"Error","Failed to create world.",0); return Terminate(); } //Create a camera TCamera cam=CreateCamera(); MoveEntity(cam,Vec3(0,5,-5)); CameraClearMode(cam,BUFFER_DEPTH); //Create a render buffer for lighting TBuffer gbuffer=CreateBuffer(800,600,BUFFER_COLOR|BUFFER_DEPTH|BUFFER_NORMAL); //Create a render buffer for post-processing effects TBuffer postbuffer=CreateBuffer(800,600,BUFFER_COLOR); //Create a directional light TLight light=CreateDirectionalLight(); RotateEntity(light,Vec3(45,45,0)); LoadScene("Scenes/scene.sbx"); //Create a skybox TWorld background=CreateWorld(); TMesh skybox=CreateCube(); TCamera skycam=CreateCamera(); FlipMesh(skybox); PaintEntity(skybox,LoadMaterial("abstract::skybox.mat")); SetWorld(world); TShader postfilter=LoadShader("abstract::postfilter.vert","abstract::postfilter_ssao.frag"); SetShaderVec2(postfilter,"camerarange",Vec2(0.1,1000)); TTexture noisetexture=LoadTexture("abstract::noise.bmp"); AmbientLight(Vec3(0.5)); EntityColor(light,Vec4(0.15)); TVec3 camrotation=Vec3(0); float mx=0; float my=0; HideMouse(); MoveMouse(GraphicsWidth()/2,GraphicsHeight()/2); //Main loop while(!KeyHit(KEY_ESCAPE)) { //Camera look mx=Curve(MouseX()-GraphicsWidth()/2,mx,6); my=Curve(MouseY()-GraphicsHeight()/2,my,6); MoveMouse(GraphicsWidth()/2,GraphicsHeight()/2); camrotation.X=camrotation.X+my/10.0; camrotation.Y=camrotation.Y-mx/10.0; RotateEntity(cam,camrotation); UpdateAppTime(); UpdateWorld(); SetBuffer(gbuffer); //Render the background RotateEntity(skycam,EntityRotation(cam)); SetWorld(background); RenderWorld(); //Render the world SetWorld(world); RenderWorld(); //Render lighting SetBuffer(postbuffer); RenderLights(gbuffer); //Draw image onscreen with postfilter applied SetBuffer(BackBuffer()); SetShader(postfilter); BindTexture(GetDepthBuffer(gbuffer),1); BindTexture(noisetexture,10); DrawImage(GetColorBuffer(postbuffer),0,GraphicsHeight(),GraphicsWidth(),-GraphicsHeight()); Flip(); } return Terminate(); }
  9. Kazar

    Warlords

    Heh. Icons from World of Warcraft. Looks great though better than anything I could do right now.
×
×
  • Create New...