D3DX9.pas 289 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973
  1. {******************************************************************************}
  2. {* *}
  3. {* Copyright (C) Microsoft Corporation. All Rights Reserved. *}
  4. {* *}
  5. {* File: d3dx9.h, d3dx9anim.h, d3dx9core.h, d3dx9effect.h, *}
  6. {* d3dx9math.h, d3dx9math.inl, d3dx9mesh.h, d3dx9shader.h, *}
  7. {* d3dx9shape.h, d3dx9tex.h *}
  8. {* *}
  9. {* Content: Direct3DX 9.0 headers *}
  10. {* *}
  11. {* Direct3DX 9.0 Delphi adaptation by Alexey Barkovoy *}
  12. {* E-Mail: clootie@reactor.ru *}
  13. {* *}
  14. {* Modified: 27-Apr-2003 *}
  15. {* *}
  16. {* Latest version can be downloaded from: *}
  17. {* http://clootie.narod.ru/delphi *}
  18. {* *}
  19. {* This File contains only Direct3DX 9.0 Definitions. *}
  20. {* If you want to use previous versions - use D3DX.pas and D3DX8.pas *}
  21. {* *}
  22. {******************************************************************************)
  23. { }
  24. { Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI) }
  25. { }
  26. { The contents of this file are used with permission, subject to the Mozilla }
  27. { Public License Version 1.1 (the "License"); you may not use this file except }
  28. { in compliance with the License. You may obtain a copy of the License at }
  29. { http://www.mozilla.org/MPL/MPL-1.1.html }
  30. { }
  31. { Software distributed under the License is distributed on an "AS IS" basis, }
  32. { WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
  33. { the specific language governing rights and limitations under the License. }
  34. { }
  35. { Alternatively, the contents of this file may be used under the terms of the }
  36. { GNU Lesser General Public License (the "LGPL License"), in which case the }
  37. { provisions of the LGPL License are applicable instead of those above. }
  38. { If you wish to allow use of your version of this file only under the terms }
  39. { of the LGPL License and not to allow others to use your version of this file }
  40. { under the MPL, indicate your decision by deleting the provisions above and }
  41. { replace them with the notice and other provisions required by the LGPL }
  42. { License. If you do not delete the provisions above, a recipient may use }
  43. { your version of this file under either the MPL or the LGPL License. }
  44. { }
  45. { For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
  46. { }
  47. {******************************************************************************}
  48. // Original source contained in "D3DX9.par"
  49. {$I DirectX.inc}
  50. unit D3DX9;
  51. interface
  52. // Remove "dot" below to link with debug version of D3DX9
  53. // (only in JEDI or TMT pascal version)
  54. {.$DEFINE DEBUG}
  55. // Remove "dot" below to link with separate DLL's (one DLL per part of D3DX9 API)
  56. // instead of monolithic "all-in-one" version of D3DX9
  57. {.$DEFINE D3DX_SEPARATE}
  58. // Remove "dot" below to link with Tim Baumgarten D3D9.pas
  59. // note: it currently has bugged definition of D3DMATRIX (on 27-Apr-2003)
  60. {.$DEFINE DXG_COMPAT}
  61. (*$HPPEMIT '#include "d3dx9.h"' *)
  62. (*$HPPEMIT '#include "dxfile.h"' *)
  63. // Do not emit "hpp" files to C++Builder
  64. {$NOINCLUDE DXFile}
  65. (*$HPPEMIT 'namespace D3dx9' *)
  66. (*$HPPEMIT '{' *)
  67. uses
  68. Windows,
  69. ActiveX,
  70. SysUtils,
  71. {$IFDEF DXG_COMPAT}D3D9{$ELSE}Direct3D9{$ENDIF},
  72. DXFile;
  73. const
  74. //////////// DLL export definitions ///////////////////////////////////////
  75. d3dx9dll ={$IFDEF DEBUG} 'd3dx9d.dll'{$ELSE} 'D3DX9ab.dll'{$ENDIF};
  76. {$IFDEF DEBUG}{$UNDEF D3DX_SEPARATE}{$ENDIF}
  77. d3dx9mathDLL = {$IFDEF D3DX_SEPARATE}'d3dx9abMath.dll'{$ELSE}d3dx9dll{$ENDIF};
  78. d3dx9coreDLL = {$IFDEF D3DX_SEPARATE}'d3dx9abCore.dll'{$ELSE}d3dx9dll{$ENDIF};
  79. d3dx9shaderDLL = {$IFDEF D3DX_SEPARATE}'d3dx9abShader.dll'{$ELSE}d3dx9dll{$ENDIF};
  80. d3dx9effectDLL = {$IFDEF D3DX_SEPARATE}'d3dx9abEffect.dll'{$ELSE}d3dx9dll{$ENDIF};
  81. d3dx9meshDLL = {$IFDEF D3DX_SEPARATE}'d3dx9abMesh.dll'{$ELSE}d3dx9dll{$ENDIF};
  82. d3dx9shapesDLL = {$IFDEF D3DX_SEPARATE}'d3dx9abShapes.dll'{$ELSE}d3dx9dll{$ENDIF};
  83. d3dx9texDLL = {$IFDEF D3DX_SEPARATE}'d3dx9abTex.dll'{$ELSE}d3dx9dll{$ENDIF};
  84. d3dx9animDLL = {$IFDEF D3DX_SEPARATE}'d3dx9abAnim.dll'{$ELSE}d3dx9dll{$ENDIF};
  85. {$IFNDEF COMPILER6_UP}
  86. type
  87. PPointer = ^Pointer;
  88. PPAnsiChar = ^PAnsiChar;
  89. {$ENDIF}
  90. //////////////////////////////////////////////////////////////////////////////
  91. //
  92. // Copyright (C) Microsoft Corporation. All Rights Reserved.
  93. //
  94. // File: d3dx9.h
  95. // Content: D3DX utility library
  96. //
  97. //////////////////////////////////////////////////////////////////////////////
  98. const
  99. // #define D3DX_DEFAULT ULONG_MAX
  100. // #define D3DX_DEFAULT ((UINT) -1)
  101. D3DX_DEFAULT = Cardinal(-1);
  102. {$EXTERNALSYM D3DX_DEFAULT}
  103. // #define D3DX_DEFAULT_NONPOW2 ((UINT) -2)
  104. D3DX_DEFAULT_NONPOW2 = Cardinal(-2);
  105. {$EXTERNALSYM D3DX_DEFAULT_NONPOW2}
  106. var
  107. // #define D3DX_DEFAULT_FLOAT FLT_MAX
  108. // Forced to define as 'var' cos pascal compiler treats all consts as Double
  109. D3DX_DEFAULT_FLOAT: Single = 3.402823466e+38; // max single value
  110. {$EXTERNALSYM D3DX_DEFAULT_FLOAT}
  111. type
  112. _D3DXERR = HResult;
  113. {$EXTERNALSYM _D3DXERR}
  114. {$IFDEF DXG_COMPAT}
  115. const
  116. MAKE_D3DHRESULT_R = MAKE_D3DHRESULT;
  117. {$ENDIF}
  118. const
  119. D3DXERR_CANNOTMODIFYINDEXBUFFER = HResult(MAKE_D3DHRESULT_R or 2900);
  120. {$EXTERNALSYM D3DXERR_CANNOTMODIFYINDEXBUFFER}
  121. D3DXERR_INVALIDMESH = HResult(MAKE_D3DHRESULT_R or 2901);
  122. {$EXTERNALSYM D3DXERR_INVALIDMESH}
  123. D3DXERR_CANNOTATTRSORT = HResult(MAKE_D3DHRESULT_R or 2902);
  124. {$EXTERNALSYM D3DXERR_CANNOTATTRSORT}
  125. D3DXERR_SKINNINGNOTSUPPORTED = HResult(MAKE_D3DHRESULT_R or 2903);
  126. {$EXTERNALSYM D3DXERR_SKINNINGNOTSUPPORTED}
  127. D3DXERR_TOOMANYINFLUENCES = HResult(MAKE_D3DHRESULT_R or 2904);
  128. {$EXTERNALSYM D3DXERR_TOOMANYINFLUENCES}
  129. D3DXERR_INVALIDDATA = HResult(MAKE_D3DHRESULT_R or 2905);
  130. {$EXTERNALSYM D3DXERR_INVALIDDATA}
  131. D3DXERR_LOADEDMESHASNODATA = HResult(MAKE_D3DHRESULT_R or 2906);
  132. {$EXTERNALSYM D3DXERR_LOADEDMESHASNODATA}
  133. D3DXERR_DUPLICATENAMEDFRAGMENT = HResult(MAKE_D3DHRESULT_R or 2907);
  134. {$EXTERNALSYM D3DXERR_DUPLICATENAMEDFRAGMENT}
  135. //////////////////////////////////////////////////////////////////////////////
  136. //
  137. // Copyright (C) Microsoft Corporation. All Rights Reserved.
  138. //
  139. // File: d3dx9math.h
  140. // Content: D3DX math types and functions
  141. //
  142. //////////////////////////////////////////////////////////////////////////////
  143. //===========================================================================
  144. //
  145. // General purpose utilities
  146. //
  147. //===========================================================================
  148. const
  149. D3DX_PI: Single = 3.141592654;
  150. {$EXTERNALSYM D3DX_PI}
  151. D3DX_1BYPI: Single = 0.318309886;
  152. {$EXTERNALSYM D3DX_1BYPI}
  153. //#define D3DXToRadian( degree ) ((degree) * (D3DX_PI / 180.0f))
  154. function D3DXToRadian(Degree: Single): Single;
  155. {$EXTERNALSYM D3DXToRadian}
  156. //#define D3DXToDegree( radian ) ((radian) * (180.0f / D3DX_PI))
  157. function D3DXToDegree(Radian: Single): Single;
  158. {$EXTERNALSYM D3DXToDegree}
  159. //===========================================================================
  160. //
  161. // 16 bit floating point numbers
  162. //
  163. //===========================================================================
  164. const
  165. D3DX_16F_DIG = 3; // # of decimal digits of precision
  166. {$EXTERNALSYM D3DX_16F_DIG}
  167. D3DX_16F_EPSILON = 4.8875809e-4; // smallest such that 1.0 + epsilon <> 1.0
  168. {$EXTERNALSYM D3DX_16F_EPSILON}
  169. D3DX_16F_MANT_DIG = 11; // # of bits in mantissa
  170. {$EXTERNALSYM D3DX_16F_MANT_DIG}
  171. D3DX_16F_MAX = 6.550400e+004; // max value
  172. {$EXTERNALSYM D3DX_16F_MAX}
  173. D3DX_16F_MAX_10_EXP = 4; // max decimal exponent
  174. {$EXTERNALSYM D3DX_16F_MAX_10_EXP}
  175. D3DX_16F_MAX_EXP = 15; // max binary exponent
  176. {$EXTERNALSYM D3DX_16F_MAX_EXP}
  177. D3DX_16F_MIN = 6.1035156e-5; // min positive value
  178. {$EXTERNALSYM D3DX_16F_MIN}
  179. D3DX_16F_MIN_10_EXP = -4; // min decimal exponent
  180. {$EXTERNALSYM D3DX_16F_MIN_10_EXP}
  181. D3DX_16F_MIN_EXP = -12; // min binary exponent
  182. {$EXTERNALSYM D3DX_16F_MIN_EXP}
  183. D3DX_16F_RADIX = 2; // exponent radix
  184. {$EXTERNALSYM D3DX_16F_RADIX}
  185. D3DX_16F_ROUNDS = 1; // addition rounding: near
  186. {$EXTERNALSYM D3DX_16F_ROUNDS}
  187. type
  188. (*$HPPEMIT 'typedef D3DXFLOAT16 TD3DXFloat16;' *)
  189. (*$HPPEMIT 'typedef D3DXFLOAT16 *PD3DXFloat16;' *)
  190. PD3DXFloat16 = ^TD3DXFloat16;
  191. {$EXTERNALSYM PD3DXFloat16}
  192. TD3DXFloat16 = packed record
  193. value: Word;
  194. end;
  195. {$NODEFINE TD3DXFloat16}
  196. // Some pascal equalents of C++ class functions & operators
  197. const D3DXFloat16Zero: TD3DXFloat16 = (value:0); // 0
  198. function D3DXFloat16(value: Single): TD3DXFloat16;
  199. function D3DXFloat16Equal(const v1, v2: TD3DXFloat16): Boolean;
  200. function D3DXFloat16ToFloat(value: TD3DXFloat16): Single;
  201. //===========================================================================
  202. //
  203. // Vectors
  204. //
  205. //===========================================================================
  206. //--------------------------
  207. // 2D Vector
  208. //--------------------------
  209. type
  210. (*$HPPEMIT 'typedef D3DXVECTOR2 TD3DXVector2;' *)
  211. (*$HPPEMIT 'typedef D3DXVECTOR2 *PD3DXVector2;' *)
  212. PD3DXVector2 = ^TD3DXVector2;
  213. {$EXTERNALSYM PD3DXVector2}
  214. TD3DXVector2 = packed record
  215. x, y: Single;
  216. end;
  217. {$NODEFINE TD3DXVector2}
  218. // Some pascal equalents of C++ class functions & operators
  219. const D3DXVector2Zero: TD3DXVector2 = (x:0; y:0); // (0,0)
  220. function D3DXVector2(_x, _y: Single): TD3DXVector2;
  221. function D3DXVector2Equal(const v1, v2: TD3DXVector2): Boolean;
  222. //--------------------------
  223. // 2D Vector (16 bit)
  224. //--------------------------
  225. type
  226. (*$HPPEMIT 'typedef D3DXVECTOR2_16F TD3DXVector2_16F;' *)
  227. (*$HPPEMIT 'typedef D3DXVECTOR2_16F *PD3DXVector2_16F;' *)
  228. PD3DXVector2_16F = ^TD3DXVector2_16F;
  229. {$EXTERNALSYM PD3DXVector2_16F}
  230. TD3DXVector2_16F = packed record
  231. x, y: TD3DXFloat16;
  232. end;
  233. {$NODEFINE TD3DXVector2_16F}
  234. // Some pascal equalents of C++ class functions & operators
  235. const D3DXVector2_16fZero: TD3DXVector2_16F = (x:(value:0); y:(value:0)); // (0,0)
  236. function D3DXVector2_16F(_x, _y: TD3DXFloat16): TD3DXVector2_16F;
  237. function D3DXVector2_16fEqual(const v1, v2: TD3DXVector2_16F): Boolean;
  238. function D3DXVector2_16fFromVector2(const v: TD3DXVector2): TD3DXVector2_16f;
  239. function D3DXVector2FromVector2_16f(const v: TD3DXVector2_16f): TD3DXVector2;
  240. //--------------------------
  241. // 3D Vector
  242. //--------------------------
  243. type
  244. (*$HPPEMIT 'typedef D3DXVECTOR3 TD3DXVector3;' *)
  245. (*$HPPEMIT 'typedef D3DXVECTOR3 *PD3DXVector3;' *)
  246. PD3DXVector3 = ^TD3DXVector3;
  247. {$EXTERNALSYM PD3DXVector3}
  248. TD3DXVector3 = TD3DVector;
  249. {$NODEFINE TD3DXVector3}
  250. // Some pascal equalents of C++ class functions & operators
  251. const D3DXVector3Zero: TD3DXVector3 = (x:0; y:0; z:0); // (0,0,0)
  252. function D3DXVector3(_x, _y, _z: Single): TD3DXVector3;
  253. function D3DXVector3Equal(const v1, v2: TD3DXVector3): Boolean;
  254. //--------------------------
  255. // 3D Vector (16 bit)
  256. //--------------------------
  257. type
  258. (*$HPPEMIT 'typedef D3DXVECTOR3_16F TD3DXVector3_16F;' *)
  259. (*$HPPEMIT 'typedef D3DXVECTOR3_16F *PD3DXVector3_16F;' *)
  260. PD3DXVector3_16F = ^TD3DXVector3_16F;
  261. {$EXTERNALSYM PD3DXVector3}
  262. TD3DXVector3_16F = packed record
  263. x, y, z: TD3DXFloat16;
  264. end;
  265. {$NODEFINE TD3DXVector3_16F}
  266. // Some pascal equalents of C++ class functions & operators
  267. const D3DXVector3_16fZero: TD3DXVector3_16F = (x:(value:0); y:(value:0); z:(value:0)); // (0,0,0)
  268. function D3DXVector3_16F(_x, _y, _z: TD3DXFloat16): TD3DXVector3_16F;
  269. function D3DXVector3_16fEqual(const v1, v2: TD3DXVector3_16F): Boolean;
  270. function D3DXVector3_16fFromVector3(const v: TD3DXVector3): TD3DXVector3_16f;
  271. function D3DXVector3FromVector3_16f(const v: TD3DXVector3_16f): TD3DXVector3;
  272. //--------------------------
  273. // 4D Vector
  274. //--------------------------
  275. type
  276. (*$HPPEMIT 'typedef D3DXVECTOR4 TD3DXVector4;' *)
  277. (*$HPPEMIT 'typedef D3DXVECTOR4 *PD3DXVector4;' *)
  278. PD3DXVector4 = ^TD3DXVector4;
  279. {$EXTERNALSYM PD3DXVector4}
  280. TD3DXVector4 = packed record
  281. x, y, z, w: Single;
  282. end;
  283. {$NODEFINE TD3DXVector4}
  284. // Some pascal equalents of C++ class functions & operators
  285. const D3DXVector4Zero: TD3DXVector4 = (x:0; y:0; z:0; w:0); // (0,0,0,0)
  286. function D3DXVector4(_x, _y, _z, _w: Single): TD3DXVector4;
  287. function D3DXVector4Equal(const v1, v2: TD3DXVector4): Boolean;
  288. //--------------------------
  289. // 4D Vector (16 bit)
  290. //--------------------------
  291. type
  292. (*$HPPEMIT 'typedef D3DXVECTOR4_16F TD3DXVector4_16F;' *)
  293. (*$HPPEMIT 'typedef D3DXVECTOR4_16F *PD3DXVector4_16F;' *)
  294. PD3DXVector4_16F = ^TD3DXVector4_16F;
  295. {$EXTERNALSYM PD3DXVector4_16F}
  296. TD3DXVector4_16F = packed record
  297. x, y, z, w: TD3DXFloat16;
  298. end;
  299. {$NODEFINE TD3DXVector4_16F}
  300. // Some pascal equalents of C++ class functions & operators
  301. const D3DXVector4_16fZero: TD3DXVector4_16F = (x:(value:0); y:(value:0); z:(value:0); w:(value:0)); // (0,0,0,0)
  302. function D3DXVector4_16F(_x, _y, _z, _w: TD3DXFloat16): TD3DXVector4_16F;
  303. function D3DXVector4_16fEqual(const v1, v2: TD3DXVector4_16F): Boolean;
  304. function D3DXVector4_16fFromVector4(const v: TD3DXVector4): TD3DXVector4_16f;
  305. function D3DXVector4FromVector4_16f(const v: TD3DXVector4_16f): TD3DXVector4;
  306. //===========================================================================
  307. //
  308. // Matrices
  309. //
  310. //===========================================================================
  311. type
  312. (*$HPPEMIT 'typedef D3DXMATRIX TD3DXMatrix;' *)
  313. (*$HPPEMIT 'typedef D3DXMATRIX *PD3DXMatrix;' *)
  314. (*$HPPEMIT 'typedef D3DXMATRIX **PPD3DXMatrix;' *)
  315. PPD3DXMatrix = ^PD3DXMatrix;
  316. PD3DXMatrix = ^TD3DXMatrix;
  317. {$EXTERNALSYM PD3DXMatrix}
  318. TD3DXMatrix = TD3DMatrix;
  319. {$NODEFINE TD3DXMatrix}
  320. // Some pascal equalents of C++ class functions & operators
  321. function D3DXMatrix(
  322. _m00, _m01, _m02, _m03,
  323. _m10, _m11, _m12, _m13,
  324. _m20, _m21, _m22, _m23,
  325. _m30, _m31, _m32, _m33: Single): TD3DXMatrix;
  326. function D3DXMatrixAdd(out mOut: TD3DXMatrix; const m1, m2: TD3DXMatrix): PD3DXMatrix;
  327. function D3DXMatrixSubtract(out mOut: TD3DXMatrix; const m1, m2: TD3DXMatrix): PD3DXMatrix;
  328. function D3DXMatrixMul(out mOut: TD3DXMatrix; const m: TD3DXMatrix; MulBy: Single): PD3DXMatrix;
  329. function D3DXMatrixEqual(const m1, m2: TD3DXMatrix): Boolean;
  330. //---------------------------------------------------------------------------
  331. // Aligned Matrices
  332. //
  333. // This class helps keep matrices 16-byte aligned as preferred by P4 cpus.
  334. // It aligns matrices on the stack and on the heap or in global scope.
  335. // It does this using __declspec(align(16)) which works on VC7 and on VC 6
  336. // with the processor pack. Unfortunately there is no way to detect the
  337. // latter so this is turned on only on VC7. On other compilers this is the
  338. // the same as D3DXMATRIX.
  339. //
  340. // Using this class on a compiler that does not actually do the alignment
  341. // can be dangerous since it will not expose bugs that ignore alignment.
  342. // E.g if an object of this class in inside a struct or class, and some code
  343. // memcopys data in it assuming tight packing. This could break on a compiler
  344. // that eventually start aligning the matrix.
  345. //---------------------------------------------------------------------------
  346. // Translator comments: None of current pascal compilers can even align data
  347. // inside records to 16 byte boundary, so we just leave aligned matrix
  348. // declaration equal to standart matrix
  349. type
  350. PD3DXMatrixA16 = ^TD3DXMatrixA16;
  351. TD3DXMatrixA16 = TD3DXMatrix;
  352. //===========================================================================
  353. //
  354. // Quaternions
  355. //
  356. //===========================================================================
  357. type
  358. (*$HPPEMIT 'typedef D3DXQUATERNION TD3DXQuaternion;' *)
  359. PD3DXQuaternion = ^TD3DXQuaternion;
  360. TD3DXQuaternion = packed record
  361. x, y, z, w: Single;
  362. end;
  363. {$NODEFINE TD3DXQuaternion}
  364. // Some pascal equalents of C++ class functions & operators
  365. function D3DXQuaternion(_x, _y, _z, _w: Single): TD3DXQuaternion;
  366. function D3DXQuaternionAdd(const q1, q2: TD3DXQuaternion): TD3DXQuaternion;
  367. function D3DXQuaternionSubtract(const q1, q2: TD3DXQuaternion): TD3DXQuaternion;
  368. function D3DXQuaternionEqual(const q1, q2: TD3DXQuaternion): Boolean;
  369. function D3DXQuaternionScale(out qOut: TD3DXQuaternion; const q: TD3DXQuaternion;
  370. s: Single): PD3DXQuaternion;
  371. //===========================================================================
  372. //
  373. // Planes
  374. //
  375. //===========================================================================
  376. type
  377. (*$HPPEMIT 'typedef D3DXPLANE TD3DXPlane;' *)
  378. PD3DXPlane = ^TD3DXPlane;
  379. TD3DXPlane = packed record
  380. a, b, c, d: Single;
  381. end;
  382. {$NODEFINE TD3DXPlane}
  383. // Some pascal equalents of C++ class functions & operators
  384. const D3DXPlaneZero: TD3DXPlane = (a:0; b:0; c:0; d:0); // (0,0,0,0)
  385. function D3DXPlane(_a, _b, _c, _d: Single): TD3DXPlane;
  386. function D3DXPlaneEqual(const p1, p2: TD3DXPlane): Boolean;
  387. //===========================================================================
  388. //
  389. // Colors
  390. //
  391. //===========================================================================
  392. type
  393. (*$HPPEMIT 'typedef D3DXCOLOR TD3DXColor;' *)
  394. (*$HPPEMIT 'typedef D3DXCOLOR *PD3DXColor;' *)
  395. PD3DXColor = PD3DColorValue;
  396. {$EXTERNALSYM PD3DXColor}
  397. TD3DXColor = TD3DColorValue;
  398. {$EXTERNALSYM TD3DXColor}
  399. function D3DXColor(_r, _g, _b, _a: Single): TD3DXColor;
  400. function D3DXColorToDWord(c: TD3DXColor): DWord;
  401. function D3DXColorFromDWord(c: DWord): TD3DXColor;
  402. function D3DXColorEqual(const c1, c2: TD3DXColor): Boolean;
  403. //===========================================================================
  404. //
  405. // D3DX math functions:
  406. //
  407. // NOTE:
  408. // * All these functions can take the same object as in and out parameters.
  409. //
  410. // * Out parameters are typically also returned as return values, so that
  411. // the output of one function may be used as a parameter to another.
  412. //
  413. //===========================================================================
  414. //--------------------------
  415. // Float16
  416. //--------------------------
  417. // non-inline
  418. // Converts an array 32-bit floats to 16-bit floats
  419. function D3DXFloat32To16Array(pOut: PD3DXFloat16; pIn: PSingle; n: LongWord): PD3DXFloat16; stdcall; external d3dx9mathDLL;
  420. {$EXTERNALSYM D3DXFloat32To16Array}
  421. // Converts an array 16-bit floats to 32-bit floats
  422. function D3DXFloat16To32Array(pOut: PSingle; pIn: PD3DXFloat16; n: LongWord): PSingle; stdcall; external d3dx9mathDLL;
  423. {$EXTERNALSYM D3DXFloat16To32Array}
  424. //--------------------------
  425. // 2D Vector
  426. //--------------------------
  427. // inline
  428. function D3DXVec2Length(const v: TD3DXVector2): Single;
  429. {$EXTERNALSYM D3DXVec2Length}
  430. function D3DXVec2LengthSq(const v: TD3DXVector2): Single;
  431. {$EXTERNALSYM D3DXVec2LengthSq}
  432. function D3DXVec2Dot(const v1, v2: TD3DXVector2): Single;
  433. {$EXTERNALSYM D3DXVec2Dot}
  434. // Z component of ((x1,y1,0) cross (x2,y2,0))
  435. function D3DXVec2CCW(const v1, v2: TD3DXVector2): Single;
  436. {$EXTERNALSYM D3DXVec2CCW}
  437. function D3DXVec2Add(const v1, v2: TD3DXVector2): TD3DXVector2;
  438. {$EXTERNALSYM D3DXVec2Add}
  439. function D3DXVec2Subtract(const v1, v2: TD3DXVector2): TD3DXVector2;
  440. {$EXTERNALSYM D3DXVec2Subtract}
  441. // Minimize each component. x = min(x1, x2), y = min(y1, y2)
  442. function D3DXVec2Minimize(out vOut: TD3DXVector2; const v1, v2: TD3DXVector2): PD3DXVector2;
  443. {$EXTERNALSYM D3DXVec2Minimize}
  444. // Maximize each component. x = max(x1, x2), y = max(y1, y2)
  445. function D3DXVec2Maximize(out vOut: TD3DXVector2; const v1, v2: TD3DXVector2): PD3DXVector2;
  446. {$EXTERNALSYM D3DXVec2Maximize}
  447. function D3DXVec2Scale(out vOut: TD3DXVector2; const v: TD3DXVector2; s: Single): PD3DXVector2;
  448. {$EXTERNALSYM D3DXVec2Scale}
  449. // Linear interpolation. V1 + s(V2-V1)
  450. function D3DXVec2Lerp(out vOut: TD3DXVector2; const v1, v2: TD3DXVector2; s: Single): PD3DXVector2;
  451. {$EXTERNALSYM D3DXVec2Lerp}
  452. // non-inline
  453. function D3DXVec2Normalize(out vOut: TD3DXVector2; const v: TD3DXVector2): PD3DXVector2; stdcall; external d3dx9mathDLL;
  454. {$EXTERNALSYM D3DXVec2Normalize}
  455. // Hermite interpolation between position V1, tangent T1 (when s == 0)
  456. // and position V2, tangent T2 (when s == 1).
  457. function D3DXVec2Hermite(out vOut: TD3DXVector2;
  458. const v1, t1, v2, t2: TD3DXVector2; s: Single): PD3DXVector2; stdcall; external d3dx9mathDLL;
  459. {$EXTERNALSYM D3DXVec2Hermite}
  460. // CatmullRom interpolation between V1 (when s == 0) and V2 (when s == 1)
  461. function D3DXVec2CatmullRom(out vOut: TD3DXVector2;
  462. const v0, v1, v2: TD3DXVector2; s: Single): PD3DXVector2; stdcall; external d3dx9mathDLL;
  463. {$EXTERNALSYM D3DXVec2CatmullRom}
  464. // Barycentric coordinates. V1 + f(V2-V1) + g(V3-V1)
  465. function D3DXVec2BaryCentric(out vOut: TD3DXVector2;
  466. const v1, v2, v3: TD3DXVector2; f, g: Single): PD3DXVector2; stdcall; external d3dx9mathDLL;
  467. {$EXTERNALSYM D3DXVec2BaryCentric}
  468. // Transform (x, y, 0, 1) by matrix.
  469. function D3DXVec2Transform(out vOut: TD3DXVector4;
  470. const v: TD3DXVector2; const m: TD3DXMatrix): PD3DXVector4; stdcall; external d3dx9mathDLL;
  471. {$EXTERNALSYM D3DXVec2Transform}
  472. // Transform (x, y, 0, 1) by matrix, project result back into w=1.
  473. function D3DXVec2TransformCoord(out vOut: TD3DXVector2;
  474. const v: TD3DXVector2; const m: TD3DXMatrix): PD3DXVector2; stdcall; external d3dx9mathDLL;
  475. {$EXTERNALSYM D3DXVec2TransformCoord}
  476. // Transform (x, y, 0, 0) by matrix.
  477. function D3DXVec2TransformNormal(out vOut: TD3DXVector2;
  478. const v: TD3DXVector2; const m: TD3DXMatrix): PD3DXVector2; stdcall; external d3dx9mathDLL;
  479. {$EXTERNALSYM D3DXVec2TransformNormal}
  480. // Transform Array (x, y, 0, 1) by matrix.
  481. function D3DXVec2TransformArray(pOut: PD3DXVector4; OutStride: LongWord;
  482. pV: PD3DXVector2; VStride: LongWord; const m: TD3DXMatrix; n: LongWord): PD3DXVector4; stdcall; external d3dx9mathDLL;
  483. {$EXTERNALSYM D3DXVec2TransformArray}
  484. // Transform Array (x, y, 0, 1) by matrix, project result back into w=1.
  485. function D3DXVec2TransformCoordArray(pOut: PD3DXVector2; OutStride: LongWord;
  486. pV: PD3DXVector2; VStride: LongWord; const m: TD3DXMatrix; n: LongWord): PD3DXVector2; stdcall; external d3dx9mathDLL;
  487. {$EXTERNALSYM D3DXVec2TransformCoordArray}
  488. // Transform Array (x, y, 0, 0) by matrix.
  489. function D3DXVec2TransformNormalArray(pOut: PD3DXVector2; OutStride: LongWord;
  490. pV: PD3DXVector2; VStride: LongWord; const m: TD3DXMatrix; n: LongWord): PD3DXVector2; stdcall; external d3dx9mathDLL;
  491. {$EXTERNALSYM D3DXVec2TransformNormalArray}
  492. //--------------------------
  493. // 3D Vector
  494. //--------------------------
  495. // inline
  496. function D3DXVec3Length(const v: TD3DXVector3): Single;
  497. {$EXTERNALSYM D3DXVec3Length}
  498. function D3DXVec3LengthSq(const v: TD3DXVector3): Single;
  499. {$EXTERNALSYM D3DXVec3LengthSq}
  500. function D3DXVec3Dot(const v1, v2: TD3DXVector3): Single;
  501. {$EXTERNALSYM D3DXVec3Dot}
  502. function D3DXVec3Cross(out vOut: TD3DXVector3; const v1, v2: TD3DXVector3): PD3DXVector3;
  503. {$EXTERNALSYM D3DXVec3Cross}
  504. function D3DXVec3Add(out vOut: TD3DXVector3; const v1, v2: TD3DXVector3): PD3DXVector3;
  505. {$EXTERNALSYM D3DXVec3Add}
  506. function D3DXVec3Subtract(out vOut: TD3DXVector3; const v1, v2: TD3DXVector3): PD3DXVector3;
  507. {$EXTERNALSYM D3DXVec3Subtract}
  508. // Minimize each component. x = min(x1, x2), y = min(y1, y2), ...
  509. function D3DXVec3Minimize(out vOut: TD3DXVector3; const v1, v2: TD3DXVector3): PD3DXVector3;
  510. {$EXTERNALSYM D3DXVec3Minimize}
  511. // Maximize each component. x = max(x1, x2), y = max(y1, y2), ...
  512. function D3DXVec3Maximize(out vOut: TD3DXVector3; const v1, v2: TD3DXVector3): PD3DXVector3;
  513. {$EXTERNALSYM D3DXVec3Maximize}
  514. function D3DXVec3Scale(out vOut: TD3DXVector3; const v: TD3DXVector3; s: Single): PD3DXVector3;
  515. {$EXTERNALSYM D3DXVec3Scale}
  516. // Linear interpolation. V1 + s(V2-V1)
  517. function D3DXVec3Lerp(out vOut: TD3DXVector3;
  518. const v1, v2: TD3DXVector3; s: Single): PD3DXVector3;
  519. {$EXTERNALSYM D3DXVec3Lerp}
  520. // non-inline
  521. function D3DXVec3Normalize(out vOut: TD3DXVector3;
  522. const v: TD3DXVector3): PD3DXVector3; stdcall; external d3dx9mathDLL;
  523. {$EXTERNALSYM D3DXVec3Normalize}
  524. // Hermite interpolation between position V1, tangent T1 (when s == 0)
  525. // and position V2, tangent T2 (when s == 1).
  526. function D3DXVec3Hermite(out vOut: TD3DXVector3;
  527. const v1, t1, v2, t2: TD3DXVector3; s: Single): PD3DXVector3; stdcall; external d3dx9mathDLL;
  528. {$EXTERNALSYM D3DXVec3Hermite}
  529. // CatmullRom interpolation between V1 (when s == 0) and V2 (when s == 1)
  530. function D3DXVec3CatmullRom(out vOut: TD3DXVector3;
  531. const v1, v2, v3: TD3DXVector3; s: Single): PD3DXVector3; stdcall; external d3dx9mathDLL;
  532. {$EXTERNALSYM D3DXVec3CatmullRom}
  533. // Barycentric coordinates. V1 + f(V2-V1) + g(V3-V1)
  534. function D3DXVec3BaryCentric(out vOut: TD3DXVector3;
  535. const v1, v2, v3: TD3DXVector3; f, g: Single): PD3DXVector3; stdcall; external d3dx9mathDLL;
  536. {$EXTERNALSYM D3DXVec3BaryCentric}
  537. // Transform (x, y, z, 1) by matrix.
  538. function D3DXVec3Transform(out vOut: TD3DXVector4;
  539. const v: TD3DXVector3; const m: TD3DXMatrix): PD3DXVector4; stdcall; external d3dx9mathDLL;
  540. {$EXTERNALSYM D3DXVec3Transform}
  541. // Transform (x, y, z, 1) by matrix, project result back into w=1.
  542. function D3DXVec3TransformCoord(out vOut: TD3DXVector3;
  543. const v: TD3DXVector3; const m: TD3DXMatrix): PD3DXVector3; stdcall; external d3dx9mathDLL;
  544. {$EXTERNALSYM D3DXVec3TransformCoord}
  545. // Transform (x, y, z, 0) by matrix. If you transforming a normal by a
  546. // non-affine matrix, the matrix you pass to this function should be the
  547. // transpose of the inverse of the matrix you would use to transform a coord.
  548. function D3DXVec3TransformNormal(out vOut: TD3DXVector3;
  549. const v: TD3DXVector3; const m: TD3DXMatrix): PD3DXVector3; stdcall; external d3dx9mathDLL;
  550. {$EXTERNALSYM D3DXVec3TransformNormal}
  551. // Transform Array (x, y, z, 1) by matrix.
  552. function D3DXVec3TransformArray(pOut: PD3DXVector4; OutStride: LongWord;
  553. pV: PD3DXVector3; VStride: LongWord; const m: TD3DXMatrix; n: LongWord): PD3DXVector4; stdcall; external d3dx9mathDLL;
  554. {$EXTERNALSYM D3DXVec3TransformArray}
  555. // Transform Array (x, y, z, 1) by matrix, project result back into w=1.
  556. function D3DXVec3TransformCoordArray(pOut: PD3DXVector3; OutStride: LongWord;
  557. pV: PD3DXVector3; VStride: LongWord; const m: TD3DXMatrix; n: LongWord): PD3DXVector3; stdcall; external d3dx9mathDLL;
  558. {$EXTERNALSYM D3DXVec3TransformCoordArray}
  559. // Transform (x, y, z, 0) by matrix. If you transforming a normal by a
  560. // non-affine matrix, the matrix you pass to this function should be the
  561. // transpose of the inverse of the matrix you would use to transform a coord.
  562. function D3DXVec3TransformNormalArray(pOut: PD3DXVector3; OutStride: LongWord;
  563. pV: PD3DXVector3; VStride: LongWord; const m: TD3DXMatrix; n: LongWord): PD3DXVector3; stdcall; external d3dx9mathDLL;
  564. {$EXTERNALSYM D3DXVec3TransformNormalArray}
  565. // Project vector from object space into screen space
  566. function D3DXVec3Project(out vOut: TD3DXVector3;
  567. const v: TD3DXVector3; const pViewport: TD3DViewport9;
  568. const pProjection, pView, pWorld: TD3DXMatrix): PD3DXVector3; stdcall; external d3dx9mathDLL;
  569. {$EXTERNALSYM D3DXVec3Project}
  570. // Project vector from screen space into object space
  571. function D3DXVec3Unproject(out vOut: TD3DXVector3;
  572. const v: TD3DXVector3; const pViewport: TD3DViewport9;
  573. const pProjection, pView, pWorld: TD3DXMatrix): PD3DXVector3; stdcall; external d3dx9mathDLL;
  574. {$EXTERNALSYM D3DXVec3Unproject}
  575. // Project vector Array from object space into screen space
  576. function D3DXVec3ProjectArray(pOut: PD3DXVector3; OutStride: LongWord;
  577. pV: PD3DXVector3; VStride: LongWord; const pViewport: TD3DViewport9;
  578. const pProjection, pView, pWorld: TD3DXMatrix; n: LongWord): PD3DXVector3; stdcall; external d3dx9mathDLL;
  579. {$EXTERNALSYM D3DXVec3ProjectArray}
  580. // Project vector Array from screen space into object space
  581. function D3DXVec3UnprojectArray(pOut: PD3DXVector3; OutStride: LongWord;
  582. pV: PD3DXVector3; VStride: LongWord; const pViewport: TD3DViewport9;
  583. const pProjection, pView, pWorld: TD3DXMatrix; n: LongWord): PD3DXVector3; stdcall; external d3dx9mathDLL;
  584. {$EXTERNALSYM D3DXVec3UnprojectArray}
  585. //--------------------------
  586. // 4D Vector
  587. //--------------------------
  588. // inline
  589. function D3DXVec4Length(const v: TD3DXVector4): Single;
  590. {$EXTERNALSYM D3DXVec4Length}
  591. function D3DXVec4LengthSq(const v: TD3DXVector4): Single;
  592. {$EXTERNALSYM D3DXVec4LengthSq}
  593. function D3DXVec4Dot(const v1, v2: TD3DXVector4): Single;
  594. {$EXTERNALSYM D3DXVec4Dot}
  595. function D3DXVec4Add(out vOut: TD3DXVector4; const v1, v2: TD3DXVector4): PD3DXVector4;
  596. {$EXTERNALSYM D3DXVec4Add}
  597. function D3DXVec4Subtract(out vOut: TD3DXVector4; const v1, v2: TD3DXVector4): PD3DXVector4;
  598. {$EXTERNALSYM D3DXVec4Subtract}
  599. // Minimize each component. x = min(x1, x2), y = min(y1, y2), ...
  600. function D3DXVec4Minimize(out vOut: TD3DXVector4; const v1, v2: TD3DXVector4): PD3DXVector4;
  601. {$EXTERNALSYM D3DXVec4Minimize}
  602. // Maximize each component. x = max(x1, x2), y = max(y1, y2), ...
  603. function D3DXVec4Maximize(out vOut: TD3DXVector4; const v1, v2: TD3DXVector4): PD3DXVector4;
  604. {$EXTERNALSYM D3DXVec4Maximize}
  605. function D3DXVec4Scale(out vOut: TD3DXVector4; const v: TD3DXVector4; s: Single): PD3DXVector4;
  606. {$EXTERNALSYM D3DXVec4Scale}
  607. // Linear interpolation. V1 + s(V2-V1)
  608. function D3DXVec4Lerp(out vOut: TD3DXVector4;
  609. const v1, v2: TD3DXVector4; s: Single): PD3DXVector4;
  610. {$EXTERNALSYM D3DXVec4Lerp}
  611. // non-inline
  612. // Cross-product in 4 dimensions.
  613. function D3DXVec4Cross(out vOut: TD3DXVector4;
  614. const v1, v2, v3: TD3DXVector4): PD3DXVector4; stdcall; external d3dx9mathDLL;
  615. {$EXTERNALSYM D3DXVec4Cross}
  616. function D3DXVec4Normalize(out vOut: TD3DXVector4;
  617. const v: TD3DXVector4): PD3DXVector4; stdcall; external d3dx9mathDLL;
  618. {$EXTERNALSYM D3DXVec4Normalize}
  619. // Hermite interpolation between position V1, tangent T1 (when s == 0)
  620. // and position V2, tangent T2 (when s == 1).
  621. function D3DXVec4Hermite(out vOut: TD3DXVector4;
  622. const v1, t1, v2, t2: TD3DXVector4; s: Single): PD3DXVector4; stdcall; external d3dx9mathDLL;
  623. {$EXTERNALSYM D3DXVec4Hermite}
  624. // CatmullRom interpolation between V1 (when s == 0) and V2 (when s == 1)
  625. function D3DXVec4CatmullRom(out vOut: TD3DXVector4;
  626. const v0, v1, v2, v3: TD3DXVector4; s: Single): PD3DXVector4; stdcall; external d3dx9mathDLL;
  627. {$EXTERNALSYM D3DXVec4CatmullRom}
  628. // Barycentric coordinates. V1 + f(V2-V1) + g(V3-V1)
  629. function D3DXVec4BaryCentric(out vOut: TD3DXVector4;
  630. const v1, v2, v3: TD3DXVector4; f, g: Single): PD3DXVector4; stdcall; external d3dx9mathDLL;
  631. {$EXTERNALSYM D3DXVec4BaryCentric}
  632. // Transform vector by matrix.
  633. function D3DXVec4Transform(out vOut: TD3DXVector4;
  634. const v: TD3DXVector4; const m: TD3DXMatrix): PD3DXVector4; stdcall; external d3dx9mathDLL;
  635. {$EXTERNALSYM D3DXVec4Transform}
  636. // Transform vector array by matrix.
  637. function D3DXVec4TransformArray(pOut: PD3DXVector4; OutStride: LongWord;
  638. pV: PD3DXVector4; VStride: LongWord; const m: TD3DXMatrix; n: LongWord): PD3DXVector4; stdcall; external d3dx9mathDLL;
  639. {$EXTERNALSYM D3DXVec4TransformArray}
  640. //--------------------------
  641. // 4D Matrix
  642. //--------------------------
  643. // inline
  644. function D3DXMatrixIdentity(out mOut: TD3DXMatrix): PD3DXMatrix;
  645. {$EXTERNALSYM D3DXMatrixIdentity}
  646. function D3DXMatrixIsIdentity(const m: TD3DXMatrix): BOOL;
  647. {$EXTERNALSYM D3DXMatrixIsIdentity}
  648. // non-inline
  649. function D3DXMatrixDeterminant(const m: TD3DXMatrix): Single; stdcall; external d3dx9mathDLL;
  650. {$EXTERNALSYM D3DXMatrixDeterminant}
  651. function D3DXMatrixTranspose(out pOut: TD3DXMatrix; const pM: TD3DXMatrix): PD3DXMatrix; stdcall; external d3dx9mathDLL;
  652. {$EXTERNALSYM D3DXMatrixTranspose}
  653. // Matrix multiplication. The result represents the transformation M2
  654. // followed by the transformation M1. (Out = M1 * M2)
  655. function D3DXMatrixMultiply(out mOut: TD3DXMatrix; const m1, m2: TD3DXMatrix): PD3DXMatrix; stdcall; external d3dx9mathDLL;
  656. {$EXTERNALSYM D3DXMatrixMultiply}
  657. // Matrix multiplication, followed by a transpose. (Out = T(M1 * M2))
  658. function D3DXMatrixMultiplyTranspose(out pOut: TD3DXMatrix; const pM1, pM2: TD3DXMatrix): PD3DXMatrix; stdcall; external d3dx9mathDLL;
  659. {$EXTERNALSYM D3DXMatrixMultiplyTranspose}
  660. // Calculate inverse of matrix. Inversion my fail, in which case NULL will
  661. // be returned. The determinant of pM is also returned it pfDeterminant
  662. // is non-NULL.
  663. function D3DXMatrixInverse(out mOut: TD3DXMatrix; pfDeterminant: PSingle;
  664. const m: TD3DXMatrix): PD3DXMatrix; stdcall; external d3dx9mathDLL;
  665. {$EXTERNALSYM D3DXMatrixInverse}
  666. // Build a matrix which scales by (sx, sy, sz)
  667. function D3DXMatrixScaling(out mOut: TD3DXMatrix; sx, sy, sz: Single): PD3DXMatrix; stdcall; external d3dx9mathDLL;
  668. {$EXTERNALSYM D3DXMatrixScaling}
  669. // Build a matrix which translates by (x, y, z)
  670. function D3DXMatrixTranslation(out mOut: TD3DXMatrix; x, y, z: Single): PD3DXMatrix; stdcall; external d3dx9mathDLL;
  671. {$EXTERNALSYM D3DXMatrixTranslation}
  672. // Build a matrix which rotates around the X axis
  673. function D3DXMatrixRotationX(out mOut: TD3DXMatrix; angle: Single): PD3DXMatrix; stdcall; external d3dx9mathDLL;
  674. {$EXTERNALSYM D3DXMatrixRotationX}
  675. // Build a matrix which rotates around the Y axis
  676. function D3DXMatrixRotationY(out mOut: TD3DXMatrix; angle: Single): PD3DXMatrix; stdcall; external d3dx9mathDLL;
  677. {$EXTERNALSYM D3DXMatrixRotationY}
  678. // Build a matrix which rotates around the Z axis
  679. function D3DXMatrixRotationZ(out mOut: TD3DXMatrix; angle: Single): PD3DXMatrix; stdcall; external d3dx9mathDLL;
  680. {$EXTERNALSYM D3DXMatrixRotationZ}
  681. // Build a matrix which rotates around an arbitrary axis
  682. function D3DXMatrixRotationAxis(out mOut: TD3DXMatrix; const v: TD3DXVector3;
  683. angle: Single): PD3DXMatrix; stdcall; external d3dx9mathDLL;
  684. {$EXTERNALSYM D3DXMatrixRotationAxis}
  685. // Build a matrix from a quaternion
  686. function D3DXMatrixRotationQuaternion(out mOut: TD3DXMatrix; const Q: TD3DXQuaternion): PD3DXMatrix; stdcall; external d3dx9mathDLL;
  687. {$EXTERNALSYM D3DXMatrixRotationQuaternion}
  688. // Yaw around the Y axis, a pitch around the X axis,
  689. // and a roll around the Z axis.
  690. function D3DXMatrixRotationYawPitchRoll(out mOut: TD3DXMatrix; yaw, pitch, roll: Single): PD3DXMatrix; stdcall; external d3dx9mathDLL;
  691. {$EXTERNALSYM D3DXMatrixRotationYawPitchRoll}
  692. // Build transformation matrix. NULL arguments are treated as identity.
  693. // Mout = Msc-1 * Msr-1 * Ms * Msr * Msc * Mrc-1 * Mr * Mrc * Mt
  694. function D3DXMatrixTransformation(out mOut: TD3DXMatrix;
  695. pScalingCenter: PD3DXVector3;
  696. pScalingRotation: PD3DXQuaternion; pScaling, pRotationCenter: PD3DXVector3;
  697. pRotation: PD3DXQuaternion; pTranslation: PD3DXVector3): PD3DXMatrix; stdcall; external d3dx9mathDLL;
  698. {$EXTERNALSYM D3DXMatrixTransformation}
  699. // Build affine transformation matrix. NULL arguments are treated as identity.
  700. // Mout = Ms * Mrc-1 * Mr * Mrc * Mt
  701. function D3DXMatrixAffineTransformation(out mOut: TD3DXMatrix;
  702. Scaling: Single; pRotationCenter: PD3DXVector3;
  703. pRotation: PD3DXQuaternion; pTranslation: PD3DXVector3): PD3DXMatrix; stdcall; external d3dx9mathDLL;
  704. {$EXTERNALSYM D3DXMatrixAffineTransformation}
  705. // Build a lookat matrix. (right-handed)
  706. function D3DXMatrixLookAtRH(out mOut: TD3DXMatrix; const Eye, At, Up: TD3DXVector3): PD3DXMatrix; stdcall; external d3dx9mathDLL;
  707. {$EXTERNALSYM D3DXMatrixLookAtRH}
  708. // Build a lookat matrix. (left-handed)
  709. function D3DXMatrixLookAtLH(out mOut: TD3DXMatrix; const Eye, At, Up: TD3DXVector3): PD3DXMatrix; stdcall; external d3dx9mathDLL;
  710. {$EXTERNALSYM D3DXMatrixLookAtLH}
  711. // Build a perspective projection matrix. (right-handed)
  712. function D3DXMatrixPerspectiveRH(out mOut: TD3DXMatrix; w, h, zn, zf: Single): PD3DXMatrix; stdcall; external d3dx9mathDLL;
  713. {$EXTERNALSYM D3DXMatrixPerspectiveRH}
  714. // Build a perspective projection matrix. (left-handed)
  715. function D3DXMatrixPerspectiveLH(out mOut: TD3DXMatrix; w, h, zn, zf: Single): PD3DXMatrix; stdcall; external d3dx9mathDLL;
  716. {$EXTERNALSYM D3DXMatrixPerspectiveLH}
  717. // Build a perspective projection matrix. (right-handed)
  718. function D3DXMatrixPerspectiveFovRH(out mOut: TD3DXMatrix; flovy, aspect, zn, zf: Single): PD3DXMatrix; stdcall; external d3dx9mathDLL;
  719. {$EXTERNALSYM D3DXMatrixPerspectiveFovRH}
  720. // Build a perspective projection matrix. (left-handed)
  721. function D3DXMatrixPerspectiveFovLH(out mOut: TD3DXMatrix; flovy, aspect, zn, zf: Single): PD3DXMatrix; stdcall; external d3dx9mathDLL;
  722. {$EXTERNALSYM D3DXMatrixPerspectiveFovLH}
  723. // Build a perspective projection matrix. (right-handed)
  724. function D3DXMatrixPerspectiveOffCenterRH(out mOut: TD3DXMatrix;
  725. l, r, b, t, zn, zf: Single): PD3DXMatrix; stdcall; external d3dx9mathDLL;
  726. {$EXTERNALSYM D3DXMatrixPerspectiveOffCenterRH}
  727. // Build a perspective projection matrix. (left-handed)
  728. function D3DXMatrixPerspectiveOffCenterLH(out mOut: TD3DXMatrix;
  729. l, r, b, t, zn, zf: Single): PD3DXMatrix; stdcall; external d3dx9mathDLL;
  730. {$EXTERNALSYM D3DXMatrixPerspectiveOffCenterLH}
  731. // Build an ortho projection matrix. (right-handed)
  732. function D3DXMatrixOrthoRH(out mOut: TD3DXMatrix; w, h, zn, zf: Single): PD3DXMatrix; stdcall; external d3dx9mathDLL;
  733. {$EXTERNALSYM D3DXMatrixOrthoRH}
  734. // Build an ortho projection matrix. (left-handed)
  735. function D3DXMatrixOrthoLH(out mOut: TD3DXMatrix; w, h, zn, zf: Single): PD3DXMatrix; stdcall; external d3dx9mathDLL;
  736. {$EXTERNALSYM D3DXMatrixOrthoLH}
  737. // Build an ortho projection matrix. (right-handed)
  738. function D3DXMatrixOrthoOffCenterRH(out mOut: TD3DXMatrix;
  739. l, r, b, t, zn, zf: Single): PD3DXMatrix; stdcall; external d3dx9mathDLL;
  740. {$EXTERNALSYM D3DXMatrixOrthoOffCenterRH}
  741. // Build an ortho projection matrix. (left-handed)
  742. function D3DXMatrixOrthoOffCenterLH(out mOut: TD3DXMatrix;
  743. l, r, b, t, zn, zf: Single): PD3DXMatrix; stdcall; external d3dx9mathDLL;
  744. {$EXTERNALSYM D3DXMatrixOrthoOffCenterLH}
  745. // Build a matrix which flattens geometry into a plane, as if casting
  746. // a shadow from a light.
  747. function D3DXMatrixShadow(out mOut: TD3DXMatrix;
  748. const Light: TD3DXVector4; const Plane: TD3DXPlane): PD3DXMatrix; stdcall; external d3dx9mathDLL;
  749. {$EXTERNALSYM D3DXMatrixShadow}
  750. // Build a matrix which reflects the coordinate system about a plane
  751. function D3DXMatrixReflect(out mOut: TD3DXMatrix;
  752. const Plane: TD3DXPlane): PD3DXMatrix; stdcall; external d3dx9mathDLL;
  753. {$EXTERNALSYM D3DXMatrixReflect}
  754. //--------------------------
  755. // Quaternion
  756. //--------------------------
  757. // inline
  758. function D3DXQuaternionLength(const q: TD3DXQuaternion): Single;
  759. {$EXTERNALSYM D3DXQuaternionLength}
  760. // Length squared, or "norm"
  761. function D3DXQuaternionLengthSq(const q: TD3DXQuaternion): Single;
  762. {$EXTERNALSYM D3DXQuaternionLengthSq}
  763. function D3DXQuaternionDot(const q1, q2: TD3DXQuaternion): Single;
  764. {$EXTERNALSYM D3DXQuaternionDot}
  765. // (0, 0, 0, 1)
  766. function D3DXQuaternionIdentity(out qOut: TD3DXQuaternion): PD3DXQuaternion;
  767. {$EXTERNALSYM D3DXQuaternionIdentity}
  768. function D3DXQuaternionIsIdentity (const q: TD3DXQuaternion): BOOL;
  769. {$EXTERNALSYM D3DXQuaternionIsIdentity}
  770. // (-x, -y, -z, w)
  771. function D3DXQuaternionConjugate(out qOut: TD3DXQuaternion;
  772. const q: TD3DXQuaternion): PD3DXQuaternion;
  773. {$EXTERNALSYM D3DXQuaternionConjugate}
  774. // non-inline
  775. // Compute a quaternin's axis and angle of rotation. Expects unit quaternions.
  776. procedure D3DXQuaternionToAxisAngle(const q: TD3DXQuaternion;
  777. out Axis: TD3DXVector3; out Angle: Single); stdcall; external d3dx9mathDLL;
  778. {$EXTERNALSYM D3DXQuaternionToAxisAngle}
  779. // Build a quaternion from a rotation matrix.
  780. function D3DXQuaternionRotationMatrix(out qOut: TD3DXQuaternion;
  781. const m: TD3DXMatrix): PD3DXQuaternion; stdcall; external d3dx9mathDLL;
  782. {$EXTERNALSYM D3DXQuaternionRotationMatrix}
  783. // Rotation about arbitrary axis.
  784. function D3DXQuaternionRotationAxis(out qOut: TD3DXQuaternion;
  785. const v: TD3DXVector3; Angle: Single): PD3DXQuaternion; stdcall; external d3dx9mathDLL;
  786. {$EXTERNALSYM D3DXQuaternionRotationAxis}
  787. // Yaw around the Y axis, a pitch around the X axis,
  788. // and a roll around the Z axis.
  789. function D3DXQuaternionRotationYawPitchRoll(out qOut: TD3DXQuaternion;
  790. yaw, pitch, roll: Single): PD3DXQuaternion; stdcall; external d3dx9mathDLL;
  791. {$EXTERNALSYM D3DXQuaternionRotationYawPitchRoll}
  792. // Quaternion multiplication. The result represents the rotation Q2
  793. // followed by the rotation Q1. (Out = Q2 * Q1)
  794. function D3DXQuaternionMultiply(out qOut: TD3DXQuaternion;
  795. const q1, q2: TD3DXQuaternion): PD3DXQuaternion; stdcall; external d3dx9mathDLL;
  796. {$EXTERNALSYM D3DXQuaternionMultiply}
  797. function D3DXQuaternionNormalize(out qOut: TD3DXQuaternion;
  798. const q: TD3DXQuaternion): PD3DXQuaternion; stdcall; external d3dx9mathDLL;
  799. {$EXTERNALSYM D3DXQuaternionNormalize}
  800. // Conjugate and re-norm
  801. function D3DXQuaternionInverse(out qOut: TD3DXQuaternion;
  802. const q: TD3DXQuaternion): PD3DXQuaternion; stdcall; external d3dx9mathDLL;
  803. {$EXTERNALSYM D3DXQuaternionInverse}
  804. // Expects unit quaternions.
  805. // if q = (cos(theta), sin(theta) * v); ln(q) = (0, theta * v)
  806. function D3DXQuaternionLn(out qOut: TD3DXQuaternion;
  807. const q: TD3DXQuaternion): PD3DXQuaternion; stdcall; external d3dx9mathDLL;
  808. {$EXTERNALSYM D3DXQuaternionLn}
  809. // Expects pure quaternions. (w == 0) w is ignored in calculation.
  810. // if q = (0, theta * v); exp(q) = (cos(theta), sin(theta) * v)
  811. function D3DXQuaternionExp(out qOut: TD3DXQuaternion;
  812. const q: TD3DXQuaternion): PD3DXQuaternion; stdcall; external d3dx9mathDLL;
  813. {$EXTERNALSYM D3DXQuaternionExp}
  814. // Spherical linear interpolation between Q1 (s == 0) and Q2 (s == 1).
  815. // Expects unit quaternions.
  816. function D3DXQuaternionSlerp(out qOut: TD3DXQuaternion;
  817. const q1, q2: TD3DXQuaternion; t: Single): PD3DXQuaternion; stdcall; external d3dx9mathDLL;
  818. {$EXTERNALSYM D3DXQuaternionSlerp}
  819. // Spherical quadrangle interpolation.
  820. // Slerp(Slerp(Q1, C, t), Slerp(A, B, t), 2t(1-t))
  821. function D3DXQuaternionSquad(out qOut: TD3DXQuaternion;
  822. const pQ1, pA, pB, pC: TD3DXQuaternion; t: Single): PD3DXQuaternion; stdcall; external d3dx9mathDLL;
  823. {$EXTERNALSYM D3DXQuaternionSquad}
  824. // Setup control points for spherical quadrangle interpolation
  825. // from Q1 to Q2. The control points are chosen in such a way
  826. // to ensure the continuity of tangents with adjacent segments.
  827. procedure D3DXQuaternionSquadSetup(out pAOut, pBOut, pCOut: TD3DXQuaternion;
  828. const pQ0, pQ1, pQ2, pQ3: TD3DXQuaternion); stdcall; external d3dx9mathDLL;
  829. {$EXTERNALSYM D3DXQuaternionSquadSetup}
  830. // Barycentric interpolation.
  831. // Slerp(Slerp(Q1, Q2, f+g), Slerp(Q1, Q3, f+g), g/(f+g))
  832. function D3DXQuaternionBaryCentric(out qOut: TD3DXQuaternion;
  833. const q1, q2, q3: TD3DXQuaternion; f, g: Single): PD3DXQuaternion; stdcall; external d3dx9mathDLL;
  834. {$EXTERNALSYM D3DXQuaternionBaryCentric}
  835. //--------------------------
  836. // Plane
  837. //--------------------------
  838. // inline
  839. // ax + by + cz + dw
  840. function D3DXPlaneDot(const p: TD3DXPlane; const v: TD3DXVector4): Single;
  841. {$EXTERNALSYM D3DXPlaneDot}
  842. // ax + by + cz + d
  843. function D3DXPlaneDotCoord(const p: TD3DXPlane; const v: TD3DXVector3): Single;
  844. {$EXTERNALSYM D3DXPlaneDotCoord}
  845. // ax + by + cz
  846. function D3DXPlaneDotNormal(const p: TD3DXPlane; const v: TD3DXVector3): Single;
  847. {$EXTERNALSYM D3DXPlaneDotNormal}
  848. // non-inline
  849. // Normalize plane (so that |a,b,c| == 1)
  850. function D3DXPlaneNormalize(out pOut: TD3DXPlane; const p: TD3DXPlane): PD3DXPlane; stdcall; external d3dx9mathDLL;
  851. {$EXTERNALSYM D3DXPlaneNormalize}
  852. // Find the intersection between a plane and a line. If the line is
  853. // parallel to the plane, NULL is returned.
  854. function D3DXPlaneIntersectLine(out vOut: TD3DXVector3;
  855. const p: TD3DXPlane; const v1, v2: TD3DXVector3): PD3DXVector3; stdcall; external d3dx9mathDLL;
  856. {$EXTERNALSYM D3DXPlaneIntersectLine}
  857. // Construct a plane from a point and a normal
  858. function D3DXPlaneFromPointNormal(out pOut: TD3DXPlane;
  859. const vPoint, vNormal: TD3DXVector3): PD3DXPlane; stdcall; external d3dx9mathDLL;
  860. {$EXTERNALSYM D3DXPlaneFromPointNormal}
  861. // Construct a plane from 3 points
  862. function D3DXPlaneFromPoints(out pOut: TD3DXPlane;
  863. const v1, v2, v3: TD3DXVector3): PD3DXPlane; stdcall; external d3dx9mathDLL;
  864. {$EXTERNALSYM D3DXPlaneFromPoints}
  865. // Transform a plane by a matrix. The vector (a,b,c) must be normal.
  866. // M should be the inverse transpose of the transformation desired.
  867. function D3DXPlaneTransform(out pOut: TD3DXPlane; const m: TD3DXMatrix): PD3DXPlane; stdcall; external d3dx9mathDLL;
  868. {$EXTERNALSYM D3DXPlaneTransform}
  869. // Transform an array of planes by a matrix. The vectors (a,b,c) must be normal.
  870. // M should be the inverse transpose of the transformation desired.
  871. function D3DXPlaneTransformArray(pOut: PD3DXPlane; OutStride: LongWord;
  872. pP: PD3DXPlane; PStride: LongWord; const m: TD3DXMatrix; n: LongWord): PD3DXPlane; stdcall; external d3dx9mathDLL;
  873. {$EXTERNALSYM D3DXPlaneTransformArray}
  874. //--------------------------
  875. // Color
  876. //--------------------------
  877. // inline
  878. // (1-r, 1-g, 1-b, a)
  879. function D3DXColorNegative(out cOut: TD3DXColor; const c: TD3DXColor): PD3DXColor;
  880. {$EXTERNALSYM D3DXColorNegative}
  881. function D3DXColorAdd(out cOut: TD3DXColor; const c1, c2: TD3DXColor): PD3DXColor;
  882. {$EXTERNALSYM D3DXColorAdd}
  883. function D3DXColorSubtract(out cOut: TD3DXColor; const c1, c2: TD3DXColor): PD3DXColor;
  884. {$EXTERNALSYM D3DXColorSubtract}
  885. function D3DXColorScale(out cOut: TD3DXColor; const c: TD3DXColor; s: Single): PD3DXColor;
  886. {$EXTERNALSYM D3DXColorScale}
  887. // (r1*r2, g1*g2, b1*b2, a1*a2)
  888. function D3DXColorModulate(out cOut: TD3DXColor; const c1, c2: TD3DXColor): PD3DXColor;
  889. {$EXTERNALSYM D3DXColorModulate}
  890. // Linear interpolation of r,g,b, and a. C1 + s(C2-C1)
  891. function D3DXColorLerp(out cOut: TD3DXColor; const c1, c2: TD3DXColor; s: Single): PD3DXColor;
  892. {$EXTERNALSYM D3DXColorLerp}
  893. // non-inline
  894. // Interpolate r,g,b between desaturated color and color.
  895. // DesaturatedColor + s(Color - DesaturatedColor)
  896. function D3DXColorAdjustSaturation(out cOut: TD3DXColor;
  897. const pC: TD3DXColor; s: Single): PD3DXColor; stdcall; external d3dx9mathDLL;
  898. {$EXTERNALSYM D3DXColorAdjustSaturation}
  899. // Interpolate r,g,b between 50% grey and color. Grey + s(Color - Grey)
  900. function D3DXColorAdjustContrast(out cOut: TD3DXColor;
  901. const pC: TD3DXColor; c: Single): PD3DXColor; stdcall; external d3dx9mathDLL;
  902. {$EXTERNALSYM D3DXColorAdjustContrast}
  903. //--------------------------
  904. // Misc
  905. //--------------------------
  906. // Calculate Fresnel term given the cosine of theta (likely obtained by
  907. // taking the dot of two normals), and the refraction index of the material.
  908. function D3DXFresnelTerm(CosTheta, RefractionIndex: Single): Single; stdcall; external d3dx9mathDLL;
  909. {$EXTERNALSYM D3DXFresnelTerm}
  910. //===========================================================================
  911. //
  912. // Matrix Stack
  913. //
  914. //===========================================================================
  915. type
  916. {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DXMatrixStack);'}
  917. {$EXTERNALSYM ID3DXMatrixStack}
  918. ID3DXMatrixStack = interface(IUnknown)
  919. ['{E3357330-CC5E-11d2-A434-00A0C90629A8}']
  920. //
  921. // ID3DXMatrixStack methods
  922. //
  923. // Pops the top of the stack, returns the current top
  924. // *after* popping the top.
  925. function Pop: HResult; stdcall;
  926. // Pushes the stack by one, duplicating the current matrix.
  927. function Push: HResult; stdcall;
  928. // Loads identity in the current matrix.
  929. function LoadIdentity: HResult; stdcall;
  930. // Loads the given matrix into the current matrix
  931. function LoadMatrix(const M: TD3DXMatrix): HResult; stdcall;
  932. // Right-Multiplies the given matrix to the current matrix.
  933. // (transformation is about the current world origin)
  934. function MultMatrix(const M: TD3DXMatrix): HResult; stdcall;
  935. // Left-Multiplies the given matrix to the current matrix
  936. // (transformation is about the local origin of the object)
  937. function MultMatrixLocal(const M: TD3DXMatrix): HResult; stdcall;
  938. // Right multiply the current matrix with the computed rotation
  939. // matrix, counterclockwise about the given axis with the given angle.
  940. // (rotation is about the current world origin)
  941. function RotateAxis(const V: TD3DXVector3; Angle: Single): HResult; stdcall;
  942. // Left multiply the current matrix with the computed rotation
  943. // matrix, counterclockwise about the given axis with the given angle.
  944. // (rotation is about the local origin of the object)
  945. function RotateAxisLocal(const V: TD3DXVector3; Angle: Single): HResult; stdcall;
  946. // Right multiply the current matrix with the computed rotation
  947. // matrix. All angles are counterclockwise. (rotation is about the
  948. // current world origin)
  949. // The rotation is composed of a yaw around the Y axis, a pitch around
  950. // the X axis, and a roll around the Z axis.
  951. function RotateYawPitchRoll(yaw, pitch, roll: Single): HResult; stdcall;
  952. // Left multiply the current matrix with the computed rotation
  953. // matrix. All angles are counterclockwise. (rotation is about the
  954. // local origin of the object)
  955. // The rotation is composed of a yaw around the Y axis, a pitch around
  956. // the X axis, and a roll around the Z axis.
  957. function RotateYawPitchRollLocal(yaw, pitch, roll: Single): HResult; stdcall;
  958. // Right multiply the current matrix with the computed scale
  959. // matrix. (transformation is about the current world origin)
  960. function Scale(x, y, z: Single): HResult; stdcall;
  961. // Left multiply the current matrix with the computed scale
  962. // matrix. (transformation is about the local origin of the object)
  963. function ScaleLocal(x, y, z: Single): HResult; stdcall;
  964. // Right multiply the current matrix with the computed translation
  965. // matrix. (transformation is about the current world origin)
  966. function Translate(x, y, z: Single): HResult; stdcall;
  967. // Left multiply the current matrix with the computed translation
  968. // matrix. (transformation is about the local origin of the object)
  969. function TranslateLocal(x, y, z: Single): HResult; stdcall;
  970. // Obtain the current matrix at the top of the stack
  971. function GetTop: PD3DXMatrix; stdcall;
  972. end;
  973. type
  974. IID_ID3DXMatrixStack = ID3DXMatrixStack;
  975. {$EXTERNALSYM IID_ID3DXMatrixStack}
  976. function D3DXCreateMatrixStack(Flags: DWord; out Stack: ID3DXMatrixStack): HResult; stdcall; external d3dx9mathDLL;
  977. {$EXTERNALSYM D3DXCreateMatrixStack}
  978. ///////////////////////////////////////////////////////////////////////////
  979. //
  980. // Copyright (C) Microsoft Corporation. All Rights Reserved.
  981. //
  982. // File: d3dx9core.h
  983. // Content: D3DX core types and functions
  984. //
  985. ///////////////////////////////////////////////////////////////////////////
  986. ///////////////////////////////////////////////////////////////////////////
  987. // D3DX_SDK_VERSION:
  988. // -----------------
  989. // This identifier is passed to D3DXCheckVersion in order to ensure that an
  990. // application was built against the correct header files and lib files.
  991. // This number is incremented whenever a header (or other) change would
  992. // require applications to be rebuilt. If the version doesn't match,
  993. // D3DXCreateVersion will return FALSE. (The number itself has no meaning.)
  994. ///////////////////////////////////////////////////////////////////////////
  995. const
  996. D3DX_VERSION = 0900;
  997. {$EXTERNALSYM D3DX_VERSION}
  998. D3DX_SDK_VERSION = 9;
  999. {$EXTERNALSYM D3DX_SDK_VERSION}
  1000. function D3DXCheckVersion(D3DSdkVersion, D3DXSdkVersion: LongWord): BOOL; stdcall; external d3dx9coreDLL;
  1001. {$EXTERNALSYM D3DXCheckVersion}
  1002. ///////////////////////////////////////////////////////////////////////////
  1003. // D3DXGetDriverLevel:
  1004. // Returns driver version information:
  1005. //
  1006. // 700 - DX7 level driver
  1007. // 800 - DX8 level driver
  1008. // 900 - DX9 level driver
  1009. ///////////////////////////////////////////////////////////////////////////
  1010. function D3DXGetDriverLevel(pDevice: IDirect3DDevice9): LongWord; stdcall; external d3dx9coreDLL;
  1011. {$EXTERNALSYM D3DXGetDriverLevel}
  1012. ///////////////////////////////////////////////////////////////////////////
  1013. // ID3DXBuffer:
  1014. // ------------
  1015. // The buffer object is used by D3DX to return arbitrary size data.
  1016. //
  1017. // GetBufferPointer -
  1018. // Returns a pointer to the beginning of the buffer.
  1019. //
  1020. // GetBufferSize -
  1021. // Returns the size of the buffer, in bytes.
  1022. ///////////////////////////////////////////////////////////////////////////
  1023. type
  1024. PID3DXBuffer = ^ID3DXBuffer;
  1025. {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DXBuffer);'}
  1026. {$EXTERNALSYM ID3DXBuffer}
  1027. ID3DXBuffer = interface(IUnknown)
  1028. ['{932E6A7E-C68E-45dd-A7BF-53D19C86DB1F}']
  1029. // ID3DXBuffer
  1030. function GetBufferPointer: Pointer; stdcall;
  1031. function GetBufferSize: DWord; stdcall;
  1032. end;
  1033. ///////////////////////////////////////////////////////////////////////////
  1034. // ID3DXFont:
  1035. // ----------
  1036. // Font objects contain the textures and resources needed to render
  1037. // a specific font on a specific device.
  1038. //
  1039. // Begin -
  1040. // Prepartes device for drawing text. This is optional.. if DrawText
  1041. // is called outside of Begin/End, it will call Begin and End for you.
  1042. //
  1043. // DrawText -
  1044. // Draws formatted text on a D3D device. Some parameters are
  1045. // surprisingly similar to those of GDI's DrawText function. See GDI
  1046. // documentation for a detailed description of these parameters.
  1047. //
  1048. // End -
  1049. // Restores device state to how it was when Begin was called.
  1050. //
  1051. // OnLostDevice, OnResetDevice -
  1052. // Call OnLostDevice() on this object before calling Reset() on the
  1053. // device, so that this object can release any stateblocks and video
  1054. // memory resources. After Reset(), the call OnResetDevice().
  1055. //
  1056. ///////////////////////////////////////////////////////////////////////////
  1057. {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DXFont);'}
  1058. {$EXTERNALSYM ID3DXFont}
  1059. ID3DXFont = interface(IUnknown)
  1060. ['{4AAE6B4D-D15F-4909-B09F-8D6AA34AC06B}']
  1061. // ID3DXFont
  1062. function GetDevice(out ppDevice: IDirect3DDevice9): HResult; stdcall;
  1063. function GetLogFont(out pLogFont: TLogFont): HResult; stdcall;
  1064. function _Begin: HResult; stdcall;
  1065. function DrawTextA(pString: PAnsiChar; Count: Integer; const pRect: TRect; Format: DWord; Color: TD3DColor): Integer; stdcall;
  1066. function DrawTextW(pString: PWideChar; Count: Integer; const pRect: TRect; Format: DWord; Color: TD3DColor): Integer; stdcall;
  1067. function _End: HResult; stdcall;
  1068. function OnLostDevice: HResult; stdcall;
  1069. function OnResetDevice: HResult; stdcall;
  1070. end;
  1071. function D3DXCreateFont(pDevice: IDirect3DDevice9; hFont: HFONT;
  1072. out ppFont: ID3DXFont): HResult; stdcall; external d3dx9coreDLL;
  1073. {$EXTERNALSYM D3DXCreateFont}
  1074. function D3DXCreateFontIndirect(pDevice: IDirect3DDevice9;
  1075. const pLogFont: TLogFont; out ppFont: ID3DXFont): HResult; stdcall; external d3dx9coreDLL;
  1076. {$EXTERNALSYM D3DXCreateFontIndirect}
  1077. ///////////////////////////////////////////////////////////////////////////
  1078. // ID3DXSprite:
  1079. // ------------
  1080. // This object intends to provide an easy way to drawing sprites using D3D.
  1081. //
  1082. // Begin -
  1083. // Prepares device for drawing sprites
  1084. //
  1085. // Draw, DrawAffine, DrawTransform -
  1086. // Draws a sprite in screen-space. Before transformation, the sprite is
  1087. // the size of SrcRect, with its top-left corner at the origin (0,0).
  1088. // The color and alpha channels are modulated by Color.
  1089. //
  1090. // End -
  1091. // Restores device state to how it was when Begin was called.
  1092. //
  1093. // OnLostDevice, OnResetDevice -
  1094. // Call OnLostDevice() on this object before calling Reset() on the
  1095. // device, so that this object can release any stateblocks and video
  1096. // memory resources. After Reset(), the call OnResetDevice().
  1097. ///////////////////////////////////////////////////////////////////////////
  1098. type
  1099. {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DXSprite);'}
  1100. {$EXTERNALSYM ID3DXSprite}
  1101. ID3DXSprite = interface(IUnknown)
  1102. ['{B07EC84A-8D35-4e86-A9A0-8DFF21D71075}']
  1103. // ID3DXSprite
  1104. function GetDevice(out ppDevice: IDirect3DDevice9): HResult; stdcall;
  1105. function _Begin: HResult; stdcall;
  1106. function Draw(pSrcTexture: IDirect3DTexture9; pSrcRect: PRect;
  1107. pScaling, pRotationCenter: PD3DXVector2; Rotation: Single;
  1108. pTranslation: PD3DXVector2; Color: TD3DColor): HResult; stdcall;
  1109. function DrawTransform(pSrcTexture: IDirect3DTexture9; pSrcRect: PRect;
  1110. const pTransform: TD3DXMatrix; Color: TD3DColor): HResult; stdcall;
  1111. function _End: HResult; stdcall;
  1112. function OnLostDevice: HResult; stdcall;
  1113. function OnResetDevice: HResult; stdcall;
  1114. end;
  1115. function D3DXCreateSprite(ppDevice: IDirect3DDevice9;
  1116. out ppSprite: ID3DXSprite): HResult; stdcall; external d3dx9coreDLL;
  1117. {$EXTERNALSYM D3DXCreateSprite}
  1118. ///////////////////////////////////////////////////////////////////////////
  1119. // ID3DXRenderToSurface:
  1120. // ---------------------
  1121. // This object abstracts rendering to surfaces. These surfaces do not
  1122. // necessarily need to be render targets. If they are not, a compatible
  1123. // render target is used, and the result copied into surface at end scene.
  1124. //
  1125. // BeginScene, EndScene -
  1126. // Call BeginScene() and EndScene() at the beginning and ending of your
  1127. // scene. These calls will setup and restore render targets, viewports,
  1128. // etc..
  1129. //
  1130. // OnLostDevice, OnResetDevice -
  1131. // Call OnLostDevice() on this object before calling Reset() on the
  1132. // device, so that this object can release any stateblocks and video
  1133. // memory resources. After Reset(), the call OnResetDevice().
  1134. ///////////////////////////////////////////////////////////////////////////
  1135. type
  1136. PD3DXRTSDesc = ^TD3DXRTSDesc;
  1137. _D3DXRTS_DESC = packed record
  1138. Width: LongWord;
  1139. Height: LongWord;
  1140. Format: TD3DFormat;
  1141. DepthStencil: BOOL;
  1142. DepthStencilFormat: TD3DFormat;
  1143. end {_D3DXRTS_DESC};
  1144. {$EXTERNALSYM _D3DXRTS_DESC}
  1145. D3DXRTS_DESC = _D3DXRTS_DESC;
  1146. {$EXTERNALSYM D3DXRTS_DESC}
  1147. TD3DXRTSDesc = _D3DXRTS_DESC;
  1148. {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DXRenderToSurface);'}
  1149. {$EXTERNALSYM ID3DXRenderToSurface}
  1150. ID3DXRenderToSurface = interface(IUnknown)
  1151. ['{0D014791-8863-4c2c-A1C0-02F3E0C0B653}']
  1152. // ID3DXRenderToSurface
  1153. function GetDevice(out ppDevice: IDirect3DDevice9): HResult; stdcall;
  1154. function GetDesc(out pDesc: TD3DXRTSDesc): HResult; stdcall;
  1155. function BeginScene(pSurface: IDirect3DSurface9; pViewport: PD3DViewport9): HResult; stdcall;
  1156. function EndScene(MipFilter: DWORD): HResult; stdcall;
  1157. function OnLostDevice: HResult; stdcall;
  1158. function OnResetDevice: HResult; stdcall;
  1159. end;
  1160. function D3DXCreateRenderToSurface(ppDevice: IDirect3DDevice9;
  1161. Width: LongWord;
  1162. Height: LongWord;
  1163. Format: TD3DFormat;
  1164. DepthStencil: BOOL;
  1165. DepthStencilFormat: TD3DFormat;
  1166. out ppRenderToSurface: ID3DXRenderToSurface): HResult; stdcall; external d3dx9coreDLL;
  1167. {$EXTERNALSYM D3DXCreateRenderToSurface}
  1168. ///////////////////////////////////////////////////////////////////////////
  1169. // ID3DXRenderToEnvMap:
  1170. // --------------------
  1171. // This object abstracts rendering to environment maps. These surfaces
  1172. // do not necessarily need to be render targets. If they are not, a
  1173. // compatible render target is used, and the result copied into the
  1174. // environment map at end scene.
  1175. //
  1176. // BeginCube, BeginSphere, BeginHemisphere, BeginParabolic -
  1177. // This function initiates the rendering of the environment map. As
  1178. // parameters, you pass the textures in which will get filled in with
  1179. // the resulting environment map.
  1180. //
  1181. // Face -
  1182. // Call this function to initiate the drawing of each face. For each
  1183. // environment map, you will call this six times.. once for each face
  1184. // in D3DCUBEMAP_FACES.
  1185. //
  1186. // End -
  1187. // This will restore all render targets, and if needed compose all the
  1188. // rendered faces into the environment map surfaces.
  1189. //
  1190. // OnLostDevice, OnResetDevice -
  1191. // Call OnLostDevice() on this object before calling Reset() on the
  1192. // device, so that this object can release any stateblocks and video
  1193. // memory resources. After Reset(), the call OnResetDevice().
  1194. ///////////////////////////////////////////////////////////////////////////
  1195. type
  1196. PD3DXRTEDesc = ^TD3DXRTEDesc;
  1197. _D3DXRTE_DESC = record
  1198. Size: LongWord;
  1199. MipLevels: LongWord;
  1200. Format: TD3DFormat;
  1201. DepthStencil: Bool;
  1202. DepthStencilFormat: TD3DFormat;
  1203. end {_D3DXRTE_DESC};
  1204. {$EXTERNALSYM _D3DXRTE_DESC}
  1205. D3DXRTE_DESC = _D3DXRTE_DESC;
  1206. {$EXTERNALSYM D3DXRTE_DESC}
  1207. TD3DXRTEDesc = _D3DXRTE_DESC;
  1208. {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DXRenderToEnvMap);'}
  1209. {$EXTERNALSYM ID3DXRenderToEnvMap}
  1210. ID3DXRenderToEnvMap = interface(IUnknown)
  1211. ['{1561135E-BC78-495b-8586-94EA537BD557}']
  1212. // ID3DXRenderToEnvMap
  1213. function GetDevice(out ppDevice: IDirect3DDevice9): HResult; stdcall;
  1214. function GetDesc(out pDesc: TD3DXRTEDesc): HResult; stdcall;
  1215. function BeginCube(pCubeTex: IDirect3DCubeTexture9): HResult; stdcall;
  1216. function BeginSphere(pTex: IDirect3DTexture9): HResult; stdcall;
  1217. function BeginHemisphere(pTexZPos, pTexZNeg: IDirect3DTexture9): HResult; stdcall;
  1218. function BeginParabolic(pTexZPos, pTexZNeg: IDirect3DTexture9): HResult; stdcall;
  1219. function Face(Face: TD3DCubemapFaces; MipFilter: DWORD): HResult; stdcall;
  1220. function _End(MipFilter: DWORD): HResult; stdcall;
  1221. function OnLostDevice: HResult; stdcall;
  1222. function OnResetDevice: HResult; stdcall;
  1223. end;
  1224. function D3DXCreateRenderToEnvMap(ppDevice: IDirect3DDevice9;
  1225. Size: LongWord;
  1226. MipLevels: LongWord;
  1227. Format: TD3DFormat;
  1228. DepthStencil: BOOL;
  1229. DepthStencilFormat: TD3DFormat;
  1230. out ppRenderToEnvMap: ID3DXRenderToEnvMap): HResult; stdcall; external d3dx9coreDLL;
  1231. {$EXTERNALSYM D3DXCreateRenderToEnvMap}
  1232. ///////////////////////////////////////////////////////////////////////////
  1233. // ID3DXLine:
  1234. // ------------
  1235. // This object intends to provide an easy way to draw lines using D3D.
  1236. //
  1237. // Begin -
  1238. // Prepares device for drawing lines
  1239. //
  1240. // Draw -
  1241. // Draws a line strip in screen-space.
  1242. // Input is in the form of a array defining points on the line strip. of D3DXVECTOR2
  1243. //
  1244. // DrawTransform -
  1245. // Draws a line in screen-space with a specified input transformation matrix.
  1246. //
  1247. // End -
  1248. // Restores device state to how it was when Begin was called.
  1249. //
  1250. // SetPattern -
  1251. // Applies a stipple pattern to the line. Input is one 32-bit
  1252. // DWORD which describes the stipple pattern. 1 is opaque, 0 is
  1253. // transparent.
  1254. //
  1255. // SetPatternScale -
  1256. // Stretches the stipple pattern in the u direction. Input is one
  1257. // floating-point value. 0.0f is no scaling, whereas 1.0f doubles
  1258. // the length of the stipple pattern.
  1259. //
  1260. // SetWidth -
  1261. // Specifies the thickness of the line in the v direction. Input is
  1262. // one floating-point value.
  1263. //
  1264. // SetAntialias -
  1265. // Toggles line antialiasing. Input is a BOOL.
  1266. // TRUE = Antialiasing on.
  1267. // FALSE = Antialiasing off.
  1268. //
  1269. // SetGLLines -
  1270. // Toggles non-antialiased OpenGL line emulation. Input is a BOOL.
  1271. // TRUE = OpenGL line emulation on.
  1272. // FALSE = OpenGL line emulation off.
  1273. //
  1274. // OpenGL line: Regular line:
  1275. // *\ *\
  1276. // | \ / \
  1277. // | \ *\ \
  1278. // *\ \ \ \
  1279. // \ \ \ \
  1280. // \ * \ *
  1281. // \ | \ /
  1282. // \| *
  1283. // *
  1284. //
  1285. // OnLostDevice, OnResetDevice -
  1286. // Call OnLostDevice() on this object before calling Reset() on the
  1287. // device, so that this object can release any stateblocks and video
  1288. // memory resources. After Reset(), the call OnResetDevice().
  1289. ///////////////////////////////////////////////////////////////////////////
  1290. type
  1291. {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DXLine);'}
  1292. {$EXTERNALSYM ID3DXLine}
  1293. ID3DXLine = interface(IUnknown)
  1294. ['{72CE4D70-CC40-4143-A896-32E50AD2EF35}']
  1295. // ID3DXLine
  1296. function GetDevice(out ppDevice: IDirect3DDevice9): HResult; stdcall;
  1297. function _Begin: HResult; stdcall;
  1298. function Draw(pVertexList: PD3DXVector2; dwVertexListCount: DWORD; Color: TD3DColor): HResult; stdcall;
  1299. function DrawTransform(pVertexList: PD3DXVector3; dwVertexListCount: DWORD;
  1300. const pTransform: TD3DXMatrix; Color: TD3DColor): HResult; stdcall;
  1301. function SetPattern(dwPattern: DWORD): HResult; stdcall;
  1302. function GetPattern: DWORD; stdcall;
  1303. function SetPatternScale(fPatternScale: Single): HResult; stdcall;
  1304. function GetPatternScale: Single; stdcall;
  1305. function SetWidth(fWidth: Single): HResult; stdcall;
  1306. function GetWidth: Single; stdcall;
  1307. function SetAntialias(bAntialias: BOOL): HResult; stdcall;
  1308. function GetAntialias: BOOL; stdcall;
  1309. function SetGLLines(bGLLines: BOOL): HResult; stdcall;
  1310. function GetGLLines: BOOL; stdcall;
  1311. function _End: HResult; stdcall;
  1312. function OnLostDevice: HResult; stdcall;
  1313. function OnResetDevice: HResult; stdcall;
  1314. end;
  1315. function D3DXCreateLine(ppDevice: IDirect3DDevice9;
  1316. out ppLine: ID3DXLine): HResult; stdcall; external d3dx9coreDLL;
  1317. {$EXTERNALSYM D3DXCreateLine}
  1318. //////////////////////////////////////////////////////////////////////////////
  1319. //
  1320. // Copyright (c) Microsoft Corporation. All rights reserved.
  1321. //
  1322. // File: d3dx9shader.h
  1323. // Content: D3DX Shader APIs
  1324. //
  1325. //////////////////////////////////////////////////////////////////////////////
  1326. //---------------------------------------------------------------------------
  1327. // D3DXTX_VERSION:
  1328. // --------------
  1329. // Version token used to create a procedural texture filler in effects
  1330. // Used by D3DXFill[]TX functions
  1331. //---------------------------------------------------------------------------
  1332. // #define D3DXTX_VERSION(_Major,_Minor) (('T' << 24) | ('X' << 16) | ((_Major) << 8) | (_Minor))
  1333. function D3DXTX_VERSION(_Major, _Minor: Byte): DWORD;
  1334. {$EXTERNALSYM D3DXTX_VERSION}
  1335. //----------------------------------------------------------------------------
  1336. // D3DXSHADER flags:
  1337. // -----------------
  1338. // D3DXSHADER_DEBUG
  1339. // Insert debug file/line/type/symbol information.
  1340. //
  1341. // D3DXSHADER_SKIPVALIDATION
  1342. // Do not validate the generated code against known capabilities and
  1343. // constraints. This option is only recommended when compiling shaders
  1344. // you KNOW will work. (ie. have compiled before without this option.)
  1345. // Shaders are always validated by D3D before they are set to the device.
  1346. //
  1347. // D3DXSHADER_SKIPOPTIMIZATION (valid for D3DXCompileShader calls only)
  1348. // Instructs the compiler to skip optimization steps during code generation.
  1349. // Unless you are trying to isolate a problem in your code, and suspect the
  1350. // compiler, using this option is not recommended.
  1351. //
  1352. // D3DXSHADER_PACKMATRIX_ROWMAJOR
  1353. // Unless explicitly specified, matrices will be packed in row-major order
  1354. // on input and output from the shader.
  1355. //
  1356. // D3DXSHADER_PACKMATRIX_COLUMNMAJOR
  1357. // Unless explicitly specified, matrices will be packed in column-major
  1358. // order on input and output from the shader. This is generally more
  1359. // efficient, since it allows vector-matrix multiplication to be performed
  1360. // using a series of dot-products.
  1361. //----------------------------------------------------------------------------
  1362. const
  1363. D3DXSHADER_DEBUG = (1 shl 0);
  1364. {$EXTERNALSYM D3DXSHADER_DEBUG}
  1365. D3DXSHADER_SKIPVALIDATION = (1 shl 2);
  1366. {$EXTERNALSYM D3DXSHADER_SKIPVALIDATION}
  1367. D3DXSHADER_SKIPOPTIMIZATION = (1 shl 3);
  1368. {$EXTERNALSYM D3DXSHADER_SKIPOPTIMIZATION}
  1369. D3DXSHADER_PACKMATRIX_ROWMAJOR = (1 shl 4);
  1370. {$EXTERNALSYM D3DXSHADER_PACKMATRIX_ROWMAJOR}
  1371. D3DXSHADER_PACKMATRIX_COLUMNMAJOR = (1 shl 5);
  1372. {$EXTERNALSYM D3DXSHADER_PACKMATRIX_COLUMNMAJOR}
  1373. //----------------------------------------------------------------------------
  1374. // D3DXHANDLE:
  1375. // -----------
  1376. // Handle values used to efficiently reference shader and effect parameters.
  1377. // Strings can be used as handles. However, handles are not always strings.
  1378. //----------------------------------------------------------------------------
  1379. type
  1380. {$HPPEMIT 'typedef D3DXHANDLE TD3DXHandle;'}
  1381. {$HPPEMIT 'typedef D3DXHANDLE *PD3DXHandle;'}
  1382. PD3DXHandle = ^TD3DXHandle;
  1383. {$EXTERNALSYM PD3DXHandle}
  1384. TD3DXHandle = {$IFDEF TYPE_IDENTITY}type {$ENDIF}PAnsiChar;
  1385. {$NODEFINE TD3DXHandle}
  1386. //----------------------------------------------------------------------------
  1387. // D3DXMACRO:
  1388. // ----------
  1389. // Preprocessor macro definition. The application pass in a NULL-terminated
  1390. // array of this structure to various D3DX APIs. This enables the application
  1391. // to #define tokens at runtime, before the file is parsed.
  1392. //----------------------------------------------------------------------------
  1393. PD3DXMacro = ^TD3DXMacro;
  1394. _D3DXMACRO = packed record
  1395. Name: PAnsiChar;
  1396. Definition: PAnsiChar;
  1397. end;
  1398. {$EXTERNALSYM _D3DXMACRO}
  1399. D3DXMACRO = _D3DXMACRO;
  1400. {$EXTERNALSYM D3DXMACRO}
  1401. TD3DXMacro = _D3DXMACRO;
  1402. //----------------------------------------------------------------------------
  1403. // D3DXSEMANTIC:
  1404. //----------------------------------------------------------------------------
  1405. PD3DXSemantic = ^TD3DXSemantic;
  1406. _D3DXSEMANTIC = packed record
  1407. Usage: LongWord;
  1408. UsageIndex: LongWord;
  1409. end;
  1410. {$EXTERNALSYM _D3DXSEMANTIC}
  1411. D3DXSEMANTIC = _D3DXSEMANTIC;
  1412. {$EXTERNALSYM D3DXSEMANTIC}
  1413. TD3DXSemantic = _D3DXSEMANTIC;
  1414. //----------------------------------------------------------------------------
  1415. // D3DXFRAGMENT_DESC:
  1416. //----------------------------------------------------------------------------
  1417. PD3DXFragmentDesc = ^TD3DXFragmentDesc;
  1418. _D3DXFRAGMENT_DESC = packed record
  1419. Name: PAnsiChar;
  1420. Target: DWORD;
  1421. end;
  1422. {$EXTERNALSYM _D3DXFRAGMENT_DESC}
  1423. D3DXFRAGMENT_DESC = _D3DXFRAGMENT_DESC;
  1424. {$EXTERNALSYM D3DXFRAGMENT_DESC}
  1425. TD3DXFragmentDesc = _D3DXFRAGMENT_DESC;
  1426. //----------------------------------------------------------------------------
  1427. // D3DXREGISTER_SET:
  1428. //----------------------------------------------------------------------------
  1429. _D3DXREGISTER_SET = (
  1430. D3DXRS_BOOL,
  1431. D3DXRS_INT4,
  1432. D3DXRS_FLOAT4,
  1433. D3DXRS_SAMPLER
  1434. );
  1435. {$EXTERNALSYM _D3DXREGISTER_SET}
  1436. D3DXREGISTER_SET = _D3DXREGISTER_SET;
  1437. {$EXTERNALSYM D3DXREGISTER_SET}
  1438. TD3DXRegisterSet = _D3DXREGISTER_SET;
  1439. //----------------------------------------------------------------------------
  1440. // D3DXPARAMETER_CLASS:
  1441. //----------------------------------------------------------------------------
  1442. _D3DXPARAMETER_CLASS = (
  1443. D3DXPC_SCALAR,
  1444. D3DXPC_VECTOR,
  1445. D3DXPC_MATRIX_ROWS,
  1446. D3DXPC_MATRIX_COLUMNS,
  1447. D3DXPC_OBJECT,
  1448. D3DXPC_STRUCT
  1449. );
  1450. {$EXTERNALSYM _D3DXPARAMETER_CLASS}
  1451. D3DXPARAMETER_CLASS = _D3DXPARAMETER_CLASS;
  1452. {$EXTERNALSYM D3DXPARAMETER_CLASS}
  1453. TD3DXParameterClass = _D3DXPARAMETER_CLASS;
  1454. //----------------------------------------------------------------------------
  1455. // D3DXPARAMETER_TYPE:
  1456. //----------------------------------------------------------------------------
  1457. _D3DXPARAMETER_TYPE = (
  1458. D3DXPT_VOID,
  1459. D3DXPT_BOOL,
  1460. D3DXPT_INT,
  1461. D3DXPT_FLOAT,
  1462. D3DXPT_STRING,
  1463. D3DXPT_TEXTURE,
  1464. D3DXPT_TEXTURE1D,
  1465. D3DXPT_TEXTURE2D,
  1466. D3DXPT_TEXTURE3D,
  1467. D3DXPT_TEXTURECUBE,
  1468. D3DXPT_SAMPLER,
  1469. D3DXPT_SAMPLER1D,
  1470. D3DXPT_SAMPLER2D,
  1471. D3DXPT_SAMPLER3D,
  1472. D3DXPT_SAMPLERCUBE,
  1473. D3DXPT_PIXELSHADER,
  1474. D3DXPT_VERTEXSHADER,
  1475. D3DXPT_PIXELFRAGMENT,
  1476. D3DXPT_VERTEXFRAGMENT
  1477. );
  1478. {$EXTERNALSYM _D3DXPARAMETER_TYPE}
  1479. D3DXPARAMETER_TYPE = _D3DXPARAMETER_TYPE;
  1480. {$EXTERNALSYM D3DXPARAMETER_TYPE}
  1481. TD3DXParameterType = _D3DXPARAMETER_TYPE;
  1482. //----------------------------------------------------------------------------
  1483. // D3DXCONSTANTTABLE_DESC:
  1484. //----------------------------------------------------------------------------
  1485. PD3DXConstantTableDesc = ^TD3DXConstantTableDesc;
  1486. _D3DXCONSTANTTABLE_DESC = packed record
  1487. Creator: PAnsiChar; // Creator string
  1488. Version: DWORD; // Shader version
  1489. Constants: LongWord; // Number of constants
  1490. end;
  1491. {$EXTERNALSYM _D3DXCONSTANTTABLE_DESC}
  1492. D3DXCONSTANTTABLE_DESC = _D3DXCONSTANTTABLE_DESC;
  1493. {$EXTERNALSYM D3DXCONSTANTTABLE_DESC}
  1494. TD3DXConstantTableDesc = _D3DXCONSTANTTABLE_DESC;
  1495. //----------------------------------------------------------------------------
  1496. // D3DXCONSTANT_DESC:
  1497. //----------------------------------------------------------------------------
  1498. PD3DXConstantDesc = ^TD3DXConstantDesc;
  1499. _D3DXCONSTANT_DESC = packed record
  1500. Name: PAnsiChar; // Constant name
  1501. RegisterSet: TD3DXRegisterSet; // Register set
  1502. RegisterIndex: LongWord; // Register index
  1503. RegisterCount: LongWord; // Number of registers occupied
  1504. _Class: TD3DXParameterClass; // Class
  1505. _Type: TD3DXParameterType; // Component type
  1506. Rows: LongWord; // Number of rows
  1507. Columns: LongWord; // Number of columns
  1508. Elements: LongWord; // Number of array elements
  1509. StructMembers: LongWord; // Number of structure member sub-parameters
  1510. Bytes: LongWord; // Data size, in bytes
  1511. DefaultValue: Pointer; // Pointer to default value
  1512. end;
  1513. {$EXTERNALSYM _D3DXCONSTANT_DESC}
  1514. D3DXCONSTANT_DESC = _D3DXCONSTANT_DESC;
  1515. {$EXTERNALSYM D3DXCONSTANT_DESC}
  1516. TD3DXConstantDesc = _D3DXCONSTANT_DESC;
  1517. //----------------------------------------------------------------------------
  1518. // ID3DXConstantTable:
  1519. //----------------------------------------------------------------------------
  1520. PID3DXConstantTable = ^ID3DXConstantTable;
  1521. {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DXConstantTable);'}
  1522. {$EXTERNALSYM ID3DXConstantTable}
  1523. ID3DXConstantTable = interface(ID3DXBuffer)
  1524. ['{9DCA3190-38B9-4fc3-92E3-39C6DDFB358B}']
  1525. // Descs
  1526. function GetDesc(out pDesc: TD3DXConstantTableDesc): HResult; stdcall;
  1527. function GetConstantDesc(hConstant: TD3DXHandle; pConstantDesc: PD3DXConstantDesc; var pCount: LongWord): HResult; stdcall;
  1528. // Handle operations
  1529. function GetConstant(hConstant: TD3DXHandle; Index: LongWord): TD3DXHandle; stdcall;
  1530. function GetConstantByName(hConstant: TD3DXHandle; pName: PAnsiChar): TD3DXHandle; stdcall;
  1531. function GetConstantElement(hConstant: TD3DXHandle; Index: LongWord): TD3DXHandle; stdcall;
  1532. // Set Constants
  1533. function SetDefaults(pDevice: IDirect3DDevice9): HResult; stdcall;
  1534. function SetValue(pDevice: IDirect3DDevice9; hConstant: TD3DXHandle; pData: Pointer; Bytes: LongWord): HResult; stdcall;
  1535. function SetBool(pDevice: IDirect3DDevice9; hConstant: TD3DXHandle; b: BOOL): HResult; stdcall;
  1536. function SetBoolArray(pDevice: IDirect3DDevice9; hConstant: TD3DXHandle; pb: PBOOL; Count: LongWord): HResult; stdcall;
  1537. function SetInt(pDevice: IDirect3DDevice9; hConstant: TD3DXHandle; n: Integer): HResult; stdcall;
  1538. function SetIntArray(pDevice: IDirect3DDevice9; hConstant: TD3DXHandle; pn: PInteger; Count: LongWord): HResult; stdcall;
  1539. function SetFloat(pDevice: IDirect3DDevice9; hConstant: TD3DXHandle; f: Single): HResult; stdcall;
  1540. function SetFloatArray(pDevice: IDirect3DDevice9; hConstant: TD3DXHandle; pf: PSingle; Count: LongWord): HResult; stdcall;
  1541. function SetVector(pDevice: IDirect3DDevice9; hConstant: TD3DXHandle; const pVector: TD3DXVector4): HResult; stdcall;
  1542. function SetVectorArray(pDevice: IDirect3DDevice9; hConstant: TD3DXHandle; pVector: PD3DXVector4; Count: LongWord): HResult; stdcall;
  1543. function SetMatrix(pDevice: IDirect3DDevice9; hConstant: TD3DXHandle; const pMatrix: TD3DXMatrix): HResult; stdcall;
  1544. function SetMatrixArray(pDevice: IDirect3DDevice9; hConstant: TD3DXHandle; pMatrix: PD3DXMatrix; Count: LongWord): HResult; stdcall;
  1545. function SetMatrixPointerArray(pDevice: IDirect3DDevice9; hConstant: TD3DXHandle; ppMatrix: PPD3DXMatrix; Count: LongWord): HResult; stdcall;
  1546. function SetMatrixTranspose(pDevice: IDirect3DDevice9; hConstant: TD3DXHandle; const pMatrix: TD3DXMatrix): HResult; stdcall;
  1547. function SetMatrixTransposeArray(pDevice: IDirect3DDevice9; hConstant: TD3DXHandle; pMatrix: PD3DXMatrix; Count: LongWord): HResult; stdcall;
  1548. function SetMatrixTransposePointerArray(pDevice: IDirect3DDevice9; hConstant: TD3DXHandle; ppMatrix: PPD3DXMatrix; Count: LongWord): HResult; stdcall;
  1549. end;
  1550. //----------------------------------------------------------------------------
  1551. // ID3DXFragmentLinker
  1552. //----------------------------------------------------------------------------
  1553. {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DXFragmentLinker);'}
  1554. {$EXTERNALSYM ID3DXFragmentLinker}
  1555. ID3DXFragmentLinker = interface(IUnknown)
  1556. ['{D59D3777-C973-4a3c-B4B0-2A62CD3D8B40}']
  1557. // ID3DXFragmentLinker
  1558. // fragment access and information retrieval functions
  1559. function GetDevice(out ppDevice: IDirect3DDevice9): HResult; stdcall;
  1560. function GetNumberOfFragments: LongWord; stdcall;
  1561. function GetFragmentHandleByIndex(Index: LongWord): TD3DXHandle; stdcall;
  1562. function GetFragmentHandleByName(Name: PAnsiChar): TD3DXHandle; stdcall;
  1563. function GetFragmentDesc(Name: TD3DXHandle; out FragDesc: TD3DXFragmentDesc): HResult; stdcall;
  1564. // add the fragments in the buffer to the linker
  1565. function AddFragments(Fragments: PDWORD): HResult; stdcall;
  1566. // Create a buffer containing the fragments. Suitable for saving to disk
  1567. function GetAllFragments(out ppBuffer: ID3DXBuffer): HResult; stdcall;
  1568. function GetFragment(Name: TD3DXHandle; out ppBuffer: ID3DXBuffer): HResult; stdcall;
  1569. function LinkShader(pTarget: PAnsiChar; Flags: DWORD; rgFragmentHandles: PD3DXHandle; cFragments: LongWord; out ppBuffer: ID3DXBuffer; ppErrorMsgs: PID3DXBuffer): HResult; stdcall;
  1570. function LinkVertexShader(pTarget: PAnsiChar; Flags: DWORD; rgFragmentHandles: PD3DXHandle; cFragments: LongWord; out pVShader: IDirect3DVertexShader9; ppErrorMsgs: PID3DXBuffer): HResult; stdcall;
  1571. function ClearCache: HResult; stdcall;
  1572. end;
  1573. //----------------------------------------------------------------------------
  1574. // D3DXINCLUDE_TYPE:
  1575. //----------------------------------------------------------------------------
  1576. type
  1577. PD3DXIncludeType = ^TD3DXIncludeType;
  1578. _D3DXINCLUDE_TYPE = (
  1579. D3DXINC_LOCAL,
  1580. D3DXINC_SYSTEM
  1581. );
  1582. {$EXTERNALSYM _D3DXINCLUDE_TYPE}
  1583. D3DXINCLUDE_TYPE = _D3DXINCLUDE_TYPE;
  1584. {$EXTERNALSYM D3DXINCLUDE_TYPE}
  1585. TD3DXIncludeType = _D3DXINCLUDE_TYPE;
  1586. //----------------------------------------------------------------------------
  1587. // ID3DXInclude:
  1588. // -------------
  1589. // This interface is intended to be implemented by the application, and can
  1590. // be used by various D3DX APIs. This enables application-specific handling
  1591. // of #include directives in source files.
  1592. //
  1593. // Open()
  1594. // Opens an include file. If successful, it should fill in ppData and
  1595. // pBytes. The data pointer returned must remain valid until Close is
  1596. // subsequently called.
  1597. // Close()
  1598. // Closes an include file. If Open was successful, Close is guaranteed
  1599. // to be called before the API using this interface returns.
  1600. //----------------------------------------------------------------------------
  1601. PID3DXInclude = ^ID3DXInclude;
  1602. {$EXTERNALSYM ID3DXInclude}
  1603. ID3DXInclude = class
  1604. function Open(IncludeType: TD3DXIncludeType; pFileName: PAnsiChar; pParentData: Pointer; out ppData: Pointer; out pBytes: LongWord): HResult; virtual; stdcall; abstract;
  1605. function Close(pData: Pointer): HResult; virtual; stdcall; abstract;
  1606. end;
  1607. //////////////////////////////////////////////////////////////////////////////
  1608. // APIs //////////////////////////////////////////////////////////////////////
  1609. //////////////////////////////////////////////////////////////////////////////
  1610. //----------------------------------------------------------------------------
  1611. // D3DXAssembleShader:
  1612. // -------------------
  1613. // Assembles a shader.
  1614. //
  1615. // Parameters:
  1616. // pSrcFile
  1617. // Source file name
  1618. // hSrcModule
  1619. // Module handle. if NULL, current module will be used
  1620. // pSrcResource
  1621. // Resource name in module
  1622. // pSrcData
  1623. // Pointer to source code
  1624. // SrcDataLen
  1625. // Size of source code, in bytes
  1626. // pDefines
  1627. // Optional NULL-terminated array of preprocessor macro definitions.
  1628. // pInclude
  1629. // Optional interface pointer to use for handling #include directives.
  1630. // If this parameter is NULL, #includes will be honored when assembling
  1631. // from file, and will error when assembling from resource or memory.
  1632. // Flags
  1633. // See D3DXSHADER_xxx flags
  1634. // ppShader
  1635. // Returns a buffer containing the created shader. This buffer contains
  1636. // the assembled shader code, as well as any embedded debug info.
  1637. // (See D3DXGetShaderDebugInfo)
  1638. // ppErrorMsgs
  1639. // Returns a buffer containing a listing of errors and warnings that were
  1640. // encountered during assembly. If you are running in a debugger,
  1641. // these are the same messages you will see in your debug output.
  1642. //----------------------------------------------------------------------------
  1643. function D3DXAssembleShaderFromFileA(
  1644. pSrcFile: PAnsiChar;
  1645. pDefines: PD3DXMacro;
  1646. pInclude: ID3DXInclude;
  1647. Flags: DWORD;
  1648. ppShader: PID3DXBuffer;
  1649. ppErrorMsgs: PID3DXBuffer): HResult; stdcall; external d3dx9shaderDLL name 'D3DXAssembleShaderFromFileA';
  1650. {$EXTERNALSYM D3DXAssembleShaderFromFileA}
  1651. function D3DXAssembleShaderFromFileW(
  1652. pSrcFile: PWideChar;
  1653. pDefines: PD3DXMacro;
  1654. pInclude: ID3DXInclude;
  1655. Flags: DWORD;
  1656. ppShader: PID3DXBuffer;
  1657. ppErrorMsgs: PID3DXBuffer): HResult; stdcall; external d3dx9shaderDLL name 'D3DXAssembleShaderFromFileW';
  1658. {$EXTERNALSYM D3DXAssembleShaderFromFileW}
  1659. function D3DXAssembleShaderFromFile(
  1660. pSrcFile: PChar;
  1661. pDefines: PD3DXMacro;
  1662. pInclude: ID3DXInclude;
  1663. Flags: DWORD;
  1664. ppShader: PID3DXBuffer;
  1665. ppErrorMsgs: PID3DXBuffer): HResult; stdcall; external d3dx9shaderDLL name 'D3DXAssembleShaderFromFileA';
  1666. {$EXTERNALSYM D3DXAssembleShaderFromFile}
  1667. function D3DXAssembleShaderFromResourceA(
  1668. hSrcModule: HModule;
  1669. pSrcResource: PAnsiChar;
  1670. pDefines: PD3DXMacro;
  1671. pInclude: ID3DXInclude;
  1672. Flags: DWord;
  1673. ppShader: PID3DXBuffer;
  1674. ppErrorMsgs: PID3DXBuffer): HResult; stdcall; external d3dx9shaderDLL name 'D3DXAssembleShaderFromResourceA';
  1675. {$EXTERNALSYM D3DXAssembleShaderFromResourceA}
  1676. function D3DXAssembleShaderFromResourceW(
  1677. hSrcModule: HModule;
  1678. pSrcResource: PWideChar;
  1679. pDefines: PD3DXMacro;
  1680. pInclude: ID3DXInclude;
  1681. Flags: DWord;
  1682. ppShader: PID3DXBuffer;
  1683. ppErrorMsgs: PID3DXBuffer): HResult; stdcall; external d3dx9shaderDLL name 'D3DXAssembleShaderFromResourceW';
  1684. {$EXTERNALSYM D3DXAssembleShaderFromResourceW}
  1685. function D3DXAssembleShaderFromResource(
  1686. hSrcModule: HModule;
  1687. pSrcResource: PChar;
  1688. pDefines: PD3DXMacro;
  1689. pInclude: ID3DXInclude;
  1690. Flags: DWord;
  1691. ppShader: PID3DXBuffer;
  1692. ppErrorMsgs: PID3DXBuffer): HResult; stdcall; external d3dx9shaderDLL name 'D3DXAssembleShaderFromResourceA';
  1693. {$EXTERNALSYM D3DXAssembleShaderFromResource}
  1694. function D3DXAssembleShader(
  1695. pSrcData: PAnsiChar;
  1696. SrcDataLen: LongWord;
  1697. pDefines: PD3DXMacro;
  1698. pInclude: ID3DXInclude;
  1699. Flags: DWord;
  1700. ppShader: PID3DXBuffer;
  1701. ppErrorMsgs: PID3DXBuffer): HResult; stdcall; external d3dx9shaderDLL;
  1702. {$EXTERNALSYM D3DXAssembleShader}
  1703. //----------------------------------------------------------------------------
  1704. // D3DXCompileShader:
  1705. // ------------------
  1706. // Compiles a shader.
  1707. //
  1708. // Parameters:
  1709. // pSrcFile
  1710. // Source file name.
  1711. // hSrcModule
  1712. // Module handle. if NULL, current module will be used.
  1713. // pSrcResource
  1714. // Resource name in module.
  1715. // pSrcData
  1716. // Pointer to source code.
  1717. // SrcDataLen
  1718. // Size of source code, in bytes.
  1719. // pDefines
  1720. // Optional NULL-terminated array of preprocessor macro definitions.
  1721. // pInclude
  1722. // Optional interface pointer to use for handling #include directives.
  1723. // If this parameter is NULL, #includes will be honored when compiling
  1724. // from file, and will error when compiling from resource or memory.
  1725. // pFunctionName
  1726. // Name of the entrypoint function where execution should begin.
  1727. // pTarget
  1728. // Instruction set to be used when generating code. Currently supported
  1729. // targets are "vs_1_1", "vs_2_0", "vs_2_sw", "ps_1_1", "ps_1_2", "ps_1_3",
  1730. // "ps_1_4", "ps_2_0", "ps_2_sw", "tx_1_0"
  1731. // Flags
  1732. // See D3DXSHADER_xxx flags.
  1733. // ppShader
  1734. // Returns a buffer containing the created shader. This buffer contains
  1735. // the compiled shader code, as well as any embedded debug and symbol
  1736. // table info. (See D3DXGetShaderDebugInfo, D3DXGetShaderConstantTable)
  1737. // ppErrorMsgs
  1738. // Returns a buffer containing a listing of errors and warnings that were
  1739. // encountered during the compile. If you are running in a debugger,
  1740. // these are the same messages you will see in your debug output.
  1741. // ppConstantTable
  1742. // Returns a ID3DXConstantTable object which can be used to set
  1743. // shader constants to the device. Alternatively, an application can
  1744. // parse the D3DXSHADER_CONSTANTTABLE block embedded as a comment within
  1745. // the shader.
  1746. //----------------------------------------------------------------------------
  1747. function D3DXCompileShaderFromFileA(
  1748. pSrcFile: PAnsiChar;
  1749. pDefines: PD3DXMacro;
  1750. pInclude: ID3DXInclude;
  1751. pFunctionName: PAnsiChar;
  1752. pTarget: PAnsiChar;
  1753. Flags: DWORD;
  1754. ppShader: PID3DXBuffer;
  1755. ppErrorMsgs: PID3DXBuffer;
  1756. ppConstantTable: PID3DXConstantTable): HResult; stdcall; external d3dx9shaderDLL name 'D3DXCompileShaderFromFileA';
  1757. {$EXTERNALSYM D3DXCompileShaderFromFileA}
  1758. function D3DXCompileShaderFromFileW(
  1759. pSrcFile: PWideChar;
  1760. pDefines: PD3DXMacro;
  1761. pInclude: ID3DXInclude;
  1762. pFunctionName: PAnsiChar;
  1763. pTarget: PAnsiChar;
  1764. Flags: DWORD;
  1765. ppShader: PID3DXBuffer;
  1766. ppErrorMsgs: PID3DXBuffer;
  1767. ppConstantTable: PID3DXConstantTable): HResult; stdcall; external d3dx9shaderDLL name 'D3DXCompileShaderFromFileW';
  1768. {$EXTERNALSYM D3DXCompileShaderFromFileW}
  1769. function D3DXCompileShaderFromFile(
  1770. pSrcFile: PChar;
  1771. pDefines: PD3DXMacro;
  1772. pInclude: ID3DXInclude;
  1773. pFunctionName: PAnsiChar;
  1774. pTarget: PAnsiChar;
  1775. Flags: DWORD;
  1776. ppShader: PID3DXBuffer;
  1777. ppErrorMsgs: PID3DXBuffer;
  1778. ppConstantTable: PID3DXConstantTable): HResult; stdcall; external d3dx9shaderDLL name 'D3DXCompileShaderFromFileA';
  1779. {$EXTERNALSYM D3DXCompileShaderFromFile}
  1780. function D3DXCompileShaderFromResourceA(
  1781. hSrcModule: HModule;
  1782. pSrcResource: PAnsiChar;
  1783. pDefines: PD3DXMacro;
  1784. pInclude: ID3DXInclude;
  1785. pFunctionName: PAnsiChar;
  1786. pTarget: PAnsiChar;
  1787. Flags: DWORD;
  1788. ppShader: PID3DXBuffer;
  1789. ppErrorMsgs: PID3DXBuffer;
  1790. ppConstantTable: PID3DXConstantTable): HResult; stdcall; external d3dx9shaderDLL name 'D3DXCompileShaderFromResourceA';
  1791. {$EXTERNALSYM D3DXCompileShaderFromResourceA}
  1792. function D3DXCompileShaderFromResourceW(
  1793. hSrcModule: HModule;
  1794. pSrcResource: PWideChar;
  1795. pDefines: PD3DXMacro;
  1796. pInclude: ID3DXInclude;
  1797. pFunctionName: PAnsiChar;
  1798. pTarget: PAnsiChar;
  1799. Flags: DWORD;
  1800. ppShader: PID3DXBuffer;
  1801. ppErrorMsgs: PID3DXBuffer;
  1802. ppConstantTable: PID3DXConstantTable): HResult; stdcall; external d3dx9shaderDLL name 'D3DXCompileShaderFromResourceW';
  1803. {$EXTERNALSYM D3DXCompileShaderFromResourceW}
  1804. function D3DXCompileShaderFromResource(
  1805. hSrcModule: HModule;
  1806. pSrcResource: PChar;
  1807. pDefines: PD3DXMacro;
  1808. pInclude: ID3DXInclude;
  1809. pFunctionName: PAnsiChar;
  1810. pTarget: PAnsiChar;
  1811. Flags: DWORD;
  1812. ppShader: PID3DXBuffer;
  1813. ppErrorMsgs: PID3DXBuffer;
  1814. ppConstantTable: PID3DXConstantTable): HResult; stdcall; external d3dx9shaderDLL name 'D3DXCompileShaderFromResourceA';
  1815. {$EXTERNALSYM D3DXCompileShaderFromResource}
  1816. function D3DXCompileShader(
  1817. pSrcData: PAnsiChar;
  1818. SrcDataLen: LongWord;
  1819. pDefines: PD3DXMacro;
  1820. pInclude: ID3DXInclude;
  1821. pFunctionName: PAnsiChar;
  1822. pTarget: PAnsiChar;
  1823. Flags: DWORD;
  1824. ppShader: PID3DXBuffer;
  1825. ppErrorMsgs: PID3DXBuffer;
  1826. ppConstantTable: PID3DXConstantTable): HResult; stdcall; external d3dx9shaderDLL;
  1827. {$EXTERNALSYM D3DXCompileShader}
  1828. //----------------------------------------------------------------------------
  1829. // D3DXFindShaderComment:
  1830. // ----------------------
  1831. // Searches through a shader for a particular comment, denoted by a FourCC in
  1832. // the first DWORD of the comment. If the comment is not found, and no other
  1833. // error has occurred, S_FALSE is returned.
  1834. //
  1835. // Parameters:
  1836. // pFunction
  1837. // Pointer to the function DWORD stream
  1838. // FourCC
  1839. // FourCC used to identify the desired comment block.
  1840. // ppData
  1841. // Returns a pointer to the comment data (not including comment token
  1842. // and FourCC). Can be NULL.
  1843. // pSizeInBytes
  1844. // Returns the size of the comment data in bytes. Can be NULL.
  1845. //----------------------------------------------------------------------------
  1846. function D3DXFindShaderComment(
  1847. pFunction: PDWORD;
  1848. FourCC: DWORD;
  1849. ppData: PPointer;
  1850. pSizeInBytes: PLongWord): HResult; stdcall; external d3dx9shaderDLL;
  1851. {$EXTERNALSYM D3DXFindShaderComment}
  1852. //----------------------------------------------------------------------------
  1853. // D3DXGetShaderSemantics:
  1854. // -----------------------
  1855. // Gets semantics for all input elements referenced inside a given shader.
  1856. //
  1857. // Parameters:
  1858. // pFunction
  1859. // Pointer to the function DWORD stream
  1860. // pSemantics
  1861. // Pointer to an array of D3DXSEMANTIC structures. The function will
  1862. // fill this array with the semantics for each input element referenced
  1863. // inside the shader. This array is assumed to contain at least
  1864. // MAXD3DDECLLENGTH elements.
  1865. // pCount
  1866. // Returns the number of elements referenced by the shader
  1867. //----------------------------------------------------------------------------
  1868. function D3DXGetShaderInputSemantics(
  1869. pFunction: PDWORD;
  1870. pSemantics: PD3DXSemantic;
  1871. pCount: PLongWord): HResult; stdcall; external d3dx9shaderDLL;
  1872. {$EXTERNALSYM D3DXGetShaderInputSemantics}
  1873. function D3DXGetShaderOutputSemantics(
  1874. pFunction: PDWORD;
  1875. pSemantics: PD3DXSemantic;
  1876. pCount: PLongWord): HResult; stdcall; external d3dx9shaderDLL;
  1877. {$EXTERNALSYM D3DXGetShaderOutputSemantics}
  1878. //----------------------------------------------------------------------------
  1879. // D3DXGetShaderSamplers:
  1880. // ----------------------
  1881. // Gets semantics for all input elements referenced inside a given shader.
  1882. //
  1883. // pFunction
  1884. // Pointer to the function DWORD stream
  1885. // pSamplers
  1886. // Pointer to an array of LPCSTRs. The function will fill this array
  1887. // with pointers to the sampler names contained within pFunction, for
  1888. // each sampler referenced inside the shader. This array is assumed to
  1889. // contain at least 16 elements.
  1890. // pCount
  1891. // Returns the number of samplers referenced by the shader
  1892. //----------------------------------------------------------------------------
  1893. function D3DXGetShaderSamplers(
  1894. pFunction: PDWORD;
  1895. pSamplers: PPAnsiChar;
  1896. pCount: PLongWord): HResult; stdcall; external d3dx9shaderDLL;
  1897. {$EXTERNALSYM D3DXGetShaderSamplers}
  1898. //----------------------------------------------------------------------------
  1899. // D3DXGetShaderConstantTable:
  1900. // ---------------------------
  1901. // Gets shader constant table embedded inside shader. A constant table is
  1902. // generated by D3DXAssembleShader and D3DXCompileShader, and is embedded in
  1903. // the body of the shader.
  1904. //
  1905. // Parameters:
  1906. // pFunction
  1907. // Pointer to the function DWORD stream
  1908. // ppConstantTable
  1909. // Returns a ID3DXConstantTable object which can be used to set
  1910. // shader constants to the device. Alternatively, an application can
  1911. // parse the D3DXSHADER_CONSTANTTABLE block embedded as a comment within
  1912. // the shader.
  1913. //----------------------------------------------------------------------------
  1914. function D3DXGetShaderConstantTable(
  1915. pFunction: PDWORD;
  1916. out ppConstantTable: ID3DXConstantTable): HResult; stdcall; external d3dx9shaderDLL;
  1917. {$EXTERNALSYM D3DXGetShaderConstantTable}
  1918. //----------------------------------------------------------------------------
  1919. // D3DXGetShaderDebugInfo:
  1920. // -----------------------
  1921. // Gets shader debug info. Debug info is generated D3DXAssembleShader and
  1922. // D3DXCompileShader and is embedded the body of the shader.
  1923. //
  1924. // Parameters:
  1925. // pFunction
  1926. // Pointer to the function DWORD stream
  1927. // ppDebugInfo
  1928. // Buffer used to return debug info. For information about the layout
  1929. // of this buffer, see definition of D3DXSHADER_DEBUGINFO above.
  1930. //----------------------------------------------------------------------------
  1931. function D3DXGetShaderDebugInfo(
  1932. pFunction: PDWORD;
  1933. out ppDebugInfo: ID3DXBuffer): HResult; stdcall; external d3dx9shaderDLL;
  1934. {$EXTERNALSYM D3DXGetShaderDebugInfo}
  1935. //----------------------------------------------------------------------------
  1936. // D3DXGatherFragments:
  1937. // -------------------
  1938. // Assembles shader fragments into a buffer to be passed to a fragment linker.
  1939. // will generate shader fragments for all fragments in the file
  1940. //
  1941. // Parameters:
  1942. // pSrcFile
  1943. // Source file name
  1944. // hSrcModule
  1945. // Module handle. if NULL, current module will be used
  1946. // pSrcResource
  1947. // Resource name in module
  1948. // pSrcData
  1949. // Pointer to source code
  1950. // SrcDataLen
  1951. // Size of source code, in bytes
  1952. // pDefines
  1953. // Optional NULL-terminated array of preprocessor macro definitions.
  1954. // pInclude
  1955. // Optional interface pointer to use for handling #include directives.
  1956. // If this parameter is NULL, #includes will be honored when assembling
  1957. // from file, and will error when assembling from resource or memory.
  1958. // Flags
  1959. // See D3DXSHADER_xxx flags
  1960. // ppShader
  1961. // Returns a buffer containing the created shader fragments. This buffer contains
  1962. // the assembled shader code, as well as any embedded debug info.
  1963. // ppErrorMsgs
  1964. // Returns a buffer containing a listing of errors and warnings that were
  1965. // encountered during assembly. If you are running in a debugger,
  1966. // these are the same messages you will see in your debug output.
  1967. //----------------------------------------------------------------------------
  1968. function D3DXGatherFragmentsFromFileA(
  1969. pSrcFile: PAnsiChar;
  1970. pDefines: PD3DXMacro;
  1971. pInclude: ID3DXInclude;
  1972. Flags: DWORD;
  1973. ppShader: PID3DXBuffer;
  1974. ppErrorMsgs: PID3DXBuffer): HResult; stdcall; external d3dx9shaderDLL name 'D3DXGatherFragmentsFromFileA';
  1975. {$EXTERNALSYM D3DXGatherFragmentsFromFileA}
  1976. function D3DXGatherFragmentsFromFileW(
  1977. pSrcFile: PWideChar;
  1978. pDefines: PD3DXMacro;
  1979. pInclude: ID3DXInclude;
  1980. Flags: DWORD;
  1981. ppShader: PID3DXBuffer;
  1982. ppErrorMsgs: PID3DXBuffer): HResult; stdcall; external d3dx9shaderDLL name 'D3DXGatherFragmentsFromFileW';
  1983. {$EXTERNALSYM D3DXGatherFragmentsFromFileW}
  1984. function D3DXGatherFragmentsFromFile(
  1985. pSrcFile: PChar;
  1986. pDefines: PD3DXMacro;
  1987. pInclude: ID3DXInclude;
  1988. Flags: DWORD;
  1989. ppShader: PID3DXBuffer;
  1990. ppErrorMsgs: PID3DXBuffer): HResult; stdcall; external d3dx9shaderDLL name 'D3DXGatherFragmentsFromFileA';
  1991. {$EXTERNALSYM D3DXGatherFragmentsFromFile}
  1992. function D3DXGatherFragmentsFromResourceA(
  1993. hSrcModule: HModule;
  1994. pSrcResource: PAnsiChar;
  1995. pDefines: PD3DXMacro;
  1996. pInclude: ID3DXInclude;
  1997. Flags: DWord;
  1998. ppShader: PID3DXBuffer;
  1999. ppErrorMsgs: PID3DXBuffer): HResult; stdcall; external d3dx9shaderDLL name 'D3DXGatherFragmentsFromResourceA';
  2000. {$EXTERNALSYM D3DXGatherFragmentsFromResourceA}
  2001. function D3DXGatherFragmentsFromResourceW(
  2002. hSrcModule: HModule;
  2003. pSrcResource: PWideChar;
  2004. pDefines: PD3DXMacro;
  2005. pInclude: ID3DXInclude;
  2006. Flags: DWord;
  2007. ppShader: PID3DXBuffer;
  2008. ppErrorMsgs: PID3DXBuffer): HResult; stdcall; external d3dx9shaderDLL name 'D3DXGatherFragmentsFromResourceW';
  2009. {$EXTERNALSYM D3DXGatherFragmentsFromResourceW}
  2010. function D3DXGatherFragmentsFromResource(
  2011. hSrcModule: HModule;
  2012. pSrcResource: PChar;
  2013. pDefines: PD3DXMacro;
  2014. pInclude: ID3DXInclude;
  2015. Flags: DWord;
  2016. ppShader: PID3DXBuffer;
  2017. ppErrorMsgs: PID3DXBuffer): HResult; stdcall; external d3dx9shaderDLL name 'D3DXGatherFragmentsFromResourceA';
  2018. {$EXTERNALSYM D3DXGatherFragmentsFromResource}
  2019. function D3DXGatherFragments(
  2020. pSrcData: PAnsiChar;
  2021. SrcDataLen: LongWord;
  2022. pDefines: PD3DXMacro;
  2023. pInclude: ID3DXInclude;
  2024. Flags: DWord;
  2025. ppShader: PID3DXBuffer;
  2026. ppErrorMsgs: PID3DXBuffer): HResult; stdcall; external d3dx9shaderDLL;
  2027. {$EXTERNALSYM D3DXGatherFragments}
  2028. //----------------------------------------------------------------------------
  2029. // D3DXCreateFragmentLinker:
  2030. // -------------------------
  2031. // Creates a fragment linker with a given cache size. The interface returned
  2032. // can be used to link together shader fragments. (both HLSL & ASM fragements)
  2033. //
  2034. // Parameters:
  2035. // pDevice
  2036. // Pointer of the device on which to create the effect
  2037. // ShaderCacheSize
  2038. // Size of the shader cache
  2039. // ppFragmentLinker
  2040. // pointer to a memory location to put the created interface pointer
  2041. //
  2042. //----------------------------------------------------------------------------
  2043. function D3DXCreateFragmentLinker(
  2044. pDevice: IDirect3DDevice9;
  2045. ShaderCacheSize: LongWord;
  2046. out ppFragmentLinker: ID3DXFragmentLinker): HResult; stdcall; external d3dx9shaderDLL;
  2047. {$EXTERNALSYM D3DXCreateFragmentLinker}
  2048. //////////////////////////////////////////////////////////////////////////////
  2049. // Shader comment block layouts //////////////////////////////////////////////
  2050. //////////////////////////////////////////////////////////////////////////////
  2051. //----------------------------------------------------------------------------
  2052. // D3DXSHADER_CONSTANTTABLE:
  2053. // -------------------------
  2054. // Shader constant information; included as an CTAB comment block inside
  2055. // shaders. All offsets are BYTE offsets from start of CONSTANTTABLE struct.
  2056. // Entries in the table are sorted by Name in ascending order.
  2057. //----------------------------------------------------------------------------
  2058. type
  2059. PD3DXShaderConstantTable = ^TD3DXShaderConstantTable;
  2060. _D3DXSHADER_CONSTANTTABLE = packed record
  2061. Size: DWORD; // sizeof(D3DXSHADER_CONSTANTTABLE)
  2062. Creator: DWORD; // LPCSTR offset
  2063. Version: DWORD; // shader version
  2064. Constants: DWORD; // number of constants
  2065. ConstantInfo: DWORD; // D3DXSHADER_CONSTANTINFO[Constants] offset
  2066. end;
  2067. {$EXTERNALSYM _D3DXSHADER_CONSTANTTABLE}
  2068. D3DXSHADER_CONSTANTTABLE = _D3DXSHADER_CONSTANTTABLE;
  2069. {$EXTERNALSYM D3DXSHADER_CONSTANTTABLE}
  2070. TD3DXShaderConstantTable = _D3DXSHADER_CONSTANTTABLE;
  2071. PD3DXShaderConstantInfo = ^TD3DXShaderConstantInfo;
  2072. _D3DXSHADER_CONSTANTINFO = packed record
  2073. Name: DWORD; // LPCSTR offset
  2074. RegisterSet: Word; // D3DXREGISTER_SET
  2075. RegisterIndex: Word; // register number
  2076. RegisterCount: Word; // number of registers
  2077. Reserved: Word; // reserved
  2078. TypeInfo: DWORD; // D3DXSHADER_TYPEINFO offset
  2079. DefaultValue: DWORD; // offset of default value
  2080. end;
  2081. {$EXTERNALSYM _D3DXSHADER_CONSTANTINFO}
  2082. D3DXSHADER_CONSTANTINFO = _D3DXSHADER_CONSTANTINFO;
  2083. {$EXTERNALSYM D3DXSHADER_CONSTANTINFO}
  2084. TD3DXShaderConstantInfo = _D3DXSHADER_CONSTANTINFO;
  2085. PD3DXShaderTypeInfo = ^TD3DXShaderTypeInfo;
  2086. _D3DXSHADER_TYPEINFO = packed record
  2087. _Class: Word; // D3DXPARAMETER_CLASS
  2088. _Type: Word; // D3DXPARAMETER_TYPE
  2089. Rows: Word; // number of rows (matrices)
  2090. Columns: Word; // number of columns (vectors and matrices)
  2091. Elements: Word; // array dimension
  2092. StructMembers: Word; // number of struct members
  2093. StructMemberInfo: DWORD; // D3DXSHADER_STRUCTMEMBERINFO[Members] offset
  2094. end;
  2095. {$EXTERNALSYM _D3DXSHADER_TYPEINFO}
  2096. D3DXSHADER_TYPEINFO = _D3DXSHADER_TYPEINFO;
  2097. {$EXTERNALSYM D3DXSHADER_TYPEINFO}
  2098. TD3DXShaderTypeInfo = _D3DXSHADER_TYPEINFO;
  2099. PD3DXShaderStructMemberInfo = ^TD3DXShaderStructMemberInfo;
  2100. _D3DXSHADER_STRUCTMEMBERINFO = packed record
  2101. Name: DWORD; // LPCSTR offset
  2102. TypeInfo: DWORD; // D3DXSHADER_TYPEINFO offset
  2103. end;
  2104. {$EXTERNALSYM _D3DXSHADER_STRUCTMEMBERINFO}
  2105. D3DXSHADER_STRUCTMEMBERINFO = _D3DXSHADER_STRUCTMEMBERINFO;
  2106. {$EXTERNALSYM D3DXSHADER_STRUCTMEMBERINFO}
  2107. TD3DXShaderStructMemberInfo = _D3DXSHADER_STRUCTMEMBERINFO;
  2108. //////////////////////////////////////////////////////////////////////////////
  2109. //
  2110. // Copyright (c) Microsoft Corporation. All rights reserved.
  2111. //
  2112. // File: d3dx9effect.h
  2113. // Content: D3DX effect types and Shaders
  2114. //
  2115. //////////////////////////////////////////////////////////////////////////////
  2116. //----------------------------------------------------------------------------
  2117. // D3DXFX_DONOTSAVESTATE
  2118. // This flag is used as a parameter to ID3DXEffect::Begin(). When this flag
  2119. // is specified, device state is not saved and restored in Begin/End.
  2120. // D3DXFX_DONOTSAVESHADERSTATE
  2121. // This flag is used as a parameter to ID3DXEffect::Begin(). When this flag
  2122. // is specified, shader device state is not saved and restored in Begin/End.
  2123. // This includes pixel/vertex shaders and shader constants
  2124. //----------------------------------------------------------------------------
  2125. const
  2126. D3DXFX_DONOTSAVESTATE = (1 shl 0);
  2127. {$EXTERNALSYM D3DXFX_DONOTSAVESTATE}
  2128. D3DXFX_DONOTSAVESHADERSTATE = (1 shl 1);
  2129. {$EXTERNALSYM D3DXFX_DONOTSAVESHADERSTATE}
  2130. //----------------------------------------------------------------------------
  2131. // D3DX_PARAMETER_SHARED
  2132. // Indicates that the value of a parameter will be shared with all effects
  2133. // which share the same namespace. Changing the value in one effect will
  2134. // change it in all.
  2135. //
  2136. // D3DX_PARAMETER_LITERAL
  2137. // Indicates that the value of this parameter can be treated as literal.
  2138. // Literal parameters can be marked when the effect is compiled, and their
  2139. // cannot be changed after the effect is compiled. Shared parameters cannot
  2140. // be literal.
  2141. //----------------------------------------------------------------------------
  2142. const
  2143. D3DX_PARAMETER_SHARED = (1 shl 0);
  2144. {$EXTERNALSYM D3DX_PARAMETER_SHARED}
  2145. D3DX_PARAMETER_LITERAL = (1 shl 1);
  2146. {$EXTERNALSYM D3DX_PARAMETER_LITERAL}
  2147. D3DX_PARAMETER_ANNOTATION = (1 shl 2);
  2148. {$EXTERNALSYM D3DX_PARAMETER_ANNOTATION}
  2149. //----------------------------------------------------------------------------
  2150. // D3DXEFFECT_DESC:
  2151. //----------------------------------------------------------------------------
  2152. type
  2153. _D3DXEFFECT_DESC = packed record
  2154. Creator: PAnsiChar; // Creator string
  2155. Parameters: LongWord; // Number of parameters
  2156. Techniques: LongWord; // Number of techniques
  2157. Functions: LongWord; // Number of function entrypoints
  2158. end;
  2159. {$EXTERNALSYM _D3DXEFFECT_DESC}
  2160. D3DXEFFECT_DESC = _D3DXEFFECT_DESC;
  2161. {$EXTERNALSYM D3DXEFFECT_DESC}
  2162. TD3DXEffectDesc = _D3DXEFFECT_DESC;
  2163. //----------------------------------------------------------------------------
  2164. // D3DXPARAMETER_DESC:
  2165. //----------------------------------------------------------------------------
  2166. PD3DXParameterDesc = ^TD3DXParameterDesc;
  2167. _D3DXPARAMETER_DESC = packed record
  2168. Name: PAnsiChar; // Parameter name
  2169. Semantic: PAnsiChar; // Parameter semantic
  2170. _Class: TD3DXParameterClass; // Class
  2171. _Type: TD3DXParameterType; // Component type
  2172. Rows: LongWord; // Number of rows
  2173. Columns: LongWord; // Number of columns
  2174. Elements: LongWord; // Number of array elements
  2175. Annotations: LongWord; // Number of annotations
  2176. StructMembers: LongWord; // Number of structure member sub-parameters
  2177. Flags: DWORD; // D3DX_PARAMETER_* flags
  2178. Bytes: LongWord; // Parameter size, in bytes
  2179. end;
  2180. {$EXTERNALSYM _D3DXPARAMETER_DESC}
  2181. D3DXPARAMETER_DESC = _D3DXPARAMETER_DESC;
  2182. {$EXTERNALSYM D3DXPARAMETER_DESC}
  2183. TD3DXParameterDesc = _D3DXPARAMETER_DESC;
  2184. //----------------------------------------------------------------------------
  2185. // D3DXTECHNIQUE_DESC:
  2186. //----------------------------------------------------------------------------
  2187. PD3DXTechniqueDesc = ^TD3DXTechniqueDesc;
  2188. _D3DXTECHNIQUE_DESC = packed record
  2189. Name: PAnsiChar; // Technique name
  2190. Passes: LongWord; // Number of passes
  2191. Annotations: LongWord; // Number of annotations
  2192. end;
  2193. {$EXTERNALSYM _D3DXTECHNIQUE_DESC}
  2194. D3DXTECHNIQUE_DESC = _D3DXTECHNIQUE_DESC;
  2195. {$EXTERNALSYM D3DXTECHNIQUE_DESC}
  2196. TD3DXTechniqueDesc = _D3DXTECHNIQUE_DESC;
  2197. //----------------------------------------------------------------------------
  2198. // D3DXPASS_DESC:
  2199. //----------------------------------------------------------------------------
  2200. PD3DXPassDesc = ^TD3DXPassDesc;
  2201. _D3DXPASS_DESC = packed record
  2202. Name: PAnsiChar; // Pass name
  2203. Annotations: LongWord; // Number of annotations
  2204. VSVersion: DWORD; // Vertex shader version (0 in case of NULL shader)
  2205. PSVersion: DWORD; // Pixel shader version (0 in case of NULL shader)
  2206. VSSemanticsUsed: LongWord;
  2207. VSSemantics: array [0..MAXD3DDECLLENGTH-1] of TD3DXSemantic;
  2208. PSSemanticsUsed: LongWord;
  2209. PSSemantics: array [0..MAXD3DDECLLENGTH-1]of TD3DXSemantic;
  2210. PSSamplersUsed: LongWord;
  2211. PSSamplers: array [0..15] of PAnsiChar;
  2212. end;
  2213. {$EXTERNALSYM _D3DXPASS_DESC}
  2214. D3DXPASS_DESC = _D3DXPASS_DESC;
  2215. {$EXTERNALSYM D3DXPASS_DESC}
  2216. TD3DXPassDesc = _D3DXPASS_DESC;
  2217. //----------------------------------------------------------------------------
  2218. // D3DXFUNCTION_DESC:
  2219. //----------------------------------------------------------------------------
  2220. PD3DXFunctionDesc = ^TD3DXFunctionDesc;
  2221. _D3DXFUNCTION_DESC = packed record
  2222. Name: PAnsiChar; // Function name
  2223. Annotations: LongWord; // Number of annotations
  2224. end;
  2225. {$EXTERNALSYM _D3DXFUNCTION_DESC}
  2226. D3DXFUNCTION_DESC = _D3DXFUNCTION_DESC;
  2227. {$EXTERNALSYM D3DXFUNCTION_DESC}
  2228. TD3DXFunctionDesc = _D3DXFUNCTION_DESC;
  2229. //////////////////////////////////////////////////////////////////////////////
  2230. // ID3DXEffectPool ///////////////////////////////////////////////////////////
  2231. //////////////////////////////////////////////////////////////////////////////
  2232. {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DXEffectPool);'}
  2233. {$EXTERNALSYM ID3DXEffectPool}
  2234. ID3DXEffectPool = interface(IUnknown)
  2235. ['{53CA7768-C0D0-4664-8E79-D156E4F5B7E0}']
  2236. // No public methods
  2237. end;
  2238. //////////////////////////////////////////////////////////////////////////////
  2239. // ID3DXBaseEffect ///////////////////////////////////////////////////////////
  2240. //////////////////////////////////////////////////////////////////////////////
  2241. {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DXBaseEffect);'}
  2242. {$EXTERNALSYM ID3DXBaseEffect}
  2243. ID3DXBaseEffect = interface(IUnknown)
  2244. ['{804EF574-CCC1-4bf6-B06A-B1404ABDEADE}']
  2245. // Descs
  2246. function GetDesc(out pDesc: TD3DXEffectDesc): HResult; stdcall;
  2247. function GetParameterDesc(hParameter: TD3DXHandle; out pDesc: TD3DXParameterDesc): HResult; stdcall;
  2248. function GetTechniqueDesc(hTechnique: TD3DXHandle; out pDesc: TD3DXTechniqueDesc): HResult; stdcall;
  2249. function GetPassDesc(hPass: TD3DXHandle; out pDesc: TD3DXPassDesc): HResult; stdcall;
  2250. function GetFunctionDesc(hShader: TD3DXHandle; out pDesc: TD3DXFunctionDesc): HResult; stdcall;
  2251. // Handle operations
  2252. function GetParameter(hParameter: TD3DXHandle; Index: LongWord): TD3DXHandle; stdcall;
  2253. function GetParameterByName(hParameter: TD3DXHandle; pName: PAnsiChar): TD3DXHandle; stdcall;
  2254. function GetParameterBySemantic(hParameter: TD3DXHandle; pSemantic: PAnsiChar): TD3DXHandle; stdcall;
  2255. function GetParameterElement(hParameter: TD3DXHandle; Index: LongWord): TD3DXHandle; stdcall;
  2256. function GetTechnique(Index: LongWord): TD3DXHandle; stdcall;
  2257. function GetTechniqueByName(pName: PAnsiChar): TD3DXHandle; stdcall;
  2258. function GetPass(hTechnique: TD3DXHandle; Index: LongWord): TD3DXHandle; stdcall;
  2259. function GetPassByName(hTechnique: TD3DXHandle; pName: PAnsiChar): TD3DXHandle; stdcall;
  2260. function GetFunction(Index: LongWord): TD3DXHandle; stdcall;
  2261. function GetFunctionByName(pName: PAnsiChar): TD3DXHandle; stdcall;
  2262. function GetAnnotation(hObject: TD3DXHandle; Index: LongWord): TD3DXHandle; stdcall;
  2263. function GetAnnotationByName(hObject: TD3DXHandle; pName: PAnsiChar): TD3DXHandle; stdcall;
  2264. // Get/Set Parameters
  2265. function SetValue(hParameter: TD3DXHandle; pData: Pointer; Bytes: LongWord): HResult; stdcall;
  2266. function GetValue(hParameter: TD3DXHandle; pData: Pointer; Bytes: LongWord): HResult; stdcall;
  2267. function SetBool(hParameter: TD3DXHandle; b: BOOL): HResult; stdcall;
  2268. function GetBool(hParameter: TD3DXHandle; out pb: BOOL): HResult; stdcall;
  2269. function SetBoolArray(hParameter: TD3DXHandle; pb: PBOOL; Count: LongWord): HResult; stdcall;
  2270. function GetBoolArray(hParameter: TD3DXHandle; pb: PBOOL; Count: LongWord): HResult; stdcall;
  2271. function SetInt(hParameter: TD3DXHandle; n: Integer): HResult; stdcall;
  2272. function GetInt(hParameter: TD3DXHandle; out pn: Integer): HResult; stdcall;
  2273. function SetIntArray(hParameter: TD3DXHandle; pn: PInteger; Count: LongWord): HResult; stdcall;
  2274. function GetIntArray(hParameter: TD3DXHandle; pn: PInteger; Count: LongWord): HResult; stdcall;
  2275. function SetFloat(hParameter: TD3DXHandle; f: Single): HResult; stdcall;
  2276. function GetFloat(hParameter: TD3DXHandle; out pf: Single): HResult; stdcall;
  2277. function SetFloatArray(hParameter: TD3DXHandle; pf: PSingle; Count: LongWord): HResult; stdcall;
  2278. function GetFloatArray(hParameter: TD3DXHandle; pf: PSingle; Count: LongWord): HResult; stdcall;
  2279. function SetVector(hParameter: TD3DXHandle; const pVector: TD3DXVector4): HResult; stdcall;
  2280. function GetVector(hParameter: TD3DXHandle; out pVector: TD3DXVector4): HResult; stdcall;
  2281. function SetVectorArray(hParameter: TD3DXHandle; pVector: PD3DXVector4; Count: LongWord): HResult; stdcall;
  2282. function GetVectorArray(hParameter: TD3DXHandle; pVector: PD3DXVector4; Count: LongWord): HResult; stdcall;
  2283. function SetMatrix(hParameter: TD3DXHandle; const pMatrix: TD3DXMatrix): HResult; stdcall;
  2284. function GetMatrix(hParameter: TD3DXHandle; out pMatrix: TD3DXMatrix): HResult; stdcall;
  2285. function SetMatrixArray(hParameter: TD3DXHandle; pMatrix: PD3DXMatrix; Count: LongWord): HResult; stdcall;
  2286. function GetMatrixArray(hParameter: TD3DXHandle; pMatrix: PD3DXMatrix; Count: LongWord): HResult; stdcall;
  2287. function SetMatrixPointerArray(hParameter: TD3DXHandle; ppMatrix: PPD3DXMatrix; Count: LongWord): HResult; stdcall;
  2288. function GetMatrixPointerArray(hParameter: TD3DXHandle; ppMatrix: PPD3DXMatrix; Count: LongWord): HResult; stdcall;
  2289. function SetMatrixTranspose(hParameter: TD3DXHandle; const pMatrix: TD3DXMatrix): HResult; stdcall;
  2290. function GetMatrixTranspose(hParameter: TD3DXHandle; out pMatrix: TD3DXMatrix): HResult; stdcall;
  2291. function SetMatrixTransposeArray(hParameter: TD3DXHandle; pMatrix: PD3DXMatrix; Count: LongWord): HResult; stdcall;
  2292. function GetMatrixTransposeArray(hParameter: TD3DXHandle; pMatrix: PD3DXMatrix; Count: LongWord): HResult; stdcall;
  2293. function SetMatrixTransposePointerArray(hParameter: TD3DXHandle; ppMatrix: PPD3DXMatrix; Count: LongWord): HResult; stdcall;
  2294. function GetMatrixTransposePointerArray(hParameter: TD3DXHandle; ppMatrix: PPD3DXMatrix; Count: LongWord): HResult; stdcall;
  2295. function SetString(hParameter: TD3DXHandle; pString: PAnsiChar): HResult; stdcall;
  2296. function GetString(hParameter: TD3DXHandle; out ppString: PAnsiChar): HResult; stdcall;
  2297. function SetTexture(hParameter: TD3DXHandle; pTexture: IDirect3DBaseTexture9): HResult; stdcall;
  2298. function GetTexture(hParameter: TD3DXHandle; out ppTexture: IDirect3DBaseTexture9): HResult; stdcall;
  2299. function SetPixelShader(hParameter: TD3DXHandle; pPShader: IDirect3DPixelShader9): HResult; stdcall;
  2300. function GetPixelShader(hParameter: TD3DXHandle; out ppPShader: IDirect3DPixelShader9): HResult; stdcall;
  2301. function SetVertexShader(hParameter: TD3DXHandle; pVShader: IDirect3DVertexShader9): HResult; stdcall;
  2302. function GetVertexShader(hParameter: TD3DXHandle; out ppVShader: IDirect3DVertexShader9): HResult; stdcall;
  2303. end;
  2304. //////////////////////////////////////////////////////////////////////////////
  2305. // ID3DXEffect ///////////////////////////////////////////////////////////////
  2306. //////////////////////////////////////////////////////////////////////////////
  2307. {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DXEffect);'}
  2308. {$EXTERNALSYM ID3DXEffect}
  2309. ID3DXEffect = interface(ID3DXBaseEffect)
  2310. ['{B589B04A-293D-4516-AF0B-3D7DBCF5AC54}']
  2311. // Pool
  2312. function GetPool(out ppPool: ID3DXEffectPool): HResult; stdcall;
  2313. // Selecting and setting a technique
  2314. function SetTechnique(hTechnique: TD3DXHandle): HResult; stdcall;
  2315. function GetCurrentTechnique: TD3DXHandle; stdcall;
  2316. function ValidateTechnique(hTechnique: TD3DXHandle): HResult; stdcall;
  2317. function FindNextValidTechnique(hTechnique: TD3DXHandle; out pTechnique: TD3DXHandle): HResult; stdcall;
  2318. function IsParameterUsed(hParameter: TD3DXHandle; hTechnique: TD3DXHandle): BOOL; stdcall;
  2319. // Using current technique
  2320. function _Begin(pPasses: PLongWord; Flags: DWORD): HResult; stdcall;
  2321. function Pass(Pass: LongWord): HResult; stdcall;
  2322. function _End: HResult; stdcall;
  2323. // Managing D3D Device
  2324. function GetDevice(out ppDevice: IDirect3DDevice9): HResult; stdcall;
  2325. function OnLostDevice: HResult; stdcall;
  2326. function OnResetDevice: HResult; stdcall;
  2327. // Cloning
  2328. function CloneEffect(pDevice: IDirect3DDevice9; out ppEffect: ID3DXEffect): HResult; stdcall;
  2329. end;
  2330. //////////////////////////////////////////////////////////////////////////////
  2331. // ID3DXEffectCompiler ///////////////////////////////////////////////////////
  2332. //////////////////////////////////////////////////////////////////////////////
  2333. {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DXEffectCompiler);'}
  2334. {$EXTERNALSYM ID3DXEffectCompiler}
  2335. ID3DXEffectCompiler = interface(ID3DXBaseEffect)
  2336. ['{F8EE90D3-FCC6-4f14-8AE8-6374AE968E33}']
  2337. // Parameter sharing, specialization, and information
  2338. function SetLiteral(hParameter: TD3DXHandle; Literal: BOOL): HResult; stdcall;
  2339. function GetLiteral(hParameter: TD3DXHandle; out pLiteral: BOOL): HResult; stdcall;
  2340. // Compilation
  2341. function CompileEffect(Flags: DWORD; ppEffect, ppErrorMsgs: PID3DXBuffer): HResult; stdcall;
  2342. function CompileShader(hFunction: TD3DXHandle; pTarget: PAnsiChar; Flags: DWORD;
  2343. ppShader, ppErrorMsgs: PID3DXBuffer; ppConstantTable: PID3DXConstantTable): HResult; stdcall;
  2344. end;
  2345. //////////////////////////////////////////////////////////////////////////////
  2346. // APIs //////////////////////////////////////////////////////////////////////
  2347. //////////////////////////////////////////////////////////////////////////////
  2348. //----------------------------------------------------------------------------
  2349. // D3DXCreateEffectPool:
  2350. // ---------------------
  2351. // Creates an effect pool. Pools are used for sharing parameters between
  2352. // multiple effects. For all effects within a pool, shared parameters of the
  2353. // same name all share the same value.
  2354. //
  2355. // Parameters:
  2356. // ppPool
  2357. // Returns the created pool.
  2358. //----------------------------------------------------------------------------
  2359. function D3DXCreateEffectPool(
  2360. out ppPool: ID3DXEffectPool): HResult; stdcall; external d3dx9effectDLL;
  2361. {$EXTERNALSYM D3DXCreateEffectPool}
  2362. //----------------------------------------------------------------------------
  2363. // D3DXCreateEffect:
  2364. // -----------------
  2365. // Creates an effect from an ascii or binary effect description.
  2366. //
  2367. // Parameters:
  2368. // pDevice
  2369. // Pointer of the device on which to create the effect
  2370. // pSrcFile
  2371. // Name of the file containing the effect description
  2372. // hSrcModule
  2373. // Module handle. if NULL, current module will be used.
  2374. // pSrcResource
  2375. // Resource name in module
  2376. // pSrcData
  2377. // Pointer to effect description
  2378. // SrcDataSize
  2379. // Size of the effect description in bytes
  2380. // pDefines
  2381. // Optional NULL-terminated array of preprocessor macro definitions.
  2382. // pInclude
  2383. // Optional interface pointer to use for handling #include directives.
  2384. // If this parameter is NULL, #includes will be honored when compiling
  2385. // from file, and will error when compiling from resource or memory.
  2386. // pPool
  2387. // Pointer to ID3DXEffectPool object to use for shared parameters.
  2388. // If NULL, no parameters will be shared.
  2389. // ppEffect
  2390. // Returns a buffer containing created effect.
  2391. // ppCompilationErrors
  2392. // Returns a buffer containing any error messages which occurred during
  2393. // compile. Or NULL if you do not care about the error messages.
  2394. //
  2395. //----------------------------------------------------------------------------
  2396. function D3DXCreateEffectFromFileA(
  2397. pDevice: IDirect3DDevice9;
  2398. pSrcFile: PAnsiChar;
  2399. pDefines: PD3DXMacro;
  2400. pInclude: ID3DXInclude;
  2401. Flags: DWORD;
  2402. pPool: ID3DXEffectPool;
  2403. out ppEffect: ID3DXEffect;
  2404. ppCompilationErrors: PID3DXBuffer): HResult; stdcall; external d3dx9effectDLL name 'D3DXCreateEffectFromFileA';
  2405. {$EXTERNALSYM D3DXCreateEffectFromFileA}
  2406. function D3DXCreateEffectFromFileW(
  2407. pDevice: IDirect3DDevice9;
  2408. pSrcFile: PWideChar;
  2409. pDefines: PD3DXMacro;
  2410. pInclude: ID3DXInclude;
  2411. Flags: DWORD;
  2412. pPool: ID3DXEffectPool;
  2413. out ppEffect: ID3DXEffect;
  2414. ppCompilationErrors: PID3DXBuffer): HResult; stdcall; external d3dx9effectDLL name 'D3DXCreateEffectFromFileW';
  2415. {$EXTERNALSYM D3DXCreateEffectFromFileW}
  2416. function D3DXCreateEffectFromFile(
  2417. pDevice: IDirect3DDevice9;
  2418. pSrcFile: PChar;
  2419. pDefines: PD3DXMacro;
  2420. pInclude: ID3DXInclude;
  2421. Flags: DWORD;
  2422. pPool: ID3DXEffectPool;
  2423. out ppEffect: ID3DXEffect;
  2424. ppCompilationErrors: PID3DXBuffer): HResult; stdcall; external d3dx9effectDLL name 'D3DXCreateEffectFromFileA';
  2425. {$EXTERNALSYM D3DXCreateEffectFromFile}
  2426. function D3DXCreateEffectFromResourceA(
  2427. pDevice: IDirect3DDevice9;
  2428. hSrcModule: HModule;
  2429. pSrcResource: PAnsiChar;
  2430. pDefines: PD3DXMacro;
  2431. pInclude: ID3DXInclude;
  2432. Flags: DWORD;
  2433. pPool: ID3DXEffectPool;
  2434. out ppEffect: ID3DXEffect;
  2435. ppCompilationErrors: PID3DXBuffer): HResult; stdcall; external d3dx9effectDLL name 'D3DXCreateEffectFromResourceA';
  2436. {$EXTERNALSYM D3DXCreateEffectFromResourceA}
  2437. function D3DXCreateEffectFromResourceW(
  2438. pDevice: IDirect3DDevice9;
  2439. hSrcModule: HModule;
  2440. pSrcResource: PWideChar;
  2441. pDefines: PD3DXMacro;
  2442. pInclude: ID3DXInclude;
  2443. Flags: DWORD;
  2444. pPool: ID3DXEffectPool;
  2445. out ppEffect: ID3DXEffect;
  2446. ppCompilationErrors: PID3DXBuffer): HResult; stdcall; external d3dx9effectDLL name 'D3DXCreateEffectFromResourceW';
  2447. {$EXTERNALSYM D3DXCreateEffectFromResourceW}
  2448. function D3DXCreateEffectFromResource(
  2449. pDevice: IDirect3DDevice9;
  2450. hSrcModule: HModule;
  2451. pSrcResource: PChar;
  2452. pDefines: PD3DXMacro;
  2453. pInclude: ID3DXInclude;
  2454. Flags: DWORD;
  2455. pPool: ID3DXEffectPool;
  2456. out ppEffect: ID3DXEffect;
  2457. ppCompilationErrors: PID3DXBuffer): HResult; stdcall; external d3dx9effectDLL name 'D3DXCreateEffectFromResourceA';
  2458. {$EXTERNALSYM D3DXCreateEffectFromResource}
  2459. function D3DXCreateEffect(
  2460. pDevice: IDirect3DDevice9;
  2461. pSrcData: Pointer;
  2462. SrcDataLen: LongWord;
  2463. pDefines: PD3DXMacro;
  2464. pInclude: ID3DXInclude;
  2465. Flags: DWORD;
  2466. pPool: ID3DXEffectPool;
  2467. out ppEffect: ID3DXEffect;
  2468. ppCompilationErrors: PID3DXBuffer): HResult; stdcall; external d3dx9effectDLL;
  2469. {$EXTERNALSYM D3DXCreateEffect}
  2470. //----------------------------------------------------------------------------
  2471. // D3DXCreateEffectCompiler:
  2472. // -------------------------
  2473. // Creates an effect from an ascii or binary effect description.
  2474. //
  2475. // Parameters:
  2476. // pSrcFile
  2477. // Name of the file containing the effect description
  2478. // hSrcModule
  2479. // Module handle. if NULL, current module will be used.
  2480. // pSrcResource
  2481. // Resource name in module
  2482. // pSrcData
  2483. // Pointer to effect description
  2484. // SrcDataSize
  2485. // Size of the effect description in bytes
  2486. // pDefines
  2487. // Optional NULL-terminated array of preprocessor macro definitions.
  2488. // pInclude
  2489. // Optional interface pointer to use for handling #include directives.
  2490. // If this parameter is NULL, #includes will be honored when compiling
  2491. // from file, and will error when compiling from resource or memory.
  2492. // pPool
  2493. // Pointer to ID3DXEffectPool object to use for shared parameters.
  2494. // If NULL, no parameters will be shared.
  2495. // ppCompiler
  2496. // Returns a buffer containing created effect compiler.
  2497. // ppParseErrors
  2498. // Returns a buffer containing any error messages which occurred during
  2499. // parse. Or NULL if you do not care about the error messages.
  2500. //
  2501. //----------------------------------------------------------------------------
  2502. function D3DXCreateEffectCompilerFromFileA(
  2503. pSrcFile: PAnsiChar;
  2504. pDefines: PD3DXMacro;
  2505. pInclude: ID3DXInclude;
  2506. Flags: DWORD;
  2507. out ppCompiler: ID3DXEffectCompiler;
  2508. ppParseErrors: PID3DXBuffer): HResult; stdcall; external d3dx9effectDLL name 'D3DXCreateEffectCompilerFromFileA';
  2509. {$EXTERNALSYM D3DXCreateEffectCompilerFromFileA}
  2510. function D3DXCreateEffectCompilerFromFileW(
  2511. pSrcFile: PWideChar;
  2512. pDefines: PD3DXMacro;
  2513. pInclude: ID3DXInclude;
  2514. Flags: DWORD;
  2515. out ppCompiler: ID3DXEffectCompiler;
  2516. ppParseErrors: PID3DXBuffer): HResult; stdcall; external d3dx9effectDLL name 'D3DXCreateEffectCompilerFromFileW';
  2517. {$EXTERNALSYM D3DXCreateEffectCompilerFromFileW}
  2518. function D3DXCreateEffectCompilerFromFile(
  2519. pSrcFile: PChar;
  2520. pDefines: PD3DXMacro;
  2521. pInclude: ID3DXInclude;
  2522. Flags: DWORD;
  2523. out ppCompiler: ID3DXEffectCompiler;
  2524. ppParseErrors: PID3DXBuffer): HResult; stdcall; external d3dx9effectDLL name 'D3DXCreateEffectCompilerFromFileA';
  2525. {$EXTERNALSYM D3DXCreateEffectCompilerFromFile}
  2526. function D3DXCreateEffectCompilerFromResourceA(
  2527. hSrcModule: HModule;
  2528. pSrcResource: PAnsiChar;
  2529. pDefines: PD3DXMacro;
  2530. pInclude: ID3DXInclude;
  2531. Flags: DWORD;
  2532. out ppCompiler: ID3DXEffectCompiler;
  2533. ppParseErrors: PID3DXBuffer): HResult; stdcall; external d3dx9effectDLL name 'D3DXCreateEffectCompilerFromResourceA';
  2534. {$EXTERNALSYM D3DXCreateEffectCompilerFromResourceA}
  2535. function D3DXCreateEffectCompilerFromResourceW(
  2536. hSrcModule: HModule;
  2537. pSrcResource: PWideChar;
  2538. pDefines: PD3DXMacro;
  2539. pInclude: ID3DXInclude;
  2540. Flags: DWORD;
  2541. out ppCompiler: ID3DXEffectCompiler;
  2542. ppParseErrors: PID3DXBuffer): HResult; stdcall; external d3dx9effectDLL name 'D3DXCreateEffectCompilerFromResourceW';
  2543. {$EXTERNALSYM D3DXCreateEffectCompilerFromResourceW}
  2544. function D3DXCreateEffectCompilerFromResource(
  2545. hSrcModule: HModule;
  2546. pSrcResource: PChar;
  2547. pDefines: PD3DXMacro;
  2548. pInclude: ID3DXInclude;
  2549. Flags: DWORD;
  2550. out ppCompiler: ID3DXEffectCompiler;
  2551. ppParseErrors: PID3DXBuffer): HResult; stdcall; external d3dx9effectDLL name 'D3DXCreateEffectCompilerFromResourceA';
  2552. {$EXTERNALSYM D3DXCreateEffectCompilerFromResource}
  2553. function D3DXCreateEffectCompiler(
  2554. pSrcData: Pointer;
  2555. SrcDataLen: LongWord;
  2556. pDefines: PD3DXMacro;
  2557. pInclude: ID3DXInclude;
  2558. Flags: DWORD;
  2559. out ppCompiler: ID3DXEffectCompiler;
  2560. ppParseErrors: PID3DXBuffer): HResult; stdcall; external d3dx9effectDLL;
  2561. {$EXTERNALSYM D3DXCreateEffectCompiler}
  2562. //////////////////////////////////////////////////////////////////////////////
  2563. //
  2564. // Copyright (C) Microsoft Corporation. All Rights Reserved.
  2565. //
  2566. // File: d3dx9mesh.h
  2567. // Content: D3DX mesh types and functions
  2568. //
  2569. //////////////////////////////////////////////////////////////////////////////
  2570. type
  2571. //patch mesh can be quads or tris
  2572. _D3DXPATCHMESHTYPE = (
  2573. {$IFNDEF COMPILER6_UP}
  2574. D3DXPATCHMESH_invalid_0,
  2575. D3DXPATCHMESH_RECT {= $001},
  2576. D3DXPATCHMESH_TRI {= $002},
  2577. D3DXPATCHMESH_NPATCH {= $003}
  2578. {$ELSE}
  2579. D3DXPATCHMESH_RECT = $001,
  2580. D3DXPATCHMESH_TRI = $002,
  2581. D3DXPATCHMESH_NPATCH = $003
  2582. {$ENDIF}
  2583. );
  2584. {$EXTERNALSYM _D3DXPATCHMESHTYPE}
  2585. D3DXPATCHMESHTYPE = _D3DXPATCHMESHTYPE;
  2586. {$EXTERNALSYM D3DXPATCHMESHTYPE}
  2587. TD3DXPatchMeshType = _D3DXPATCHMESHTYPE;
  2588. type
  2589. _D3DXMESH = {$IFDEF TYPE_IDENTITY}type {$ENDIF}DWord;
  2590. {$EXTERNALSYM _D3DXMESH}
  2591. TD3DXMesh = _D3DXMESH;
  2592. // Mesh options - lower 3 bytes only, upper byte used by _D3DXMESHOPT option flags
  2593. const
  2594. D3DXMESH_32BIT = $001; // If set, then use 32 bit indices, if not set use 16 bit indices.
  2595. {$EXTERNALSYM D3DXMESH_32BIT}
  2596. D3DXMESH_DONOTCLIP = $002; // Use D3DUSAGE_DONOTCLIP for VB & IB.
  2597. {$EXTERNALSYM D3DXMESH_DONOTCLIP}
  2598. D3DXMESH_POINTS = $004; // Use D3DUSAGE_POINTS for VB & IB.
  2599. {$EXTERNALSYM D3DXMESH_POINTS}
  2600. D3DXMESH_RTPATCHES = $008; // Use D3DUSAGE_RTPATCHES for VB & IB.
  2601. {$EXTERNALSYM D3DXMESH_RTPATCHES}
  2602. D3DXMESH_NPATCHES = $4000;// Use D3DUSAGE_NPATCHES for VB & IB.
  2603. {$EXTERNALSYM D3DXMESH_NPATCHES}
  2604. D3DXMESH_VB_SYSTEMMEM = $010; // Use D3DPOOL_SYSTEMMEM for VB. Overrides D3DXMESH_MANAGEDVERTEXBUFFER
  2605. {$EXTERNALSYM D3DXMESH_VB_SYSTEMMEM}
  2606. D3DXMESH_VB_MANAGED = $020; // Use D3DPOOL_MANAGED for VB.
  2607. {$EXTERNALSYM D3DXMESH_VB_MANAGED}
  2608. D3DXMESH_VB_WRITEONLY = $040; // Use D3DUSAGE_WRITEONLY for VB.
  2609. {$EXTERNALSYM D3DXMESH_VB_WRITEONLY}
  2610. D3DXMESH_VB_DYNAMIC = $080; // Use D3DUSAGE_DYNAMIC for VB.
  2611. {$EXTERNALSYM D3DXMESH_VB_DYNAMIC}
  2612. D3DXMESH_VB_SOFTWAREPROCESSING = $8000; // Use D3DUSAGE_SOFTWAREPROCESSING for VB.
  2613. {$EXTERNALSYM D3DXMESH_VB_SOFTWAREPROCESSING}
  2614. D3DXMESH_IB_SYSTEMMEM = $100; // Use D3DPOOL_SYSTEMMEM for IB. Overrides D3DXMESH_MANAGEDINDEXBUFFER
  2615. {$EXTERNALSYM D3DXMESH_IB_SYSTEMMEM}
  2616. D3DXMESH_IB_MANAGED = $200; // Use D3DPOOL_MANAGED for IB.
  2617. {$EXTERNALSYM D3DXMESH_IB_MANAGED}
  2618. D3DXMESH_IB_WRITEONLY = $400; // Use D3DUSAGE_WRITEONLY for IB.
  2619. {$EXTERNALSYM D3DXMESH_IB_WRITEONLY}
  2620. D3DXMESH_IB_DYNAMIC = $800; // Use D3DUSAGE_DYNAMIC for IB.
  2621. {$EXTERNALSYM D3DXMESH_IB_DYNAMIC}
  2622. D3DXMESH_IB_SOFTWAREPROCESSING= $10000; // Use D3DUSAGE_SOFTWAREPROCESSING for IB.
  2623. {$EXTERNALSYM D3DXMESH_IB_SOFTWAREPROCESSING}
  2624. D3DXMESH_VB_SHARE = $1000; // Valid for Clone* calls only, forces cloned mesh/pmesh to share vertex buffer
  2625. {$EXTERNALSYM D3DXMESH_VB_SHARE}
  2626. D3DXMESH_USEHWONLY = $2000; // Valid for ID3DXSkinMesh::ConvertToBlendedMesh
  2627. {$EXTERNALSYM D3DXMESH_USEHWONLY}
  2628. // Helper options
  2629. D3DXMESH_SYSTEMMEM = $110; // D3DXMESH_VB_SYSTEMMEM | D3DXMESH_IB_SYSTEMMEM
  2630. {$EXTERNALSYM D3DXMESH_SYSTEMMEM}
  2631. D3DXMESH_MANAGED = $220; // D3DXMESH_VB_MANAGED | D3DXMESH_IB_MANAGED
  2632. {$EXTERNALSYM D3DXMESH_MANAGED}
  2633. D3DXMESH_WRITEONLY = $440; // D3DXMESH_VB_WRITEONLY | D3DXMESH_IB_WRITEONLY
  2634. {$EXTERNALSYM D3DXMESH_WRITEONLY}
  2635. D3DXMESH_DYNAMIC = $880; // D3DXMESH_VB_DYNAMIC | D3DXMESH_IB_DYNAMIC
  2636. {$EXTERNALSYM D3DXMESH_DYNAMIC}
  2637. D3DXMESH_SOFTWAREPROCESSING = $18000; // D3DXMESH_VB_SOFTWAREPROCESSING | D3DXMESH_IB_SOFTWAREPROCESSING
  2638. {$EXTERNALSYM D3DXMESH_SOFTWAREPROCESSING}
  2639. type
  2640. //patch mesh options
  2641. _D3DXPATCHMESH = (
  2642. D3DXPATCHMESH_DEFAULT {= 000,}
  2643. );
  2644. {$EXTERNALSYM _D3DXPATCHMESH}
  2645. D3DXPATCHMESH = _D3DXPATCHMESH;
  2646. {$EXTERNALSYM D3DXPATCHMESH}
  2647. TD3DXPatchMesh = _D3DXPATCHMESH;
  2648. // option field values for specifying min value in D3DXGeneratePMesh and D3DXSimplifyMesh
  2649. _D3DXMESHSIMP = (
  2650. {$IFNDEF COMPILER6_UP}
  2651. D3DXMESHSIMP_invalid_0{= 0x0},
  2652. D3DXMESHSIMP_VERTEX {= 0x1},
  2653. D3DXMESHSIMP_FACE {= 0x2}
  2654. {$ELSE}
  2655. D3DXMESHSIMP_VERTEX = $1,
  2656. D3DXMESHSIMP_FACE = $2
  2657. {$ENDIF}
  2658. );
  2659. {$EXTERNALSYM _D3DXMESHSIMP}
  2660. TD3DMeshSimp = _D3DXMESHSIMP;
  2661. _MAX_FVF_DECL_SIZE = DWord;
  2662. {$EXTERNALSYM _MAX_FVF_DECL_SIZE}
  2663. const
  2664. MAX_FVF_DECL_SIZE = MAXD3DDECLLENGTH + 1; // +1 for END
  2665. {$EXTERNALSYM MAX_FVF_DECL_SIZE}
  2666. type
  2667. TFVFDeclaration = array [0..MAX_FVF_DECL_SIZE-1] of TD3DVertexElement9;
  2668. PD3DXAttributeRange = ^TD3DXAttributeRange;
  2669. _D3DXATTRIBUTERANGE = packed record
  2670. AttribId: DWord;
  2671. FaceStart: DWord;
  2672. FaceCount: DWord;
  2673. VertexStart: DWord;
  2674. VertexCount: DWord;
  2675. end;
  2676. {$EXTERNALSYM _D3DXATTRIBUTERANGE}
  2677. D3DXATTRIBUTERANGE = _D3DXATTRIBUTERANGE;
  2678. {$EXTERNALSYM D3DXATTRIBUTERANGE}
  2679. TD3DXAttributeRange = _D3DXATTRIBUTERANGE;
  2680. PD3DXMaterial = ^TD3DXMaterial;
  2681. _D3DXMATERIAL = packed record
  2682. MatD3D: TD3Dmaterial9;
  2683. pTextureFilename: PAnsiChar;
  2684. end;
  2685. {$EXTERNALSYM _D3DXMATERIAL}
  2686. D3DXMATERIAL = _D3DXMATERIAL;
  2687. {$EXTERNALSYM D3DXMATERIAL}
  2688. TD3DXMaterial = _D3DXMATERIAL;
  2689. _D3DXEFFECTDEFAULTTYPE = (
  2690. {$IFNDEF COMPILER6_UP}
  2691. D3DXEDT_invalid_0,
  2692. D3DXEDT_STRING {= $1}, // pValue points to a null terminated ASCII string
  2693. D3DXEDT_FLOATS {= $2}, // pValue points to an array of floats - number of floats is NumBytes / sizeof(float)
  2694. D3DXEDT_DWORD {= $3} // pValue points to a DWORD
  2695. {$ELSE}
  2696. D3DXEDT_STRING = $1, // pValue points to a null terminated ASCII string
  2697. D3DXEDT_FLOATS = $2, // pValue points to an array of floats - number of floats is NumBytes / sizeof(float)
  2698. D3DXEDT_DWORD = $3 // pValue points to a DWORD
  2699. {$ENDIF}
  2700. );
  2701. {$EXTERNALSYM _D3DXEFFECTDEFAULTTYPE}
  2702. D3DXEFFECTDEFAULTTYPE = _D3DXEFFECTDEFAULTTYPE;
  2703. {$EXTERNALSYM D3DXEFFECTDEFAULTTYPE}
  2704. TD3DXEffectDefaultType = _D3DXEFFECTDEFAULTTYPE;
  2705. PD3DXEffectDefault = ^TD3DXEffectDefault;
  2706. _D3DXEFFECTDEFAULT = packed record
  2707. pParamName: PAnsiChar;
  2708. _Type: TD3DXEffectDefaultType; // type of the data pointed to by pValue
  2709. NumBytes: DWORD; // size in bytes of the data pointed to by pValue
  2710. pValue: Pointer; // data for the default of the effect
  2711. end;
  2712. {$EXTERNALSYM _D3DXEFFECTDEFAULT}
  2713. D3DXEFFECTDEFAULT = _D3DXEFFECTDEFAULT;
  2714. {$EXTERNALSYM D3DXEFFECTDEFAULT}
  2715. TD3DXEffectDefault = _D3DXEFFECTDEFAULT;
  2716. PD3DXEffectInstance = ^TD3DXEffectInstance;
  2717. _D3DXEFFECTINSTANCE = packed record
  2718. pEffectFilename: PAnsiChar;
  2719. NumDefaults: DWORD;
  2720. pDefaults: PD3DXEffectDefault;
  2721. end;
  2722. {$EXTERNALSYM _D3DXEFFECTINSTANCE}
  2723. D3DXEFFECTINSTANCE = _D3DXEFFECTINSTANCE;
  2724. {$EXTERNALSYM D3DXEFFECTINSTANCE}
  2725. TD3DXEffectInstance = _D3DXEFFECTINSTANCE;
  2726. PD3DXAttributeWeights = ^TD3DXAttributeWeights;
  2727. _D3DXATTRIBUTEWEIGHTS = packed record
  2728. Position: Single;
  2729. Boundary: Single;
  2730. Normal: Single;
  2731. Diffuse: Single;
  2732. Specular: Single;
  2733. Texcoord: array[0..7] of Single;
  2734. Tangent: Single;
  2735. Binormal: Single;
  2736. end;
  2737. {$EXTERNALSYM _D3DXATTRIBUTEWEIGHTS}
  2738. D3DXATTRIBUTEWEIGHTS = _D3DXATTRIBUTEWEIGHTS;
  2739. {$EXTERNALSYM D3DXATTRIBUTEWEIGHTS}
  2740. TD3DXAttributeWeights = _D3DXATTRIBUTEWEIGHTS;
  2741. _D3DXWELDEPSILONSFLAGS = {$IFDEF TYPE_IDENTITY}type {$ENDIF}DWord;
  2742. {$EXTERNALSYM _D3DXWELDEPSILONSFLAGS}
  2743. TD3DXWeldEpsilonsFlags = _D3DXWELDEPSILONSFLAGS;
  2744. const
  2745. D3DXWELDEPSILONS_WELDALL = $1; // weld all vertices marked by adjacency as being overlapping
  2746. {$EXTERNALSYM D3DXWELDEPSILONS_WELDALL}
  2747. D3DXWELDEPSILONS_WELDPARTIALMATCHES = $2; // if a given vertex component is within epsilon, modify partial matched
  2748. // vertices so that both components identical AND if all components "equal"
  2749. // remove one of the vertices
  2750. {$EXTERNALSYM D3DXWELDEPSILONS_WELDPARTIALMATCHES}
  2751. D3DXWELDEPSILONS_DONOTREMOVEVERTICES = $4; // instructs weld to only allow modifications to vertices and not removal
  2752. // ONLY valid if D3DXWELDEPSILONS_WELDPARTIALMATCHES is set
  2753. // useful to modify vertices to be equal, but not allow vertices to be removed
  2754. {$EXTERNALSYM D3DXWELDEPSILONS_DONOTREMOVEVERTICES}
  2755. D3DXWELDEPSILONS_DONOTSPLIT = $8; // instructs weld to specify the D3DXMESHOPT_DONOTSPLIT flag when doing an Optimize(ATTR_SORT)
  2756. // if this flag is not set, all vertices that are in separate attribute groups
  2757. // will remain split and not welded. Setting this flag can slow down software vertex processing
  2758. {$EXTERNALSYM D3DXWELDEPSILONS_DONOTSPLIT}
  2759. type
  2760. PD3DXWeldEpsilons = ^TD3DXWeldEpsilons;
  2761. _D3DXWELDEPSILONS = packed record
  2762. Position: Single; // NOTE: This does NOT replace the epsilon in GenerateAdjacency
  2763. // in general, it should be the same value or greater than the one passed to GeneratedAdjacency
  2764. BlendWeights: Single;
  2765. Normal: Single;
  2766. PSize: Single;
  2767. Specular: Single;
  2768. Diffuse: Single;
  2769. Texcoord: array[0..7] of Single;
  2770. Tangent: Single;
  2771. Binormal: Single;
  2772. TessFactor: Single;
  2773. end;
  2774. {$EXTERNALSYM _D3DXWELDEPSILONS}
  2775. D3DXWELDEPSILONS = _D3DXWELDEPSILONS;
  2776. {$EXTERNALSYM D3DXWELDEPSILONS}
  2777. TD3DXWeldEpsilons = _D3DXWELDEPSILONS;
  2778. ID3DXMesh = interface;
  2779. {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DXBaseMesh);'}
  2780. {$EXTERNALSYM ID3DXBaseMesh}
  2781. ID3DXBaseMesh = interface(IUnknown)
  2782. ['{2A835771-BF4D-43f4-8E14-82A809F17D8A}']
  2783. // ID3DXBaseMesh
  2784. function DrawSubset(AttribId: DWord): HResult; stdcall;
  2785. function GetNumFaces: DWord; stdcall;
  2786. function GetNumVertices: DWord; stdcall;
  2787. function GetFVF: DWord; stdcall;
  2788. function GetDeclaration(out Declaration: TFVFDeclaration): HResult; stdcall;
  2789. function GetNumBytesPerVertex: DWORD;
  2790. function GetOptions: DWord; stdcall;
  2791. function GetDevice(out ppDevice: IDirect3DDevice9): HResult; stdcall;
  2792. function CloneMeshFVF(Options, FVF: DWord; pD3DDevice: IDirect3DDevice9;
  2793. out ppCloneMesh: ID3DXMesh): HResult; stdcall;
  2794. function CloneMesh(Options: DWORD; pDeclaration: PD3DVertexElement9;
  2795. pD3DDevice: IDirect3DDevice9; out ppCloneMesh: ID3DXMesh): HResult; stdcall;
  2796. function GetVertexBuffer(out ppVB: IDirect3DVertexBuffer9): HResult; stdcall;
  2797. function GetIndexBuffer(out ppIB: IDirect3DIndexBuffer9): HResult; stdcall;
  2798. function LockVertexBuffer(Flags: DWord; out ppData: Pointer): HResult; stdcall;
  2799. function UnlockVertexBuffer: HResult; stdcall;
  2800. function LockIndexBuffer(Flags: DWord; out ppData: Pointer): HResult; stdcall;
  2801. function UnlockIndexBuffer: HResult; stdcall;
  2802. function GetAttributeTable(pAttribTable: PD3DXAttributeRange;
  2803. pAttribTableSize: PDWord): HResult; stdcall;
  2804. function ConvertPointRepsToAdjacency(pPRep: PDWord; pAdjacency: PDWord): HResult; stdcall;
  2805. function ConvertAdjacencyToPointReps(pAdjacency: PDWord; pPRep: PDWord): HResult; stdcall;
  2806. function GenerateAdjacency(Epsilon: Single; pAdjacency: PDWord): HResult; stdcall;
  2807. function UpdateSemantics(const Declaration: TFVFDeclaration): HResult; stdcall;
  2808. end;
  2809. {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DXMesh);'}
  2810. {$EXTERNALSYM ID3DXMesh}
  2811. ID3DXMesh = interface(ID3DXBaseMesh)
  2812. ['{CCAE5C3B-4DD1-4d0f-997E-4684CA64557F}']
  2813. // ID3DXMesh
  2814. function LockAttributeBuffer(Flags: DWord; out ppData: PByte): HResult; stdcall;
  2815. function UnlockAttributeBuffer: HResult; stdcall;
  2816. function Optimize(Flags: DWord; pAdjacencyIn, pAdjacencyOut: PDWord;
  2817. pFaceRemap: PDWord; ppVertexRemap: PID3DXBuffer;
  2818. out ppOptMesh: ID3DXMesh): HResult; stdcall;
  2819. function OptimizeInplace(Flags: DWord; pAdjacencyIn, pAdjacencyOut: PDWord;
  2820. pFaceRemap: PDWord; ppVertexRemap: PID3DXBuffer): HResult; stdcall;
  2821. function SetAttributeTable(pAttribTable: PD3DXAttributeRange; cAttribTableSize: DWORD): HResult; stdcall;
  2822. end;
  2823. {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DXPMesh);'}
  2824. {$EXTERNALSYM ID3DXPMesh}
  2825. ID3DXPMesh = interface(ID3DXBaseMesh)
  2826. ['{19FBE386-C282-4659-97BD-CB869B084A6C}']
  2827. // ID3DXPMesh
  2828. function ClonePMeshFVF(Options, FVF: DWord; ppDevice: IDirect3DDevice9;
  2829. out ppCloneMesh: ID3DXPMesh): HResult; stdcall;
  2830. function ClonePMesh(Options: DWORD; pDeclaration: PD3DVertexElement9;
  2831. pD3D: IDirect3DDevice9; out ppCloneMesh: ID3DXPMesh): HResult; stdcall;
  2832. function SetNumFaces(Faces: DWord): HResult; stdcall;
  2833. function SetNumVertices(Vertices: DWord): HResult; stdcall;
  2834. function GetMaxFaces: DWord; stdcall;
  2835. function GetMinFaces: DWord; stdcall;
  2836. function GetMaxVertices: DWord; stdcall;
  2837. function GetMinVertices: DWord; stdcall;
  2838. function Save(pStream: IStream; pMaterials: PD3DXMaterial;
  2839. pEffectInstances: PD3DXEffectInstance; NumMaterials: DWORD): HResult; stdcall;
  2840. function Optimize(Flags: DWord; pAdjacencyOut: PDWord;
  2841. pFaceRemap: PDWord; ppVertexRemap: PID3DXBuffer;
  2842. out ppOptMesh: ID3DXMesh): HResult; stdcall;
  2843. function OptimizeBaseLOD(Flags: DWord; pFaceRemap: PDWord): HResult; stdcall;
  2844. function TrimByFaces(NewFacesMin, NewFacesMax: DWord; rgiFaceRemap, rgiVertRemap: PDWord): HResult; stdcall;
  2845. function TrimByVertices(NewVerticesMin, NewVerticesMax: DWord; rgiFaceRemap, rgiVertRemap: PDWord): HResult; stdcall;
  2846. function GetAdjacency(pAdjacency: PDWord): HResult; stdcall;
  2847. // Used to generate the immediate "ancestor" for each vertex when it is removed by a vsplit. Allows generation of geomorphs
  2848. // Vertex buffer must be equal to or greater than the maximum number of vertices in the pmesh
  2849. function GenerateVertexHistory(pVertexHistory: PDWORD): HResult; stdcall;
  2850. end;
  2851. {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DXSPMesh);'}
  2852. {$EXTERNALSYM ID3DXSPMesh}
  2853. ID3DXSPMesh = interface(IUnknown)
  2854. ['{4E3CA05C-D4FF-4d11-8A02-16459E08F6F4}']
  2855. // ID3DXSPMesh
  2856. function GetNumFaces: DWord; stdcall;
  2857. function GetNumVertices: DWord; stdcall;
  2858. function GetFVF: DWord; stdcall;
  2859. function GetDeclaration(out Declaration: TFVFDeclaration): HResult; stdcall;
  2860. function GetOptions: DWord; stdcall;
  2861. function GetDevice(out ppDevice: IDirect3DDevice9): HResult; stdcall;
  2862. function CloneMeshFVF(Options, FVF: DWord; ppDevice: IDirect3DDevice9;
  2863. pAdjacencyOut, pVertexRemapOut: PDWord;
  2864. out ppCloneMesh: ID3DXMesh): HResult; stdcall;
  2865. function CloneMesh(Options: DWORD; pDeclaration: PD3DVertexElement9;
  2866. pD3DDevice: IDirect3DDevice9; pAdjacencyOut, pVertexRemapOut: PDWORD;
  2867. out ppCloneMesh: ID3DXMesh): HResult; stdcall;
  2868. function ClonePMeshFVF(Options, FVF: DWORD; pD3D: IDirect3DDevice9;
  2869. pVertexRemapOut: PDWORD; pErrorsByFace: PSingle; out ppCloneMesh: ID3DXPMesh): HResult; stdcall;
  2870. function ClonePMesh(Options: DWORD; pDeclaration: PD3DVertexElement9;
  2871. pD3D: IDirect3DDevice9; pVertexRemapOut: PDWORD; pErrorsbyFace: PSingle;
  2872. out ppCloneMesh: ID3DXPMesh): HResult; stdcall;
  2873. function ReduceFaces(Faces: DWord): HResult; stdcall;
  2874. function ReduceVertices(Vertices: DWord): HResult; stdcall;
  2875. function GetMaxFaces: DWord; stdcall;
  2876. function GetMaxVertices: DWord; stdcall;
  2877. function GetVertexAttributeWeights(pVertexAttributeWeights: PD3DXAttributeWeights): HResult; stdcall;
  2878. function GetVertexWeights(pVertexWeights: PSingle): HResult; stdcall;
  2879. end;
  2880. const
  2881. UNUSED16 = $ffff;
  2882. {$EXTERNALSYM UNUSED16}
  2883. UNUSED32 = $ffffffff;
  2884. {$EXTERNALSYM UNUSED32}
  2885. // ID3DXMesh::Optimize options - upper byte only, lower 3 bytes used from _D3DXMESH option flags
  2886. type
  2887. _D3DXMESHOPT = {$IFDEF TYPE_IDENTITY}type {$ENDIF}DWord;
  2888. {$EXTERNALSYM _D3DXMESHOPT}
  2889. TD3DXMeshOpt = _D3DXMESHOPT;
  2890. const
  2891. D3DXMESHOPT_COMPACT = $01000000;
  2892. {$EXTERNALSYM D3DXMESHOPT_COMPACT}
  2893. D3DXMESHOPT_ATTRSORT = $02000000;
  2894. {$EXTERNALSYM D3DXMESHOPT_ATTRSORT}
  2895. D3DXMESHOPT_VERTEXCACHE = $04000000;
  2896. {$EXTERNALSYM D3DXMESHOPT_VERTEXCACHE}
  2897. D3DXMESHOPT_STRIPREORDER = $08000000;
  2898. {$EXTERNALSYM D3DXMESHOPT_STRIPREORDER}
  2899. D3DXMESHOPT_IGNOREVERTS = $10000000; // optimize faces only; don't touch vertices
  2900. {$EXTERNALSYM D3DXMESHOPT_IGNOREVERTS}
  2901. D3DXMESHOPT_DONOTSPLIT = $20000000; // do not split vertices shared between attribute groups when attribute sorting
  2902. {$EXTERNALSYM D3DXMESHOPT_DONOTSPLIT}
  2903. D3DXMESHOPT_DEVICEINDEPENDENT = $00400000; // Only affects VCache. uses a static known good cache size for all cards
  2904. {$EXTERNALSYM D3DXMESHOPT_DEVICEINDEPENDENT}
  2905. // D3DXMESHOPT_SHAREVB has been removed, please use D3DXMESH_VB_SHARE instead
  2906. // Subset of the mesh that has the same attribute and bone combination.
  2907. // This subset can be rendered in a single draw call
  2908. type
  2909. PDWordArray = ^TDWordArray;
  2910. {$NODEFINE PDWordArray}
  2911. TDWordArray = array[0..MaxInt div SizeOf(DWORD) - 1] of DWord;
  2912. {$NODEFINE TDWordArray}
  2913. PD3DXBoneCombination = ^TD3DXBoneCombination;
  2914. _D3DXBONECOMBINATION = packed record
  2915. AttribId: DWord;
  2916. FaceStart: DWord;
  2917. FaceCount: DWord;
  2918. VertexStart: DWord;
  2919. VertexCount: DWord;
  2920. BoneId: PDWordArray; // [ DWORD* ] in original d3dx8mesh.h
  2921. end;
  2922. {$EXTERNALSYM _D3DXBONECOMBINATION}
  2923. D3DXBONECOMBINATION = _D3DXBONECOMBINATION;
  2924. {$EXTERNALSYM D3DXBONECOMBINATION}
  2925. TD3DXBoneCombination = _D3DXBONECOMBINATION;
  2926. // The following types of patch combinations are supported:
  2927. // Patch type Basis Degree
  2928. // Rect Bezier 2,3,5
  2929. // Rect B-Spline 2,3,5
  2930. // Rect Catmull-Rom 3
  2931. // Tri Bezier 2,3,5
  2932. // N-Patch N/A 3
  2933. PD3DXPatchInfo = ^TD3DXPatchInfo;
  2934. _D3DXPATCHINFO = packed record
  2935. PatchType: TD3DXPatchMeshType;
  2936. Degree: TD3DDegreeType;
  2937. Basis: TD3DBasisType;
  2938. end;
  2939. {$EXTERNALSYM _D3DXPATCHINFO}
  2940. D3DXPATCHINFO = _D3DXPATCHINFO;
  2941. {$EXTERNALSYM D3DXPATCHINFO}
  2942. TD3DXPatchInfo = _D3DXPATCHINFO;
  2943. {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DXPatchMesh);'}
  2944. {$EXTERNALSYM ID3DXPatchMesh}
  2945. ID3DXPatchMesh = interface(IUnknown)
  2946. ['{0AD3E8BC-290D-4dc7-91AB-73A82755B13E}']
  2947. // ID3DXPatchMesh
  2948. // Return creation parameters
  2949. function GetNumPatches: DWORD; stdcall;
  2950. function GetNumVertices: DWORD; stdcall;
  2951. function GetDeclaration(pDeclaration: PD3DVertexElement9): HResult; stdcall;
  2952. function GetControlVerticesPerPatch: DWORD; stdcall;
  2953. function GetOptions: DWORD; stdcall;
  2954. function GetDevice(out ppDevice: IDirect3DDevice9): HResult; stdcall;
  2955. function GetPatchInfo(out PatchInfo: TD3DXPatchInfo): HResult; stdcall;
  2956. // Control mesh access
  2957. function GetVertexBuffer(out ppVB: IDirect3DVertexBuffer9): HResult; stdcall;
  2958. function GetIndexBuffer(out ppIB: IDirect3DIndexBuffer9): HResult; stdcall;
  2959. function LockVertexBuffer(flags: DWORD; out ppData: Pointer): HResult; stdcall;
  2960. function UnlockVertexBuffer: HResult; stdcall;
  2961. function LockIndexBuffer(flags: DWORD; out ppData: Pointer): HResult; stdcall;
  2962. function UnlockIndexBuffer: HResult; stdcall;
  2963. function LockAttributeBuffer(flags: DWORD; out ppData: PDWORD): HResult; stdcall;
  2964. function UnlockAttributeBuffer: HResult; stdcall;
  2965. // This function returns the size of the tessellated mesh given a tessellation level.
  2966. // This assumes uniform tessellation. For adaptive tessellation the Adaptive parameter must
  2967. // be set to TRUE and TessellationLevel should be the max tessellation.
  2968. // This will result in the max mesh size necessary for adaptive tessellation.
  2969. function GetTessSize(fTessLevel: Single; Adaptive: LongBool; out NumTriangles, NumVertices: DWORD): HResult; stdcall;
  2970. //GenerateAdjacency determines which patches are adjacent with provided tolerance
  2971. //this information is used internally to optimize tessellation
  2972. function GenerateAdjacency(Tolerance: Single): HResult; stdcall;
  2973. //CloneMesh Creates a new patchmesh with the specified decl, and converts the vertex buffer
  2974. //to the new decl. Entries in the new decl which are new are set to 0. If the current mesh
  2975. //has adjacency, the new mesh will also have adjacency
  2976. function CloneMesh(Options: DWORD; pDecl: PD3DVertexElement9; out pMesh: ID3DXPatchMesh): HResult; stdcall;
  2977. // Optimizes the patchmesh for efficient tessellation. This function is designed
  2978. // to perform one time optimization for patch meshes that need to be tessellated
  2979. // repeatedly by calling the Tessellate() method. The optimization performed is
  2980. // independent of the actual tessellation level used.
  2981. // Currently Flags is unused.
  2982. // If vertices are changed, Optimize must be called again
  2983. function Optimize(flags: DWORD): HResult; stdcall;
  2984. //gets and sets displacement parameters
  2985. //displacement maps can only be 2D textures MIP-MAPPING is ignored for non adapative tessellation
  2986. function SetDisplaceParam(Texture: IDirect3DBaseTexture9;
  2987. MinFilter: TD3DTextureFilterType;
  2988. MagFilter: TD3DTextureFilterType;
  2989. MipFilter: TD3DTextureFilterType;
  2990. Wrap: TD3DTextureAddress;
  2991. dwLODBias: DWORD): HResult; stdcall;
  2992. function GetDisplaceParam(out Texture: IDirect3DBaseTexture9;
  2993. out MinFilter: TD3DTextureFilterType;
  2994. out MagFilter: TD3DTextureFilterType;
  2995. out MipFilter: TD3DTextureFilterType;
  2996. out Wrap: TD3DTextureAddress;
  2997. out dwLODBias: DWORD): HResult; stdcall;
  2998. // Performs the uniform tessellation based on the tessellation level.
  2999. // This function will perform more efficiently if the patch mesh has been optimized using the Optimize() call.
  3000. function Tessellate(fTessLevel: Single; pMesh: ID3DXMesh): HResult; stdcall;
  3001. // Performs adaptive tessellation based on the Z based adaptive tessellation criterion.
  3002. // pTrans specifies a 4D vector that is dotted with the vertices to get the per vertex
  3003. // adaptive tessellation amount. Each edge is tessellated to the average of the criterion
  3004. // at the 2 vertices it connects.
  3005. // MaxTessLevel specifies the upper limit for adaptive tesselation.
  3006. // This function will perform more efficiently if the patch mesh has been optimized using the Optimize() call.
  3007. function TessellateAdaptive(const pTrans: TD3DXVector4; dwMaxTessLevel, dwMinTessLevel: DWORD; pMesh: ID3DXMesh): HResult; stdcall;
  3008. end;
  3009. {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DXSkinInfo);'}
  3010. {$EXTERNALSYM ID3DXSkinInfo}
  3011. ID3DXSkinInfo = interface(IUnknown)
  3012. ['{0E7DBBF3-421A-4dd8-B738-A5DAC3A48767}']
  3013. // Specify the which vertices do each bones influence and by how much
  3014. function SetBoneInfluence(bone, numInfluences: DWORD; vertices: PDWORD; weights: PSingle): HResult; stdcall;
  3015. function GetNumBoneInfluences(bone: DWORD): DWORD; stdcall;
  3016. function GetBoneInfluence(bone: DWORD; vertices: PDWORD; weights: PSingle): HResult; stdcall;
  3017. function GetMaxVertexInfluences(out maxVertexInfluences: DWORD): HResult; stdcall;
  3018. function GetNumBones: DWORD; stdcall;
  3019. // This gets the max face influences based on a triangle mesh with the specified index buffer
  3020. function GetMaxFaceInfluences(pIB: IDirect3DIndexBuffer9; NumFaces: DWORD; out maxFaceInfluences:DWORD): HResult; stdcall;
  3021. // Set min bone influence. Bone influences that are smaller than this are ignored
  3022. function SetMinBoneInfluence(MinInfl: Single): HResult; stdcall;
  3023. // Get min bone influence.
  3024. function GetMinBoneInfluence: Single; stdcall;
  3025. // Bone names are returned by D3DXLoadSkinMeshFromXof. They are not used by any other method of this object
  3026. function SetBoneName(Bone: DWORD; pName: PAnsiChar): HResult; stdcall; // pName is copied to an internal string buffer
  3027. function GetBoneName(Bone: DWORD): PAnsiChar; stdcall; // A pointer to an internal string buffer is returned. Do not free this.
  3028. // Bone offset matrices are returned by D3DXLoadSkinMeshFromXof. They are not used by any other method of this object
  3029. function SetBoneOffsetMatrix(Bone: DWORD; const pBoneTransform: TD3DXMatrix): HResult; stdcall; // pBoneTransform is copied to an internal buffer
  3030. function GetBoneOffsetMatrix(Bone: DWORD): PD3DXMatrix; stdcall; // A pointer to an internal matrix is returned. Do not free this.
  3031. // Clone a skin info object
  3032. function Clone(out ppSkinInfo: ID3DXSkinInfo): HResult; stdcall;
  3033. // Update bone influence information to match vertices after they are reordered. This should be called
  3034. // if the target vertex buffer has been reordered externally.
  3035. function Remap(NumVertices: DWORD; pVertexRemap: PDWORD): HResult; stdcall;
  3036. // These methods enable the modification of the vertex layout of the vertices that will be skinned
  3037. function SetFVF(FVF: DWORD): HResult; stdcall;
  3038. function SetDeclaration(pDeclaration: PD3DVertexElement9): HResult; stdcall;
  3039. function GetFVF: DWORD; stdcall;
  3040. function GetDeclaration(Declaration: TFVFDeclaration): HResult; stdcall;
  3041. // Apply SW skinning based on current pose matrices to the target vertices.
  3042. function UpdateSkinnedMesh(
  3043. pBoneTransforms: PD3DXMatrix;
  3044. pBoneInvTransposeTransforms: PD3DXMatrix;
  3045. pVerticesSrc: Pointer;
  3046. pVerticesDst: Pointer): HResult; stdcall;
  3047. // Takes a mesh and returns a new mesh with per vertex blend weights and a bone combination
  3048. // table that describes which bones affect which subsets of the mesh
  3049. function ConvertToBlendedMesh(
  3050. pMesh: ID3DXMesh;
  3051. Options: DWORD;
  3052. pAdjacencyIn: PDWORD;
  3053. pAdjacencyOut: PDWORD;
  3054. pFaceRemap: PDWORD;
  3055. ppVertexRemap: PID3DXBuffer;
  3056. pMaxFaceInfl: PDWORD;
  3057. out pNumBoneCombinations: DWORD;
  3058. out ppBoneCombinationTable: ID3DXBuffer;
  3059. out ppMesh: ID3DXMesh): HResult; stdcall;
  3060. // Takes a mesh and returns a new mesh with per vertex blend weights and indices
  3061. // and a bone combination table that describes which bones palettes affect which subsets of the mesh
  3062. function ConvertToIndexedBlendedMesh(
  3063. pMesh: ID3DXMesh;
  3064. Options: DWORD;
  3065. paletteSize: DWORD;
  3066. pAdjacencyIn: PDWORD;
  3067. pAdjacencyOut: PDWORD;
  3068. pFaceRemap: PDWORD;
  3069. ppVertexRemap: PID3DXBuffer;
  3070. pMaxVertexInfl: PDWORD;
  3071. out pNumBoneCombinations: DWORD;
  3072. out ppBoneCombinationTable: ID3DXBuffer;
  3073. out ppMesh: ID3DXMesh): HResult; stdcall;
  3074. end;
  3075. type
  3076. IID_ID3DXBaseMesh = ID3DXBaseMesh;
  3077. {$EXTERNALSYM IID_ID3DXBaseMesh}
  3078. IID_ID3DXMesh = ID3DXMesh;
  3079. {$EXTERNALSYM IID_ID3DXMesh}
  3080. IID_ID3DXPMesh = ID3DXPMesh;
  3081. {$EXTERNALSYM IID_ID3DXPMesh}
  3082. IID_ID3DXSPMesh = ID3DXSPMesh;
  3083. {$EXTERNALSYM IID_ID3DXSPMesh}
  3084. IID_ID3DXSkinInfo = ID3DXSkinInfo;
  3085. {$EXTERNALSYM IID_ID3DXSkinInfo}
  3086. IID_ID3DXPatchMesh = ID3DXPatchMesh;
  3087. {$EXTERNALSYM IID_ID3DXPatchMesh}
  3088. function D3DXCreateMesh(NumFaces, NumVertices: DWord; Options: DWord;
  3089. pDeclaration: PD3DVertexElement9;
  3090. pD3D: IDirect3DDevice9; out ppMesh: ID3DXMesh): HResult; stdcall; external d3dx9meshDLL;
  3091. {$EXTERNALSYM D3DXCreateMesh}
  3092. function D3DXCreateMeshFVF(NumFaces, NumVertices: DWord; Options: DWord;
  3093. FVF: DWord; pD3D: IDirect3DDevice9; out ppMesh: ID3DXMesh): HResult; stdcall; external d3dx9meshDLL;
  3094. {$EXTERNALSYM D3DXCreateMeshFVF}
  3095. function D3DXCreateSPMesh(pMesh: ID3DXMesh; pAdjacency: PDWord;
  3096. pVertexAttributeWeights: PD3DXAttributeWeights; pVertexWeights: PSingle;
  3097. out ppSMesh: ID3DXSPMesh): HResult; stdcall; external d3dx9meshDLL;
  3098. {$EXTERNALSYM D3DXCreateSPMesh}
  3099. // clean a mesh up for simplification, try to make manifold
  3100. function D3DXCleanMesh(pMeshIn: ID3DXMesh; pAdjacencyIn: PDWord;
  3101. out ppMeshOut: ID3DXMesh; pAdjacencyOut: PDWord;
  3102. ppErrorsAndWarnings: PID3DXBuffer): HResult; stdcall; external d3dx9meshDLL;
  3103. {$EXTERNALSYM D3DXCleanMesh}
  3104. function D3DXValidMesh(pMeshIn: ID3DXMesh; pAdjacency: PDWord;
  3105. ppErrorsAndWarnings: PID3DXBuffer): HResult; stdcall; external d3dx9meshDLL;
  3106. {$EXTERNALSYM D3DXValidMesh}
  3107. function D3DXGeneratePMesh(pMesh: ID3DXMesh; pAdjacency: PDWord;
  3108. pVertexAttributeWeights: PD3DXAttributeWeights; pVertexWeights: PSingle;
  3109. MinValue: DWord; Options: TD3DMeshSimp; out ppPMesh: ID3DXPMesh): HResult; stdcall; external d3dx9meshDLL;
  3110. {$EXTERNALSYM D3DXGeneratePMesh}
  3111. function D3DXSimplifyMesh(pMesh: ID3DXMesh; pAdjacency: PDWord;
  3112. pVertexAttributeWeights: PD3DXAttributeWeights; pVertexWeights: PSingle;
  3113. MinValue: DWord; Options: TD3DMeshSimp; out ppMesh: ID3DXMesh): HResult; stdcall; external d3dx9meshDLL;
  3114. {$EXTERNALSYM D3DXSimplifyMesh}
  3115. function D3DXComputeBoundingSphere(
  3116. pFirstPosition: PD3DXVector3; // pointer to first position
  3117. NumVertices: DWORD;
  3118. dwStride: DWORD; // count in bytes to subsequent position vectors
  3119. out pCenter: TD3DXVector3;
  3120. out pRadius: Single): HResult; stdcall; external d3dx9meshDLL;
  3121. {$EXTERNALSYM D3DXComputeBoundingSphere}
  3122. function D3DXComputeBoundingBox(
  3123. pFirstPosition: PD3DXVector3; // pointer to first position
  3124. NumVertices: DWORD;
  3125. dwStride: DWORD; // count in bytes to subsequent position vectors
  3126. out pMin, pMax: TD3DXVector3): HResult; stdcall; external d3dx9meshDLL;
  3127. {$EXTERNALSYM D3DXComputeBoundingBox}
  3128. function D3DXComputeNormals(pMesh: ID3DXBaseMesh; pAdjacency: PDWord): HResult; stdcall; external d3dx9meshDLL;
  3129. {$EXTERNALSYM D3DXComputeNormals}
  3130. function D3DXCreateBuffer(NumBytes: DWord; out ppBuffer: ID3DXBuffer): HResult; stdcall; external d3dx9meshDLL;
  3131. {$EXTERNALSYM D3DXCreateBuffer}
  3132. function D3DXLoadMeshFromXA(
  3133. pFilename: PAnsiChar;
  3134. Options: DWord;
  3135. pD3D: IDirect3DDevice9;
  3136. ppAdjacency, ppMaterials, ppEffectInstances: PID3DXBuffer;
  3137. pNumMaterials: PDWORD;
  3138. out ppMesh: ID3DXMesh): HResult; stdcall; external d3dx9meshDLL name 'D3DXLoadMeshFromXA';
  3139. {$EXTERNALSYM D3DXLoadMeshFromXA}
  3140. function D3DXLoadMeshFromXW(
  3141. pFilename: PWideChar;
  3142. Options: DWord;
  3143. pD3D: IDirect3DDevice9;
  3144. ppAdjacency, ppMaterials, ppEffectInstances: PID3DXBuffer;
  3145. pNumMaterials: PDWORD;
  3146. out ppMesh: ID3DXMesh): HResult; stdcall; external d3dx9meshDLL name 'D3DXLoadMeshFromXW';
  3147. {$EXTERNALSYM D3DXLoadMeshFromXW}
  3148. function D3DXLoadMeshFromX(
  3149. pFilename: PChar;
  3150. Options: DWord;
  3151. pD3D: IDirect3DDevice9;
  3152. ppAdjacency, ppMaterials, ppEffectInstances: PID3DXBuffer;
  3153. pNumMaterials: PDWORD;
  3154. out ppMesh: ID3DXMesh): HResult; stdcall; external d3dx9meshDLL name 'D3DXLoadMeshFromXA';
  3155. {$EXTERNALSYM D3DXLoadMeshFromX}
  3156. function D3DXLoadMeshFromXInMemory(
  3157. Memory: Pointer;
  3158. SizeOfMemory: DWORD;
  3159. Options: DWORD;
  3160. pD3D: IDirect3DDevice9;
  3161. ppAdjacency, ppMaterials, ppEffectInstances: PID3DXBuffer;
  3162. pNumMaterials: PDWORD;
  3163. out ppMesh: ID3DXMesh): HResult; stdcall; external d3dx9meshDLL;
  3164. {$EXTERNALSYM D3DXLoadMeshFromXInMemory}
  3165. function D3DXLoadMeshFromXResource(
  3166. Module: HModule;
  3167. Name: PAnsiChar;
  3168. _Type: PAnsiChar;
  3169. Options: DWORD;
  3170. pD3D: IDirect3DDevice9;
  3171. ppAdjacency, ppMaterials, ppEffectInstances: PID3DXBuffer;
  3172. pNumMaterials: PDWORD;
  3173. out ppMesh: ID3DXMesh): HResult; stdcall; external d3dx9meshDLL;
  3174. {$EXTERNALSYM D3DXLoadMeshFromXResource}
  3175. function D3DXSaveMeshToXA(
  3176. pFilename: PAnsiChar;
  3177. pMesh: ID3DXMesh;
  3178. pAdjacency: PDWORD;
  3179. pMaterials: PD3DXMaterial;
  3180. pEffectInstances: PD3DXEffectInstance;
  3181. NumMaterials: DWORD;
  3182. Format: DWORD): HResult; stdcall; external d3dx9meshDLL name 'D3DXSaveMeshToXA';
  3183. {$EXTERNALSYM D3DXSaveMeshToXA}
  3184. function D3DXSaveMeshToXW(
  3185. pFilename: PWideChar;
  3186. pMesh: ID3DXMesh;
  3187. pAdjacency: PDWORD;
  3188. pMaterials: PD3DXMaterial;
  3189. pEffectInstances: PD3DXEffectInstance;
  3190. NumMaterials: DWORD;
  3191. Format: DWORD): HResult; stdcall; external d3dx9meshDLL name 'D3DXSaveMeshToXW';
  3192. {$EXTERNALSYM D3DXSaveMeshToXW}
  3193. function D3DXSaveMeshToX(
  3194. pFilename: PChar;
  3195. pMesh: ID3DXMesh;
  3196. pAdjacency: PDWORD;
  3197. pMaterials: PD3DXMaterial;
  3198. pEffectInstances: PD3DXEffectInstance;
  3199. NumMaterials: DWORD;
  3200. Format: DWORD): HResult; stdcall; external d3dx9meshDLL name 'D3DXSaveMeshToXA';
  3201. {$EXTERNALSYM D3DXSaveMeshToX}
  3202. function D3DXCreatePMeshFromStream(
  3203. pStream: IStream;
  3204. Options: DWORD;
  3205. pD3DDevice: IDirect3DDevice9;
  3206. ppMaterials: PID3DXBuffer;
  3207. ppEffectInstances: PID3DXBuffer;
  3208. pNumMaterials: PDWORD;
  3209. out ppPMesh: ID3DXPMesh): HResult; stdcall; external d3dx9meshDLL;
  3210. {$EXTERNALSYM D3DXCreatePMeshFromStream}
  3211. // Creates a skin info object based on the number of vertices, number of bones, and a declaration describing the vertex layout of the target vertices
  3212. // The bone names and initial bone transforms are not filled in the skin info object by this method.
  3213. function D3DXCreateSkinInfo(
  3214. NumVertices: DWORD;
  3215. pDeclaration: PD3DVertexElement9;
  3216. NumBones: DWORD;
  3217. out ppSkinInfo: ID3DXSkinInfo): HResult; stdcall; external d3dx9meshDLL;
  3218. {$EXTERNALSYM D3DXCreateSkinInfo}
  3219. // Creates a skin info object based on the number of vertices, number of bones, and a FVF describing the vertex layout of the target vertices
  3220. // The bone names and initial bone transforms are not filled in the skin info object by this method.
  3221. function D3DXCreateSkinInfoFVF(
  3222. NumVertices: DWORD;
  3223. FVF: DWORD;
  3224. NumBones: DWORD;
  3225. out ppSkinInfo: ID3DXSkinInfo): HResult; stdcall; external d3dx9meshDLL;
  3226. {$EXTERNALSYM D3DXCreateSkinInfoFVF}
  3227. function D3DXLoadMeshFromXof(
  3228. pXofObjMesh: IDirectXFileData;
  3229. Options: DWord;
  3230. pD3D: IDirect3DDevice9;
  3231. ppAdjacency, ppMaterials, ppEffectInstances: PID3DXBuffer;
  3232. pNumMaterials: PDWord;
  3233. out ppMesh: ID3DXMesh): HResult; stdcall; external d3dx9meshDLL;
  3234. {$EXTERNALSYM D3DXLoadMeshFromXof}
  3235. // This similar to D3DXLoadMeshFromXof, except also returns skinning info if present in the file
  3236. // If skinning info is not present, ppSkinInfo will be NULL
  3237. function D3DXLoadSkinMeshFromXof(
  3238. pXofObjMesh: IDirectXFileData;
  3239. Options: DWORD;
  3240. pD3D: IDirect3DDevice9;
  3241. ppAdjacency, ppMaterials, ppEffectInstances: PID3DXBuffer;
  3242. pMatOut: PDWORD;
  3243. out ppSkinInfo: ID3DXSkinInfo;
  3244. out ppMesh: ID3DXMesh): HResult; stdcall; external d3dx9meshDLL;
  3245. {$EXTERNALSYM D3DXLoadSkinMeshFromXof}
  3246. // The inverse of D3DXConvertTo{Indexed}BlendedMesh() functions. It figures out the skinning info from
  3247. // the mesh and the bone combination table and populates a skin info object with that data. The bone
  3248. // names and initial bone transforms are not filled in the skin info object by this method. This works
  3249. // with either a non-indexed or indexed blended mesh. It examines the FVF or declarator of the mesh to
  3250. // determine what type it is.
  3251. function D3DXCreateSkinInfoFromBlendedMesh(
  3252. pMesh: ID3DXBaseMesh;
  3253. NumBoneCombinations: DWORD;
  3254. pBoneCombinationTable: PD3DXBoneCombination;
  3255. out ppSkinInfo: ID3DXSkinInfo): HResult; stdcall; external d3dx9meshDLL;
  3256. {$EXTERNALSYM D3DXCreateSkinInfoFromBlendedMesh}
  3257. function D3DXTessellateNPatches(pMeshIn: ID3DXMesh;
  3258. pAdjacencyIn: PDWord; NumSegs: Single;
  3259. QuadraticInterpNormals: BOOL; // if false use linear intrep for normals, if true use quadratic
  3260. out ppMeshOut: ID3DXMesh; ppAdjacencyOut: PDWord): HResult; stdcall; external d3dx9meshDLL;
  3261. {$EXTERNALSYM D3DXTessellateNPatches}
  3262. //generates implied outputdecl from input decl
  3263. //the decl generated from this should be used to generate the output decl for
  3264. //the tessellator subroutines.
  3265. function D3DXGenerateOutputDecl(
  3266. pOutput: PD3DVertexElement9;
  3267. pInput: PD3DVertexElement9): HResult; stdcall; external d3dx9meshDLL;
  3268. {$EXTERNALSYM D3DXGenerateOutputDecl}
  3269. //loads patches from an XFileData
  3270. //since an X file can have up to 6 different patch meshes in it,
  3271. //returns them in an array - pNumPatches will contain the number of
  3272. //meshes in the actual file.
  3273. function D3DXLoadPatchMeshFromXof(
  3274. pXofObjMesh: IDirectXFileData;
  3275. Options: DWORD;
  3276. pDevice: IDirect3DDevice9;
  3277. ppMaterials: PID3DXBuffer;
  3278. ppEffectInstances: PID3DXBuffer;
  3279. pNumMaterials: PDWORD;
  3280. out ppMesh: ID3DXPatchMesh): HResult; stdcall; external d3dx9meshDLL;
  3281. {$EXTERNALSYM D3DXLoadPatchMeshFromXof}
  3282. //computes the size a single rect patch.
  3283. function D3DXRectPatchSize(
  3284. pfNumSegs: PSingle; //segments for each edge (4)
  3285. pdwTriangles: PDWORD; //output number of triangles
  3286. pdwVertices: PDWORD //output number of vertices
  3287. ): HResult; stdcall; external d3dx9meshDLL;
  3288. {$EXTERNALSYM D3DXRectPatchSize}
  3289. //computes the size of a single triangle patch
  3290. function D3DXTriPatchSize(
  3291. pfNumSegs: PSingle; //segments for each edge (3)
  3292. pdwTriangles: PDWORD; //output number of triangles
  3293. pdwVertices: PDWORD //output number of vertices
  3294. ): HResult; stdcall; external d3dx9meshDLL;
  3295. {$EXTERNALSYM D3DXTriPatchSize}
  3296. //tessellates a patch into a created mesh
  3297. //similar to D3D RT patch
  3298. function D3DXTessellateRectPatch(
  3299. pVB: IDirect3DVertexBuffer9;
  3300. pNumSegs: PSingle;
  3301. pdwInDecl: PD3DVertexElement9;
  3302. const pRectPatchInfo: TD3DRectPatchInfo;
  3303. pMesh: ID3DXMesh): HResult; stdcall; external d3dx9meshDLL;
  3304. {$EXTERNALSYM D3DXTessellateRectPatch}
  3305. function D3DXTessellateTriPatch(
  3306. pVB: IDirect3DVertexBuffer9;
  3307. pNumSegs: PSingle;
  3308. pInDecl: PD3DVertexElement9;
  3309. pTriPatchInfo: TD3DTriPatchInfo;
  3310. pMesh: ID3DXMesh): HResult; stdcall; external d3dx9meshDLL;
  3311. {$EXTERNALSYM D3DXTessellateTriPatch}
  3312. //creates an NPatch PatchMesh from a D3DXMESH
  3313. function D3DXCreateNPatchMesh(
  3314. pMeshSysMem: ID3DXMesh;
  3315. out pPatchMesh: ID3DXPatchMesh): HResult; stdcall; external d3dx9meshDLL;
  3316. {$EXTERNALSYM D3DXCreateNPatchMesh}
  3317. //creates a patch mesh
  3318. function D3DXCreatePatchMesh(
  3319. const pInfo: TD3DXPatchInfo; //patch type
  3320. dwNumPatches: DWORD; //number of patches
  3321. dwNumVertices: DWORD; //number of control vertices
  3322. dwOptions: DWORD; //options
  3323. pDecl: PD3DVertexElement9; //format of control vertices
  3324. pDevice: IDirect3DDevice9;
  3325. out pPatchMesh: ID3DXPatchMesh): HResult; stdcall; external d3dx9meshDLL;
  3326. {$EXTERNALSYM D3DXCreatePatchMesh}
  3327. //returns the number of degenerates in a patch mesh -
  3328. //text output put in string.
  3329. function D3DXValidPatchMesh(
  3330. pMesh: ID3DXPatchMesh;
  3331. dwcDegenerateVertices: PDWORD;
  3332. dwcDegeneratePatches: PDWORD;
  3333. ppErrorsAndWarnings: PID3DXBuffer): HResult; stdcall; external d3dx9meshDLL;
  3334. {$EXTERNALSYM D3DXValidPatchMesh}
  3335. function D3DXGetFVFVertexSize(FVF: DWord): LongWord; stdcall; external d3dx9meshDLL;
  3336. {$EXTERNALSYM D3DXGetFVFVertexSize}
  3337. function D3DXGetDeclVertexSize(pDecl: PD3DVertexElement9; Stream: DWORD): LongWord; stdcall; external d3dx9meshDLL;
  3338. {$EXTERNALSYM D3DXGetDeclVertexSize}
  3339. function D3DXGetDeclLength(pDecl: PD3DVertexElement9): LongWord; stdcall; external d3dx9meshDLL;
  3340. {$EXTERNALSYM D3DXGetDeclLength}
  3341. function D3DXDeclaratorFromFVF(FVF: DWord; out Declaration: TFVFDeclaration): HResult; stdcall; external d3dx9meshDLL;
  3342. {$EXTERNALSYM D3DXDeclaratorFromFVF}
  3343. function D3DXFVFFromDeclarator(pDeclarator: PD3DVertexElement9; out pFVF: DWord): HResult; stdcall; external d3dx9meshDLL;
  3344. {$EXTERNALSYM D3DXFVFFromDeclarator}
  3345. function D3DXWeldVertices(
  3346. pMesh: ID3DXMesh;
  3347. Flags: DWORD;
  3348. pEpsilons: PD3DXWeldEpsilons;
  3349. rgdwAdjacencyIn, rgdwAdjacencyOut, pFaceRemap: PDWord;
  3350. ppVertexRemap: PID3DXBuffer): HResult; stdcall; external d3dx9meshDLL;
  3351. {$EXTERNALSYM D3DXWeldVertices}
  3352. type
  3353. PD3DXIntersectInfo = ^TD3DXIntersectInfo;
  3354. _D3DXINTERSECTINFO = packed record
  3355. FaceIndex: DWord; // index of face intersected
  3356. U: Single; // Barycentric Hit Coordinates
  3357. V: Single; // Barycentric Hit Coordinates
  3358. Dist: Single; // Ray-Intersection Parameter Distance
  3359. end;
  3360. {$EXTERNALSYM _D3DXINTERSECTINFO}
  3361. D3DXINTERSECTINFO = _D3DXINTERSECTINFO;
  3362. {$EXTERNALSYM D3DXINTERSECTINFO}
  3363. TD3DXIntersectInfo = _D3DXINTERSECTINFO;
  3364. function D3DXIntersect(pMesh: ID3DXBaseMesh;
  3365. const pRayPos, pRayDir: TD3DXVector3;
  3366. out pHit: BOOL; // True if any faces were intersected
  3367. pFaceIndex: PDWord; // index of closest face intersected
  3368. pU: PSingle; // Barycentric Hit Coordinates
  3369. pV: PSingle; // Barycentric Hit Coordinates
  3370. pDist: PSingle; // Ray-Intersection Parameter Distance
  3371. ppAllHits: PID3DXBuffer; // Array of D3DXINTERSECTINFOs for all hits (not just closest)
  3372. pCountOfHits: PDWord // Number of entries in AllHits array
  3373. ): HResult; stdcall; external d3dx9meshDLL;
  3374. {$EXTERNALSYM D3DXIntersect}
  3375. function D3DXIntersectSubset(pMesh: ID3DXBaseMesh; AttribId: DWord;
  3376. const pRayPos, pRayDir: TD3DXVector3;
  3377. out pHit: BOOL; // True if any faces were intersected
  3378. pFaceIndex: PDWord; // index of closest face intersected
  3379. pU: PSingle; // Barycentric Hit Coordinates
  3380. pV: PSingle; // Barycentric Hit Coordinates
  3381. pDist: PSingle; // Ray-Intersection Parameter Distance
  3382. ppAllHits: PID3DXBuffer; // Array of D3DXINTERSECTINFOs for all hits (not just closest)
  3383. pCountOfHits: PDWord // Number of entries in AllHits array
  3384. ): HResult; stdcall; external d3dx9meshDLL;
  3385. {$EXTERNALSYM D3DXIntersectSubset}
  3386. function D3DXSplitMesh(pMeshIn: ID3DXMesh; pAdjacencyIn: PDWord;
  3387. MaxSize, Options: DWord;
  3388. out pMeshesOut: DWord; out ppMeshArrayOut: ID3DXBuffer;
  3389. ppAdjacencyArrayOut, ppFaceRemapArrayOut, ppVertRemapArrayOut: PID3DXBuffer
  3390. ): HResult; stdcall; external d3dx9meshDLL;
  3391. {$EXTERNALSYM D3DXSplitMesh}
  3392. function D3DXIntersectTri(
  3393. const p0: TD3DXVector3; // Triangle vertex 0 position
  3394. const p1: TD3DXVector3; // Triangle vertex 1 position
  3395. const p2: TD3DXVector3; // Triangle vertex 2 position
  3396. const pRayPos: TD3DXVector3; // Ray origin
  3397. const pRayDir: TD3DXVector3; // Ray direction
  3398. out pU: Single; // Barycentric Hit Coordinates
  3399. out pV: Single; // Barycentric Hit Coordinates
  3400. out pDist: Single // Ray-Intersection Parameter Distance
  3401. ): HResult; stdcall; external d3dx9meshDLL;
  3402. {$EXTERNALSYM D3DXIntersectTri}
  3403. function D3DXSphereBoundProbe(const pCenter: TD3DXVector3; Radius: Single;
  3404. out pRayPosition, pRayDirection: TD3DXVector3): BOOL; stdcall; external d3dx9meshDLL;
  3405. {$EXTERNALSYM D3DXSphereBoundProbe}
  3406. function D3DXBoxBoundProbe(const pMin, pMax: TD3DXVector3;
  3407. out pRayPosition, pRayDirection: TD3DXVector3): BOOL; stdcall; external d3dx9meshDLL;
  3408. {$EXTERNALSYM D3DXBoxBoundProbe}
  3409. //D3DXComputeTangent
  3410. //
  3411. //Computes the Tangent vectors for the TexStage texture coordinates
  3412. //and places the results in the TANGENT[TangentIndex] specified in the meshes' DECL
  3413. //puts the binorm in BINORM[BinormIndex] also specified in the decl.
  3414. //
  3415. //If neither the binorm or the tangnet are in the meshes declaration,
  3416. //the function will fail.
  3417. //
  3418. //If a tangent or Binorm field is in the Decl, but the user does not
  3419. //wish D3DXComputeTangent to replace them, then D3DX_DEFAULT specified
  3420. //in the TangentIndex or BinormIndex will cause it to ignore the specified
  3421. //semantic.
  3422. //
  3423. //Wrap should be specified if the texture coordinates wrap.
  3424. function D3DXComputeTangent(
  3425. Mesh: ID3DXMesh;
  3426. TexStage: DWORD;
  3427. TangentIndex: DWORD;
  3428. BinormIndex: DWORD;
  3429. Wrap: DWORD;
  3430. Adjacency: PDWORD): HResult; stdcall; external d3dx9meshDLL;
  3431. {$EXTERNALSYM D3DXComputeTangent}
  3432. function D3DXConvertMeshSubsetToSingleStrip(
  3433. MeshIn: ID3DXBaseMesh;
  3434. AttribId: DWord;
  3435. IBOptions: DWord;
  3436. out ppIndexBuffer: IDirect3DIndexBuffer9;
  3437. pNumIndices: PDWord): HResult; stdcall; external d3dx9meshDLL;
  3438. {$EXTERNALSYM D3DXConvertMeshSubsetToSingleStrip}
  3439. function D3DXConvertMeshSubsetToStrips(
  3440. MeshIn: ID3DXBaseMesh;
  3441. AttribId: DWord;
  3442. IBOptions: DWord;
  3443. out ppIndexBuffer: IDirect3DIndexBuffer9;
  3444. pNumIndices: PDWord;
  3445. ppStripLengths: PID3DXBuffer;
  3446. pNumStrips: PDWord): HResult; stdcall; external d3dx9meshDLL;
  3447. {$EXTERNALSYM D3DXConvertMeshSubsetToStrips}
  3448. //////////////////////////////////////////////////////////////////////////////
  3449. //
  3450. // Definitions of .X file templates used by mesh load/save functions
  3451. // that are not RM standard
  3452. //
  3453. //////////////////////////////////////////////////////////////////////////////
  3454. const
  3455. DXFILEOBJ_XSkinMeshHeader: TGUID = '{3CF169CE-FF7C-44ab-93C0-F78F62D172E2}';
  3456. {$EXTERNALSYM DXFILEOBJ_XSkinMeshHeader}
  3457. DXFILEOBJ_VertexDuplicationIndices: TGUID = '{B8D65549-D7C9-4995-89CF-53A9A8B031E3}';
  3458. {$EXTERNALSYM DXFILEOBJ_VertexDuplicationIndices}
  3459. DXFILEOBJ_FaceAdjacency: TGUID = '{A64C844A-E282-4756-8B80-250CDE04398C}';
  3460. {$EXTERNALSYM DXFILEOBJ_FaceAdjacency}
  3461. DXFILEOBJ_SkinWeights: TGUID = '{6F0D123B-BAD2-4167-A0D0-80224F25FABB}';
  3462. {$EXTERNALSYM DXFILEOBJ_SkinWeights}
  3463. DXFILEOBJ_Patch: TGUID = '{A3EB5D44-FC22-429d-9AFB-3221CB9719A6}';
  3464. {$EXTERNALSYM DXFILEOBJ_Patch}
  3465. DXFILEOBJ_PatchMesh: TGUID = '{D02C95CC-EDBA-4305-9B5D-1820D7704BBF}';
  3466. {$EXTERNALSYM DXFILEOBJ_PatchMesh}
  3467. DXFILEOBJ_PatchMesh9: TGUID = '{B9EC94E1-B9A6-4251-BA18-94893F02C0EA}';
  3468. {$EXTERNALSYM DXFILEOBJ_PatchMesh9}
  3469. DXFILEOBJ_PMInfo: TGUID = '{B6C3E656-EC8B-4b92-9B62-681659522947}';
  3470. {$EXTERNALSYM DXFILEOBJ_PMInfo}
  3471. DXFILEOBJ_PMAttributeRange: TGUID = '{917E0427-C61E-4a14-9C64-AFE65F9E9844}';
  3472. {$EXTERNALSYM DXFILEOBJ_PMAttributeRange}
  3473. DXFILEOBJ_PMVSplitRecord: TGUID = '{574CCC14-F0B3-4333-822D-93E8A8A08E4C}';
  3474. {$EXTERNALSYM DXFILEOBJ_PMVSplitRecord}
  3475. DXFILEOBJ_FVFData: TGUID = '{B6E70A0E-8EF9-4e83-94AD-ECC8B0C04897}';
  3476. {$EXTERNALSYM DXFILEOBJ_FVFData}
  3477. DXFILEOBJ_VertexElement: TGUID = '{F752461C-1E23-48f6-B9F8-8350850F336F}';
  3478. {$EXTERNALSYM DXFILEOBJ_VertexElement}
  3479. DXFILEOBJ_DeclData: TGUID = '{BF22E553-292C-4781-9FEA-62BD554BDD93}';
  3480. {$EXTERNALSYM DXFILEOBJ_DeclData}
  3481. DXFILEOBJ_EffectFloats: TGUID = '{F1CFE2B3-0DE3-4e28-AFA1-155A750A282D}';
  3482. {$EXTERNALSYM DXFILEOBJ_EffectFloats}
  3483. DXFILEOBJ_EffectString: TGUID = '{D55B097E-BDB6-4c52-B03D-6051C89D0E42}';
  3484. {$EXTERNALSYM DXFILEOBJ_EffectString}
  3485. DXFILEOBJ_EffectDWord: TGUID = '{622C0ED0-956E-4da9-908A-2AF94F3CE716}';
  3486. {$EXTERNALSYM DXFILEOBJ_EffectDWord}
  3487. DXFILEOBJ_EffectParamFloats: TGUID = '{3014B9A0-62F5-478c-9B86-E4AC9F4E418B}';
  3488. {$EXTERNALSYM DXFILEOBJ_EffectParamFloats}
  3489. DXFILEOBJ_EffectParamString: TGUID = '{1DBC4C88-94C1-46ee-9076-2C28818C9481}';
  3490. {$EXTERNALSYM DXFILEOBJ_EffectParamString}
  3491. DXFILEOBJ_EffectParamDWord: TGUID = '{E13963BC-AE51-4c5d-B00F-CFA3A9D97CE5}';
  3492. {$EXTERNALSYM DXFILEOBJ_EffectParamDWord}
  3493. DXFILEOBJ_EffectInstance: TGUID = '{E331F7E4-0559-4cc2-8E99-1CEC1657928F}';
  3494. {$EXTERNALSYM DXFILEOBJ_EffectInstance}
  3495. DXFILEOBJ_AnimTicksPerSecond: TGUID = '{9E415A43-7BA6-4a73-8743-B73D47E88476}';
  3496. {$EXTERNALSYM DXFILEOBJ_AnimTicksPerSecond}
  3497. const
  3498. XSKINEXP_TEMPLATES =
  3499. 'xof 0303txt 0032' +
  3500. 'template XSkinMeshHeader ' +
  3501. '{ ' +
  3502. ' <3CF169CE-FF7C-44ab-93C0-F78F62D172E2> ' +
  3503. ' WORD nMaxSkinWeightsPerVertex; ' +
  3504. ' WORD nMaxSkinWeightsPerFace; ' +
  3505. ' WORD nBones; ' +
  3506. '} ' +
  3507. 'template VertexDuplicationIndices ' +
  3508. '{ ' +
  3509. ' <B8D65549-D7C9-4995-89CF-53A9A8B031E3> ' +
  3510. ' DWORD nIndices; ' +
  3511. ' DWORD nOriginalVertices; ' +
  3512. ' array DWORD indices[nIndices]; ' +
  3513. '} ' +
  3514. 'template FaceAdjacency ' +
  3515. '{ ' +
  3516. ' <A64C844A-E282-4756-8B80-250CDE04398C> ' +
  3517. ' DWORD nIndices; ' +
  3518. ' array DWORD indices[nIndices]; ' +
  3519. '} ' +
  3520. 'template SkinWeights ' +
  3521. '{ ' +
  3522. ' <6F0D123B-BAD2-4167-A0D0-80224F25FABB> ' +
  3523. ' STRING transformNodeName; ' +
  3524. ' DWORD nWeights; ' +
  3525. ' array DWORD vertexIndices[nWeights]; ' +
  3526. ' array float weights[nWeights]; ' +
  3527. ' Matrix4x4 matrixOffset; ' +
  3528. '} ' +
  3529. 'template Patch ' +
  3530. '{ ' +
  3531. ' <A3EB5D44-FC22-429D-9AFB-3221CB9719A6> ' +
  3532. ' DWORD nControlIndices; ' +
  3533. ' array DWORD controlIndices[nControlIndices]; ' +
  3534. '} ' +
  3535. 'template PatchMesh ' +
  3536. '{ ' +
  3537. ' <D02C95CC-EDBA-4305-9B5D-1820D7704BBF> ' +
  3538. ' DWORD nVertices; ' +
  3539. ' array Vector vertices[nVertices]; ' +
  3540. ' DWORD nPatches; ' +
  3541. ' array Patch patches[nPatches]; ' +
  3542. ' [ ... ] ' +
  3543. '} ' +
  3544. 'template PatchMesh9 ' +
  3545. '{ ' +
  3546. ' <B9EC94E1-B9A6-4251-BA18-94893F02C0EA> ' +
  3547. ' DWORD Type; ' +
  3548. ' DWORD Degree; ' +
  3549. ' DWORD Basis; ' +
  3550. ' DWORD nVertices; ' +
  3551. ' array Vector vertices[nVertices]; ' +
  3552. ' DWORD nPatches; ' +
  3553. ' array Patch patches[nPatches]; ' +
  3554. ' [ ... ] ' +
  3555. '} ' +
  3556. 'template EffectFloats ' +
  3557. '{ ' +
  3558. ' <F1CFE2B3-0DE3-4e28-AFA1-155A750A282D> ' +
  3559. ' DWORD nFloats; ' +
  3560. ' array float Floats[nFloats]; ' +
  3561. '} ' +
  3562. 'template EffectString ' +
  3563. '{ ' +
  3564. ' <D55B097E-BDB6-4c52-B03D-6051C89D0E42> ' +
  3565. ' STRING Value; ' +
  3566. '} ' +
  3567. 'template EffectDWord ' +
  3568. '{ ' +
  3569. ' <622C0ED0-956E-4da9-908A-2AF94F3CE716> ' +
  3570. ' DWORD Value; ' +
  3571. '} ' +
  3572. 'template EffectParamFloats ' +
  3573. '{ ' +
  3574. ' <3014B9A0-62F5-478c-9B86-E4AC9F4E418B> ' +
  3575. ' STRING ParamName; ' +
  3576. ' DWORD nFloats; ' +
  3577. ' array float Floats[nFloats]; ' +
  3578. '} ' +
  3579. 'template EffectParamString ' +
  3580. '{ ' +
  3581. ' <1DBC4C88-94C1-46ee-9076-2C28818C9481> ' +
  3582. ' STRING ParamName; ' +
  3583. ' STRING Value; ' +
  3584. '} ' +
  3585. 'template EffectParamDWord ' +
  3586. '{ ' +
  3587. ' <E13963BC-AE51-4c5d-B00F-CFA3A9D97CE5> ' +
  3588. ' STRING ParamName; ' +
  3589. ' DWORD Value; ' +
  3590. '} ' +
  3591. 'template EffectInstance ' +
  3592. '{ ' +
  3593. ' <E331F7E4-0559-4cc2-8E99-1CEC1657928F> ' +
  3594. ' STRING EffectFilename; ' +
  3595. ' [ ... ] ' +
  3596. '} ' +
  3597. 'template AnimTicksPerSecond ' +
  3598. '{ ' +
  3599. ' <9E415A43-7BA6-4a73-8743-B73D47E88476> ' +
  3600. ' DWORD AnimTicksPerSecond; ' +
  3601. '} ';
  3602. {$EXTERNALSYM XSKINEXP_TEMPLATES}
  3603. XEXTENSIONS_TEMPLATES =
  3604. 'xof 0303txt 0032' +
  3605. 'template FVFData ' +
  3606. '{ ' +
  3607. ' <B6E70A0E-8EF9-4e83-94AD-ECC8B0C04897> ' +
  3608. ' DWORD dwFVF; ' +
  3609. ' DWORD nDWords; ' +
  3610. ' array DWORD data[nDWords]; ' +
  3611. '} ' +
  3612. 'template VertexElement ' +
  3613. '{ ' +
  3614. ' <F752461C-1E23-48f6-B9F8-8350850F336F> ' +
  3615. ' DWORD Type; ' +
  3616. ' DWORD Method; ' +
  3617. ' DWORD Usage; ' +
  3618. ' DWORD UsageIndex; ' +
  3619. '} ' +
  3620. 'template DeclData ' +
  3621. '{ ' +
  3622. ' <BF22E553-292C-4781-9FEA-62BD554BDD93> ' +
  3623. ' DWORD nElements; ' +
  3624. ' array VertexElement Elements[nElements]; ' +
  3625. ' DWORD nDWords; ' +
  3626. ' array DWORD data[nDWords]; ' +
  3627. '} ' +
  3628. 'template PMAttributeRange ' +
  3629. '{ ' +
  3630. ' <917E0427-C61E-4a14-9C64-AFE65F9E9844> ' +
  3631. ' DWORD iFaceOffset; ' +
  3632. ' DWORD nFacesMin; ' +
  3633. ' DWORD nFacesMax; ' +
  3634. ' DWORD iVertexOffset; ' +
  3635. ' DWORD nVerticesMin; ' +
  3636. ' DWORD nVerticesMax; ' +
  3637. '} ' +
  3638. 'template PMVSplitRecord ' +
  3639. '{ ' +
  3640. ' <574CCC14-F0B3-4333-822D-93E8A8A08E4C> ' +
  3641. ' DWORD iFaceCLW; ' +
  3642. ' DWORD iVlrOffset; ' +
  3643. ' DWORD iCode; ' +
  3644. '} ' +
  3645. 'template PMInfo ' +
  3646. '{ ' +
  3647. ' <B6C3E656-EC8B-4b92-9B62-681659522947> ' +
  3648. ' DWORD nAttributes; ' +
  3649. ' array PMAttributeRange attributeRanges[nAttributes]; ' +
  3650. ' DWORD nMaxValence; ' +
  3651. ' DWORD nMinLogicalVertices; ' +
  3652. ' DWORD nMaxLogicalVertices; ' +
  3653. ' DWORD nVSplits; ' +
  3654. ' array PMVSplitRecord splitRecords[nVSplits]; ' +
  3655. ' DWORD nAttributeMispredicts; ' +
  3656. ' array DWORD attributeMispredicts[nAttributeMispredicts]; ' +
  3657. '} ';
  3658. {$EXTERNALSYM XEXTENSIONS_TEMPLATES}
  3659. ///////////////////////////////////////////////////////////////////////////
  3660. //
  3661. // Copyright (C) Microsoft Corporation. All Rights Reserved.
  3662. //
  3663. // File: d3dx9shapes.h
  3664. // Content: D3DX simple shapes
  3665. //
  3666. ///////////////////////////////////////////////////////////////////////////
  3667. ///////////////////////////////////////////////////////////////////////////
  3668. // Functions:
  3669. ///////////////////////////////////////////////////////////////////////////
  3670. //-------------------------------------------------------------------------
  3671. // D3DXCreatePolygon:
  3672. // ------------------
  3673. // Creates a mesh containing an n-sided polygon. The polygon is centered
  3674. // at the origin.
  3675. //
  3676. // Parameters:
  3677. //
  3678. // pDevice The D3D device with which the mesh is going to be used.
  3679. // Length Length of each side.
  3680. // Sides Number of sides the polygon has. (Must be >= 3)
  3681. // ppMesh The mesh object which will be created
  3682. // ppAdjacency Returns a buffer containing adjacency info. Can be NULL.
  3683. //-------------------------------------------------------------------------
  3684. function D3DXCreatePolygon(ppDevice: IDirect3DDevice9;
  3685. Length: Single;
  3686. Sides: LongWord;
  3687. out ppMesh: ID3DXMesh;
  3688. ppAdjacency: PID3DXBuffer): HResult; stdcall; external d3dx9shapesDLL;
  3689. {$EXTERNALSYM D3DXCreatePolygon}
  3690. //-------------------------------------------------------------------------
  3691. // D3DXCreateBox:
  3692. // --------------
  3693. // Creates a mesh containing an axis-aligned box. The box is centered at
  3694. // the origin.
  3695. //
  3696. // Parameters:
  3697. //
  3698. // pDevice The D3D device with which the mesh is going to be used.
  3699. // Width Width of box (along X-axis)
  3700. // Height Height of box (along Y-axis)
  3701. // Depth Depth of box (along Z-axis)
  3702. // ppMesh The mesh object which will be created
  3703. // ppAdjacency Returns a buffer containing adjacency info. Can be NULL.
  3704. //-------------------------------------------------------------------------
  3705. function D3DXCreateBox(ppDevice: IDirect3DDevice9;
  3706. Width,
  3707. Height,
  3708. Depth: Single;
  3709. out ppMesh: ID3DXMesh;
  3710. ppAdjacency: PID3DXBuffer): HResult; stdcall; external d3dx9shapesDLL;
  3711. {$EXTERNALSYM D3DXCreateBox}
  3712. //-------------------------------------------------------------------------
  3713. // D3DXCreateCylinder:
  3714. // -------------------
  3715. // Creates a mesh containing a cylinder. The generated cylinder is
  3716. // centered at the origin, and its axis is aligned with the Z-axis.
  3717. //
  3718. // Parameters:
  3719. //
  3720. // pDevice The D3D device with which the mesh is going to be used.
  3721. // Radius1 Radius at -Z end (should be >= 0.0f)
  3722. // Radius2 Radius at +Z end (should be >= 0.0f)
  3723. // Length Length of cylinder (along Z-axis)
  3724. // Slices Number of slices about the main axis
  3725. // Stacks Number of stacks along the main axis
  3726. // ppMesh The mesh object which will be created
  3727. // ppAdjacency Returns a buffer containing adjacency info. Can be NULL.
  3728. //-------------------------------------------------------------------------
  3729. function D3DXCreateCylinder(ppDevice: IDirect3DDevice9;
  3730. Radius1,
  3731. Radius2,
  3732. Length: Single;
  3733. Slices,
  3734. Stacks: LongWord;
  3735. out ppMesh: ID3DXMesh;
  3736. ppAdjacency: PID3DXBuffer): HResult; stdcall; external d3dx9shapesDLL;
  3737. {$EXTERNALSYM D3DXCreateCylinder}
  3738. //-------------------------------------------------------------------------
  3739. // D3DXCreateSphere:
  3740. // -----------------
  3741. // Creates a mesh containing a sphere. The sphere is centered at the
  3742. // origin.
  3743. //
  3744. // Parameters:
  3745. //
  3746. // pDevice The D3D device with which the mesh is going to be used.
  3747. // Radius Radius of the sphere (should be >= 0.0f)
  3748. // Slices Number of slices about the main axis
  3749. // Stacks Number of stacks along the main axis
  3750. // ppMesh The mesh object which will be created
  3751. // ppAdjacency Returns a buffer containing adjacency info. Can be NULL.
  3752. //-------------------------------------------------------------------------
  3753. function D3DXCreateSphere(ppDevice: IDirect3DDevice9;
  3754. Radius: Single;
  3755. Slices,
  3756. Stacks: LongWord;
  3757. out ppMesh: ID3DXMesh;
  3758. ppAdjacency: PID3DXBuffer): HResult; stdcall; external d3dx9shapesDLL;
  3759. {$EXTERNALSYM D3DXCreateSphere}
  3760. //-------------------------------------------------------------------------
  3761. // D3DXCreateTorus:
  3762. // ----------------
  3763. // Creates a mesh containing a torus. The generated torus is centered at
  3764. // the origin, and its axis is aligned with the Z-axis.
  3765. //
  3766. // Parameters:
  3767. //
  3768. // pDevice The D3D device with which the mesh is going to be used.
  3769. // InnerRadius Inner radius of the torus (should be >= 0.0f)
  3770. // OuterRadius Outer radius of the torue (should be >= 0.0f)
  3771. // Sides Number of sides in a cross-section (must be >= 3)
  3772. // Rings Number of rings making up the torus (must be >= 3)
  3773. // ppMesh The mesh object which will be created
  3774. // ppAdjacency Returns a buffer containing adjacency info. Can be NULL.
  3775. //-------------------------------------------------------------------------
  3776. function D3DXCreateTorus(ppDevice: IDirect3DDevice9;
  3777. InnerRadius,
  3778. OuterRadius: Single;
  3779. Sides,
  3780. Rings: LongWord;
  3781. out ppMesh: ID3DXMesh;
  3782. ppAdjacency: PID3DXBuffer): HResult; stdcall; external d3dx9shapesDLL;
  3783. {$EXTERNALSYM D3DXCreateTorus}
  3784. //-------------------------------------------------------------------------
  3785. // D3DXCreateTeapot:
  3786. // -----------------
  3787. // Creates a mesh containing a teapot.
  3788. //
  3789. // Parameters:
  3790. //
  3791. // pDevice The D3D device with which the mesh is going to be used.
  3792. // ppMesh The mesh object which will be created
  3793. // ppAdjacency Returns a buffer containing adjacency info. Can be NULL.
  3794. //-------------------------------------------------------------------------
  3795. function D3DXCreateTeapot(ppDevice: IDirect3DDevice9;
  3796. out ppMesh: ID3DXMesh;
  3797. ppAdjacency: PID3DXBuffer): HResult; stdcall; external d3dx9shapesDLL;
  3798. {$EXTERNALSYM D3DXCreateTeapot}
  3799. //-------------------------------------------------------------------------
  3800. // D3DXCreateText:
  3801. // ---------------
  3802. // Creates a mesh containing the specified text using the font associated
  3803. // with the device context.
  3804. //
  3805. // Parameters:
  3806. //
  3807. // pDevice The D3D device with which the mesh is going to be used.
  3808. // hDC Device context, with desired font selected
  3809. // pText Text to generate
  3810. // Deviation Maximum chordal deviation from true font outlines
  3811. // Extrusion Amount to extrude text in -Z direction
  3812. // ppMesh The mesh object which will be created
  3813. // pGlyphMetrics Address of buffer to receive glyph metric data (or NULL)
  3814. //-------------------------------------------------------------------------
  3815. function D3DXCreateTextA(ppDevice: IDirect3DDevice9;
  3816. hDC: HDC;
  3817. pText: PAnsiChar;
  3818. Deviation: Single;
  3819. Extrusion: Single;
  3820. out ppMesh: ID3DXMesh;
  3821. ppAdjacency: PID3DXBuffer;
  3822. pGlyphMetrics: PGlyphMetricsFloat): HResult; stdcall; external d3dx9shapesDLL name 'D3DXCreateTextA';
  3823. {$EXTERNALSYM D3DXCreateTextA}
  3824. function D3DXCreateTextW(ppDevice: IDirect3DDevice9;
  3825. hDC: HDC;
  3826. pText: PWideChar;
  3827. Deviation: Single;
  3828. Extrusion: Single;
  3829. out ppMesh: ID3DXMesh;
  3830. ppAdjacency: PID3DXBuffer;
  3831. pGlyphMetrics: PGlyphMetricsFloat): HResult; stdcall; external d3dx9shapesDLL name 'D3DXCreateTextW';
  3832. {$EXTERNALSYM D3DXCreateTextW}
  3833. function D3DXCreateText(ppDevice: IDirect3DDevice9;
  3834. hDC: HDC;
  3835. pText: PChar;
  3836. Deviation: Single;
  3837. Extrusion: Single;
  3838. out ppMesh: ID3DXMesh;
  3839. ppAdjacency: PID3DXBuffer;
  3840. pGlyphMetrics: PGlyphMetricsFloat): HResult; stdcall; external d3dx9shapesDLL name 'D3DXCreateTextA';
  3841. {$EXTERNALSYM D3DXCreateText}
  3842. //////////////////////////////////////////////////////////////////////////////
  3843. //
  3844. // Copyright (C) Microsoft Corporation. All Rights Reserved.
  3845. //
  3846. // File: d3dx9tex.h
  3847. // Content: D3DX texturing APIs
  3848. //
  3849. //////////////////////////////////////////////////////////////////////////////
  3850. //----------------------------------------------------------------------------
  3851. // D3DX_FILTER flags:
  3852. // ------------------
  3853. //
  3854. // A valid filter must contain one of these values:
  3855. //
  3856. // D3DX_FILTER_NONE
  3857. // No scaling or filtering will take place. Pixels outside the bounds
  3858. // of the source image are assumed to be transparent black.
  3859. // D3DX_FILTER_POINT
  3860. // Each destination pixel is computed by sampling the nearest pixel
  3861. // from the source image.
  3862. // D3DX_FILTER_LINEAR
  3863. // Each destination pixel is computed by linearly interpolating between
  3864. // the nearest pixels in the source image. This filter works best
  3865. // when the scale on each axis is less than 2.
  3866. // D3DX_FILTER_TRIANGLE
  3867. // Every pixel in the source image contributes equally to the
  3868. // destination image. This is the slowest of all the filters.
  3869. // D3DX_FILTER_BOX
  3870. // Each pixel is computed by averaging a 2x2(x2) box pixels from
  3871. // the source image. Only works when the dimensions of the
  3872. // destination are half those of the source. (as with mip maps)
  3873. //
  3874. // And can be OR'd with any of these optional flags:
  3875. //
  3876. // D3DX_FILTER_MIRROR_U
  3877. // Indicates that pixels off the edge of the texture on the U-axis
  3878. // should be mirrored, not wraped.
  3879. // D3DX_FILTER_MIRROR_V
  3880. // Indicates that pixels off the edge of the texture on the V-axis
  3881. // should be mirrored, not wraped.
  3882. // D3DX_FILTER_MIRROR_W
  3883. // Indicates that pixels off the edge of the texture on the W-axis
  3884. // should be mirrored, not wraped.
  3885. // D3DX_FILTER_MIRROR
  3886. // Same as specifying D3DX_FILTER_MIRROR_U | D3DX_FILTER_MIRROR_V |
  3887. // D3DX_FILTER_MIRROR_V
  3888. // D3DX_FILTER_DITHER
  3889. // Dithers the resulting image using a 4x4 order dither pattern.
  3890. // D3DX_FILTER_SRGB_IN
  3891. // Denotes that the input data is in sRGB (gamma 2.2) colorspace.
  3892. // D3DX_FILTER_SRGB_OUT
  3893. // Denotes that the output data is in sRGB (gamma 2.2) colorspace.
  3894. // D3DX_FILTER_SRGB
  3895. // Same as specifying D3DX_FILTER_SRGB_IN | D3DX_FILTER_SRGB_OUT
  3896. //
  3897. //----------------------------------------------------------------------------
  3898. const
  3899. D3DX_FILTER_NONE = (1 shl 0);
  3900. {$EXTERNALSYM D3DX_FILTER_NONE}
  3901. D3DX_FILTER_POINT = (2 shl 0);
  3902. {$EXTERNALSYM D3DX_FILTER_POINT}
  3903. D3DX_FILTER_LINEAR = (3 shl 0);
  3904. {$EXTERNALSYM D3DX_FILTER_LINEAR}
  3905. D3DX_FILTER_TRIANGLE = (4 shl 0);
  3906. {$EXTERNALSYM D3DX_FILTER_TRIANGLE}
  3907. D3DX_FILTER_BOX = (5 shl 0);
  3908. {$EXTERNALSYM D3DX_FILTER_BOX}
  3909. D3DX_FILTER_MIRROR_U = (1 shl 16);
  3910. {$EXTERNALSYM D3DX_FILTER_MIRROR_U}
  3911. D3DX_FILTER_MIRROR_V = (2 shl 16);
  3912. {$EXTERNALSYM D3DX_FILTER_MIRROR_V}
  3913. D3DX_FILTER_MIRROR_W = (4 shl 16);
  3914. {$EXTERNALSYM D3DX_FILTER_MIRROR_W}
  3915. D3DX_FILTER_MIRROR = (7 shl 16);
  3916. {$EXTERNALSYM D3DX_FILTER_MIRROR}
  3917. D3DX_FILTER_DITHER = (1 shl 19);
  3918. {$EXTERNALSYM D3DX_FILTER_DITHER}
  3919. D3DX_FILTER_SRGB_IN = (1 shl 20);
  3920. {$EXTERNALSYM D3DX_FILTER_SRGB_IN}
  3921. D3DX_FILTER_SRGB_OUT = (2 shl 20);
  3922. {$EXTERNALSYM D3DX_FILTER_SRGB_OUT}
  3923. D3DX_FILTER_SRGB = (3 shl 20);
  3924. {$EXTERNALSYM D3DX_FILTER_SRGB}
  3925. //----------------------------------------------------------------------------
  3926. // D3DX_NORMALMAP flags:
  3927. // ---------------------
  3928. // These flags are used to control how D3DXComputeNormalMap generates normal
  3929. // maps. Any number of these flags may be OR'd together in any combination.
  3930. //
  3931. // D3DX_NORMALMAP_MIRROR_U
  3932. // Indicates that pixels off the edge of the texture on the U-axis
  3933. // should be mirrored, not wraped.
  3934. // D3DX_NORMALMAP_MIRROR_V
  3935. // Indicates that pixels off the edge of the texture on the V-axis
  3936. // should be mirrored, not wraped.
  3937. // D3DX_NORMALMAP_MIRROR
  3938. // Same as specifying D3DX_NORMALMAP_MIRROR_U | D3DX_NORMALMAP_MIRROR_V
  3939. // D3DX_NORMALMAP_INVERTSIGN
  3940. // Inverts the direction of each normal
  3941. // D3DX_NORMALMAP_COMPUTE_OCCLUSION
  3942. // Compute the per pixel Occlusion term and encodes it into the alpha.
  3943. // An Alpha of 1 means that the pixel is not obscured in anyway, and
  3944. // an alpha of 0 would mean that the pixel is completly obscured.
  3945. //
  3946. //----------------------------------------------------------------------------
  3947. //----------------------------------------------------------------------------
  3948. const
  3949. D3DX_NORMALMAP_MIRROR_U = (1 shl 16);
  3950. {$EXTERNALSYM D3DX_NORMALMAP_MIRROR_U}
  3951. D3DX_NORMALMAP_MIRROR_V = (2 shl 16);
  3952. {$EXTERNALSYM D3DX_NORMALMAP_MIRROR_V}
  3953. D3DX_NORMALMAP_MIRROR = (3 shl 16);
  3954. {$EXTERNALSYM D3DX_NORMALMAP_MIRROR}
  3955. D3DX_NORMALMAP_INVERTSIGN = (8 shl 16);
  3956. {$EXTERNALSYM D3DX_NORMALMAP_INVERTSIGN}
  3957. D3DX_NORMALMAP_COMPUTE_OCCLUSION = (16 shl 16);
  3958. {$EXTERNALSYM D3DX_NORMALMAP_COMPUTE_OCCLUSION}
  3959. //----------------------------------------------------------------------------
  3960. // D3DX_CHANNEL flags:
  3961. // -------------------
  3962. // These flags are used by functions which operate on or more channels
  3963. // in a texture.
  3964. //
  3965. // D3DX_CHANNEL_RED
  3966. // Indicates the red channel should be used
  3967. // D3DX_CHANNEL_BLUE
  3968. // Indicates the blue channel should be used
  3969. // D3DX_CHANNEL_GREEN
  3970. // Indicates the green channel should be used
  3971. // D3DX_CHANNEL_ALPHA
  3972. // Indicates the alpha channel should be used
  3973. // D3DX_CHANNEL_LUMINANCE
  3974. // Indicates the luminaces of the red green and blue channels should be
  3975. // used.
  3976. //
  3977. //----------------------------------------------------------------------------
  3978. const
  3979. D3DX_CHANNEL_RED = (1 shl 0);
  3980. {$EXTERNALSYM D3DX_CHANNEL_RED}
  3981. D3DX_CHANNEL_BLUE = (1 shl 1);
  3982. {$EXTERNALSYM D3DX_CHANNEL_BLUE}
  3983. D3DX_CHANNEL_GREEN = (1 shl 2);
  3984. {$EXTERNALSYM D3DX_CHANNEL_GREEN}
  3985. D3DX_CHANNEL_ALPHA = (1 shl 3);
  3986. {$EXTERNALSYM D3DX_CHANNEL_ALPHA}
  3987. D3DX_CHANNEL_LUMINANCE = (1 shl 4);
  3988. {$EXTERNALSYM D3DX_CHANNEL_LUMINANCE}
  3989. //----------------------------------------------------------------------------
  3990. // D3DXIMAGE_FILEFORMAT:
  3991. // ---------------------
  3992. // This enum is used to describe supported image file formats.
  3993. //
  3994. //----------------------------------------------------------------------------
  3995. type
  3996. PD3DXImageFileFormat = ^TD3DXImageFileFormat;
  3997. _D3DXIMAGE_FILEFORMAT = (
  3998. D3DXIFF_BMP {= 0},
  3999. D3DXIFF_JPG {= 1},
  4000. D3DXIFF_TGA {= 2},
  4001. D3DXIFF_PNG {= 3},
  4002. D3DXIFF_DDS {= 4},
  4003. D3DXIFF_PPM {= 5},
  4004. D3DXIFF_DIB {= 6}
  4005. );
  4006. {$EXTERNALSYM _D3DXIMAGE_FILEFORMAT}
  4007. D3DXIMAGE_FILEFORMAT = _D3DXIMAGE_FILEFORMAT;
  4008. {$EXTERNALSYM D3DXIMAGE_FILEFORMAT}
  4009. TD3DXImageFileFormat = _D3DXIMAGE_FILEFORMAT;
  4010. //----------------------------------------------------------------------------
  4011. // LPD3DXFILL2D and LPD3DXFILL3D:
  4012. // ------------------------------
  4013. // Function types used by the texture fill functions.
  4014. //
  4015. // Parameters:
  4016. // pOut
  4017. // Pointer to a vector which the function uses to return its result.
  4018. // X,Y,Z,W will be mapped to R,G,B,A respectivly.
  4019. // pTexCoord
  4020. // Pointer to a vector containing the coordinates of the texel currently
  4021. // being evaluated. Textures and VolumeTexture texcoord components
  4022. // range from 0 to 1. CubeTexture texcoord component range from -1 to 1.
  4023. // pTexelSize
  4024. // Pointer to a vector containing the dimensions of the current texel.
  4025. // pData
  4026. // Pointer to user data.
  4027. //
  4028. //----------------------------------------------------------------------------
  4029. type
  4030. //typedef VOID (WINAPI *LPD3DXFILL2D)(D3DXVECTOR4 *pOut,
  4031. // CONST D3DXVECTOR2 *pTexCoord, CONST D3DXVECTOR2 *pTexelSize, LPVOID pData);
  4032. TD3DXFill2D = procedure (out pOut: TD3DXVector4; const pTexCoord, pTexelSize: TD3DXVector2; var pData);
  4033. {$NODEFINE TD3DXFill2D}
  4034. {$HPPEMIT 'typedef LPD3DXFILL2D TD3DXFill2D;'}
  4035. //typedef VOID (WINAPI *LPD3DXFILL3D)(D3DXVECTOR4 *pOut,
  4036. // CONST D3DXVECTOR3 *pTexCoord, CONST D3DXVECTOR3 *pTexelSize, LPVOID pData);
  4037. TD3DXFill3D = procedure (out pOut: TD3DXVector4; const pTexCoord, pTexelSize: TD3DXVector3; var pData);
  4038. {$NODEFINE TD3DXFill3D}
  4039. {$HPPEMIT 'typedef LPD3DXFILL3D TD3DXFill3D;'}
  4040. //----------------------------------------------------------------------------
  4041. // D3DXIMAGE_INFO:
  4042. // ---------------
  4043. // This structure is used to return a rough description of what the
  4044. // the original contents of an image file looked like.
  4045. //
  4046. // Width
  4047. // Width of original image in pixels
  4048. // Height
  4049. // Height of original image in pixels
  4050. // Depth
  4051. // Depth of original image in pixels
  4052. // MipLevels
  4053. // Number of mip levels in original image
  4054. // Format
  4055. // D3D format which most closely describes the data in original image
  4056. // ResourceType
  4057. // D3DRESOURCETYPE representing the type of texture stored in the file.
  4058. // D3DRTYPE_TEXTURE, D3DRTYPE_VOLUMETEXTURE, or D3DRTYPE_CUBETEXTURE.
  4059. // ImageFileFormat
  4060. // D3DXIMAGE_FILEFORMAT representing the format of the image file.
  4061. //
  4062. //----------------------------------------------------------------------------
  4063. type
  4064. PD3DXImageInfo = ^TD3DXImageInfo;
  4065. _D3DXIMAGE_INFO = packed record
  4066. Width: LongWord;
  4067. Height: LongWord;
  4068. Depth: LongWord;
  4069. MipLevels: LongWord;
  4070. Format: TD3DFormat;
  4071. ResourceType: TD3DResourceType;
  4072. ImageFileFormat: TD3DXImageFileFormat;
  4073. end;
  4074. {$EXTERNALSYM _D3DXIMAGE_INFO}
  4075. D3DXIMAGE_INFO = _D3DXIMAGE_INFO;
  4076. {$EXTERNALSYM D3DXIMAGE_INFO}
  4077. TD3DXImageInfo = _D3DXIMAGE_INFO;
  4078. //////////////////////////////////////////////////////////////////////////////
  4079. // Image File APIs ///////////////////////////////////////////////////////////
  4080. //////////////////////////////////////////////////////////////////////////////
  4081. //----------------------------------------------------------------------------
  4082. // GetImageInfoFromFile/Resource:
  4083. // ------------------------------
  4084. // Fills in a D3DXIMAGE_INFO struct with information about an image file.
  4085. //
  4086. // Parameters:
  4087. // pSrcFile
  4088. // File name of the source image.
  4089. // pSrcModule
  4090. // Module where resource is located, or NULL for module associated
  4091. // with image the os used to create the current process.
  4092. // pSrcResource
  4093. // Resource name
  4094. // pSrcData
  4095. // Pointer to file in memory.
  4096. // SrcDataSize
  4097. // Size in bytes of file in memory.
  4098. // pSrcInfo
  4099. // Pointer to a D3DXIMAGE_INFO structure to be filled in with the
  4100. // description of the data in the source image file.
  4101. //
  4102. //----------------------------------------------------------------------------
  4103. function D3DXGetImageInfoFromFileA(
  4104. pSrcFile: PAnsiChar;
  4105. out pSrcInfo: TD3DXImageInfo): HResult; stdcall; external d3dx9texDLL name 'D3DXGetImageInfoFromFileA';
  4106. {$EXTERNALSYM D3DXGetImageInfoFromFileA}
  4107. function D3DXGetImageInfoFromFileW(
  4108. pSrcFile: PWideChar;
  4109. out pSrcInfo: TD3DXImageInfo): HResult; stdcall; external d3dx9texDLL name 'D3DXGetImageInfoFromFileW';
  4110. {$EXTERNALSYM D3DXGetImageInfoFromFileW}
  4111. function D3DXGetImageInfoFromFile(
  4112. pSrcFile: PChar;
  4113. out pSrcInfo: TD3DXImageInfo): HResult; stdcall; external d3dx9texDLL name 'D3DXGetImageInfoFromFileA';
  4114. {$EXTERNALSYM D3DXGetImageInfoFromFile}
  4115. function D3DXGetImageInfoFromResourceA(
  4116. hSrcModule: HModule;
  4117. pSrcResource: PAnsiChar;
  4118. out pSrcInfo: TD3DXImageInfo): HResult; stdcall; external d3dx9texDLL name 'D3DXGetImageInfoFromResourceA';
  4119. {$EXTERNALSYM D3DXGetImageInfoFromResourceA}
  4120. function D3DXGetImageInfoFromResourceW(
  4121. hSrcModule: HModule;
  4122. pSrcResource: PWideChar;
  4123. out pSrcInfo: TD3DXImageInfo): HResult; stdcall; external d3dx9texDLL name 'D3DXGetImageInfoFromResourceW';
  4124. {$EXTERNALSYM D3DXGetImageInfoFromResourceW}
  4125. function D3DXGetImageInfoFromResource(
  4126. hSrcModule: HModule;
  4127. pSrcResource: PChar;
  4128. out pSrcInfo: TD3DXImageInfo): HResult; stdcall; external d3dx9texDLL name 'D3DXGetImageInfoFromResourceA';
  4129. {$EXTERNALSYM D3DXGetImageInfoFromResource}
  4130. function D3DXGetImageInfoFromFileInMemory(
  4131. const pSrcData;
  4132. SrcDataSize: LongWord;
  4133. out pSrcInfo: TD3DXImageInfo): HResult; stdcall; external d3dx9texDLL;
  4134. {$EXTERNALSYM D3DXGetImageInfoFromFileInMemory}
  4135. //////////////////////////////////////////////////////////////////////////////
  4136. // Load/Save Surface APIs ////////////////////////////////////////////////////
  4137. //////////////////////////////////////////////////////////////////////////////
  4138. //----------------------------------------------------------------------------
  4139. // D3DXLoadSurfaceFromFile/Resource:
  4140. // ---------------------------------
  4141. // Load surface from a file or resource
  4142. //
  4143. // Parameters:
  4144. // pDestSurface
  4145. // Destination surface, which will receive the image.
  4146. // pDestPalette
  4147. // Destination palette of 256 colors, or NULL
  4148. // pDestRect
  4149. // Destination rectangle, or NULL for entire surface
  4150. // pSrcFile
  4151. // File name of the source image.
  4152. // pSrcModule
  4153. // Module where resource is located, or NULL for module associated
  4154. // with image the os used to create the current process.
  4155. // pSrcResource
  4156. // Resource name
  4157. // pSrcData
  4158. // Pointer to file in memory.
  4159. // SrcDataSize
  4160. // Size in bytes of file in memory.
  4161. // pSrcRect
  4162. // Source rectangle, or NULL for entire image
  4163. // Filter
  4164. // D3DX_FILTER flags controlling how the image is filtered.
  4165. // Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE.
  4166. // ColorKey
  4167. // Color to replace with transparent black, or 0 to disable colorkey.
  4168. // This is always a 32-bit ARGB color, independent of the source image
  4169. // format. Alpha is significant, and should usually be set to FF for
  4170. // opaque colorkeys. (ex. Opaque black == 0xff000000)
  4171. // pSrcInfo
  4172. // Pointer to a D3DXIMAGE_INFO structure to be filled in with the
  4173. // description of the data in the source image file, or NULL.
  4174. //
  4175. //----------------------------------------------------------------------------
  4176. function D3DXLoadSurfaceFromFileA(
  4177. pDestSurface: IDirect3DSurface9;
  4178. pDestPalette: PPaletteEntry;
  4179. pDestRect: PRect;
  4180. pSrcFile: PAnsiChar;
  4181. pSrcRect: PRect;
  4182. Filter: DWord;
  4183. ColorKey: TD3DColor;
  4184. pSrcInfo: PD3DXImageInfo): HResult; stdcall; external d3dx9texDLL name 'D3DXLoadSurfaceFromFileA';
  4185. {$EXTERNALSYM D3DXLoadSurfaceFromFileA}
  4186. function D3DXLoadSurfaceFromFileW(
  4187. pDestSurface: IDirect3DSurface9;
  4188. pDestPalette: PPaletteEntry;
  4189. pDestRect: PRect;
  4190. pSrcFile: PWideChar;
  4191. pSrcRect: PRect;
  4192. Filter: DWord;
  4193. ColorKey: TD3DColor;
  4194. pSrcInfo: PD3DXImageInfo): HResult; stdcall; external d3dx9texDLL name 'D3DXLoadSurfaceFromFileW';
  4195. {$EXTERNALSYM D3DXLoadSurfaceFromFileW}
  4196. function D3DXLoadSurfaceFromFile(
  4197. pDestSurface: IDirect3DSurface9;
  4198. pDestPalette: PPaletteEntry;
  4199. pDestRect: PRect;
  4200. pSrcFile: PChar;
  4201. pSrcRect: PRect;
  4202. Filter: DWord;
  4203. ColorKey: TD3DColor;
  4204. pSrcInfo: PD3DXImageInfo): HResult; stdcall; external d3dx9texDLL name 'D3DXLoadSurfaceFromFileA';
  4205. {$EXTERNALSYM D3DXLoadSurfaceFromFile}
  4206. function D3DXLoadSurfaceFromResourceA(
  4207. pDestSurface: IDirect3DSurface9;
  4208. pDestPalette: PPaletteEntry;
  4209. pDestRect: PRect;
  4210. hSrcModule: HModule;
  4211. pSrcResource: PAnsiChar;
  4212. pSrcRect: PRect;
  4213. Filter: DWord;
  4214. ColorKey: TD3DColor;
  4215. pSrcInfo: PD3DXImageInfo): HResult; stdcall; external d3dx9texDLL name 'D3DXLoadSurfaceFromResourceA';
  4216. {$EXTERNALSYM D3DXLoadSurfaceFromResourceA}
  4217. function D3DXLoadSurfaceFromResourceW(
  4218. pDestSurface: IDirect3DSurface9;
  4219. pDestPalette: PPaletteEntry;
  4220. pDestRect: PRect;
  4221. hSrcModule: HModule;
  4222. pSrcResource: PWideChar;
  4223. pSrcRect: PRect;
  4224. Filter: DWord;
  4225. ColorKey: TD3DColor;
  4226. pSrcInfo: PD3DXImageInfo): HResult; stdcall; external d3dx9texDLL name 'D3DXLoadSurfaceFromResourceW';
  4227. {$EXTERNALSYM D3DXLoadSurfaceFromResourceW}
  4228. function D3DXLoadSurfaceFromResource(
  4229. pDestSurface: IDirect3DSurface9;
  4230. pDestPalette: PPaletteEntry;
  4231. pDestRect: PRect;
  4232. hSrcModule: HModule;
  4233. pSrcResource: PChar;
  4234. pSrcRect: PRect;
  4235. Filter: DWord;
  4236. ColorKey: TD3DColor;
  4237. pSrcInfo: PD3DXImageInfo): HResult; stdcall; external d3dx9texDLL name 'D3DXLoadSurfaceFromResourceA';
  4238. {$EXTERNALSYM D3DXLoadSurfaceFromResource}
  4239. function D3DXLoadSurfaceFromFileInMemory(
  4240. pDestSurface: IDirect3DSurface9;
  4241. pDestPalette: PPaletteEntry;
  4242. pDestRect: PRect;
  4243. const pSrcData;
  4244. SrcDataSize: LongWord;
  4245. pSrcRect: PRect;
  4246. Filter: DWord;
  4247. ColorKey: TD3DColor;
  4248. pSrcInfo: PD3DXImageInfo): HResult; stdcall; external d3dx9texDLL;
  4249. {$EXTERNALSYM D3DXLoadSurfaceFromFileInMemory}
  4250. //----------------------------------------------------------------------------
  4251. // D3DXLoadSurfaceFromSurface:
  4252. // ---------------------------
  4253. // Load surface from another surface (with color conversion)
  4254. //
  4255. // Parameters:
  4256. // pDestSurface
  4257. // Destination surface, which will receive the image.
  4258. // pDestPalette
  4259. // Destination palette of 256 colors, or NULL
  4260. // pDestRect
  4261. // Destination rectangle, or NULL for entire surface
  4262. // pSrcSurface
  4263. // Source surface
  4264. // pSrcPalette
  4265. // Source palette of 256 colors, or NULL
  4266. // pSrcRect
  4267. // Source rectangle, or NULL for entire surface
  4268. // Filter
  4269. // D3DX_FILTER flags controlling how the image is filtered.
  4270. // Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE.
  4271. // ColorKey
  4272. // Color to replace with transparent black, or 0 to disable colorkey.
  4273. // This is always a 32-bit ARGB color, independent of the source image
  4274. // format. Alpha is significant, and should usually be set to FF for
  4275. // opaque colorkeys. (ex. Opaque black == 0xff000000)
  4276. //
  4277. //----------------------------------------------------------------------------
  4278. function D3DXLoadSurfaceFromSurface(
  4279. pDestSurface: IDirect3DSurface9;
  4280. pDestPalette: PPaletteEntry;
  4281. pDestRect: PRect;
  4282. pSrcSurface: IDirect3DSurface9;
  4283. pSrcPalette: PPaletteEntry;
  4284. pSrcRect: PRect;
  4285. Filter: DWord;
  4286. ColorKey: TD3DColor): HResult; stdcall; external d3dx9texDLL;
  4287. {$EXTERNALSYM D3DXLoadSurfaceFromSurface}
  4288. //----------------------------------------------------------------------------
  4289. // D3DXLoadSurfaceFromMemory:
  4290. // ---------------------------
  4291. // Load surface from memory.
  4292. //
  4293. // Parameters:
  4294. // pDestSurface
  4295. // Destination surface, which will receive the image.
  4296. // pDestPalette
  4297. // Destination palette of 256 colors, or NULL
  4298. // pDestRect
  4299. // Destination rectangle, or NULL for entire surface
  4300. // pSrcMemory
  4301. // Pointer to the top-left corner of the source image in memory
  4302. // SrcFormat
  4303. // Pixel format of the source image.
  4304. // SrcPitch
  4305. // Pitch of source image, in bytes. For DXT formats, this number
  4306. // should represent the width of one row of cells, in bytes.
  4307. // pSrcPalette
  4308. // Source palette of 256 colors, or NULL
  4309. // pSrcRect
  4310. // Source rectangle.
  4311. // Filter
  4312. // D3DX_FILTER flags controlling how the image is filtered.
  4313. // Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE.
  4314. // ColorKey
  4315. // Color to replace with transparent black, or 0 to disable colorkey.
  4316. // This is always a 32-bit ARGB color, independent of the source image
  4317. // format. Alpha is significant, and should usually be set to FF for
  4318. // opaque colorkeys. (ex. Opaque black == 0xff000000)
  4319. //
  4320. //----------------------------------------------------------------------------
  4321. function D3DXLoadSurfaceFromMemory(
  4322. pDestSurface: IDirect3DSurface9;
  4323. pDestPalette: PPaletteEntry;
  4324. pDestRect: PRect;
  4325. const pSrcMemory;
  4326. SrcFormat: TD3DFormat;
  4327. SrcPitch: LongWord;
  4328. pSrcPalette: PPaletteEntry;
  4329. pSrcRect: PRect;
  4330. Filter: DWord;
  4331. ColorKey: TD3DColor): HResult; stdcall; external d3dx9texDLL;
  4332. {$EXTERNALSYM D3DXLoadSurfaceFromMemory}
  4333. //----------------------------------------------------------------------------
  4334. // D3DXSaveSurfaceToFile:
  4335. // ----------------------
  4336. // Save a surface to a image file.
  4337. //
  4338. // Parameters:
  4339. // pDestFile
  4340. // File name of the destination file
  4341. // DestFormat
  4342. // D3DXIMAGE_FILEFORMAT specifying file format to use when saving.
  4343. // pSrcSurface
  4344. // Source surface, containing the image to be saved
  4345. // pSrcPalette
  4346. // Source palette of 256 colors, or NULL
  4347. // pSrcRect
  4348. // Source rectangle, or NULL for the entire image
  4349. //
  4350. //----------------------------------------------------------------------------
  4351. function D3DXSaveSurfaceToFileA(
  4352. pDestFile: PAnsiChar;
  4353. DestFormat: TD3DXImageFileFormat;
  4354. pSrcSurface: IDirect3DSurface9;
  4355. pSrcPalette: PPaletteEntry;
  4356. pSrcRect: PRect): HResult; stdcall; external d3dx9texDLL name 'D3DXSaveSurfaceToFileA';
  4357. {$EXTERNALSYM D3DXSaveSurfaceToFileA}
  4358. function D3DXSaveSurfaceToFileW(
  4359. pDestFile: PWideChar;
  4360. DestFormat: TD3DXImageFileFormat;
  4361. pSrcSurface: IDirect3DSurface9;
  4362. pSrcPalette: PPaletteEntry;
  4363. pSrcRect: PRect): HResult; stdcall; external d3dx9texDLL name 'D3DXSaveSurfaceToFileW';
  4364. {$EXTERNALSYM D3DXSaveSurfaceToFileW}
  4365. function D3DXSaveSurfaceToFile(
  4366. pDestFile: PChar;
  4367. DestFormat: TD3DXImageFileFormat;
  4368. pSrcSurface: IDirect3DSurface9;
  4369. pSrcPalette: PPaletteEntry;
  4370. pSrcRect: PRect): HResult; stdcall; external d3dx9texDLL name 'D3DXSaveSurfaceToFileA';
  4371. {$EXTERNALSYM D3DXSaveSurfaceToFile}
  4372. //////////////////////////////////////////////////////////////////////////////
  4373. // Load/Save Volume APIs /////////////////////////////////////////////////////
  4374. //////////////////////////////////////////////////////////////////////////////
  4375. //----------------------------------------------------------------------------
  4376. // D3DXLoadVolumeFromFile/Resource:
  4377. // --------------------------------
  4378. // Load volume from a file or resource
  4379. //
  4380. // Parameters:
  4381. // pDestVolume
  4382. // Destination volume, which will receive the image.
  4383. // pDestPalette
  4384. // Destination palette of 256 colors, or NULL
  4385. // pDestBox
  4386. // Destination box, or NULL for entire volume
  4387. // pSrcFile
  4388. // File name of the source image.
  4389. // pSrcModule
  4390. // Module where resource is located, or NULL for module associated
  4391. // with image the os used to create the current process.
  4392. // pSrcResource
  4393. // Resource name
  4394. // pSrcData
  4395. // Pointer to file in memory.
  4396. // SrcDataSize
  4397. // Size in bytes of file in memory.
  4398. // pSrcBox
  4399. // Source box, or NULL for entire image
  4400. // Filter
  4401. // D3DX_FILTER flags controlling how the image is filtered.
  4402. // Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE.
  4403. // ColorKey
  4404. // Color to replace with transparent black, or 0 to disable colorkey.
  4405. // This is always a 32-bit ARGB color, independent of the source image
  4406. // format. Alpha is significant, and should usually be set to FF for
  4407. // opaque colorkeys. (ex. Opaque black == 0xff000000)
  4408. // pSrcInfo
  4409. // Pointer to a D3DXIMAGE_INFO structure to be filled in with the
  4410. // description of the data in the source image file, or NULL.
  4411. //
  4412. //----------------------------------------------------------------------------
  4413. function D3DXLoadVolumeFromFileA(
  4414. pDestVolume: IDirect3DVolume9;
  4415. pDestPalette: PPaletteEntry;
  4416. pDestBox: TD3DBox;
  4417. pSrcFile: PAnsiChar;
  4418. pSrcBox: TD3DBox;
  4419. Filter: DWord;
  4420. ColorKey: TD3DColor;
  4421. pSrcInfo: PD3DXImageInfo): HResult; stdcall; external d3dx9texDLL name 'D3DXLoadVolumeFromFileA';
  4422. {$EXTERNALSYM D3DXLoadVolumeFromFileA}
  4423. function D3DXLoadVolumeFromFileW(
  4424. pDestVolume: IDirect3DVolume9;
  4425. pDestPalette: PPaletteEntry;
  4426. pDestBox: TD3DBox;
  4427. pSrcFile: PWideChar;
  4428. pSrcBox: TD3DBox;
  4429. Filter: DWord;
  4430. ColorKey: TD3DColor;
  4431. pSrcInfo: PD3DXImageInfo): HResult; stdcall; external d3dx9texDLL name 'D3DXLoadVolumeFromFileW';
  4432. {$EXTERNALSYM D3DXLoadVolumeFromFileW}
  4433. function D3DXLoadVolumeFromFile(
  4434. pDestVolume: IDirect3DVolume9;
  4435. pDestPalette: PPaletteEntry;
  4436. pDestBox: TD3DBox;
  4437. pSrcFile: PChar;
  4438. pSrcBox: TD3DBox;
  4439. Filter: DWord;
  4440. ColorKey: TD3DColor;
  4441. pSrcInfo: PD3DXImageInfo): HResult; stdcall; external d3dx9texDLL name 'D3DXLoadVolumeFromFileA';
  4442. {$EXTERNALSYM D3DXLoadVolumeFromFile}
  4443. function D3DXLoadVolumeFromResourceA(
  4444. pDestVolume: IDirect3DVolume9;
  4445. pDestPalette: PPaletteEntry;
  4446. pDestBox: TD3DBox;
  4447. hSrcModule: HModule;
  4448. pSrcResource: PAnsiChar;
  4449. pSrcBox: TD3DBox;
  4450. Filter: DWord;
  4451. ColorKey: TD3DColor;
  4452. pSrcInfo: PD3DXImageInfo): HResult; stdcall; external d3dx9texDLL name 'D3DXLoadVolumeFromResourceA';
  4453. {$EXTERNALSYM D3DXLoadVolumeFromResourceA}
  4454. function D3DXLoadVolumeFromResourceW(
  4455. pDestVolume: IDirect3DVolume9;
  4456. pDestPalette: PPaletteEntry;
  4457. pDestBox: TD3DBox;
  4458. hSrcModule: HModule;
  4459. pSrcResource: PWideChar;
  4460. pSrcBox: TD3DBox;
  4461. Filter: DWord;
  4462. ColorKey: TD3DColor;
  4463. pSrcInfo: PD3DXImageInfo): HResult; stdcall; external d3dx9texDLL name 'D3DXLoadVolumeFromResourceW';
  4464. {$EXTERNALSYM D3DXLoadVolumeFromResourceW}
  4465. function D3DXLoadVolumeFromResource(
  4466. pDestVolume: IDirect3DVolume9;
  4467. pDestPalette: PPaletteEntry;
  4468. pDestBox: TD3DBox;
  4469. hSrcModule: HModule;
  4470. pSrcResource: PChar;
  4471. pSrcBox: TD3DBox;
  4472. Filter: DWord;
  4473. ColorKey: TD3DColor;
  4474. pSrcInfo: PD3DXImageInfo): HResult; stdcall; external d3dx9texDLL name 'D3DXLoadVolumeFromResourceA';
  4475. {$EXTERNALSYM D3DXLoadVolumeFromResource}
  4476. function D3DXLoadVolumeFromFileInMemory(
  4477. pDestVolume: IDirect3DVolume9;
  4478. pDestPalette: PPaletteEntry;
  4479. pDestBox: TD3DBox;
  4480. const pSrcData;
  4481. SrcDataSize: LongWord;
  4482. pSrcBox: TD3DBox;
  4483. Filter: DWord;
  4484. ColorKey: TD3DColor;
  4485. pSrcInfo: PD3DXImageInfo): HResult; stdcall; external d3dx9texDLL;
  4486. {$EXTERNALSYM D3DXLoadVolumeFromFileInMemory}
  4487. //----------------------------------------------------------------------------
  4488. // D3DXLoadVolumeFromVolume:
  4489. // ---------------------------
  4490. // Load volume from another volume (with color conversion)
  4491. //
  4492. // Parameters:
  4493. // pDestVolume
  4494. // Destination volume, which will receive the image.
  4495. // pDestPalette
  4496. // Destination palette of 256 colors, or NULL
  4497. // pDestBox
  4498. // Destination box, or NULL for entire volume
  4499. // pSrcVolume
  4500. // Source volume
  4501. // pSrcPalette
  4502. // Source palette of 256 colors, or NULL
  4503. // pSrcBox
  4504. // Source box, or NULL for entire volume
  4505. // Filter
  4506. // D3DX_FILTER flags controlling how the image is filtered.
  4507. // Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE.
  4508. // ColorKey
  4509. // Color to replace with transparent black, or 0 to disable colorkey.
  4510. // This is always a 32-bit ARGB color, independent of the source image
  4511. // format. Alpha is significant, and should usually be set to FF for
  4512. // opaque colorkeys. (ex. Opaque black == 0xff000000)
  4513. //
  4514. //----------------------------------------------------------------------------
  4515. function D3DXLoadVolumeFromVolume(
  4516. pDestVolume: IDirect3DVolume9;
  4517. pDestPalette: PPaletteEntry;
  4518. pDestBox: TD3DBox;
  4519. pSrcVolume: IDirect3DVolume9;
  4520. pSrcPalette: PPaletteEntry;
  4521. pSrcBox: TD3DBox;
  4522. Filter: DWord;
  4523. ColorKey: TD3DColor): HResult; stdcall; external d3dx9texDLL;
  4524. {$EXTERNALSYM D3DXLoadVolumeFromVolume}
  4525. //----------------------------------------------------------------------------
  4526. // D3DXLoadVolumeFromMemory:
  4527. // ---------------------------
  4528. // Load volume from memory.
  4529. //
  4530. // Parameters:
  4531. // pDestVolume
  4532. // Destination volume, which will receive the image.
  4533. // pDestPalette
  4534. // Destination palette of 256 colors, or NULL
  4535. // pDestBox
  4536. // Destination box, or NULL for entire volume
  4537. // pSrcMemory
  4538. // Pointer to the top-left corner of the source volume in memory
  4539. // SrcFormat
  4540. // Pixel format of the source volume.
  4541. // SrcRowPitch
  4542. // Pitch of source image, in bytes. For DXT formats, this number
  4543. // should represent the size of one row of cells, in bytes.
  4544. // SrcSlicePitch
  4545. // Pitch of source image, in bytes. For DXT formats, this number
  4546. // should represent the size of one slice of cells, in bytes.
  4547. // pSrcPalette
  4548. // Source palette of 256 colors, or NULL
  4549. // pSrcBox
  4550. // Source box.
  4551. // Filter
  4552. // D3DX_FILTER flags controlling how the image is filtered.
  4553. // Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE.
  4554. // ColorKey
  4555. // Color to replace with transparent black, or 0 to disable colorkey.
  4556. // This is always a 32-bit ARGB color, independent of the source image
  4557. // format. Alpha is significant, and should usually be set to FF for
  4558. // opaque colorkeys. (ex. Opaque black == 0xff000000)
  4559. //
  4560. //----------------------------------------------------------------------------
  4561. function D3DXLoadVolumeFromMemory(
  4562. pDestVolume: IDirect3DVolume9;
  4563. pDestPalette: PPaletteEntry;
  4564. pDestBox: TD3DBox;
  4565. const pSrcMemory;
  4566. SrcFormat: TD3DFormat;
  4567. SrcRowPitch: LongWord;
  4568. SrcSlicePitch: LongWord;
  4569. pSrcPalette: PPaletteEntry;
  4570. pSrcBox: TD3DBox;
  4571. Filter: DWord;
  4572. ColorKey: TD3DColor): HResult; stdcall; external d3dx9texDLL;
  4573. {$EXTERNALSYM D3DXLoadVolumeFromMemory}
  4574. //----------------------------------------------------------------------------
  4575. // D3DXSaveVolumeToFile:
  4576. // ---------------------
  4577. // Save a volume to a image file.
  4578. //
  4579. // Parameters:
  4580. // pDestFile
  4581. // File name of the destination file
  4582. // DestFormat
  4583. // D3DXIMAGE_FILEFORMAT specifying file format to use when saving.
  4584. // pSrcVolume
  4585. // Source volume, containing the image to be saved
  4586. // pSrcPalette
  4587. // Source palette of 256 colors, or NULL
  4588. // pSrcBox
  4589. // Source box, or NULL for the entire volume
  4590. //
  4591. //----------------------------------------------------------------------------
  4592. function D3DXSaveVolumeToFileA(
  4593. pDestFile: PAnsiChar;
  4594. DestFormat: TD3DXImageFileFormat;
  4595. pSrcVolume: IDirect3DVolume9;
  4596. pSrcPalette: PPaletteEntry;
  4597. pSrcBox: TD3DBox): HResult; stdcall; external d3dx9texDLL name 'D3DXSaveVolumeToFileA';
  4598. {$EXTERNALSYM D3DXSaveVolumeToFileA}
  4599. function D3DXSaveVolumeToFileW(
  4600. pDestFile: PWideChar;
  4601. DestFormat: TD3DXImageFileFormat;
  4602. pSrcVolume: IDirect3DVolume9;
  4603. pSrcPalette: PPaletteEntry;
  4604. pSrcBox: TD3DBox): HResult; stdcall; external d3dx9texDLL name 'D3DXSaveVolumeToFileW';
  4605. {$EXTERNALSYM D3DXSaveVolumeToFileW}
  4606. function D3DXSaveVolumeToFile(
  4607. pDestFile: PChar;
  4608. DestFormat: TD3DXImageFileFormat;
  4609. pSrcVolume: IDirect3DVolume9;
  4610. pSrcPalette: PPaletteEntry;
  4611. pSrcBox: TD3DBox): HResult; stdcall; external d3dx9texDLL name 'D3DXSaveVolumeToFileA';
  4612. {$EXTERNALSYM D3DXSaveVolumeToFile}
  4613. //////////////////////////////////////////////////////////////////////////////
  4614. // Create/Save Texture APIs //////////////////////////////////////////////////
  4615. //////////////////////////////////////////////////////////////////////////////
  4616. //----------------------------------------------------------------------------
  4617. // D3DXCheckTextureRequirements:
  4618. // -----------------------------
  4619. // Checks texture creation parameters. If parameters are invalid, this
  4620. // function returns corrected parameters.
  4621. //
  4622. // Parameters:
  4623. //
  4624. // pDevice
  4625. // The D3D device to be used
  4626. // pWidth, pHeight, pDepth, pSize
  4627. // Desired size in pixels, or NULL. Returns corrected size.
  4628. // pNumMipLevels
  4629. // Number of desired mipmap levels, or NULL. Returns corrected number.
  4630. // Usage
  4631. // Texture usage flags
  4632. // pFormat
  4633. // Desired pixel format, or NULL. Returns corrected format.
  4634. // Pool
  4635. // Memory pool to be used to create texture
  4636. //
  4637. //----------------------------------------------------------------------------
  4638. function D3DXCheckTextureRequirements(
  4639. pDevice: IDirect3DDevice9;
  4640. pWidth: PLongWord;
  4641. pHeight: PLongWord;
  4642. pNumMipLevels: PLongWord;
  4643. Usage: DWord;
  4644. pFormat: PD3DFormat;
  4645. Pool: TD3DPool): HResult; stdcall; external d3dx9texDLL;
  4646. {$EXTERNALSYM D3DXCheckTextureRequirements}
  4647. function D3DXCheckCubeTextureRequirements(
  4648. pDevice: IDirect3DDevice9;
  4649. pSize: PLongWord;
  4650. pNumMipLevels: PLongWord;
  4651. Usage: DWord;
  4652. pFormat: PD3DFormat;
  4653. Pool: TD3DPool): HResult; stdcall; external d3dx9texDLL;
  4654. {$EXTERNALSYM D3DXCheckCubeTextureRequirements}
  4655. function D3DXCheckVolumeTextureRequirements(
  4656. pDevice: IDirect3DDevice9;
  4657. pWidth: PLongWord;
  4658. pHeight: PLongWord;
  4659. pDepth: PLongWord;
  4660. pNumMipLevels: PLongWord;
  4661. Usage: DWord;
  4662. pFormat: PD3DFormat;
  4663. Pool: TD3DPool): HResult; stdcall; external d3dx9texDLL;
  4664. {$EXTERNALSYM D3DXCheckVolumeTextureRequirements}
  4665. //----------------------------------------------------------------------------
  4666. // D3DXCreateTexture:
  4667. // ------------------
  4668. // Create an empty texture
  4669. //
  4670. // Parameters:
  4671. //
  4672. // pDevice
  4673. // The D3D device with which the texture is going to be used.
  4674. // Width, Height, Depth, Size
  4675. // size in pixels. these must be non-zero
  4676. // MipLevels
  4677. // number of mip levels desired. if zero or D3DX_DEFAULT, a complete
  4678. // mipmap chain will be created.
  4679. // Usage
  4680. // Texture usage flags
  4681. // Format
  4682. // Pixel format.
  4683. // Pool
  4684. // Memory pool to be used to create texture
  4685. // ppTexture, ppCubeTexture, ppVolumeTexture
  4686. // The texture object that will be created
  4687. //
  4688. //----------------------------------------------------------------------------
  4689. function D3DXCreateTexture(
  4690. Device: IDirect3DDevice9;
  4691. Width: LongWord;
  4692. Height: LongWord;
  4693. MipLevels: LongWord;
  4694. Usage: DWord;
  4695. Format: TD3DFormat;
  4696. Pool: TD3DPool;
  4697. out ppTexture: IDirect3DTexture9): HResult; stdcall; external d3dx9texDLL;
  4698. {$EXTERNALSYM D3DXCreateTexture}
  4699. function D3DXCreateCubeTexture(
  4700. Device: IDirect3DDevice9;
  4701. Size: LongWord;
  4702. MipLevels: LongWord;
  4703. Usage: DWord;
  4704. Format: TD3DFormat;
  4705. Pool: TD3DPool;
  4706. out ppCubeTexture: IDirect3DCubeTexture9): HResult; stdcall; external d3dx9texDLL;
  4707. {$EXTERNALSYM D3DXCreateCubeTexture}
  4708. function D3DXCreateVolumeTexture(
  4709. Device: IDirect3DDevice9;
  4710. Width: LongWord;
  4711. Height: LongWord;
  4712. Depth: LongWord;
  4713. MipLevels: LongWord;
  4714. Usage: DWord;
  4715. Format: TD3DFormat;
  4716. Pool: TD3DPool;
  4717. out ppVolumeTexture: IDirect3DVolumeTexture9): HResult; stdcall; external d3dx9texDLL;
  4718. {$EXTERNALSYM D3DXCreateVolumeTexture}
  4719. //----------------------------------------------------------------------------
  4720. // D3DXCreateTextureFromFile/Resource:
  4721. // -----------------------------------
  4722. // Create a texture object from a file or resource.
  4723. //
  4724. // Parameters:
  4725. //
  4726. // pDevice
  4727. // The D3D device with which the texture is going to be used.
  4728. // pSrcFile
  4729. // File name.
  4730. // hSrcModule
  4731. // Module handle. if NULL, current module will be used.
  4732. // pSrcResource
  4733. // Resource name in module
  4734. // pvSrcData
  4735. // Pointer to file in memory.
  4736. // SrcDataSize
  4737. // Size in bytes of file in memory.
  4738. // Width, Height, Depth, Size
  4739. // Size in pixels. If zero or D3DX_DEFAULT, the size will be taken from
  4740. // the file and rounded up to a power of two. If D3DX_DEFAULT_NONPOW2,
  4741. // the size will be not be rounded, if the device supports NONPOW2 textures.
  4742. // MipLevels
  4743. // Number of mip levels. If zero or D3DX_DEFAULT, a complete mipmap
  4744. // chain will be created.
  4745. // Usage
  4746. // Texture usage flags
  4747. // Format
  4748. // Desired pixel format. If D3DFMT_UNKNOWN, the format will be
  4749. // taken from the file.
  4750. // Pool
  4751. // Memory pool to be used to create texture
  4752. // Filter
  4753. // D3DX_FILTER flags controlling how the image is filtered.
  4754. // Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE.
  4755. // MipFilter
  4756. // D3DX_FILTER flags controlling how each miplevel is filtered.
  4757. // Or D3DX_DEFAULT for D3DX_FILTER_BOX,
  4758. // ColorKey
  4759. // Color to replace with transparent black, or 0 to disable colorkey.
  4760. // This is always a 32-bit ARGB color, independent of the source image
  4761. // format. Alpha is significant, and should usually be set to FF for
  4762. // opaque colorkeys. (ex. Opaque black == 0xff000000)
  4763. // pSrcInfo
  4764. // Pointer to a D3DXIMAGE_INFO structure to be filled in with the
  4765. // description of the data in the source image file, or NULL.
  4766. // pPalette
  4767. // 256 color palette to be filled in, or NULL
  4768. // ppTexture, ppCubeTexture, ppVolumeTexture
  4769. // The texture object that will be created
  4770. //
  4771. //----------------------------------------------------------------------------
  4772. // FromFile
  4773. function D3DXCreateTextureFromFileA(
  4774. Device: IDirect3DDevice9;
  4775. pSrcFile: PAnsiChar;
  4776. out ppTexture: IDirect3DTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateTextureFromFileA';
  4777. {$EXTERNALSYM D3DXCreateTextureFromFileA}
  4778. function D3DXCreateTextureFromFileW(
  4779. Device: IDirect3DDevice9;
  4780. pSrcFile: PWideChar;
  4781. out ppTexture: IDirect3DTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateTextureFromFileW';
  4782. {$EXTERNALSYM D3DXCreateTextureFromFileW}
  4783. function D3DXCreateTextureFromFile(
  4784. Device: IDirect3DDevice9;
  4785. pSrcFile: PChar;
  4786. out ppTexture: IDirect3DTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateTextureFromFileA';
  4787. {$EXTERNALSYM D3DXCreateTextureFromFile}
  4788. function D3DXCreateCubeTextureFromFileA(
  4789. Device: IDirect3DDevice9;
  4790. pSrcFile: PAnsiChar;
  4791. out ppCubeTexture: IDirect3DCubeTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateCubeTextureFromFileA';
  4792. {$EXTERNALSYM D3DXCreateCubeTextureFromFileA}
  4793. function D3DXCreateCubeTextureFromFileW(
  4794. Device: IDirect3DDevice9;
  4795. pSrcFile: PWideChar;
  4796. out ppCubeTexture: IDirect3DCubeTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateCubeTextureFromFileW';
  4797. {$EXTERNALSYM D3DXCreateCubeTextureFromFileW}
  4798. function D3DXCreateCubeTextureFromFile(
  4799. Device: IDirect3DDevice9;
  4800. pSrcFile: PChar;
  4801. out ppCubeTexture: IDirect3DCubeTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateCubeTextureFromFileA';
  4802. {$EXTERNALSYM D3DXCreateCubeTextureFromFile}
  4803. function D3DXCreateVolumeTextureFromFileA(
  4804. Device: IDirect3DDevice9;
  4805. pSrcFile: PAnsiChar;
  4806. out ppVolumeTexture: IDirect3DVolumeTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateVolumeTextureFromFileA';
  4807. {$EXTERNALSYM D3DXCreateVolumeTextureFromFileA}
  4808. function D3DXCreateVolumeTextureFromFileW(
  4809. Device: IDirect3DDevice9;
  4810. pSrcFile: PWideChar;
  4811. out ppVolumeTexture: IDirect3DVolumeTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateVolumeTextureFromFileW';
  4812. {$EXTERNALSYM D3DXCreateVolumeTextureFromFileW}
  4813. function D3DXCreateVolumeTextureFromFile(
  4814. Device: IDirect3DDevice9;
  4815. pSrcFile: PChar;
  4816. out ppVolumeTexture: IDirect3DVolumeTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateVolumeTextureFromFileA';
  4817. {$EXTERNALSYM D3DXCreateVolumeTextureFromFile}
  4818. // FromResource
  4819. function D3DXCreateTextureFromResourceA(
  4820. Device: IDirect3DDevice9;
  4821. hSrcModule: HModule;
  4822. pSrcResource: PAnsiChar;
  4823. out ppTexture: IDirect3DTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateTextureFromResourceA';
  4824. {$EXTERNALSYM D3DXCreateTextureFromResourceA}
  4825. function D3DXCreateTextureFromResourceW(
  4826. Device: IDirect3DDevice9;
  4827. hSrcModule: HModule;
  4828. pSrcResource: PWideChar;
  4829. out ppTexture: IDirect3DTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateTextureFromResourceW';
  4830. {$EXTERNALSYM D3DXCreateTextureFromResourceW}
  4831. function D3DXCreateTextureFromResource(
  4832. Device: IDirect3DDevice9;
  4833. hSrcModule: HModule;
  4834. pSrcResource: PChar;
  4835. out ppTexture: IDirect3DTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateTextureFromResourceA';
  4836. {$EXTERNALSYM D3DXCreateTextureFromResource}
  4837. function D3DXCreateCubeTextureFromResourceA(
  4838. Device: IDirect3DDevice9;
  4839. hSrcModule: HModule;
  4840. pSrcResource: PAnsiChar;
  4841. out ppCubeTexture: IDirect3DCubeTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateCubeTextureFromResourceA';
  4842. {$EXTERNALSYM D3DXCreateCubeTextureFromResourceA}
  4843. function D3DXCreateCubeTextureFromResourceW(
  4844. Device: IDirect3DDevice9;
  4845. hSrcModule: HModule;
  4846. pSrcResource: PWideChar;
  4847. out ppCubeTexture: IDirect3DCubeTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateCubeTextureFromResourceW';
  4848. {$EXTERNALSYM D3DXCreateCubeTextureFromResourceW}
  4849. function D3DXCreateCubeTextureFromResource(
  4850. Device: IDirect3DDevice9;
  4851. hSrcModule: HModule;
  4852. pSrcResource: PChar;
  4853. out ppCubeTexture: IDirect3DCubeTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateCubeTextureFromResourceA';
  4854. {$EXTERNALSYM D3DXCreateCubeTextureFromResource}
  4855. function D3DXCreateVolumeTextureFromResourceA(
  4856. Device: IDirect3DDevice9;
  4857. hSrcModule: HModule;
  4858. pSrcResource: PAnsiChar;
  4859. out ppVolumeTexture: IDirect3DVolumeTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateVolumeTextureFromResourceA';
  4860. {$EXTERNALSYM D3DXCreateVolumeTextureFromResourceA}
  4861. function D3DXCreateVolumeTextureFromResourceW(
  4862. Device: IDirect3DDevice9;
  4863. hSrcModule: HModule;
  4864. pSrcResource: PWideChar;
  4865. out ppVolumeTexture: IDirect3DVolumeTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateVolumeTextureFromResourceW';
  4866. {$EXTERNALSYM D3DXCreateVolumeTextureFromResourceW}
  4867. function D3DXCreateVolumeTextureFromResource(
  4868. Device: IDirect3DDevice9;
  4869. hSrcModule: HModule;
  4870. pSrcResource: PChar;
  4871. out ppVolumeTexture: IDirect3DVolumeTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateVolumeTextureFromResourceA';
  4872. {$EXTERNALSYM D3DXCreateVolumeTextureFromResource}
  4873. // FromFileEx
  4874. function D3DXCreateTextureFromFileExA(
  4875. Device: IDirect3DDevice9;
  4876. pSrcFile: PAnsiChar;
  4877. Width: LongWord;
  4878. Height: LongWord;
  4879. MipLevels: LongWord;
  4880. Usage: DWord;
  4881. Format: TD3DFormat;
  4882. Pool: TD3DPool;
  4883. Filter: DWord;
  4884. MipFilter: DWord;
  4885. ColorKey: TD3DColor;
  4886. pSrcInfo: PD3DXImageInfo;
  4887. pPalette: PPaletteEntry;
  4888. out ppTexture: IDirect3DTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateTextureFromFileExA';
  4889. {$EXTERNALSYM D3DXCreateTextureFromFileExA}
  4890. function D3DXCreateTextureFromFileExW(
  4891. Device: IDirect3DDevice9;
  4892. pSrcFile: PWideChar;
  4893. Width: LongWord;
  4894. Height: LongWord;
  4895. MipLevels: LongWord;
  4896. Usage: DWord;
  4897. Format: TD3DFormat;
  4898. Pool: TD3DPool;
  4899. Filter: DWord;
  4900. MipFilter: DWord;
  4901. ColorKey: TD3DColor;
  4902. pSrcInfo: PD3DXImageInfo;
  4903. pPalette: PPaletteEntry;
  4904. out ppTexture: IDirect3DTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateTextureFromFileExW';
  4905. {$EXTERNALSYM D3DXCreateTextureFromFileExW}
  4906. function D3DXCreateTextureFromFileEx(
  4907. Device: IDirect3DDevice9;
  4908. pSrcFile: PChar;
  4909. Width: LongWord;
  4910. Height: LongWord;
  4911. MipLevels: LongWord;
  4912. Usage: DWord;
  4913. Format: TD3DFormat;
  4914. Pool: TD3DPool;
  4915. Filter: DWord;
  4916. MipFilter: DWord;
  4917. ColorKey: TD3DColor;
  4918. pSrcInfo: PD3DXImageInfo;
  4919. pPalette: PPaletteEntry;
  4920. out ppTexture: IDirect3DTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateTextureFromFileExA';
  4921. {$EXTERNALSYM D3DXCreateTextureFromFileEx}
  4922. function D3DXCreateCubeTextureFromFileExA(
  4923. Device: IDirect3DDevice9;
  4924. pSrcFile: PAnsiChar;
  4925. Size: LongWord;
  4926. MipLevels: LongWord;
  4927. Usage: DWord;
  4928. Format: TD3DFormat;
  4929. Pool: TD3DPool;
  4930. Filter: DWord;
  4931. MipFilter: DWord;
  4932. ColorKey: TD3DColor;
  4933. pSrcInfo: PD3DXImageInfo;
  4934. pPalette: PPaletteEntry;
  4935. out ppCubeTexture: IDirect3DCubeTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateCubeTextureFromFileExA';
  4936. {$EXTERNALSYM D3DXCreateCubeTextureFromFileExA}
  4937. function D3DXCreateCubeTextureFromFileExW(
  4938. Device: IDirect3DDevice9;
  4939. pSrcFile: PWideChar;
  4940. Size: LongWord;
  4941. MipLevels: LongWord;
  4942. Usage: DWord;
  4943. Format: TD3DFormat;
  4944. Pool: TD3DPool;
  4945. Filter: DWord;
  4946. MipFilter: DWord;
  4947. ColorKey: TD3DColor;
  4948. pSrcInfo: PD3DXImageInfo;
  4949. pPalette: PPaletteEntry;
  4950. out ppCubeTexture: IDirect3DCubeTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateCubeTextureFromFileExW';
  4951. {$EXTERNALSYM D3DXCreateCubeTextureFromFileExW}
  4952. function D3DXCreateCubeTextureFromFileEx(
  4953. Device: IDirect3DDevice9;
  4954. pSrcFile: PChar;
  4955. Size: LongWord;
  4956. MipLevels: LongWord;
  4957. Usage: DWord;
  4958. Format: TD3DFormat;
  4959. Pool: TD3DPool;
  4960. Filter: DWord;
  4961. MipFilter: DWord;
  4962. ColorKey: TD3DColor;
  4963. pSrcInfo: PD3DXImageInfo;
  4964. pPalette: PPaletteEntry;
  4965. out ppCubeTexture: IDirect3DCubeTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateCubeTextureFromFileExA';
  4966. {$EXTERNALSYM D3DXCreateCubeTextureFromFileEx}
  4967. function D3DXCreateVolumeTextureFromFileExA(
  4968. Device: IDirect3DDevice9;
  4969. pSrcFile: PAnsiChar;
  4970. Width: LongWord;
  4971. Height: LongWord;
  4972. Depth: LongWord;
  4973. MipLevels: LongWord;
  4974. Usage: DWord;
  4975. Format: TD3DFormat;
  4976. Pool: TD3DPool;
  4977. Filter: DWord;
  4978. MipFilter: DWord;
  4979. ColorKey: TD3DColor;
  4980. pSrcInfo: PD3DXImageInfo;
  4981. pPalette: PPaletteEntry;
  4982. out ppVolumeTexture: IDirect3DVolumeTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateVolumeTextureFromFileExA';
  4983. {$EXTERNALSYM D3DXCreateVolumeTextureFromFileExA}
  4984. function D3DXCreateVolumeTextureFromFileExW(
  4985. Device: IDirect3DDevice9;
  4986. pSrcFile: PWideChar;
  4987. Width: LongWord;
  4988. Height: LongWord;
  4989. Depth: LongWord;
  4990. MipLevels: LongWord;
  4991. Usage: DWord;
  4992. Format: TD3DFormat;
  4993. Pool: TD3DPool;
  4994. Filter: DWord;
  4995. MipFilter: DWord;
  4996. ColorKey: TD3DColor;
  4997. pSrcInfo: PD3DXImageInfo;
  4998. pPalette: PPaletteEntry;
  4999. out ppVolumeTexture: IDirect3DVolumeTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateVolumeTextureFromFileExW';
  5000. {$EXTERNALSYM D3DXCreateVolumeTextureFromFileExW}
  5001. function D3DXCreateVolumeTextureFromFileEx(
  5002. Device: IDirect3DDevice9;
  5003. pSrcFile: PChar;
  5004. Width: LongWord;
  5005. Height: LongWord;
  5006. Depth: LongWord;
  5007. MipLevels: LongWord;
  5008. Usage: DWord;
  5009. Format: TD3DFormat;
  5010. Pool: TD3DPool;
  5011. Filter: DWord;
  5012. MipFilter: DWord;
  5013. ColorKey: TD3DColor;
  5014. pSrcInfo: PD3DXImageInfo;
  5015. pPalette: PPaletteEntry;
  5016. out ppVolumeTexture: IDirect3DVolumeTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateVolumeTextureFromFileExA';
  5017. {$EXTERNALSYM D3DXCreateVolumeTextureFromFileEx}
  5018. // FromResourceEx
  5019. function D3DXCreateTextureFromResourceExA(
  5020. Device: IDirect3DDevice9;
  5021. hSrcModule: HModule;
  5022. pSrcResource: PAnsiChar;
  5023. Width: LongWord;
  5024. Height: LongWord;
  5025. MipLevels: LongWord;
  5026. Usage: DWord;
  5027. Format: TD3DFormat;
  5028. Pool: TD3DPool;
  5029. Filter: DWord;
  5030. MipFilter: DWord;
  5031. ColorKey: TD3DColor;
  5032. pSrcInfo: PD3DXImageInfo;
  5033. pPalette: PPaletteEntry;
  5034. out ppTexture: IDirect3DTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateTextureFromResourceExA';
  5035. {$EXTERNALSYM D3DXCreateTextureFromResourceExA}
  5036. function D3DXCreateTextureFromResourceExW(
  5037. Device: IDirect3DDevice9;
  5038. hSrcModule: HModule;
  5039. pSrcResource: PWideChar;
  5040. Width: LongWord;
  5041. Height: LongWord;
  5042. MipLevels: LongWord;
  5043. Usage: DWord;
  5044. Format: TD3DFormat;
  5045. Pool: TD3DPool;
  5046. Filter: DWord;
  5047. MipFilter: DWord;
  5048. ColorKey: TD3DColor;
  5049. pSrcInfo: PD3DXImageInfo;
  5050. pPalette: PPaletteEntry;
  5051. out ppTexture: IDirect3DTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateTextureFromResourceExW';
  5052. {$EXTERNALSYM D3DXCreateTextureFromResourceExW}
  5053. function D3DXCreateTextureFromResourceEx(
  5054. Device: IDirect3DDevice9;
  5055. hSrcModule: HModule;
  5056. pSrcResource: PChar;
  5057. Width: LongWord;
  5058. Height: LongWord;
  5059. MipLevels: LongWord;
  5060. Usage: DWord;
  5061. Format: TD3DFormat;
  5062. Pool: TD3DPool;
  5063. Filter: DWord;
  5064. MipFilter: DWord;
  5065. ColorKey: TD3DColor;
  5066. pSrcInfo: PD3DXImageInfo;
  5067. pPalette: PPaletteEntry;
  5068. out ppTexture: IDirect3DTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateTextureFromResourceExA';
  5069. {$EXTERNALSYM D3DXCreateTextureFromResourceEx}
  5070. function D3DXCreateCubeTextureFromResourceExA(
  5071. Device: IDirect3DDevice9;
  5072. hSrcModule: HModule;
  5073. pSrcResource: PAnsiChar;
  5074. Size: LongWord;
  5075. MipLevels: LongWord;
  5076. Usage: DWord;
  5077. Format: TD3DFormat;
  5078. Pool: TD3DPool;
  5079. Filter: DWord;
  5080. MipFilter: DWord;
  5081. ColorKey: TD3DColor;
  5082. pSrcInfo: PD3DXImageInfo;
  5083. pPalette: PPaletteEntry;
  5084. out ppCubeTexture: IDirect3DCubeTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateCubeTextureFromResourceExA';
  5085. {$EXTERNALSYM D3DXCreateCubeTextureFromResourceExA}
  5086. function D3DXCreateCubeTextureFromResourceExW(
  5087. Device: IDirect3DDevice9;
  5088. hSrcModule: HModule;
  5089. pSrcResource: PWideChar;
  5090. Size: LongWord;
  5091. MipLevels: LongWord;
  5092. Usage: DWord;
  5093. Format: TD3DFormat;
  5094. Pool: TD3DPool;
  5095. Filter: DWord;
  5096. MipFilter: DWord;
  5097. ColorKey: TD3DColor;
  5098. pSrcInfo: PD3DXImageInfo;
  5099. pPalette: PPaletteEntry;
  5100. out ppCubeTexture: IDirect3DCubeTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateCubeTextureFromResourceExW';
  5101. {$EXTERNALSYM D3DXCreateCubeTextureFromResourceExW}
  5102. function D3DXCreateCubeTextureFromResourceEx(
  5103. Device: IDirect3DDevice9;
  5104. hSrcModule: HModule;
  5105. pSrcResource: PChar;
  5106. Size: LongWord;
  5107. MipLevels: LongWord;
  5108. Usage: DWord;
  5109. Format: TD3DFormat;
  5110. Pool: TD3DPool;
  5111. Filter: DWord;
  5112. MipFilter: DWord;
  5113. ColorKey: TD3DColor;
  5114. pSrcInfo: PD3DXImageInfo;
  5115. pPalette: PPaletteEntry;
  5116. out ppCubeTexture: IDirect3DCubeTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateCubeTextureFromResourceExA';
  5117. {$EXTERNALSYM D3DXCreateCubeTextureFromResourceEx}
  5118. function D3DXCreateVolumeTextureFromResourceExA(
  5119. Device: IDirect3DDevice9;
  5120. hSrcModule: HModule;
  5121. pSrcResource: PAnsiChar;
  5122. Width: LongWord;
  5123. Height: LongWord;
  5124. Depth: LongWord;
  5125. MipLevels: LongWord;
  5126. Usage: DWord;
  5127. Format: TD3DFormat;
  5128. Pool: TD3DPool;
  5129. Filter: DWord;
  5130. MipFilter: DWord;
  5131. ColorKey: TD3DColor;
  5132. pSrcInfo: PD3DXImageInfo;
  5133. pPalette: PPaletteEntry;
  5134. out ppVolumeTexture: IDirect3DVolumeTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateVolumeTextureFromResourceExA';
  5135. {$EXTERNALSYM D3DXCreateVolumeTextureFromResourceExA}
  5136. function D3DXCreateVolumeTextureFromResourceExW(
  5137. Device: IDirect3DDevice9;
  5138. hSrcModule: HModule;
  5139. pSrcResource: PWideChar;
  5140. Width: LongWord;
  5141. Height: LongWord;
  5142. Depth: LongWord;
  5143. MipLevels: LongWord;
  5144. Usage: DWord;
  5145. Format: TD3DFormat;
  5146. Pool: TD3DPool;
  5147. Filter: DWord;
  5148. MipFilter: DWord;
  5149. ColorKey: TD3DColor;
  5150. pSrcInfo: PD3DXImageInfo;
  5151. pPalette: PPaletteEntry;
  5152. out ppVolumeTexture: IDirect3DVolumeTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateVolumeTextureFromResourceExW';
  5153. {$EXTERNALSYM D3DXCreateVolumeTextureFromResourceExW}
  5154. function D3DXCreateVolumeTextureFromResourceEx(
  5155. Device: IDirect3DDevice9;
  5156. hSrcModule: HModule;
  5157. pSrcResource: PChar;
  5158. Width: LongWord;
  5159. Height: LongWord;
  5160. Depth: LongWord;
  5161. MipLevels: LongWord;
  5162. Usage: DWord;
  5163. Format: TD3DFormat;
  5164. Pool: TD3DPool;
  5165. Filter: DWord;
  5166. MipFilter: DWord;
  5167. ColorKey: TD3DColor;
  5168. pSrcInfo: PD3DXImageInfo;
  5169. pPalette: PPaletteEntry;
  5170. out ppVolumeTexture: IDirect3DVolumeTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateVolumeTextureFromResourceExA';
  5171. {$EXTERNALSYM D3DXCreateVolumeTextureFromResourceEx}
  5172. // FromFileInMemory
  5173. function D3DXCreateTextureFromFileInMemory(
  5174. Device: IDirect3DDevice9;
  5175. const pSrcData;
  5176. SrcDataSize: LongWord;
  5177. out ppTexture: IDirect3DTexture9): HResult; stdcall; external d3dx9texDLL;
  5178. {$EXTERNALSYM D3DXCreateTextureFromFileInMemory}
  5179. function D3DXCreateCubeTextureFromFileInMemory(
  5180. Device: IDirect3DDevice9;
  5181. const pSrcData;
  5182. SrcDataSize: LongWord;
  5183. out ppCubeTexture: IDirect3DCubeTexture9): HResult; stdcall; external d3dx9texDLL;
  5184. {$EXTERNALSYM D3DXCreateCubeTextureFromFileInMemory}
  5185. function D3DXCreateVolumeTextureFromFileInMemory(
  5186. Device: IDirect3DDevice9;
  5187. const pSrcData;
  5188. SrcDataSize: LongWord;
  5189. out ppVolumeTexture: IDirect3DVolumeTexture9): HResult; stdcall; external d3dx9texDLL;
  5190. {$EXTERNALSYM D3DXCreateVolumeTextureFromFileInMemory}
  5191. // FromFileInMemoryEx
  5192. function D3DXCreateTextureFromFileInMemoryEx(
  5193. Device: IDirect3DDevice9;
  5194. const pSrcData;
  5195. SrcDataSize: LongWord;
  5196. Width: LongWord;
  5197. Height: LongWord;
  5198. MipLevels: LongWord;
  5199. Usage: DWord;
  5200. Format: TD3DFormat;
  5201. Pool: TD3DPool;
  5202. Filter: DWord;
  5203. MipFilter: DWord;
  5204. ColorKey: TD3DColor;
  5205. pSrcInfo: PD3DXImageInfo;
  5206. pPalette: PPaletteEntry;
  5207. out ppTexture: IDirect3DTexture9): HResult; stdcall; external d3dx9texDLL;
  5208. {$EXTERNALSYM D3DXCreateTextureFromFileInMemoryEx}
  5209. function D3DXCreateCubeTextureFromFileInMemoryEx(
  5210. Device: IDirect3DDevice9;
  5211. const pSrcData;
  5212. SrcDataSize: LongWord;
  5213. Size: LongWord;
  5214. MipLevels: LongWord;
  5215. Usage: DWord;
  5216. Format: TD3DFormat;
  5217. Pool: TD3DPool;
  5218. Filter: DWord;
  5219. MipFilter: DWord;
  5220. ColorKey: TD3DColor;
  5221. pSrcInfo: PD3DXImageInfo;
  5222. pPalette: PPaletteEntry;
  5223. out ppCubeTexture: IDirect3DCubeTexture9): HResult; stdcall; external d3dx9texDLL;
  5224. {$EXTERNALSYM D3DXCreateCubeTextureFromFileInMemoryEx}
  5225. function D3DXCreateVolumeTextureFromFileInMemoryEx(
  5226. Device: IDirect3DDevice9;
  5227. const pSrcData;
  5228. SrcDataSize: LongWord;
  5229. Width: LongWord;
  5230. Height: LongWord;
  5231. Depth: LongWord;
  5232. MipLevels: LongWord;
  5233. Usage: DWord;
  5234. Format: TD3DFormat;
  5235. Pool: TD3DPool;
  5236. Filter: DWord;
  5237. MipFilter: DWord;
  5238. ColorKey: TD3DColor;
  5239. pSrcInfo: PD3DXImageInfo;
  5240. pPalette: PPaletteEntry;
  5241. out ppVolumeTexture: IDirect3DVolumeTexture9): HResult; stdcall; external d3dx9texDLL;
  5242. {$EXTERNALSYM D3DXCreateVolumeTextureFromFileInMemoryEx}
  5243. //----------------------------------------------------------------------------
  5244. // D3DXSaveTextureToFile:
  5245. // ----------------------
  5246. // Save a texture to a file.
  5247. //
  5248. // Parameters:
  5249. // pDestFile
  5250. // File name of the destination file
  5251. // DestFormat
  5252. // D3DXIMAGE_FILEFORMAT specifying file format to use when saving.
  5253. // pSrcTexture
  5254. // Source texture, containing the image to be saved
  5255. // pSrcPalette
  5256. // Source palette of 256 colors, or NULL
  5257. //
  5258. //----------------------------------------------------------------------------
  5259. function D3DXSaveTextureToFileA(
  5260. pDestFile: PAnsiChar;
  5261. DestFormat: TD3DXImageFileFormat;
  5262. pSrcTexture: IDirect3DBaseTexture9;
  5263. pSrcPalette: PPaletteEntry): HResult; stdcall; external d3dx9texDLL name 'D3DXSaveTextureToFileA';
  5264. {$EXTERNALSYM D3DXSaveTextureToFileA}
  5265. function D3DXSaveTextureToFileW(
  5266. pDestFile: PWideChar;
  5267. DestFormat: TD3DXImageFileFormat;
  5268. pSrcTexture: IDirect3DBaseTexture9;
  5269. pSrcPalette: PPaletteEntry): HResult; stdcall; external d3dx9texDLL name 'D3DXSaveTextureToFileW';
  5270. {$EXTERNALSYM D3DXSaveTextureToFileW}
  5271. function D3DXSaveTextureToFile(
  5272. pDestFile: PChar;
  5273. DestFormat: TD3DXImageFileFormat;
  5274. pSrcTexture: IDirect3DBaseTexture9;
  5275. pSrcPalette: PPaletteEntry): HResult; stdcall; external d3dx9texDLL name 'D3DXSaveTextureToFileA';
  5276. {$EXTERNALSYM D3DXSaveTextureToFile}
  5277. //////////////////////////////////////////////////////////////////////////////
  5278. // Misc Texture APIs /////////////////////////////////////////////////////////
  5279. //////////////////////////////////////////////////////////////////////////////
  5280. //----------------------------------------------------------------------------
  5281. // D3DXFilterTexture:
  5282. // ------------------
  5283. // Filters mipmaps levels of a texture.
  5284. //
  5285. // Parameters:
  5286. // pBaseTexture
  5287. // The texture object to be filtered
  5288. // pPalette
  5289. // 256 color palette to be used, or NULL for non-palettized formats
  5290. // SrcLevel
  5291. // The level whose image is used to generate the subsequent levels.
  5292. // Filter
  5293. // D3DX_FILTER flags controlling how each miplevel is filtered.
  5294. // Or D3DX_DEFAULT for D3DX_FILTER_BOX,
  5295. //
  5296. //-------------------------------------------------------------------------
  5297. function D3DXFilterTexture(
  5298. pTexture: IDirect3DTexture9;
  5299. pPalette: PPaletteEntry;
  5300. SrcLevel: LongWord;
  5301. Filter: DWord): HResult; stdcall; external d3dx9texDLL;
  5302. {$EXTERNALSYM D3DXFilterTexture}
  5303. // #define D3DXFilterCubeTexture D3DXFilterTexture
  5304. // In Pascal this mapped to DLL-exported "D3DXFilterTexture" function
  5305. function D3DXFilterCubeTexture(
  5306. pTexture: IDirect3DCubeTexture9;
  5307. pPalette: PPaletteEntry;
  5308. SrcLevel: LongWord;
  5309. Filter: DWord): HResult; stdcall; external d3dx9texDLL name 'D3DXFilterTexture';
  5310. {$EXTERNALSYM D3DXFilterCubeTexture}
  5311. // #define D3DXFilterVolumeTexture D3DXFilterTexture
  5312. // In Pascal this mapped to DLL-exported "D3DXFilterTexture" function
  5313. function D3DXFilterVolumeTexture(
  5314. pTexture: IDirect3DVolumeTexture9;
  5315. pPalette: PPaletteEntry;
  5316. SrcLevel: LongWord;
  5317. Filter: DWord): HResult; stdcall; external d3dx9texDLL name 'D3DXFilterTexture';
  5318. {$EXTERNALSYM D3DXFilterVolumeTexture}
  5319. //----------------------------------------------------------------------------
  5320. // D3DXFillTexture:
  5321. // ----------------
  5322. // Uses a user provided function to fill each texel of each mip level of a
  5323. // given texture.
  5324. //
  5325. // Paramters:
  5326. // pTexture, pCubeTexture, pVolumeTexture
  5327. // Pointer to the texture to be filled.
  5328. // pFunction
  5329. // Pointer to user provided evalutor function which will be used to
  5330. // compute the value of each texel.
  5331. // pData
  5332. // Pointer to an arbitrary block of user defined data. This pointer
  5333. // will be passed to the function provided in pFunction
  5334. //-----------------------------------------------------------------------------
  5335. function D3DXFillTexture(
  5336. pTexture: IDirect3DTexture9;
  5337. pFunction: TD3DXFill2D;
  5338. const pData): HResult; stdcall; external d3dx9texDLL;
  5339. {$EXTERNALSYM D3DXFillTexture}
  5340. function D3DXFillCubeTexture(
  5341. pCubeTexture: IDirect3DCubeTexture9;
  5342. pFunction: TD3DXFill2D;
  5343. const pData): HResult; stdcall; external d3dx9texDLL;
  5344. {$EXTERNALSYM D3DXFillCubeTexture}
  5345. function D3DXFillVolumeTexture(
  5346. pVolumeTexture: IDirect3DVolumeTexture9;
  5347. pFunction: TD3DXFill3D;
  5348. const pData): HResult; stdcall; external d3dx9texDLL;
  5349. {$EXTERNALSYM D3DXFillVolumeTexture}
  5350. //----------------------------------------------------------------------------
  5351. // D3DXFillTextureTX:
  5352. // ----------------
  5353. // Uses a TX Shader target to function to fill each texel of each mip level of a
  5354. // given texture. The TX Shader target should be a compiled function taking 2
  5355. // 2 paramters and returning a float4 color.
  5356. //
  5357. // Paramters:
  5358. // pTexture, pCubeTexture, pVolumeTexture
  5359. // Pointer to the texture to be filled.
  5360. // pFunction:
  5361. // Pointer to the compiled function returned by D3DX
  5362. // pConstants
  5363. // Constants used by program. Should be filled by user by parsing constant
  5364. // Table information
  5365. // Constants
  5366. // Number of Constants
  5367. //-----------------------------------------------------------------------------
  5368. function D3DXFillTextureTX(
  5369. pTexture: IDirect3DTexture9;
  5370. pFunction: PDWORD;
  5371. pConstants: PD3DXVector4;
  5372. Constants: LongWord): HResult; stdcall; external d3dx9texDLL;
  5373. {$EXTERNALSYM D3DXFillTextureTX}
  5374. function D3DXFillCubeTextureTX(
  5375. pCubeTexture: IDirect3DCubeTexture9;
  5376. pFunction: PDWORD;
  5377. pConstants: PD3DXVector4;
  5378. Constants: LongWord): HResult; stdcall; external d3dx9texDLL;
  5379. {$EXTERNALSYM D3DXFillCubeTextureTX}
  5380. function D3DXFillVolumeTextureTX(
  5381. pVolumeTexture: IDirect3DVolumeTexture9;
  5382. pFunction: PDWORD;
  5383. pConstants: PD3DXVector4;
  5384. Constants: LongWord): HResult; stdcall; external d3dx9texDLL;
  5385. {$EXTERNALSYM D3DXFillVolumeTextureTX}
  5386. //----------------------------------------------------------------------------
  5387. // D3DXComputeNormalMap:
  5388. // ---------------------
  5389. // Converts a height map into a normal map. The (x,y,z) components of each
  5390. // normal are mapped to the (r,g,b) channels of the output texture.
  5391. //
  5392. // Parameters
  5393. // pTexture
  5394. // Pointer to the destination texture
  5395. // pSrcTexture
  5396. // Pointer to the source heightmap texture
  5397. // pSrcPalette
  5398. // Source palette of 256 colors, or NULL
  5399. // Flags
  5400. // D3DX_NORMALMAP flags
  5401. // Channel
  5402. // D3DX_CHANNEL specifying source of height information
  5403. // Amplitude
  5404. // The constant value which the height information is multiplied by.
  5405. //---------------------------------------------------------------------------
  5406. function D3DXComputeNormalMap(
  5407. pTexture: IDirect3DTexture9;
  5408. pSrcTexture: IDirect3DTexture9;
  5409. pSrcPalette: PPaletteEntry;
  5410. Flags: DWord;
  5411. Channel: DWord;
  5412. Amplitude: Single): HResult; stdcall; external d3dx9texDLL;
  5413. {$EXTERNALSYM D3DXComputeNormalMap}
  5414. //////////////////////////////////////////////////////////////////////////////
  5415. //
  5416. // Copyright (C) Microsoft Corporation. All Rights Reserved.
  5417. //
  5418. // File: d3dx9anim.h
  5419. // Content: D3DX mesh types and functions
  5420. //
  5421. //////////////////////////////////////////////////////////////////////////////
  5422. type
  5423. //----------------------------------------------------------------------------
  5424. // This enum defines the type of mesh data present in a MeshData structure
  5425. //----------------------------------------------------------------------------
  5426. _D3DXMESHDATATYPE = (
  5427. {$IFNDEF COMPILER6_UP}
  5428. D3DXMESHTYPE_invalid_0,
  5429. D3DXMESHTYPE_MESH {= $001}, // normal ID3DXMesh data
  5430. D3DXMESHTYPE_PMESH {= $002}, // Progressive Mesh - ID3DXPMesh
  5431. D3DXMESHTYPE_PATCHMESH {= $003} // Patch MEsh - ID3DXPatchMesh
  5432. {$ELSE}
  5433. D3DXMESHTYPE_MESH = $001, // normal ID3DXMesh data
  5434. D3DXMESHTYPE_PMESH = $002, // Progressive Mesh - ID3DXPMesh
  5435. D3DXMESHTYPE_PATCHMESH = $003 // Patch MEsh - ID3DXPatchMesh
  5436. {$ENDIF}
  5437. );
  5438. {$EXTERNALSYM _D3DXMESHDATATYPE}
  5439. D3DXMESHDATATYPE = _D3DXMESHDATATYPE;
  5440. {$EXTERNALSYM D3DXMESHDATATYPE}
  5441. TD3DXMeshDataType = _D3DXMESHDATATYPE;
  5442. //----------------------------------------------------------------------------
  5443. // This struct encapsulates a the mesh data that can be present in a mesh
  5444. // container. The supported mesh types are pMesh, pPMesh, pPatchMesh
  5445. // The valid way to access this is determined by the MeshType enum
  5446. //----------------------------------------------------------------------------
  5447. PD3DXMeshData = ^TD3DXMeshData;
  5448. _D3DXMESHDATA = packed record
  5449. _Type: TD3DXMeshDataType;
  5450. // current mesh data interface
  5451. // *** Translator ***: Delphi doesn't allow interfaces in variant records
  5452. // so I declare only one field that can be casted in code, for examples, as:
  5453. // either "mesh := ID3DXPatchMesh(pPatchMesh)"
  5454. // or "mesh := pPatchMesh as ID3DXPatchMesh"
  5455. pMesh: IUnknown;
  5456. { case Byte of // In Delphi use pMesh record item as defined above
  5457. 0: (pMesh: ID3DXMesh);
  5458. 1: (pPMesh: ID3DXPMesh);
  5459. 2: (pPatchMesh: ID3DXPatchMesh); }
  5460. end;
  5461. {$EXTERNALSYM _D3DXMESHDATA}
  5462. D3DXMESHDATA = _D3DXMESHDATA;
  5463. {$EXTERNALSYM D3DXMESHDATA}
  5464. TD3DXMeshData = _D3DXMESHDATA;
  5465. //----------------------------------------------------------------------------
  5466. // This struct encapsulates a mesh object in a transformation frame
  5467. // hierarchy. The app can derive from this structure to add other app specific
  5468. // data to this
  5469. //----------------------------------------------------------------------------
  5470. PD3DXMeshContainer = ^TD3DXMeshContainer;
  5471. _D3DXMESHCONTAINER = packed record
  5472. Name: PAnsiChar;
  5473. MeshData: TD3DXMeshData;
  5474. pMaterials: PD3DXMaterial;
  5475. pEffects: PD3DXEffectInstance;
  5476. NumMaterials: DWORD;
  5477. pAdjacency: PDWORD;
  5478. pSkinInfo: ID3DXSkinInfo;
  5479. pNextMeshContainer: PD3DXMeshContainer;
  5480. end;
  5481. {$EXTERNALSYM _D3DXMESHCONTAINER}
  5482. D3DXMESHCONTAINER = _D3DXMESHCONTAINER;
  5483. {$EXTERNALSYM D3DXMESHCONTAINER}
  5484. TD3DXMeshContainer = _D3DXMESHCONTAINER;
  5485. //----------------------------------------------------------------------------
  5486. // This struct is the encapsulates a transform frame in a transformation frame
  5487. // hierarchy. The app can derive from this structure to add other app specific
  5488. // data to this
  5489. //----------------------------------------------------------------------------
  5490. PD3DXFrame = ^TD3DXFrame;
  5491. _D3DXFRAME = packed record
  5492. Name: PAnsiChar;
  5493. TransformationMatrix: TD3DXMatrix;
  5494. pMeshContainer: PD3DXMeshContainer;
  5495. pFrameSibling: PD3DXFrame;
  5496. pFrameFirstChild: PD3DXFrame;
  5497. end;
  5498. {$EXTERNALSYM _D3DXFRAME}
  5499. D3DXFRAME = _D3DXFRAME;
  5500. {$EXTERNALSYM D3DXFRAME}
  5501. TD3DXFrame = _D3DXFRAME;
  5502. //----------------------------------------------------------------------------
  5503. // This interface is implemented by the application to allocate/free frame and
  5504. // mesh container objects. Methods on this are called during loading and
  5505. // destroying frame hierarchies
  5506. //----------------------------------------------------------------------------
  5507. //////////////////////////////////////////////////////////////////////////////
  5508. // ID3DXAllocateHierarchy ////////////////////////////////////////////////////
  5509. //////////////////////////////////////////////////////////////////////////////
  5510. type
  5511. {$EXTERNALSYM ID3DXAllocateHierarchy}
  5512. ID3DXAllocateHierarchy = class
  5513. // ID3DXAllocateHierarchy
  5514. //------------------------------------------------------------------------
  5515. // CreateFrame:
  5516. // ------------
  5517. // Requests allocation of a frame object.
  5518. //
  5519. // Parameters:
  5520. // Name
  5521. // Name of the frame to be created
  5522. // ppNewFrame
  5523. // Returns returns the created frame object
  5524. //
  5525. //------------------------------------------------------------------------
  5526. function CreateFrame(Name: PAnsiChar; out ppNewFrame: PD3DXFrame): HResult; virtual; stdcall; abstract;
  5527. //------------------------------------------------------------------------
  5528. // CreateMeshContainer:
  5529. // --------------------
  5530. // Requests allocation of a mesh container object.
  5531. //
  5532. // Parameters:
  5533. // Name
  5534. // Name of the mesh
  5535. // pMesh
  5536. // Pointer to the mesh object if basic polygon data found
  5537. // pPMesh
  5538. // Pointer to the progressive mesh object if progressive mesh data found
  5539. // pPatchMesh
  5540. // Pointer to the patch mesh object if patch data found
  5541. // pMaterials
  5542. // Array of materials used in the mesh
  5543. // pEffectInstances
  5544. // Array of effect instances used in the mesh
  5545. // NumMaterials
  5546. // Num elements in the pMaterials array
  5547. // pAdjacency
  5548. // Adjacency array for the mesh
  5549. // pSkinInfo
  5550. // Pointer to the skininfo object if the mesh is skinned
  5551. // pBoneNames
  5552. // Array of names, one for each bone in the skinned mesh.
  5553. // The numberof bones can be found from the pSkinMesh object
  5554. // pBoneOffsetMatrices
  5555. // Array of matrices, one for each bone in the skinned mesh.
  5556. //
  5557. //------------------------------------------------------------------------
  5558. function CreateMeshContainer(Name: PAnsiChar; const pMeshData: TD3DXMeshData;
  5559. pMaterials: PD3DXMaterial; pEffectInstances: PD3DXEffectInstance;
  5560. NumMaterials: DWORD; pAdjacency: PDWORD; pSkinInfo: ID3DXSkinInfo;
  5561. out ppNewMeshContainer: PD3DXMeshContainer): HResult; virtual; stdcall; abstract;
  5562. //------------------------------------------------------------------------
  5563. // DestroyFrame:
  5564. // -------------
  5565. // Requests de-allocation of a frame object.
  5566. //
  5567. // Parameters:
  5568. // pFrameToFree
  5569. // Pointer to the frame to be de-allocated
  5570. //
  5571. //------------------------------------------------------------------------
  5572. function DestroyFrame(pFrameToFree: PD3DXFrame): HResult; virtual; stdcall; abstract;
  5573. //------------------------------------------------------------------------
  5574. // DestroyMeshContainer:
  5575. // ---------------------
  5576. // Requests de-allocation of a mesh container object.
  5577. //
  5578. // Parameters:
  5579. // pMeshContainerToFree
  5580. // Pointer to the mesh container object to be de-allocated
  5581. //
  5582. //------------------------------------------------------------------------
  5583. function DestroyMeshContainer(pMeshContainerToFree: PD3DXMeshContainer): HResult; virtual; stdcall; abstract;
  5584. end;
  5585. //----------------------------------------------------------------------------
  5586. // This interface is implemented by the application to load user data in a .X file
  5587. // When user data is found, these callbacks will be used to allow the application
  5588. // to load the data
  5589. //----------------------------------------------------------------------------
  5590. //////////////////////////////////////////////////////////////////////////////
  5591. // ID3DXLoadUserData ////////////////////////////////////////////////////////
  5592. //////////////////////////////////////////////////////////////////////////////
  5593. type
  5594. {$EXTERNALSYM ID3DXLoadUserData}
  5595. ID3DXLoadUserData = class
  5596. function LoadTopLevelData(pXofChildData: IDirectXFileData): HResult; virtual; stdcall; abstract;
  5597. function LoadFrameChildData(pFrame: PD3DXFrame;
  5598. pXofChildData: IDirectXFileData): HResult; virtual; stdcall; abstract;
  5599. function LoadMeshChildData(pMeshContainer: PD3DXMeshContainer;
  5600. pXofChildData: IDirectXFileData): HResult; virtual; stdcall; abstract;
  5601. end;
  5602. //----------------------------------------------------------------------------
  5603. // This interface is implemented by the application to save user data in a .X file
  5604. // The callbacks are called for all data saved. The user can then add any
  5605. // child data objects to the object provided to the callback
  5606. //----------------------------------------------------------------------------
  5607. //////////////////////////////////////////////////////////////////////////////
  5608. // ID3DXSaveUserData /////////////////////////////////////////////////////////
  5609. //////////////////////////////////////////////////////////////////////////////
  5610. type
  5611. {$EXTERNALSYM ID3DXSaveUserData}
  5612. ID3DXSaveUserData = class
  5613. function AddFrameChildData(pFrame: PD3DXFrame;
  5614. pXofSave: IDirectXFileSaveObject; pXofFrameData: IDirectXFileData): HResult; virtual; stdcall; abstract;
  5615. function AddMeshChildData(pMeshContainer: PD3DXMeshContainer;
  5616. pXofSave: IDirectXFileSaveObject; pXofMeshData: IDirectXFileData): HResult; virtual; stdcall; abstract;
  5617. // NOTE: this is called once per Save. All top level objects should be added using the
  5618. // provided interface. One call adds objects before the frame hierarchy, the other after
  5619. function AddTopLevelDataObjectsPre(pXofSave: IDirectXFileSaveObject): HResult; virtual; stdcall; abstract;
  5620. function AddTopLevelDataObjectsPost(pXofSave: IDirectXFileSaveObject): HResult; virtual; stdcall; abstract;
  5621. // callbacks for the user to register and then save templates to the XFile
  5622. function RegisterTemplates(pXFileApi: IDirectXFile): HResult; virtual; stdcall; abstract;
  5623. function SaveTemplates(pXofSave: IDirectXFileSaveObject): HResult; virtual; stdcall; abstract;
  5624. end;
  5625. //----------------------------------------------------------------------------
  5626. // This interface defines a SRT (scale/rotate/translate) interpolator. This
  5627. // is an abstract interface. ID3DXKeyFrameInterpolator inherits from this.
  5628. // An application can implement this for custom SRT interpolator
  5629. //----------------------------------------------------------------------------
  5630. //////////////////////////////////////////////////////////////////////////////
  5631. // ID3DXInterpolator /////////////////////////////////////////////////////////
  5632. //////////////////////////////////////////////////////////////////////////////
  5633. type
  5634. PID3DXInterpolator = ^ID3DXInterpolator;
  5635. {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DXInterpolator);'}
  5636. {$EXTERNALSYM ID3DXInterpolator}
  5637. ID3DXInterpolator = interface(IUnknown)
  5638. ['{ADE2C06D-3747-4b9f-A514-3440B8284980}']
  5639. // ID3DXInterpolator
  5640. function GetName: PAnsiChar; stdcall;
  5641. function GetPeriod: Double; stdcall;
  5642. //----------------------------------------------------------------------------
  5643. // GetSRT:
  5644. // -------
  5645. // Returns the scale, rotation and translation at a given time
  5646. //
  5647. // Parameters:
  5648. // Time
  5649. // Time at which the interpolator should be queried
  5650. // pScale
  5651. // Returns the scale vector
  5652. // pRotate
  5653. // Returns the rotation qaternion
  5654. // pTranslate
  5655. // Returns the translate vector
  5656. //
  5657. //----------------------------------------------------------------------------
  5658. function GetSRT(Time: Double; pScale: PD3DXVector3; pRotate: PD3DXQuaternion; pTranslate: PD3DXVector3): HResult; stdcall;
  5659. function GetLastSRT(pScale: PD3DXVector3; pRotate: PD3DXQuaternion; pTranslate: PD3DXVector3): HResult; stdcall;
  5660. end;
  5661. //----------------------------------------------------------------------------
  5662. // This structure describes a vector key for use in keyframe animation.
  5663. // It specifies a vector Value at a given Time. This is used for scale and
  5664. // translation keys
  5665. //----------------------------------------------------------------------------
  5666. type
  5667. PD3DXKeyVector3 = ^TD3DXKeyVector3;
  5668. _D3DXKEY_VECTOR3 = packed record
  5669. Time: Single;
  5670. Value: TD3DXVector3;
  5671. end;
  5672. {$EXTERNALSYM _D3DXKEY_VECTOR3}
  5673. D3DXKEY_VECTOR3 = _D3DXKEY_VECTOR3;
  5674. {$EXTERNALSYM D3DXKEY_VECTOR3}
  5675. TD3DXKeyVector3 = _D3DXKEY_VECTOR3;
  5676. //----------------------------------------------------------------------------
  5677. // This structure describes a quaternion key for use in keyframe animation.
  5678. // It specifies a quaternion Value at a given Time. This is used for rotation
  5679. // keys
  5680. //----------------------------------------------------------------------------
  5681. type
  5682. PD3DXKeyQuaternion = ^TD3DXKeyQuaternion;
  5683. _D3DXKEY_QUATERNION = packed record
  5684. Time: Single;
  5685. Value: TD3DXQuaternion;
  5686. end;
  5687. {$EXTERNALSYM _D3DXKEY_QUATERNION}
  5688. D3DXKEY_QUATERNION = _D3DXKEY_QUATERNION;
  5689. {$EXTERNALSYM D3DXKEY_QUATERNION}
  5690. TD3DXKeyQuaternion = _D3DXKEY_QUATERNION;
  5691. //----------------------------------------------------------------------------
  5692. // This interface implements an SRT (scale/rotate/translate) interpolator
  5693. // It takes a scattered set of keys and interpolates the transform for any
  5694. // given time
  5695. //----------------------------------------------------------------------------
  5696. //////////////////////////////////////////////////////////////////////////////
  5697. // ID3DXKeyFrameInterpolator /////////////////////////////////////////////////
  5698. //////////////////////////////////////////////////////////////////////////////
  5699. type
  5700. {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DXKeyFrameInterpolator);'}
  5701. {$EXTERNALSYM ID3DXKeyFrameInterpolator}
  5702. ID3DXKeyFrameInterpolator = interface(ID3DXInterpolator)
  5703. ['{6CAA71F8-0972-4cdb-A55B-43B968997515}']
  5704. // ID3DXKeyFrameInterpolator
  5705. function GetNumScaleKeys: LongWord; stdcall;
  5706. function GetScaleKeys(pKeys: PD3DXKeyVector3): HResult; stdcall;
  5707. function GetNumRotationKeys: LongWord; stdcall;
  5708. function GetRotationKeys(pKeys: PD3DXKeyQuaternion): HResult; stdcall;
  5709. function GetNumTranslationKeys: LongWord; stdcall;
  5710. function GetTranslationKeys(pKeys: PD3DXKeyVector3): HResult; stdcall;
  5711. // the value passed to D3DXCreateKeyFrameInterpolator to scale from the times in LPD3DXKEY_VECTOR3 to global/anim time.
  5712. function GetSourceTicksPerSecond: Double; stdcall;
  5713. end;
  5714. //----------------------------------------------------------------------------
  5715. // This interface implements an set of interpolators. The set consists of
  5716. // interpolators for many nodes for the same animation.
  5717. //----------------------------------------------------------------------------
  5718. //////////////////////////////////////////////////////////////////////////////
  5719. // ID3DXAnimationSet /////////////////////////////////////////////////////////
  5720. //////////////////////////////////////////////////////////////////////////////
  5721. type
  5722. {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DXAnimationSet);'}
  5723. {$EXTERNALSYM ID3DXAnimationSet}
  5724. ID3DXAnimationSet = interface(IUnknown)
  5725. ['{54B569AC-0AEF-473e-9704-3FEF317F64AB}']
  5726. // ID3DXAnimationSet
  5727. function GetName: PAnsiChar; stdcall;
  5728. function GetPeriod: Double; stdcall;
  5729. function GetNumInterpolators: LongWord; stdcall;
  5730. function GetInterpolatorByIndex(Index: LongWord; out ppInterpolator: ID3DXInterpolator): HResult; stdcall;
  5731. function GetInterpolatorByName(pName: PAnsiChar; out ppInterpolator: ID3DXInterpolator): HResult; stdcall;
  5732. end;
  5733. //----------------------------------------------------------------------------
  5734. // This structure describes an animation track. A track is a combination
  5735. // of an animation set (stored separately) and mixing information.
  5736. // the mixing information consists of the current position, speed, and blending
  5737. // weight for the track. The Flags field also specifies whether the track
  5738. // is low or high priority. Tracks with the same priority are blended together
  5739. // and then the two resulting values are blended using the priority blend factor.
  5740. //----------------------------------------------------------------------------
  5741. type
  5742. PD3DXTrackDesc = ^TD3DXTrackDesc;
  5743. _D3DXTRACK_DESC = packed record
  5744. Flags: DWORD;
  5745. Weight: Single;
  5746. Speed: Single;
  5747. Enable: BOOL;
  5748. AnimTime: Double;
  5749. end;
  5750. {$EXTERNALSYM _D3DXTRACK_DESC}
  5751. D3DXTRACK_DESC = _D3DXTRACK_DESC;
  5752. {$EXTERNALSYM D3DXTRACK_DESC}
  5753. TD3DXTrackDesc = _D3DXTRACK_DESC;
  5754. //----------------------------------------------------------------------------
  5755. // This enum defines the type of transtion performed on a event that transitions from one value to another
  5756. //----------------------------------------------------------------------------
  5757. type
  5758. PD3DXTrackFlag = ^TD3DXTrackFlag;
  5759. _D3DXTRACKFLAG = (
  5760. D3DXTF_LOWPRIORITY {= $000}, // This track should be blended with all low priority tracks before mixed with the high priority result
  5761. D3DXTF_HIGHPRIORITY {= $001} // This track should be blended with all high priority tracks before mixed with the low priority result
  5762. );
  5763. {$EXTERNALSYM _D3DXTRACKFLAG}
  5764. D3DXTRACKFLAG = _D3DXTRACKFLAG;
  5765. {$EXTERNALSYM D3DXTRACKFLAG}
  5766. TD3DXTrackFlag = _D3DXTRACKFLAG;
  5767. //----------------------------------------------------------------------------
  5768. // This interface implements the main animation functionality. It connects
  5769. // animation sets with the transform frames that are being animated. Allows
  5770. // mixing multiple animations for blended animations or for transistions
  5771. // It adds also has methods to modify blending parameters over time to
  5772. // enable smooth transistions and other effects.
  5773. //----------------------------------------------------------------------------
  5774. //----------------------------------------------------------------------------
  5775. // This enum defines the type of transtion performed on a event that transitions from one value to another
  5776. //----------------------------------------------------------------------------
  5777. type
  5778. PD3DXTransitionType = ^TD3DXTransitionType;
  5779. _D3DXTRANSITIONTYPE = (
  5780. D3DXTRANSITION_LINEAR {= $000}, // Linear transition from one value to the next
  5781. D3DXTRANSITION_EASEINEASEOUT {= $001} // Ease-In Ease-Out spline transtion from one value to the next
  5782. );
  5783. {$EXTERNALSYM _D3DXTRANSITIONTYPE}
  5784. D3DXTRANSITIONTYPE = _D3DXTRANSITIONTYPE;
  5785. {$EXTERNALSYM D3DXTRANSITIONTYPE}
  5786. TD3DXTransitionType = _D3DXTRANSITIONTYPE;
  5787. //////////////////////////////////////////////////////////////////////////////
  5788. // ID3DXAnimationController //////////////////////////////////////////////////
  5789. //////////////////////////////////////////////////////////////////////////////
  5790. type
  5791. {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DXAnimationController);'}
  5792. {$EXTERNALSYM ID3DXAnimationController}
  5793. ID3DXAnimationController = interface(IUnknown)
  5794. ['{3A714D34-FF61-421e-909F-639F38356708}']
  5795. // mixing functionality
  5796. // register outputs of SetTime
  5797. function RegisterMatrix(Name: PAnsiChar; const pMatrix: TD3DXMatrix): HResult; stdcall;
  5798. // AnimationSets
  5799. function GetNumAnimationSets: LongWord; stdcall;
  5800. function GetAnimationSet(iAnimationSet: DWORD; out ppAnimSet: ID3DXAnimationSet): HResult; stdcall;
  5801. function RegisterAnimationSet(pAnimSet: ID3DXAnimationSet): HResult; stdcall;
  5802. function UnregisterAnimationSet(pAnimSet: ID3DXAnimationSet): HResult; stdcall;
  5803. // Tracks
  5804. function GetMaxNumTracks: LongWord; stdcall;
  5805. function GetTrackDesc(Track: DWORD; out pDesc: TD3DXTrackDesc): HResult; stdcall;
  5806. function SetTrackDesc(Track: DWORD; const pDesc: TD3DXTrackDesc): HResult; stdcall;
  5807. function GetTrackAnimationSet(Track: DWORD; out ppAnimSet: ID3DXAnimationSet): HResult; stdcall;
  5808. function SetTrackAnimationSet(Track: DWORD; pAnimSet: ID3DXAnimationSet): HResult; stdcall;
  5809. // Individual track field access
  5810. function SetTrackSpeed(Track: DWORD; Speed: Single): HResult; stdcall;
  5811. function SetTrackWeight(Track: DWORD; Weight: Single): HResult; stdcall;
  5812. function SetTrackAnimTime(Track: DWORD; AnimTime: Double): HResult; stdcall;
  5813. function SetTrackEnable(Track: DWORD; Enable: BOOL): HResult; stdcall;
  5814. // Time
  5815. function GetTime: Double; stdcall;
  5816. function SetTime(Time: Double): HResult; stdcall;
  5817. function CloneAnimationController(MaxNumMatrices, MaxNumAnimationSets, MaxNumTracks, MaxNumEvents: LongWord; out ppAnimController: ID3DXAnimationController): HResult; stdcall;
  5818. function GetMaxNumMatrices: LongWord; stdcall;
  5819. function GetMaxNumEvents: LongWord; stdcall;
  5820. function GetMaxNumAnimationSets: LongWord; stdcall;
  5821. // Sequencing abilities
  5822. function KeyTrackSpeed(Track: DWORD; NewSpeed: Single; StartTime, Duration: Double; Method: DWORD): HResult; stdcall;
  5823. function KeyTrackWeight(Track: DWORD; NewWeight: Single; StartTime, Duration: Double; Method: DWORD): HResult; stdcall;
  5824. function KeyTrackAnimTime(Track: DWORD; NewAnimTime, StartTime: Double): HResult; stdcall;
  5825. function KeyTrackEnable(Track: DWORD; NewEnable: BOOL; StartTime: Double): HResult; stdcall;
  5826. // this functions sets the blend weight to be used to blend high and low priority tracks together.
  5827. // NOTE: this has no effect unless there are active animations on tracks for a given matrix that have both high and low results
  5828. function GetPriorityBlend: Single; stdcall;
  5829. function SetPriorityBlend(BlendWeight: Single): HResult; stdcall;
  5830. function KeyPriorityBlend(NewBlendWeight: Single; StartTime, Duration: Double; Method: DWORD): HResult; stdcall;
  5831. end;
  5832. type
  5833. IID_ID3DXInterpolator = ID3DXInterpolator;
  5834. {$EXTERNALSYM IID_ID3DXInterpolator}
  5835. IID_ID3DXKeyFrameInterpolator = ID3DXKeyFrameInterpolator;
  5836. {$EXTERNALSYM IID_ID3DXKeyFrameInterpolator}
  5837. IID_ID3DXAnimationSet = ID3DXAnimationSet;
  5838. {$EXTERNALSYM IID_ID3DXAnimationSet}
  5839. IID_ID3DXAnimationController = ID3DXAnimationController;
  5840. {$EXTERNALSYM IID_ID3DXAnimationController}
  5841. //----------------------------------------------------------------------------
  5842. // D3DXLoadMeshHierarchyFromX:
  5843. // ---------------------------
  5844. // Loads the first frame hierarchy in a .X file.
  5845. //
  5846. // Parameters:
  5847. // Filename
  5848. // Name of the .X file
  5849. // MeshOptions
  5850. // Mesh creation options for meshes in the file (see d3dx9mesh.h)
  5851. // pD3DDevice
  5852. // D3D9 device on which meshes in the file are created in
  5853. // pAlloc
  5854. // Allocation interface used to allocate nodes of the frame hierarchy
  5855. // pUserDataLoader
  5856. // Application provided interface to allow loading of user data
  5857. // ppFrameHierarchy
  5858. // Returns root node pointer of the loaded frame hierarchy
  5859. // ppAnimController
  5860. // Returns pointer to an animation controller corresponding to animation
  5861. // in the .X file. This is created with default max tracks and events
  5862. //
  5863. //----------------------------------------------------------------------------
  5864. function D3DXLoadMeshHierarchyFromXA(
  5865. Filename: PAnsiChar;
  5866. MeshOptions: DWORD;
  5867. pD3DDevice: IDirect3DDevice9;
  5868. pAlloc: ID3DXAllocateHierarchy;
  5869. pUserDataLoader: ID3DXLoadUserData;
  5870. out ppFrameHierarchy: PD3DXFrame;
  5871. out ppAnimController: ID3DXAnimationController): HResult; stdcall; external d3dx9animDLL name 'D3DXLoadMeshHierarchyFromXA';
  5872. {$EXTERNALSYM D3DXLoadMeshHierarchyFromXA}
  5873. function D3DXLoadMeshHierarchyFromXW(
  5874. Filename: PWideChar;
  5875. MeshOptions: DWORD;
  5876. pD3DDevice: IDirect3DDevice9;
  5877. pAlloc: ID3DXAllocateHierarchy;
  5878. pUserDataLoader: ID3DXLoadUserData;
  5879. out ppFrameHierarchy: PD3DXFrame;
  5880. out ppAnimController: ID3DXAnimationController): HResult; stdcall; external d3dx9animDLL name 'D3DXLoadMeshHierarchyFromXW';
  5881. {$EXTERNALSYM D3DXLoadMeshHierarchyFromXW}
  5882. function D3DXLoadMeshHierarchyFromX(
  5883. Filename: PChar;
  5884. MeshOptions: DWORD;
  5885. pD3DDevice: IDirect3DDevice9;
  5886. pAlloc: ID3DXAllocateHierarchy;
  5887. pUserDataLoader: ID3DXLoadUserData;
  5888. out ppFrameHierarchy: PD3DXFrame;
  5889. out ppAnimController: ID3DXAnimationController): HResult; stdcall; external d3dx9animDLL name 'D3DXLoadMeshHierarchyFromXA';
  5890. {$EXTERNALSYM D3DXLoadMeshHierarchyFromX}
  5891. function D3DXLoadMeshHierarchyFromXInMemory(
  5892. Memory: Pointer;
  5893. SizeOfMemory: DWORD;
  5894. MeshOptions: DWORD;
  5895. pD3DDevice: IDirect3DDevice9;
  5896. pAlloc: ID3DXAllocateHierarchy;
  5897. pUserDataLoader: ID3DXLoadUserData;
  5898. out ppFrameHierarchy: PD3DXFrame;
  5899. out ppAnimController: ID3DXAnimationController): HResult; stdcall; external d3dx9animDLL;
  5900. {$EXTERNALSYM D3DXLoadMeshHierarchyFromXInMemory}
  5901. //----------------------------------------------------------------------------
  5902. // D3DXSaveMeshHierarchyToFile:
  5903. // ---------------------------
  5904. // Creates a .X file and saves the mesh hierarchy and corresponding animations
  5905. // in it
  5906. //
  5907. // Parameters:
  5908. // Filename
  5909. // Name of the .X file
  5910. // XFormat
  5911. // Format of the .X file (text or binary, compressed or not, etc)
  5912. // pFrameRoot
  5913. // Root node of the hierarchy to be saved
  5914. // pAnimController
  5915. // The animation mixer whose animation sets are to be stored
  5916. // pUserDataSaver
  5917. // Application provided interface to allow adding of user data to
  5918. // data objects saved to .X file
  5919. //
  5920. //----------------------------------------------------------------------------
  5921. function D3DXSaveMeshHierarchyToFileA(
  5922. Filename: PAnsiChar;
  5923. XFormat: TDXFileFormat;
  5924. pFrameRoot: PD3DXFrame;
  5925. pAnimMixer: ID3DXAnimationController;
  5926. pUserDataSaver: ID3DXSaveUserData): HResult; stdcall; external d3dx9animDLL name 'D3DXSaveMeshHierarchyToFileA';
  5927. {$EXTERNALSYM D3DXSaveMeshHierarchyToFileA}
  5928. function D3DXSaveMeshHierarchyToFileW(
  5929. Filename: PWideChar;
  5930. XFormat: TDXFileFormat;
  5931. pFrameRoot: PD3DXFrame;
  5932. pAnimMixer: ID3DXAnimationController;
  5933. pUserDataSaver: ID3DXSaveUserData): HResult; stdcall; external d3dx9animDLL name 'D3DXSaveMeshHierarchyToFileW';
  5934. {$EXTERNALSYM D3DXSaveMeshHierarchyToFileW}
  5935. function D3DXSaveMeshHierarchyToFile(
  5936. Filename: PChar;
  5937. XFormat: TDXFileFormat;
  5938. pFrameRoot: PD3DXFrame;
  5939. pAnimMixer: ID3DXAnimationController;
  5940. pUserDataSaver: ID3DXSaveUserData): HResult; stdcall; external d3dx9animDLL name 'D3DXSaveMeshHierarchyToFileA';
  5941. {$EXTERNALSYM D3DXSaveMeshHierarchyToFile}
  5942. //----------------------------------------------------------------------------
  5943. // D3DXFrameDestroy:
  5944. // -----------------
  5945. // Destroys the subtree of frames under the root, including the root
  5946. //
  5947. // Parameters:
  5948. // pFrameRoot
  5949. // Pointer to the root node
  5950. // pAlloc
  5951. // Allocation interface used to de-allocate nodes of the frame hierarchy
  5952. //
  5953. //----------------------------------------------------------------------------
  5954. function D3DXFrameDestroy(
  5955. pFrameRoot: PD3DXFrame;
  5956. pAlloc: ID3DXAllocateHierarchy): HResult; stdcall; external d3dx9animDLL;
  5957. {$EXTERNALSYM D3DXFrameDestroy}
  5958. //----------------------------------------------------------------------------
  5959. // D3DXFrameAppendChild:
  5960. // ---------------------
  5961. // Add a child frame to a frame
  5962. //
  5963. // Parameters:
  5964. // pFrameParent
  5965. // Pointer to the parent node
  5966. // pFrameChild
  5967. // Pointer to the child node
  5968. //
  5969. //----------------------------------------------------------------------------
  5970. function D3DXFrameAppendChild(
  5971. pFrameParent: PD3DXFrame;
  5972. pFrameChild: PD3DXFrame): HResult; stdcall; external d3dx9animDLL;
  5973. {$EXTERNALSYM D3DXFrameAppendChild}
  5974. //----------------------------------------------------------------------------
  5975. // D3DXFrameFind:
  5976. // --------------
  5977. // Finds a frame with the given name. Returns NULL if no frame found.
  5978. //
  5979. // Parameters:
  5980. // pFrameRoot
  5981. // Pointer to the root node
  5982. // Name
  5983. // Name of frame to find
  5984. //
  5985. //----------------------------------------------------------------------------
  5986. function D3DXFrameFind(
  5987. pFrameRoot: PD3DXFrame;
  5988. Name: PAnsiChar): HResult; stdcall; external d3dx9animDLL;
  5989. {$EXTERNALSYM D3DXFrameFind}
  5990. //----------------------------------------------------------------------------
  5991. // D3DXFrameRegisterNamedMatrices:
  5992. // --------------------------
  5993. // Finds all frames that have non-null names and registers each of those frame
  5994. // matrices to the given animation mixer
  5995. //
  5996. // Parameters:
  5997. // pFrameRoot
  5998. // Pointer to the root node
  5999. // pAnimMixer
  6000. // Pointer to the animation mixer where the matrices are registered
  6001. //
  6002. //----------------------------------------------------------------------------
  6003. function D3DXFrameRegisterNamedMatrices(
  6004. pFrameRoot: PD3DXFrame;
  6005. pAnimMixer: ID3DXAnimationController): HResult; stdcall; external d3dx9animDLL;
  6006. {$EXTERNALSYM D3DXFrameRegisterNamedMatrices}
  6007. //----------------------------------------------------------------------------
  6008. // D3DXFrameNumNamedMatrices:
  6009. // --------------------------
  6010. // Counts number of frames in a subtree that have non-null names
  6011. //
  6012. // Parameters:
  6013. // pFrameRoot
  6014. // Pointer to the root node of the subtree
  6015. // Return Value:
  6016. // Count of frames
  6017. //
  6018. //----------------------------------------------------------------------------
  6019. function D3DXFrameNumNamedMatrices(
  6020. pFrameRoot: PD3DXFrame): HResult; stdcall; external d3dx9animDLL;
  6021. {$EXTERNALSYM D3DXFrameNumNamedMatrices}
  6022. //----------------------------------------------------------------------------
  6023. // D3DXFrameCalculateBoundingSphere:
  6024. // ---------------------------------
  6025. // Computes the bounding sphere of all the meshes in the frame hierarchy
  6026. //
  6027. // Parameters:
  6028. // pFrameRoot
  6029. // Pointer to the root node
  6030. // pObjectCenter
  6031. // Returns the center of the bounding sphere
  6032. // pObjectRadius
  6033. // Returns the radius of the bounding sphere
  6034. //
  6035. //----------------------------------------------------------------------------
  6036. function D3DXFrameCalculateBoundingSphere(
  6037. pFrameRoot: PD3DXFrame;
  6038. out pObjectCenter: TD3DXVector3;
  6039. out pObjectRadius: Single): HResult; stdcall; external d3dx9animDLL;
  6040. {$EXTERNALSYM D3DXFrameCalculateBoundingSphere}
  6041. //----------------------------------------------------------------------------
  6042. // D3DXCreateKeyFrameInterpolator:
  6043. // -------------------------------
  6044. // Creates a SRT key frame interpolator object from the given set of keys
  6045. //
  6046. // Parameters:
  6047. // ScaleKeys
  6048. // Array of scale key vectors
  6049. // NumScaleKeys
  6050. // Num elements in ScaleKeys array
  6051. // RotationKeys
  6052. // Array of rotation key quternions
  6053. // NumRotationKeys
  6054. // Num elements in RotationKeys array
  6055. // TranslateKeys
  6056. // Array of translation key vectors
  6057. // NumTranslateKeys
  6058. // Num elements in TranslateKeys array
  6059. // ScaleInputTimeBy
  6060. // All key times are scaled by this factor
  6061. // ppNewInterpolator
  6062. // Returns the keyframe interpolator interface
  6063. //
  6064. //----------------------------------------------------------------------------
  6065. function D3DXCreateKeyFrameInterpolator(Name: PAnsiChar;
  6066. ScaleKeys: PD3DXKeyVector3; NumScaleKeys: LongWord;
  6067. RotationKeys: PD3DXKeyQuaternion; NumRotationKeys: LongWord;
  6068. TranslateKeys: PD3DXKeyVector3; NumTranslateKeys: LongWord;
  6069. ScaleInputTimeBy: Double; out ppNewInterpolator: ID3DXKeyFrameInterpolator): HResult; stdcall; external d3dx9animDLL;
  6070. {$EXTERNALSYM D3DXCreateKeyFrameInterpolator}
  6071. //----------------------------------------------------------------------------
  6072. // D3DXCreateAnimationSet:
  6073. // -----------------------
  6074. // Creates an animtions set interface given a set of interpolators
  6075. //
  6076. // Parameters:
  6077. // Name
  6078. // Name of the animation set
  6079. // pInterpolators
  6080. // Array of interpolators
  6081. // NumInterpolators
  6082. // Num elements in the pInterpolators array
  6083. // ppAnimSet
  6084. // Returns the animation set interface
  6085. //
  6086. //-----------------------------------------------------------------------------
  6087. function D3DXCreateAnimationSet(Name: PAnsiChar;
  6088. ppInterpolators: PID3DXInterpolator; NumInterpolators: LongWord;
  6089. out ppAnimSet: ID3DXAnimationSet): HResult; stdcall; external d3dx9animDLL;
  6090. {$EXTERNALSYM D3DXCreateAnimationSet}
  6091. //----------------------------------------------------------------------------
  6092. // D3DXCreateAnimationController:
  6093. // -------------------------
  6094. // Creates an animtion mixer object
  6095. //
  6096. // Parameters:
  6097. // MaxNumMatrices
  6098. // The upper limit for the number of matrices that can be animated by the
  6099. // the object
  6100. // MaxNumAnimationSets
  6101. // The upper limit of the number of animation sets that can be played by
  6102. // the object
  6103. // MaxNumTracks
  6104. // The upper limit of the number of animation sets that can be blended at
  6105. // any time.
  6106. // MaxNumEvents
  6107. // The upper limit of the number of outstanding events that can be
  6108. // scheduled at once.
  6109. // ppAnimController
  6110. // Returns the animation controller interface
  6111. //
  6112. //-----------------------------------------------------------------------------
  6113. function D3DXCreateAnimationController(
  6114. MaxNumMatrices, MaxNumAnimationSets, MaxNumTracks, MaxNumEvents: LongWord;
  6115. out ppAnimController: ID3DXAnimationController): HResult; stdcall; external d3dx9animDLL;
  6116. {$EXTERNALSYM D3DXCreateAnimationController}
  6117. (*$HPPEMIT '} /* namespace D3dx9 */' *)
  6118. //***************************************************************************//
  6119. //***************************************************************************//
  6120. //***************************************************************************//
  6121. implementation
  6122. //***************************************************************************//
  6123. //***************************************************************************//
  6124. //***************************************************************************//
  6125. //////////////////////////////////////////////////////////////////////////////
  6126. //
  6127. // Copyright (C) Microsoft Corporation. All Rights Reserved.
  6128. //
  6129. // File: d3dx8math.h
  6130. // Content: D3DX math types and functions
  6131. //
  6132. //////////////////////////////////////////////////////////////////////////////
  6133. //===========================================================================
  6134. //
  6135. // General purpose utilities
  6136. //
  6137. //===========================================================================
  6138. function D3DXToRadian(Degree: Single): Single;
  6139. begin
  6140. Result:= Degree * (D3DX_PI / 180.0);
  6141. end;
  6142. function D3DXToDegree(Radian: Single): Single;
  6143. begin
  6144. Result:= Radian * (180.0 / D3DX_PI);
  6145. end;
  6146. //===========================================================================
  6147. //
  6148. // 16 bit floating point numbers
  6149. //
  6150. //===========================================================================
  6151. function D3DXFloat16(value: Single): TD3DXFloat16;
  6152. begin
  6153. D3DXFloat32To16Array(@Result, @value, 1);
  6154. end;
  6155. function D3DXFloat16Equal(const v1, v2: TD3DXFloat16): Boolean;
  6156. begin
  6157. Result:= (v1.value = v2.value);
  6158. end;
  6159. function D3DXFloat16ToFloat(value: TD3DXFloat16): Single;
  6160. begin
  6161. D3DXFloat16To32Array(@Result, @value, 1);
  6162. end;
  6163. //===========================================================================
  6164. //
  6165. // Vectors
  6166. //
  6167. //===========================================================================
  6168. //--------------------------
  6169. // 2D Vector
  6170. //--------------------------
  6171. function D3DXVector2(_x, _y: Single): TD3DXVector2;
  6172. begin
  6173. Result.x:= _x; Result.y:= _y;
  6174. end;
  6175. function D3DXVector2Equal(const v1, v2: TD3DXVector2): Boolean;
  6176. begin
  6177. Result:= (v1.x = v2.x) and (v1.y = v2.y);
  6178. end;
  6179. //--------------------------
  6180. // 2D Vector (16 bit)
  6181. //--------------------------
  6182. function D3DXVector2_16F(_x, _y: TD3DXFloat16): TD3DXVector2_16F;
  6183. begin
  6184. with Result do
  6185. begin
  6186. x:= _x;
  6187. y:= _y;
  6188. end;
  6189. end;
  6190. function D3DXVector2_16fEqual(const v1, v2: TD3DXVector2_16F): Boolean;
  6191. begin
  6192. Result:= (DWORD(v1) = DWORD(v2));
  6193. end;
  6194. function D3DXVector2_16fFromVector2(const v: TD3DXVector2): TD3DXVector2_16f;
  6195. begin
  6196. D3DXFloat32To16Array(@Result.x, @v.x, 2);
  6197. end;
  6198. function D3DXVector2FromVector2_16f(const v: TD3DXVector2_16f): TD3DXVector2;
  6199. begin
  6200. D3DXFloat16To32Array(@Result.x, @v.x, 2);
  6201. end;
  6202. //--------------------------
  6203. // 3D Vector
  6204. //--------------------------
  6205. function D3DXVector3(_x, _y, _z: Single): TD3DXVector3;
  6206. begin
  6207. with Result do
  6208. begin
  6209. x:= _x; y:= _y; z:=_z;
  6210. end;
  6211. end;
  6212. function D3DXVector3Equal(const v1, v2: TD3DXVector3): Boolean;
  6213. begin
  6214. Result:= (v1.x = v2.x) and (v1.y = v2.y) and (v1.z = v2.z);
  6215. end;
  6216. //--------------------------
  6217. // 3D Vector (16 bit)
  6218. //--------------------------
  6219. function D3DXVector3_16F(_x, _y, _z: TD3DXFloat16): TD3DXVector3_16F;
  6220. begin
  6221. with Result do
  6222. begin
  6223. x:= _x; y:= _y; z:= _z;
  6224. end;
  6225. end;
  6226. function D3DXVector3_16fEqual(const v1, v2: TD3DXVector3_16F): Boolean;
  6227. begin
  6228. Result:= (PDWORD(@v1.x)^ = PDWORD(@v2.x)^) and
  6229. (Word (v1.z) = Word (v2.z));
  6230. end;
  6231. function D3DXVector3_16fFromVector3(const v: TD3DXVector3): TD3DXVector3_16f;
  6232. begin
  6233. D3DXFloat32To16Array(@Result.x, @v.x, 3);
  6234. end;
  6235. function D3DXVector3FromVector3_16f(const v: TD3DXVector3_16f): TD3DXVector3;
  6236. begin
  6237. D3DXFloat16To32Array(@Result.x, @v.x, 3);
  6238. end;
  6239. //--------------------------
  6240. // 4D Vector
  6241. //--------------------------
  6242. function D3DXVector4(_x, _y, _z, _w: Single): TD3DXVector4;
  6243. begin
  6244. with Result do
  6245. begin
  6246. x:= _x; y:= _y; z:= _z; w:= _w;
  6247. end;
  6248. end;
  6249. function D3DXVector4Equal(const v1, v2: TD3DXVector4): Boolean;
  6250. begin
  6251. Result:= (v1.x = v2.x) and (v1.y = v2.y) and
  6252. (v1.z = v2.z) and (v1.w = v2.w);
  6253. end;
  6254. //--------------------------
  6255. // 4D Vector (16 bit)
  6256. //--------------------------
  6257. function D3DXVector4_16F(_x, _y, _z, _w: TD3DXFloat16): TD3DXVector4_16F;
  6258. begin
  6259. with Result do
  6260. begin
  6261. x:= _x; y:= _y; z:= _z; w:= _w;
  6262. end;
  6263. end;
  6264. function D3DXVector4_16fEqual(const v1, v2: TD3DXVector4_16F): Boolean;
  6265. begin
  6266. Result:= (PDWORD(@v1.x)^ = PDWORD(@v2.x)^) and
  6267. (PDWORD(@v1.z)^ = PDWORD(@v2.z)^);
  6268. end;
  6269. function D3DXVector4_16fFromVector4(const v: TD3DXVector4): TD3DXVector4_16f;
  6270. begin
  6271. D3DXFloat32To16Array(@Result.x, @v.x, 4);
  6272. end;
  6273. function D3DXVector4FromVector4_16f(const v: TD3DXVector4_16f): TD3DXVector4;
  6274. begin
  6275. D3DXFloat16To32Array(@Result.x, @v.x, 4);
  6276. end;
  6277. //--------------------------
  6278. // 4D Matrix
  6279. //--------------------------
  6280. function D3DXMatrix(
  6281. _m00, _m01, _m02, _m03,
  6282. _m10, _m11, _m12, _m13,
  6283. _m20, _m21, _m22, _m23,
  6284. _m30, _m31, _m32, _m33: Single): TD3DXMatrix;
  6285. begin
  6286. with Result do
  6287. begin
  6288. m[0,0]:= _m00; m[0,1]:= _m01; m[0,2]:= _m02; m[0,3]:= _m03;
  6289. m[1,0]:= _m10; m[1,1]:= _m11; m[1,2]:= _m12; m[1,3]:= _m13;
  6290. m[2,0]:= _m20; m[2,1]:= _m21; m[2,2]:= _m22; m[2,3]:= _m23;
  6291. m[3,0]:= _m30; m[3,1]:= _m31; m[3,2]:= _m32; m[3,3]:= _m33;
  6292. end;
  6293. end;
  6294. function D3DXMatrixAdd(out mOut: TD3DXMatrix; const m1, m2: TD3DXMatrix): PD3DXMatrix;
  6295. var
  6296. pOut, p1, p2: PSingle; x: Integer;
  6297. begin
  6298. pOut:= @mOut._11; p1:= @m1._11; p2:= @m2._11;
  6299. for x:= 0 to 15 do
  6300. begin
  6301. pOut^:= p1^+p2^;
  6302. Inc(pOut); Inc(p1); Inc(p2);
  6303. end;
  6304. Result:= @mOut;
  6305. end;
  6306. function D3DXMatrixSubtract(out mOut: TD3DXMatrix; const m1, m2: TD3DXMatrix): PD3DXMatrix;
  6307. var
  6308. pOut, p1, p2: PSingle; x: Integer;
  6309. begin
  6310. pOut:= @mOut._11; p1:= @m1._11; p2:= @m2._11;
  6311. for x:= 0 to 15 do
  6312. begin
  6313. pOut^:= p1^-p2^;
  6314. Inc(pOut); Inc(p1); Inc(p2);
  6315. end;
  6316. Result:= @mOut;
  6317. end;
  6318. function D3DXMatrixMul(out mOut: TD3DXMatrix; const m: TD3DXMatrix; MulBy: Single): PD3DXMatrix;
  6319. var
  6320. pOut, p: PSingle; x: Integer;
  6321. begin
  6322. pOut:= @mOut._11; p:= @m._11;
  6323. for x:= 0 to 15 do
  6324. begin
  6325. pOut^:= p^* MulBy;
  6326. Inc(pOut); Inc(p);
  6327. end;
  6328. Result:= @mOut;
  6329. end;
  6330. function D3DXMatrixEqual(const m1, m2: TD3DXMatrix): Boolean;
  6331. begin
  6332. Result:= CompareMem(@m1, @m2, SizeOf(TD3DXMatrix));
  6333. end;
  6334. //--------------------------
  6335. // Quaternion
  6336. //--------------------------
  6337. function D3DXQuaternion(_x, _y, _z, _w: Single): TD3DXQuaternion;
  6338. begin
  6339. with Result do
  6340. begin
  6341. x:= _x; y:= _y; z:= _z; w:= _w;
  6342. end;
  6343. end;
  6344. function D3DXQuaternionAdd(const q1, q2: TD3DXQuaternion): TD3DXQuaternion;
  6345. begin
  6346. with Result do
  6347. begin
  6348. x:= q1.x+q2.x; y:= q1.y+q2.y; z:= q1.z+q2.z; w:= q1.w+q2.w;
  6349. end;
  6350. end;
  6351. function D3DXQuaternionSubtract(const q1, q2: TD3DXQuaternion): TD3DXQuaternion;
  6352. begin
  6353. with Result do
  6354. begin
  6355. x:= q1.x-q2.x; y:= q1.y-q2.y; z:= q1.z-q2.z; w:= q1.w-q2.w;
  6356. end;
  6357. end;
  6358. function D3DXQuaternionEqual(const q1, q2: TD3DXQuaternion): Boolean;
  6359. begin
  6360. Result:= (q1.x = q2.x) and (q1.y = q2.y) and
  6361. (q1.z = q2.z) and (q1.w = q2.w);
  6362. end;
  6363. function D3DXQuaternionScale(out qOut: TD3DXQuaternion; const q: TD3DXQuaternion;
  6364. s: Single): PD3DXQuaternion;
  6365. begin
  6366. with qOut do
  6367. begin
  6368. x:= q.x*s; y:= q.y*s; z:= q.z*s; w:= q.w*s;
  6369. end;
  6370. Result:= @qOut;
  6371. end;
  6372. //--------------------------
  6373. // Plane
  6374. //--------------------------
  6375. function D3DXPlane(_a, _b, _c, _d: Single): TD3DXPlane;
  6376. begin
  6377. with Result do
  6378. begin
  6379. a:= _a; b:= _b; c:= _c; d:= _d;
  6380. end;
  6381. end;
  6382. function D3DXPlaneEqual(const p1, p2: TD3DXPlane): Boolean;
  6383. begin
  6384. Result:=
  6385. (p1.a = p2.a) and (p1.b = p2.b) and
  6386. (p1.c = p2.c) and (p1.d = p2.d);
  6387. end;
  6388. //--------------------------
  6389. // Color
  6390. //--------------------------
  6391. function D3DXColor(_r, _g, _b, _a: Single): TD3DXColor;
  6392. begin
  6393. with Result do
  6394. begin
  6395. r:= _r; g:= _g; b:= _b; a:= _a;
  6396. end;
  6397. end;
  6398. function D3DXColorToDWord(c: TD3DXColor): DWord;
  6399. function ColorLimit(const x: Single): DWord;
  6400. begin
  6401. if x > 1.0 then Result:= 255
  6402. else if x < 0 then Result:= 0
  6403. else Result:= Trunc(x * 255.0 + 0.5);
  6404. end;
  6405. begin
  6406. Result:= ColorLimit(c.a) shl 24 or ColorLimit(c.r) shl 16
  6407. or ColorLimit(c.g) shl 8 or ColorLimit(c.b);
  6408. end;
  6409. function D3DXColorFromDWord(c: DWord): TD3DXColor;
  6410. const
  6411. f: Single = 1/255;
  6412. begin
  6413. with Result do
  6414. begin
  6415. r:= f * Byte(c shr 16);
  6416. g:= f * Byte(c shr 8);
  6417. b:= f * Byte(c shr 0);
  6418. a:= f * Byte(c shr 24);
  6419. end;
  6420. end;
  6421. function D3DXColorEqual(const c1, c2: TD3DXColor): Boolean;
  6422. begin
  6423. Result:= (c1.r = c2.r) and (c1.g = c2.g) and (c1.b = c2.b) and (c1.a = c2.a);
  6424. end;
  6425. //===========================================================================
  6426. //
  6427. // D3DX math functions:
  6428. //
  6429. // NOTE:
  6430. // * All these functions can take the same object as in and out parameters.
  6431. //
  6432. // * Out parameters are typically also returned as return values, so that
  6433. // the output of one function may be used as a parameter to another.
  6434. //
  6435. //===========================================================================
  6436. //--------------------------
  6437. // 2D Vector
  6438. //--------------------------
  6439. // "inline"
  6440. function D3DXVec2Length(const v: TD3DXVector2): Single;
  6441. begin
  6442. with v do Result:= Sqrt(x*x + y*y);
  6443. end;
  6444. function D3DXVec2LengthSq(const v: TD3DXVector2): Single;
  6445. begin
  6446. with v do Result:= x*x + y*y;
  6447. end;
  6448. function D3DXVec2Dot(const v1, v2: TD3DXVector2): Single;
  6449. begin
  6450. Result:= v1.x*v2.x + v1.y*v2.y;
  6451. end;
  6452. // Z component of ((x1,y1,0) cross (x2,y2,0))
  6453. function D3DXVec2CCW(const v1, v2: TD3DXVector2): Single;
  6454. begin
  6455. Result:= v1.x*v2.y - v1.y*v2.x;
  6456. end;
  6457. function D3DXVec2Add(const v1, v2: TD3DXVector2): TD3DXVector2;
  6458. begin
  6459. Result.x:= v1.x + v2.x;
  6460. Result.y:= v1.y + v2.y;
  6461. end;
  6462. function D3DXVec2Subtract(const v1, v2: TD3DXVector2): TD3DXVector2;
  6463. begin
  6464. Result.x:= v1.x - v2.x;
  6465. Result.y:= v1.y - v2.y;
  6466. end;
  6467. // Minimize each component. x = min(x1, x2), y = min(y1, y2)
  6468. function D3DXVec2Minimize(out vOut: TD3DXVector2; const v1, v2: TD3DXVEctor2): PD3DXVector2;
  6469. begin
  6470. if v1.x < v2.x then vOut.x:= v1.x else vOut.y:= v2.x;
  6471. if v1.y < v2.y then vOut.y:= v1.y else vOut.y:= v2.y;
  6472. Result:= @vOut;
  6473. end;
  6474. // Maximize each component. x = max(x1, x2), y = max(y1, y2)
  6475. function D3DXVec2Maximize(out vOut: TD3DXVector2; const v1, v2: TD3DXVector2): PD3DXVector2;
  6476. begin
  6477. if v1.x > v2.x then vOut.x:= v1.x else vOut.y:= v2.x;
  6478. if v1.y > v2.y then vOut.y:= v1.y else vOut.y:= v2.y;
  6479. Result:= @vOut;
  6480. end;
  6481. function D3DXVec2Scale(out vOut: TD3DXVector2; const v: TD3DXVector2; s: Single): PD3DXVector2;
  6482. begin
  6483. vOut.x:= v.x*s; vOut.y:= v.y*s;
  6484. Result:= @vOut;
  6485. end;
  6486. // Linear interpolation. V1 + s(V2-V1)
  6487. function D3DXVec2Lerp(out vOut: TD3DXVector2; const v1, v2: TD3DXVector2; s: Single): PD3DXVector2;
  6488. begin
  6489. vOut.x:= v1.x + s * (v2.x-v1.x);
  6490. vOut.y:= v1.y + s * (v2.y-v1.y);
  6491. Result:= @vOut;
  6492. end;
  6493. //--------------------------
  6494. // 3D Vector
  6495. //--------------------------
  6496. function D3DXVec3Length(const v: TD3DXVector3): Single;
  6497. begin
  6498. with v do Result:= Sqrt(x*x + y*y + z*z);
  6499. end;
  6500. function D3DXVec3LengthSq(const v: TD3DXVector3): Single;
  6501. begin
  6502. with v do Result:= x*x + y*y + z*z;
  6503. end;
  6504. function D3DXVec3Dot(const v1, v2: TD3DXVector3): Single;
  6505. begin
  6506. Result:= v1.x * v2.x + v1.y * v2.y + v1.z * v2.z;
  6507. end;
  6508. function D3DXVec3Cross(out vOut: TD3DXVector3; const v1, v2: TD3DXVector3): PD3DXVector3;
  6509. begin
  6510. vOut.x:= v1.y * v2.z - v1.z * v2.y;
  6511. vOut.y:= v1.z * v2.x - v1.x * v2.z;
  6512. vOut.z:= v1.x * v2.y - v1.y * v2.x;
  6513. Result:= @vOut;
  6514. end;
  6515. function D3DXVec3Add(out vOut: TD3DXVector3; const v1, v2: TD3DXVector3): PD3DXVector3;
  6516. begin
  6517. with vOut do
  6518. begin
  6519. x:= v1.x + v2.x;
  6520. y:= v1.y + v2.y;
  6521. z:= v1.z + v2.z;
  6522. end;
  6523. Result:= @vOut;
  6524. end;
  6525. function D3DXVec3Subtract(out vOut: TD3DXVector3; const v1, v2: TD3DXVector3): PD3DXVector3;
  6526. begin
  6527. with vOut do
  6528. begin
  6529. x:= v1.x - v2.x;
  6530. y:= v1.y - v2.y;
  6531. z:= v1.z - v2.z;
  6532. end;
  6533. Result:= @vOut;
  6534. end;
  6535. // Minimize each component. x = min(x1, x2), y = min(y1, y2)
  6536. function D3DXVec3Minimize(out vOut: TD3DXVector3; const v1, v2: TD3DXVector3): PD3DXVector3;
  6537. begin
  6538. if v1.x < v2.x then vOut.x:= v1.x else vOut.x:= v2.x;
  6539. if v1.y < v2.y then vOut.y:= v1.y else vOut.y:= v2.y;
  6540. if v1.z < v2.z then vOut.z:= v1.z else vOut.z:= v2.z;
  6541. Result:= @vOut;
  6542. end;
  6543. // Maximize each component. x = max(x1, x2), y = max(y1, y2)
  6544. function D3DXVec3Maximize(out vOut: TD3DXVector3; const v1, v2: TD3DXVector3): PD3DXVector3;
  6545. begin
  6546. if v1.x > v2.x then vOut.x:= v1.x else vOut.x:= v2.x;
  6547. if v1.y > v2.y then vOut.y:= v1.y else vOut.y:= v2.y;
  6548. if v1.z > v2.z then vOut.z:= v1.z else vOut.z:= v2.z;
  6549. Result:= @vOut;
  6550. end;
  6551. function D3DXVec3Scale(out vOut: TD3DXVector3; const v: TD3DXVector3; s: Single): PD3DXVector3;
  6552. begin
  6553. with vOut do
  6554. begin
  6555. x:= v.x * s; y:= v.y * s; z:= v.z * s;
  6556. end;
  6557. Result:= @vOut;
  6558. end;
  6559. // Linear interpolation. V1 + s(V2-V1)
  6560. function D3DXVec3Lerp(out vOut: TD3DXVector3; const v1, v2: TD3DXVector3; s: Single): PD3DXVector3;
  6561. begin
  6562. vOut.x:= v1.x + s * (v2.x-v1.x);
  6563. vOut.y:= v1.y + s * (v2.y-v1.y);
  6564. vOut.z:= v1.z + s * (v2.z-v1.z);
  6565. Result:= @vOut;
  6566. end;
  6567. //--------------------------
  6568. // 4D Vector
  6569. //--------------------------
  6570. function D3DXVec4Length(const v: TD3DXVector4): Single;
  6571. begin
  6572. with v do Result:= Sqrt(x*x + y*y + z*z + w*w);
  6573. end;
  6574. function D3DXVec4LengthSq(const v: TD3DXVector4): Single;
  6575. begin
  6576. with v do Result:= x*x + y*y + z*z + w*w
  6577. end;
  6578. function D3DXVec4Dot(const v1, v2: TD3DXVector4): Single;
  6579. begin
  6580. Result:= v1.x * v2.x + v1.y * v2.y + v1.z * v2.z + v1.w * v2.w;
  6581. end;
  6582. function D3DXVec4Add(out vOut: TD3DXVector4; const v1, v2: TD3DXVector4): PD3DXVector4;
  6583. begin
  6584. with vOut do
  6585. begin
  6586. x:= v1.x + v2.x;
  6587. y:= v1.y + v2.y;
  6588. z:= v1.z + v2.z;
  6589. w:= v1.w + v2.w;
  6590. end;
  6591. Result:= @vOut;
  6592. end;
  6593. function D3DXVec4Subtract(out vOut: TD3DXVector4; const v1, v2: TD3DXVector4): PD3DXVector4;
  6594. begin
  6595. with vOut do
  6596. begin
  6597. x:= v1.x - v2.x;
  6598. y:= v1.y - v2.y;
  6599. z:= v1.z - v2.z;
  6600. w:= v1.w - v2.w;
  6601. end;
  6602. Result:= @vOut;
  6603. end;
  6604. // Minimize each component. x = min(x1, x2), y = min(y1, y2)
  6605. function D3DXVec4Minimize(out vOut: TD3DXVector4; const v1, v2: TD3DXVector4): PD3DXVector4;
  6606. begin
  6607. if v1.x < v2.x then vOut.x:= v1.x else vOut.x:= v2.x;
  6608. if v1.y < v2.y then vOut.y:= v1.y else vOut.y:= v2.y;
  6609. if v1.z < v2.z then vOut.z:= v1.z else vOut.z:= v2.z;
  6610. if v1.w < v2.w then vOut.w:= v1.w else vOut.w:= v2.w;
  6611. Result:= @vOut;
  6612. end;
  6613. // Maximize each component. x = max(x1, x2), y = max(y1, y2)
  6614. function D3DXVec4Maximize(out vOut: TD3DXVector4; const v1, v2: TD3DXVector4): PD3DXVector4;
  6615. begin
  6616. if v1.x > v2.x then vOut.x:= v1.x else vOut.x:= v2.x;
  6617. if v1.y > v2.y then vOut.y:= v1.y else vOut.y:= v2.y;
  6618. if v1.z > v2.z then vOut.z:= v1.z else vOut.z:= v2.z;
  6619. if v1.w > v2.w then vOut.w:= v1.w else vOut.w:= v2.w;
  6620. Result:= @vOut;
  6621. end;
  6622. function D3DXVec4Scale(out vOut: TD3DXVector4; const v: TD3DXVector4; s: Single): PD3DXVector4;
  6623. begin
  6624. with vOut do
  6625. begin
  6626. x:= v.x * s; y:= v.y * s; z:= v.z * s; w:= v.w * s;
  6627. end;
  6628. Result:= @vOut;
  6629. end;
  6630. // Linear interpolation. V1 + s(V2-V1)
  6631. function D3DXVec4Lerp(out vOut: TD3DXVector4;
  6632. const v1, v2: TD3DXVector4; s: Single): PD3DXVector4;
  6633. begin
  6634. with vOut do
  6635. begin
  6636. x:= v1.x + s * (v2.x - v1.x);
  6637. y:= v1.y + s * (v2.y - v1.y);
  6638. z:= v1.z + s * (v2.z - v1.z);
  6639. w:= v1.w + s * (v2.w - v1.w);
  6640. end;
  6641. Result:= @vOut;
  6642. end;
  6643. //--------------------------
  6644. // 4D Matrix
  6645. //--------------------------
  6646. // inline
  6647. function D3DXMatrixIdentity(out mOut: TD3DXMatrix): PD3DXMatrix;
  6648. begin
  6649. FillChar(mOut, SizeOf(mOut), 0);
  6650. mOut._11:= 1; mOut._22:= 1; mOut._33:= 1; mOut._44:= 1;
  6651. Result:= @mOut;
  6652. end;
  6653. function D3DXMatrixIsIdentity(const m: TD3DXMatrix): BOOL;
  6654. begin
  6655. with m do Result:=
  6656. (_11 = 1) and (_12 = 0) and (_13 = 0) and (_14 = 0) and
  6657. (_21 = 0) and (_22 = 1) and (_23 = 0) and (_24 = 0) and
  6658. (_31 = 0) and (_32 = 0) and (_33 = 1) and (_34 = 0) and
  6659. (_41 = 0) and (_42 = 0) and (_43 = 0) and (_44 = 1);
  6660. end;
  6661. //--------------------------
  6662. // Quaternion
  6663. //--------------------------
  6664. // inline
  6665. function D3DXQuaternionLength(const q: TD3DXQuaternion): Single;
  6666. begin
  6667. with q do Result:= Sqrt(x*x + y*y + z*z + w*w);
  6668. end;
  6669. // Length squared, or "norm"
  6670. function D3DXQuaternionLengthSq(const q: TD3DXQuaternion): Single;
  6671. begin
  6672. with q do Result:= x*x + y*y + z*z + w*w;
  6673. end;
  6674. function D3DXQuaternionDot(const q1, q2: TD3DXQuaternion): Single;
  6675. begin
  6676. Result:= q1.x * q2.x + q1.y * q2.y + q1.z * q2.z + q1.w * q2.w;
  6677. end;
  6678. function D3DXQuaternionIdentity(out qOut: TD3DXQuaternion): PD3DXQuaternion;
  6679. begin
  6680. with qOut do
  6681. begin
  6682. x:= 0; y:= 0; z:= 0; w:= 1.0;
  6683. end;
  6684. Result:= @qOut;
  6685. end;
  6686. function D3DXQuaternionIsIdentity(const q: TD3DXQuaternion): BOOL;
  6687. begin
  6688. with q do Result:= (x = 0) and (y = 0) and (z = 0) and (w = 1);
  6689. end;
  6690. // (-x, -y, -z, w)
  6691. function D3DXQuaternionConjugate(out qOut: TD3DXQuaternion;
  6692. const q: TD3DXQuaternion): PD3DXQuaternion;
  6693. begin
  6694. with qOut do
  6695. begin
  6696. x:= -q.x; y:= -q.y; z:= -q.z; w:= q.w;
  6697. end;
  6698. Result:= @qOut;
  6699. end;
  6700. //--------------------------
  6701. // Plane
  6702. //--------------------------
  6703. // ax + by + cz + dw
  6704. function D3DXPlaneDot(const p: TD3DXPlane; const v: TD3DXVector4): Single;
  6705. begin
  6706. with p,v do Result:= a*x + b*y + c*z + d*w;
  6707. end;
  6708. // ax + by + cz + d
  6709. function D3DXPlaneDotCoord(const p: TD3DXPlane; const v: TD3DXVector3): Single;
  6710. begin
  6711. with p,v do Result:= a*x + b*y + c*z + d;
  6712. end;
  6713. // ax + by + cz
  6714. function D3DXPlaneDotNormal(const p: TD3DXPlane; const v: TD3DXVector3): Single;
  6715. begin
  6716. with p,v do Result:= a*x + b*y + c*z;
  6717. end;
  6718. //--------------------------
  6719. // Color
  6720. //--------------------------
  6721. // inline
  6722. function D3DXColorNegative(out cOut: TD3DXColor; const c: TD3DXColor): PD3DXColor;
  6723. begin
  6724. with cOut do
  6725. begin
  6726. r:= 1.0 - c.r; g:= 1.0 - c.g; b:= 1.0 - c.b;
  6727. a:= c.a;
  6728. end;
  6729. Result:= @cOut;
  6730. end;
  6731. function D3DXColorAdd(out cOut: TD3DXColor; const c1,c2: TD3DXColor): PD3DXColor;
  6732. begin
  6733. with cOut do
  6734. begin
  6735. r:= c1.r + c2.r; g:= c1.g + c2.g; b:= c1.b + c2.b;
  6736. a:= c1.a + c2.a;
  6737. end;
  6738. Result:= @cOut;
  6739. end;
  6740. function D3DXColorSubtract(out cOut: TD3DXColor; const c1,c2: TD3DXColor): PD3DXColor;
  6741. begin
  6742. with cOut do
  6743. begin
  6744. r:= c1.r - c2.r; g:= c1.g - c2.g; b:= c1.b - c2.b;
  6745. a:= c1.a - c2.a;
  6746. end;
  6747. Result:= @cOut;
  6748. end;
  6749. function D3DXColorScale(out cOut: TD3DXColor; const c: TD3DXColor; s: Single): PD3DXColor;
  6750. begin
  6751. with cOut do
  6752. begin
  6753. r:= c.r * s; g:= c.g * s;
  6754. b:= c.b * s; a:= c.a * s;
  6755. end;
  6756. Result:= @cOut;
  6757. end;
  6758. // (r1*r2, g1*g2, b1*b2, a1*a2)
  6759. function D3DXColorModulate(out cOut: TD3DXColor; const c1,c2: TD3DXColor): PD3DXColor;
  6760. begin
  6761. with cOut do
  6762. begin
  6763. r:= c1.r * c2.r; g:= c1.g * c2.g;
  6764. b:= c1.b * c2.b; a:= c1.a * c2.a;
  6765. end;
  6766. Result:= @cOut;
  6767. end;
  6768. // Linear interpolation of r,g,b, and a. C1 + s(C2-C1)
  6769. function D3DXColorLerp(out cOut: TD3DXColor; const c1,c2: TD3DXColor; s: Single): PD3DXColor;
  6770. begin
  6771. with cOut do
  6772. begin
  6773. r:= c1.r + s * (c2.r - c1.r);
  6774. g:= c1.g + s * (c2.g - c1.g);
  6775. b:= c1.b + s * (c2.b - c1.b);
  6776. a:= c1.a + s * (c2.a - c1.a);
  6777. end;
  6778. Result:= @cOut;
  6779. end;
  6780. //////////////////////////////////////////////////////////////////////////////
  6781. //
  6782. // Copyright (c) Microsoft Corporation. All rights reserved.
  6783. //
  6784. // File: d3dx9shader.h
  6785. // Content: D3DX Shader APIs
  6786. //
  6787. //////////////////////////////////////////////////////////////////////////////
  6788. //---------------------------------------------------------------------------
  6789. // D3DXTX_VERSION:
  6790. // --------------
  6791. // Version token used to create a procedural texture filler in effects
  6792. // Used by D3DXFill[]TX functions
  6793. //---------------------------------------------------------------------------
  6794. // #define D3DXTX_VERSION(_Major,_Minor) (('T' << 24) | ('X' << 16) | ((_Major) << 8) | (_Minor))
  6795. function D3DXTX_VERSION(_Major, _Minor: Byte): DWORD;
  6796. begin
  6797. Result := (Ord('T') shl 24) or (Ord('X') shl 16) or (_Major shl 8) or (_Minor);
  6798. end;
  6799. end.