Jump to content

Ben Russell

X-Plugins
  • Posts

    3,822
  • Joined

  • Last visited

  • Days Won

    109

Everything posted by Ben Russell

  1. AC3D download: http://www.inivis.com/downloads.html AC3D X-Plane .obj plugin: http://scenery.x-plane.com/tools.php Blender download: http://www.blender.org/download/get-blender/ Blender export scripts and tutorials: http://marginal.org.uk/x-planescenery/ Google Sketchup: http://sketchup.google.com/ Google Sketchup Export script: http://marginal.org.uk/x-planescenery/tools.html 3DS Max and GMax: These programs do not export directly to X-Plane format but using the above tools and some intermediate formats you can use them to author content.
  2. How to use the [nobbc][vimeo][/nobbc] tag: 1. Go to the video you'd like to embed on Vimeo. 2. Copy this part of the URL: http://www.vimeo.com/2348540 3. Paste the video-id like so: [nobbc][vimeo][/nobbc]2348540[nobbc][/vimeo][/nobbc] You should end up with something like this: [vimeo]2348540[/vimeo]
  3. How to use the [nobbc][/nobbc] tag: 1. Go to the video you'd like to embed on YouTube. 2. Copy this part of the URL: http://www.youtube.com/watch?v=c2in5UKH7qU 3. Paste the video-id like so: [nobbc][/nobbc]c2in5UKH7qU[nobbc][/nobbc] You should end up with something like this: http://www.youtube.com/watch?v=c2in5UKH7qU
  4. These are the byte-swapping functions. The core code originally came from Austin. They are more useful than htonl() and ntohl() as they do not attempt to be "smart" they simply swap the data you feed them. void rev_byte_order4(char* retval) // reverse byte-order for least/most signifigant-byte-first, { // which is done differently on Mac and IBM... char* add=retval; char b1=*(add); add++; // This works as long as both platforms are IEEE, and char b2=*(add); add++; // the values passed in are FOUR BYTES (32 bits)... this char b3=*(add); add++; // includes FLOATS and LONGS, NOT SHORTS OR DOUBLEsS char b4=*(add); add=retval; *add=b4; add++; *add=b3; add++; *add=b2; add++; *add=b1; } void bswapi(int *pint){ char tmpb[4]; memcpy(tmpb, pint, 4); rev_byte_order4(tmpb); memcpy(pint, tmpb, 4); } void bswapf(float *pf){ char tmpb[4]; memcpy(tmpb, pf, 4); rev_byte_order4(tmpb); memcpy(pf, tmpb, 4); }
  5. This code will decode a 9.x UDP packet. It will automatically detect the need to do byte-swapping. There is some Objective-C syntax mixed in. It uses lots of square brackets. "[ ]". Substitute your own code as needed. void OnReceiveCore(char *pp, uint iPacketSize){ //dynamically adapts. static int iPowerPC_Host = 0; int iCompoundPacketCount = (iPacketSize - 5) / 36; //printf("rx packet size: %i - compound: %i\n", iPacketSize, iCompoundPacketCount); int itmp=0; float payload[8]; //if( iPacketSize == 41 ){ //radio and nav frequency setting packets, also the ap heading packet. //we now have the packet in the packet[] var //DATAxXXXXaaaaBBBBccccDDDDeeeeFFFFggggHHHH <- 41 bytes. //XXXX = int, packet index //aaaa-HHHH = data payload, floats //packet pData; int iPacketIndex = 0; int bo=5; //byte offset for( int iPacketX=0; iPacketX < iCompoundPacketCount; iPacketX++ ){ //extrac the packet index number id int memcpy(&itmp, pp+bo, 4); bo+=4; //if the value is absurdly large we have a PPC big endian packet if( itmp > 1024 ){ iPowerPC_Host = 1; }else{ iPowerPC_Host = 0; } if( iPowerPC_Host ){ iPacketIndex = ntohl(itmp); memcpy(payload, pp+bo, 32); for( int x=0; x<8; x++ ){ bswapf( &(payload[x]) ); } }else{ iPacketIndex = (itmp); memcpy(payload, pp+bo, 32); } bo+=32; //printf("index: %i\n", iPacketIndex); switch(iPacketIndex){ //03 - speeds //kias - vind //keas - vind //ktas - vtrue //ktgs - vtrue //blank //mph - vind //mphas - vtrue //mphgs - vtrue //04 - mach VVI g-load //mach - ratio //blank //vvi - fpm //gload - normal //gload - axial //gload - side //12 - wing sweep / thrust vec //sweep - 1,deg //sweep - 2,deg //sweep - h,deg //vect - ratio //sweep - ratio //incid - ratio //dihed - ratio //retra - ratio case 13: //13 - trim/flap/slat/s-brakes //trim - elev //trim - ail //trim - rudder //flap handle //flap position //slat ratio //spbrk handle //spbrk position if( payload[7] >= 0.5f ){ [glViewC setSpeedBrake:1.f]; }else{ [glViewC setSpeedBrake:0.f]; } break; //14 - gear and brakes //gear //wbrak - part //lbrak - part //rbrak - part //V9.21 Pitch Packet case 18: //printf("pitch: %.3f, roll: %.3f\n", payload[0], payload[1] ); [glViewC setPitch:payload[0]]; [glViewC setRoll:payload[1]]; //hding true //hding mag //mag comp //blank //blank //mavar deg break; case 19: //19 - AoA, side slip, paths [glViewC setAlpha:payload[0]];//alpha [glViewC setBeta:payload[1]];//beta //hpath //vpath //blank //blank //blank //slip break; //20 - lat lon altitude //lat //log //alt ftmsl //alt ftagl //blank //alt ind //lat south //lat west //26 - throttle actual //throttle per engine //41 - N1 //n1 pct per engine //62 - fuel weights //fuel weight per tank //63 - payload weights and cg //empty weight //payload //fuel //jettison //current //max //blank //cg ftref case 67: //67 - gear deployment //gear rat per strut if( payload[0] >= 1.0f ){ [glViewC setGear:1.f]; }else{ [glViewC setGear:0.f]; } break; //117 - weapon stats //hdng delta //pitch delta //R d/sec //Q d/sec //rudd ratio //elev ration //V kts //dis ft default: //unkown packet type, never expected, dont do anything. -shrug- break; } // end of switch(iPacketIndex) }//end packet loop } // end OnReceiveCore(...)
×
×
  • Create New...