| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955 |
- /*******************************************************************************
- Copyright © 2015-2022 PICO Technology Co., Ltd.All rights reserved.
- NOTICE:All information contained herein is, and remains the property of
- PICO Technology Co., Ltd. The intellectual and technical concepts
- contained herein are proprietary to PICO Technology Co., Ltd. and may be
- covered by patents, patents in process, and are protected by trade secret or
- copyright law. Dissemination of this information or reproduction of this
- material is strictly forbidden unless prior written permission is obtained from
- PICO Technology Co., Ltd.
- *******************************************************************************/
- using System.ComponentModel;
- using System.Drawing;
- using System;
- using System.Collections.Generic;
- using System.Runtime.InteropServices;
- using UnityEngine;
- namespace Unity.XR.PXR
- {
- //MR
- #region MR
- #region new mr
- public struct PxrAnchorEntityCreateInfo
- {
- public PxrTrackingOrigin origin;
- public PxrPosef pose;
- public double time;
- }
- public struct PxrAnchorEntityDestroyInfo
- {
- public ulong anchorHandle;
- }
- public struct PxrUuid
- {
- public ulong value0;
- public ulong value1;
- }
- public struct PxrAnchorComponentSceneLabelInfo
- {
- public PxrStructureType type;
- public PxrSceneLabel label;
- }
- public struct PxrAnchorComponentPlaneInfo
- {
- public PxrStructureType type;
- public PxrVector3f center;
- public PxrExtent2Df extent;
- public uint polygonSize;
- public IntPtr polygonVertices; //=>PxrVector3f[]
- }
- public struct PxrAnchorComponentVolumeInfo
- {
- public PxrStructureType type;
- public PxrVector3f center;
- public PxrVector3f extent;
- }
- public struct PxrExtent2Df
- {
- public float width;
- public float height;
- }
- public struct PxrAnchorPlaneBoundaryInfo
- {
- public PxrVector3f center;
- public PxrExtent2Df extent;
- }
- public struct PxrAnchorPlanePolygonInfo
- {
- public uint inputCount;
- public uint outputCount;
- public IntPtr vertices;
- }
- public struct PxrAnchorVolumeInfo
- {
- public PxrVector3f center;
- public PxrVector3f extent;
- }
- public struct PxrAnchorEntityList
- {
- public uint count;
- public IntPtr anchorHandles;//=>ulong[]
- }
- public struct PxrAnchorEntityPersistInfo
- {
- public PxrAnchorEntityList anchorList;
- public PxrPersistLocation location;
- }
- /// <summary>
- /// Information about the event of creating an anchor entity.
- /// </summary>
- public struct PxrEventAnchorEntityCreated
- {
- /// <summary>
- /// Task ID.
- /// </summary>
- public ulong taskId;
- /// <summary>
- /// Task result, which indicates whether the anchor entity is successfully created.
- /// </summary>
- public PxrResult result;
- /// <summary>
- /// The handle of the anchor entity.
- /// </summary>
- public ulong anchorHandle;
- /// <summary>
- /// The UUID of the anchor entity.
- /// </summary>
- public Guid uuid;
- }
- /// <summary>
- /// Information about the event of persisting an anchor entity.
- /// </summary>
- public struct PxrEventAnchorEntityPersisted
- {
- /// <summary>
- /// Task ID.
- /// </summary>
- public ulong taskId;
- /// <summary>
- /// Task result, which indicates whether the anchor entity is successfully persisted.
- /// </summary>
- public PxrResult result;
- /// <summary>
- /// The location where the anchor entity is saved. Currently, the anchor entity can only be saved to the device's local storage.
- /// </summary>
- public PxrPersistLocation location;
- }
- public struct PxrAnchorEntityUnPersistInfo
- {
- public PxrAnchorEntityList anchorList;
- public PxrPersistLocation location;
- }
- /// <summary>
- /// Information about the event of unpersisting an anchor entity.
- /// </summary>
- public struct PxrEventAnchorEntityUnPersisted
- {
- /// <summary>
- /// Task ID.
- /// </summary>
- public ulong taskId;
- /// <summary>
- /// Task result, which indicates whether the anchor entity is successfully unpersisted.
- /// </summary>
- public PxrResult result;
- /// <summary>
- /// The location from which the anchor entity is unpersisted. Currently, the anchor entity can only be unpersisted from the device's local storage.
- /// </summary>
- public PxrPersistLocation location;
- }
- public struct PxrAnchorEntityClearInfo
- {
- public PxrPersistLocation location;
- }
- /// <summary>
- /// Information about the event of clearing all anchor entities.
- /// </summary>
- public struct PxrEventAnchorEntityCleared
- {
- /// <summary>
- /// Task ID.
- /// </summary>
- public ulong taskId;
- /// <summary>
- /// Task result, which indicates whether the anchor entities are successfully cleared.
- /// </summary>
- public PxrResult result;
- /// <summary>
- /// The location of the anchor entities cleared.
- /// </summary>
- public PxrPersistLocation location;
- }
- public struct PxrAnchorEntityLoadInfo
- {
- public uint maxResult;
- public ulong timeout;
- public PxrPersistLocation location;
- public IntPtr include; //=>PxrAnchorEntityLoadFilterBaseHeader
- public IntPtr exclude; //=>PxrAnchorEntityLoadFilterBaseHeader
- }
- public struct PxrAnchorEntityLoadUuidFilter
- {
- public PxrStructureType type;
- public uint uuidCount;
- public IntPtr uuidList; //=>PxrUuid[]
- }
- public struct PxrAnchorEntityLoadComponentFilter
- {
- public PxrStructureType type;
- public ulong typeFlags;
- }
- public struct PxrAnchorEntityLoadSpatialSceneFilter
- {
- public PxrStructureType type;
- public ulong typeFlags;
- }
- public struct PxrAnchorEntityLoadResult
- {
- public ulong anchor;
- public PxrUuid uuid;
- }
- public struct PxrAnchorEntityLoadResults
- {
- public uint inputCount;
- public uint outputCount;
- public IntPtr loadResults; //=>PxrAnchorEntityLoadResult[]
- }
- /// <summary>
- /// Information about the event of loading anchor entities.
- /// </summary>
- public struct PxrEventAnchorEntityLoaded
- {
- /// <summary>
- /// Task ID.
- /// </summary>
- public ulong taskId;
- /// <summary>
- /// Task result, which indicates whether the anchor entities are successfully loaded.
- /// </summary>
- public PxrResult result;
- /// <summary>
- /// The number of anchor entities loaded.
- /// </summary>
- public uint count;
- /// <summary>
- /// The location from which the anchor entities are loaded.
- /// </summary>
- public PxrPersistLocation location;
- }
- /// <summary>
- /// Information about the event of room calibration.
- /// </summary>
- public struct PxrEventSpatialSceneCaptured
- {
- /// <summary>
- /// Task ID.
- /// </summary>
- public ulong taskId;
- /// <summary>
- /// Task result, which indicate whether the room is successfully calibrated.
- /// </summary>
- public PxrResult result;
- /// <summary>
- /// (not defined)
- /// </summary>
- public PxrSpatialSceneCaptureStatus status;
- }
- public struct PxrEventSpatialTrackingStateUpdate
- {
- public PxrSpatialTrackingState state;
- public PxrSpatialTrackingStateMessage message;
- }
- public enum PxrSpatialSceneCaptureStatus
- {
- NotDefined = 0,
- }
- /// <summary>
- /// The flags of components.
- /// </summary>
- public enum PxrAnchorComponentTypeFlags
- {
- Pose = 0x00000001,
- Persistence = 0x00000002,
- SceneLabel = 0x00000004,
- Plane = 0x00000008,
- Volume = 0x00000010
- }
- public enum PxrSpatialSceneDataTypeFlags
- {
- Unknown = 0x00000001,
- Floor = 0x00000002,
- Ceiling = 0x00000004,
- Wall = 0x00000008,
- Door = 0x00000010,
- Window = 0x00000020,
- Opening = 0x00000040,
- Object = 0x00000080
- }
- public enum PxrTrackingOrigin
- {
- Eye = 0,
- Floor = 1,
- Stage = 2
- }
- public enum PxrAnchorComponentType
- {
- Pose = 0,
- Persistence = 1,
- SceneLabel = 2,
- Plane = 3,
- Volume = 4,
- }
- public enum PxrSceneLabel
- {
- UnKnown = 0,
- Floor,
- Ceiling,
- Wall,
- Door,
- Window,
- Opening,
- Table,
- Sofa,
- }
- /// <summary>
- /// The location that an anchor entity is saved to.
- /// </summary>
- public enum PxrPersistLocation
- {
- /// <summary>
- /// The device's local storage.
- /// </summary>
- Local = 1,
- /// <summary>
- /// (Not supported yet)
- /// </summary>
- Remote = 2,
- }
- /// <summary>
- /// Video seethrough effect-related parameters.
- /// </summary>
- public enum PxrLayerEffect
- {
- Contrast = 0,
- Saturation = 1,
- Brightness = 2,
- /// <summary>
- /// Color temperature.
- /// </summary>
- Colortemp = 3,
- }
- #endregion
- //deprecate
- // Spatial Instance uuid 128 bit
- public struct PxrSpatialInstanceUuid
- {
- public UInt64 value0;
- public UInt64 value1;
- }
- // Create info struct used when creating a spatial anchor
- public struct PxrSpatialAnchorCreateInfo
- {
- public PxrReferenceType referenceType; // Global or Local
- public PxrPosef pose; // Position and Rotation
- public double time; // timestamp in milliseconds
- }
- // Save info struct used when saving a spatial anchor
- public struct PxrSpatialAnchorSaveInfo
- {
- public UInt64 anchorHandle;
- public PxrSpatialPersistenceLocation location;
- public PxrSpatialPersistenceMode persistenceMode;
- }
- // Delete info struct used when deleting a spatial anchor
- public struct PxrSpatialAnchorDeleteInfo
- {
- public UInt64 anchorHandle;
- public PxrSpatialPersistenceLocation persistenceLocation;
- }
- // Used to load all spatial instances that match the uuids provided
- // in the filter info. If numIds is set to 0, all Ids will be loaded.
- [StructLayout(LayoutKind.Sequential)]
- public struct PxrSpatialInstanceIdFilter
- {
- public UInt32 numIds;
- [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1024)]
- public PxrSpatialInstanceUuid[] uuids;
- }
- // Load info strut used when loading spatial instances
- [StructLayout(LayoutKind.Sequential)]
- public struct PxrSpatialInstanceLoadByIdInfo
- {
- public UInt32 maxNum; // Max num of handles can be returned by this query
- public double timeout; // milliseconds
- public PxrSpatialPersistenceLocation persistenceLocation; // Where to load
- public PxrSpatialInstanceIdFilter idFilter; // What to load
- }
- public enum PxrSpatialTrackingState
- {
- Invalid = 0,
- Valid = 1,
- Limited = 2,
- }
- public enum PxrSpatialTrackingStateMessage
- {
- Unknown = 0,
- Error = 1,
- Locating = 100,
- Located = 101,
- LocatingFailed = 102,
- LocatingFailedInvalidMap = 103,
- LocatingFailedNoMap = 104,
- LocateStopping = 105,
- LocateStopFailed = 106,
- LocateStopped = 107,
- MapCreating = 108,
- MapCreateFailed = 109,
- MapCreated = 110,
- MapSaving = 111,
- MapSaveFailed = 112,
- MapSaveFailedLowQuality = 113,
- MapSaveFailedInsufficentDiskSpace = 114,
- MapSaved = 115,
- MrEngineStarted = 116,
- MrEngineStopped = 117,
- MrEngineDestroyed = 118,
- MrMapLoss = 119,
- }
- public struct PxrSpatialTrackingStateInfo
- {
- public PxrSpatialTrackingState state;
- public PxrSpatialTrackingStateMessage message;
- }
- public struct PxrEventSpatialTrackingStateInfo
- {
- public PxrStructureType type;
- public PxrEventLevel eventLevel;
- public PxrSpatialTrackingStateInfo stateInfo;
- }
- public struct PxrEventSpatialAnchorSaveResult
- {
- public PxrStructureType type;
- public PxrEventLevel eventLevel;
- public PxrSpatialPersistenceResult result;
- public UInt64 asyncRequestId;
- public PxrSpatialInstanceUuid uuid;
- public UInt64 handle;
- public PxrSpatialPersistenceLocation location;
- }
- public struct PxrEventSpatialAnchorDeleteResult
- {
- public PxrStructureType type;
- public PxrEventLevel eventLevel;
- public PxrSpatialPersistenceResult result;
- public UInt64 asyncRequestId;
- public PxrSpatialInstanceUuid uuid;
- public PxrSpatialPersistenceLocation location;
- }
- public struct PxrSpatialAnchorLoadResult
- {
- public UInt64 anchorHandle;
- public PxrSpatialInstanceUuid uuid;
- }
- public struct PxrEventSpatialAnchorLoadResults
- {
- public PxrStructureType type;
- public PxrEventLevel eventLevel;
- public PxrSpatialPersistenceResult result;
- public bool hasNext;
- public UInt64 asyncRequestId;
- public UInt32 numResults;
- [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
- public PxrSpatialAnchorLoadResult[] loadResults;
- }
- public struct PxrSpatialAnchorLoadResults
- {
- public Int32 resultCapacityInput;
- public Int32 resultCountOutput;
- public IntPtr results; //PxrSpatialAnchorLoadResult
- }
- public struct PxrEventSpatialAnchorLoadResultsAvailable
- {
- public PxrStructureType type;
- public PxrEventLevel eventLevel;
- public UInt64 asyncRequestId;
- }
- public struct PxrEventSpatialAnchorLoadResultsComplete
- {
- public PxrStructureType type;
- public PxrEventLevel eventLevel;
- public UInt64 asyncRequestId;
- public PxrSpatialPersistenceResult result;
- }
- [StructLayout(LayoutKind.Sequential)]
- public struct PxrEventDataBuffer
- {
- public PxrStructureType type;
- public PxrEventLevel eventLevel;
- [MarshalAs(UnmanagedType.ByValArray, SizeConst = 500)]
- public byte[] data;
- };
- public struct PxrRoomSceneDataSaveInfo
- {
- public ulong roomSceneDataHandle;
- public PxrSpatialPersistenceLocation location;
- }
- public struct PxrRoomSceneDataDeleteInfo
- {
- public ulong roomSceneDataHandle;
- public PxrSpatialPersistenceLocation location;
- }
- public struct PxrEventRoomSceneDataSaveResult
- {
- public PxrStructureType type;
- public PxrEventLevel eventLevel;
- public PxrSpatialPersistenceResult result;
- public ulong asyncRequestId;
- public ulong handle;
- public PxrSpatialPersistenceLocation location;
- }
- public struct PxrEventRoomSceneDataDeleteResult
- {
- public PxrStructureType type;
- public PxrEventLevel eventLevel;
- public PxrSpatialPersistenceResult result;
- public ulong asyncRequestId;
- public ulong handle;
- public PxrSpatialPersistenceLocation location;
- }
- public struct PxrRoomSceneLoadInfo
- {
- public double timeoutMs; // time in milliseconds
- public PxrSpatialPersistenceLocation location;
- }
- public struct PxrRoomSceneLoadResult
- {
- public ulong anchorHandle;
- public PxrSpatialInstanceUuid anchorUuid;
- public ulong roomSceneDataHandle;
- public int dataLen;
- [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1024)]
- public byte[] data;
- }
- public struct PxrEventRoomSceneLoadResultsComplete
- {
- public PxrStructureType type;
- public PxrEventLevel eventLevel;
- public ulong asyncRequestId;
- public PxrSpatialPersistenceResult result;
- }
- public struct PxrRoomSceneLoadResults
- {
- public int resultCapacityInput;
- public int resultCountOutput;
- public IntPtr results; //PxrRoomSceneLoadResult
- }
- public struct PxrEventRoomSceneDataUpdateResult
- {
- public PxrStructureType type;
- public PxrEventLevel level;
- public PxrSpatialInstanceUuid anchorUuid;
- public ulong roomSceneDataHandle;
- public uint result;
- public uint dataLength;
- [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
- public byte[] roomSceneData;
- }
- public struct PxrEventSemiAutoCandidatesUpdate
- {
- public uint state;
- public uint count;
- }
- public struct PxrSemiAutoRoomCaptureCandidatesUpdate
- {
- public PxrStructureType type;
- public PxrEventLevel eventLevel;
- public PxrSpatialPersistenceResult result;
- }
- public struct PxrPoint3D
- {
- public float x;
- public float y;
- public float z;
- }
- public struct PxrEventDataSeethroughStateChanged
- {
- public PxrStructureType type;
- public PxrEventLevel eventLevel;
- public int state;
- };
- public enum PxrStructureType
- {
- Unknown = 0,
- PXR_TYPE_EVENT_DATA_SEETHROUGH_STATE_CHANGED = 9,
- SpatialAnchorSaveResult = 20,
- SpatialAnchorDeleteResult = 21,
- SpatialAnchorLoadResults = 22,
- NewSpaceReady = 28,
- SpatialAnchorLoadResultsAvailable = 29,
- SpatialAnchorLoadResultsComplete = 30,
- RoomSceneDataSaveResult = 31,
- RoomSceneDataDeleteResult = 32,
- RoomSceneLoadResultsComplete = 33,
- SemiAutoRoomCaptureCandidatesUpdate = 36,
- RoomSceneDataUpdateResult = 37,
- TrackingStateChanged = 40,
- //mrsdk2.0
- MRMin = 100,
- SpatialTrackingStateUpdate = 101,
- AnchorEntityProperties = 102,
- AnchorEntityCreateInfo = 103,
- AnchorEntityDestroyInfo = 104,
- AnchorSpaceCreateInfo = 105,
- AnchorComponentSceneLabelInfo = 106,
- AnchorComponentPlaneInfo = 107,
- AnchorComponentVolumeInfo = 108,
- AnchorComponentAddInfo = 109,
- AnchorComponentRemoveInfo = 110,
- AnchorPlaneBoundaryInfo = 111,
- AnchorPlanePolygonInfo = 112,
- AnchorVolumeInfo = 113,
- AnchorEntityPersistInfo = 114,
- AnchorEntityUnPersistInfo = 115,
- AnchorEntityList = 116,
- AnchorEntityClearInfo = 117,
- AnchorEntityPersisted = 118,
- AnchorEntityUnPersisted = 119,
- AnchorEntityCleared = 120,
- AnchorEntityLoadInfo = 121,
- AnchorEntityLoadUuidFilter = 122,
- AnchorEntityLoadComponentFilter = 123,
- AnchorEntityLoaded = 124,
- AnchorEntityLoadResult = 125,
- SpatialSceneCaptureStartInfo = 126,
- SpatialSceneCaptured = 127,
- AnchorEntityLoadSpatialSceneFilter = 128,
- SemiAutoCandidatesUpdate = 129,
- AnchorEntityCreated = 130,
- MRMax = 200
- }
-
- /// <summary>
- /// The result of mixed reality-realted events.
- /// </summary>
- public enum PxrResult
- {
- SUCCESS = 0,
- TIMEOUT_EXPIRED = 1,
- SESSION_LOSS_PENDING = 3,
- EVENT_UNAVAILABLE = 4,
- SPACE_BOUNDS_UNAVAILABLE = 7,
- SESSION_NOT_FOCUSED = 8,
- FRAME_DISCARDED = 9,
- ERROR_VALIDATION_FAILURE = -1,
- ERROR_RUNTIME_FAILURE = -2,
- ERROR_OUT_OF_MEMORY = -3,
- ERROR_API_VERSION_UNSUPPORTED = -4,
- ERROR_INITIALIZATION_FAILED = -6,
- ERROR_FUNCTION_UNSUPPORTED = -7,
- ERROR_FEATURE_UNSUPPORTED = -8,
- ERROR_EXTENSION_NOT_PRESENT = -9,
- ERROR_LIMIT_REACHED = -10,
- ERROR_SIZE_INSUFFICIENT = -11,
- ERROR_HANDLE_INVALID = -12,
- ERROR_SPATIAL_LOCALIZATION_RUNNING = -1000,
- ERROR_SPATIAL_LOCALIZATION_NOT_RUNNING = -1001,
- ERROR_SPATIAL_MAP_CREATED = -1002,
- ERROR_SPATIAL_MAP_NOT_CREATED = -1003,
- ERROR_COMPONENT_NOT_SUPPORTED = -501,
- ERROR_COMPONENT_CONFLICT = -502,
- ERROR_COMPONENT_NOT_ADDED = -503,
- ERROR_COMPONENT_ADDED = -504,
- ERROR_ANCHOR_ENTITY_NOT_FOUND = -505
- }
- public enum PxrEventLevel
- {
- Low = 0,
- Mid,
- High
- }
-
- // The reference frame in which the pose is calculated,
- // Currently Local and Global are supported.
- public enum PxrReferenceType
- {
- NotDefined = 0,
- Local = 1,
- Global = 2
- }
- // Storage location to be used to store, load, erase, and query spatial instances from
- public enum PxrSpatialPersistenceLocation
- {
- NotDefined = 0,
- Local = 1, // local device storage
- Remote = 2, // remote storage
- }
- // Persistence mode, only one mode is supported and may be more mode in future.
- public enum PxrSpatialPersistenceMode
- {
- NotDefined = 0,
- Default = 1, // only this mode is supported now.
- }
- public enum PxrSpatialPersistenceResult
- {
- ErrorRuntimeFailure = -2,
- ErrorValidationFailure = -1,
- Success = 0,
- TimeoutExpired = 1,
- }
- #endregion
- [StructLayout(LayoutKind.Sequential)]
- public struct UserDefinedSettings
- {
- public ushort stereoRenderingMode;
- public ushort colorSpace;
- public ushort systemDisplayFrequency;
- public ushort useContentProtect;
- public ushort optimizeBufferDiscards;
- public ushort enableAppSpaceWarp;
- public ushort enableSubsampled;
- public ushort lateLatchingDebug;
- public ushort enableStageMode;
- public ushort enableSuperResolution;
- public ushort normalSharpening;
- public ushort qualitySharpening;
- public ushort fixedFoveatedSharpening;
- public ushort selfAdaptiveSharpening;
- }
- public enum RenderEvent
- {
- CreateTexture,
- DeleteTexture,
- UpdateTexture
- }
- public enum ResUtilsType
- {
- TypeTextSize,
- TypeColor,
- TypeText,
- TypeFont,
- TypeValue,
- TypeDrawable,
- TypeObject,
- TypeObjectArray,
- }
- public enum GraphicsAPI
- {
- OpenGLES,
- Vulkan
- };
- public enum EyeType
- {
- EyeLeft,
- EyeRight,
- EyeBoth
- };
- public enum ConfigType
- {
- RenderTextureWidth,
- RenderTextureHeight,
- ShowFps,
- RuntimeLogLevel,
- PluginLogLevel,
- UnityLogLevel,
- UnrealLogLevel,
- NativeLogLevel,
- TargetFrameRate,
- NeckModelX,
- NeckModelY,
- NeckModelZ,
- DisplayRefreshRate,
- Ability6Dof,
- DeviceModel,
- PhysicalIPD,
- ToDelaSensorY,
- SystemDisplayRate,
- FoveationSubsampledEnabled,
- TrackingOriginHeight,
- EngineVersion,
- UnrealOpenglNoError,
- EnableCPT,
- MRCTextureID,
- RenderFPS,
- AntiAliasingLevelRecommended,
- MRCTextureID2,
- PxrSetSurfaceView,
- PxrAPIVersion,
- PxrMrcPosiyionYOffset,
- PxrMrcTextureWidth,
- PxrMrcTextureHeight,
- PxrAndroidLayerDimensions = 34,
- PxrANDROID_SN,
- PxrSetDesiredFPS,
- PxrGetSeethroughState,
- PxrSetLayerBlend,
- PxrLeftEyeFOV,
- PxrRightEyeFOV,
- PxrBothEyeFOV,
- SupportQuickSeethrough,
- SetFilterType,
- SetSubmitLayerEXTItemColorMatrix,
- };
- public enum FoveatedRenderingMode
- {
- FixedFoveatedRendering = 0,
- EyeTrackedFoveatedRendering = 1
- }
- public enum FoveationLevel
- {
- None = -1,
- Low,
- Med,
- High,
- TopHigh
- }
- public enum BoundaryType
- {
- OuterBoundary,
- PlayArea
- }
- public enum BoundaryTrackingNode
- {
- HandLeft,
- HandRight,
- Head
- }
- public enum PxrTrackingState
- {
- LostNoReason,
- LostCamera,
- LostHighLight,
- LostLowLight,
- LostLowFeatureCount,
- LostReLocation,
- LostInitialization,
- LostNoCamera,
- LostNoIMU,
- LostIMUJitter,
- LostUnknown,
- }
- public enum ResetSensorOption
- {
- ResetPosition,
- ResetRotation,
- ResetRotationYOnly,
- ResetAll
- };
- public enum PxrLayerCreateFlags
- {
- PxrLayerFlagAndroidSurface = 1 << 0,
- PxrLayerFlagProtectedContent = 1 << 1,
- PxrLayerFlagStaticImage = 1 << 2,
- PxrLayerFlagUseExternalImages = 1 << 4,
- PxrLayerFlag3DLeftRightSurface = 1 << 5,
- PxrLayerFlag3DTopBottomSurface = 1 << 6,
- PxrLayerFlagEnableFrameExtrapolation = 1 << 7,
- PxrLayerFlagEnableSubsampled = 1 << 8,
- PxrLayerFlagEnableFrameExtrapolationPTW = 1 << 9,
- PxrLayerFlagSharedImagesBetweenLayers = 1 << 10,
- }
- public enum PxrLayerSubmitFlagsEXT
- {
- PxrLayerFlagMRCComposition = 1 << 30,
- }
- public enum PxrLayerSubmitFlags
- {
- PxrLayerFlagNoCompositionDepthTesting = 1 << 3,
- PxrLayerFlagUseExternalHeadPose = 1 << 5,
- PxrLayerFlagLayerPoseNotInTrackingSpace = 1 << 6,
- PxrLayerFlagHeadLocked = 1 << 7,
- PxrLayerFlagUseExternalImageIndex = 1 << 8,
- PxrLayerFlagPresentationProtection = 1 << 9,
- PxrLayerFlagSourceAlpha_1_0 = 1 << 10,
- PxrLayerFlagUseFrameExtrapolation = 1 << 11,
- PxrLayerFlagQuickSeethrough = 1 << 12,
- PxrLayerFlagEnableNormalSuperSampling = 1 << 13,
- PxrLayerFlagEnableQualitySuperSampling = 1 << 14,
- PxrLayerFlagEnableNormalSharpening = 1 << 15,
- PxrLayerFlagEnableQualitySharpening = 1 << 16,
- PxrLayerFlagEnableFixedFoveatedSuperSampling = 1 << 17,
- PxrLayerFlagEnableFixedFoveatedSharpening = 1 << 18,
- PxrLayerFlagEnableSelfAdaptiveSharpening = 1 << 19,
- PxrLayerFlagPremultipliedAlpha = 1 << 20,
- }
- public enum PxrControllerKeyMap
- {
- PXR_CONTROLLER_KEY_HOME = 0,
- PXR_CONTROLLER_KEY_AX = 1,
- PXR_CONTROLLER_KEY_BY = 2,
- PXR_CONTROLLER_KEY_BACK = 3,
- PXR_CONTROLLER_KEY_TRIGGER = 4,
- PXR_CONTROLLER_KEY_VOL_UP = 5,
- PXR_CONTROLLER_KEY_VOL_DOWN = 6,
- PXR_CONTROLLER_KEY_ROCKER = 7,
- PXR_CONTROLLER_KEY_GRIP = 8,
- PXR_CONTROLLER_KEY_TOUCHPAD = 9,
- PXR_CONTROLLER_KEY_LASTONE = 127,
- PXR_CONTROLLER_TOUCH_AX = 128,
- PXR_CONTROLLER_TOUCH_BY = 129,
- PXR_CONTROLLER_TOUCH_ROCKER = 130,
- PXR_CONTROLLER_TOUCH_TRIGGER = 131,
- PXR_CONTROLLER_TOUCH_THUMB = 132,
- PXR_CONTROLLER_TOUCH_LASTONE = 255
- }
- public enum GetDataType
- {
- PXR_GET_FACE_DATA_DEFAULT = 0,
- PXR_GET_FACE_DATA = 3,
- PXR_GET_LIP_DATA = 4,
- PXR_GET_FACELIP_DATA = 5,
- }
- /// <summary>
- /// Body joint enumerations.
- /// * For leg tracking mode, joints numbered from 0 to 15 return data.
- /// * For full body tracking mode, all joints return data.
- /// </summary>
- public enum BodyTrackerRole
- {
- Pelvis = 0,
- LEFT_HIP = 1,
- RIGHT_HIP = 2,
- SPINE1 = 3,
- LEFT_KNEE = 4,
- RIGHT_KNEE = 5,
- SPINE2 = 6,
- LEFT_ANKLE = 7,
- RIGHT_ANKLE = 8,
- SPINE3 = 9,
- LEFT_FOOT = 10,
- RIGHT_FOOT = 11,
- NECK = 12,
- LEFT_COLLAR = 13,
- RIGHT_COLLAR = 14,
- HEAD = 15,
- LEFT_SHOULDER = 16,
- RIGHT_SHOULDER = 17,
- LEFT_ELBOW = 18,
- RIGHT_ELBOW = 19,
- LEFT_WRIST = 20,
- RIGHT_WRIST = 21,
- LEFT_HAND = 22,
- RIGHT_HAND = 23,
- NONE_ROLE = 24, // unvalid
- MIN_ROLE = 0, // min value
- MAX_ROLE = 23, // max value
- ROLE_NUM = 24,
- }
- public enum BodyActionList
- {
- PxrNoneAction = 0x00000000,
- PxrTouchGround = 0x00000001,
- PxrKeepStatic = 0x00000002,
- }
- /// <summary>
- /// Contains data about the position and rotation of a body joint.
- /// </summary>
- public struct BodyTrackerTransPose
- {
- /// <summary>
- /// IMU timestamp.
- /// </summary>
- public Int64 TimeStamp;
- /// <summary>
- /// The joint's position on the X axis.
- /// </summary>
- public double PosX;
- /// <summary>
- /// The joint's position on the Y axis.
- /// </summary>
- public double PosY;
- /// <summary>
- /// The joint's position on the Z axis.
- /// </summary>
- public double PosZ;
- /// <summary>
- /// The joint's rotation on the X component of the Quaternion.
- /// </summary>
- public double RotQx;
- /// <summary>
- /// The joint's rotation on the Y component of the Quaternion.
- /// </summary>
- public double RotQy;
- /// <summary>
- /// The joint's rotation on the Z component of the Quaternion.
- /// </summary>
- public double RotQz;
- /// <summary>
- /// The joint's rotation on the W component of the Quaternion.
- /// </summary>
- public double RotQw;
- }
- /// <summary>
- /// Contains data about the position, velocity, acceleration, and action of a body joint.
- /// </summary>
- [StructLayout(LayoutKind.Sequential)]
- public struct BodyTrackerTransform
- {
- /// <summary>
- /// Body joint name. If the value is `NONE_ROLE`, the joint's data will not be calculated.
- /// </summary>
- public BodyTrackerRole bone;
- /// <summary>
- /// The joint's position in the scene. Use `localpose` for your app.
- /// </summary>
- public BodyTrackerTransPose localpose;
- /// <summary>
- /// (do not use `globalpose`)
- /// </summary>
- public BodyTrackerTransPose globalpose;
- /// <summary>
- /// The joint's velocity on the X, Y, and Z axes.
- /// </summary>
- [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
- public double[] velo;
- /// <summary>
- /// The joint's acceleration on the X, Y, and Z axes.
- /// </summary>
- [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
- public double[] acce;
- /// <summary>
- /// The joint's angular velocity on the X, Y, and Z axes.
- /// </summary>
- [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
- public double[] wvelo;
- /// <summary>
- /// The joint's angular acceleration on the X, Y, and Z axes.
- /// </summary>
- [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
- public double[] wacce;
- /// <summary>
- /// Multiple actions can be supported at the same time by means of OR
- /// </summary>
- public UInt32 Action;
- }
- /// <summary>
- /// Contains data about the position, velocity, acceleration, and action of each body joint.
- /// </summary>
- public struct BodyTrackerResult
- {
- /// <summary>
- /// A fixed-length array, each position transmits the data of one body joint.
- /// </summary>
- [MarshalAs(UnmanagedType.ByValArray, SizeConst = 24)]
- public BodyTrackerTransform[] trackingdata;
- }
- /// <summary>
- /// Information about PICO Motion Tracker's connection state.
- /// </summary>
- [StructLayout(LayoutKind.Sequential)]
- public unsafe struct PxrFitnessBandConnectState
- {
- /// <summary>
- ///
- /// </summary>
- public Byte num;
- /// <summary>
- ///
- /// </summary>
- public fixed Byte trackerID[12];
- }
- public enum BodyTrackingAlgParamType
- {
- HUMAN_HEIGHT = 0,
- SWIFT_MODE = 1,
- BONE_PARAM = 2
- }
- public struct BodyTrackingAlgParam
- {
- public int BodyJointSet;
- public BodyTrackingBoneLength BoneLength;
- }
- /// <summary>
- /// The struct that defines the lengths (in centimeters) of different body parts of the avatar.
- /// </summary>
- public struct BodyTrackingBoneLength
- {
- /// <summary>
- /// The length of the head, which is from the top of the head to the upper area of the neck.
- /// </summary>
- public float headLen;
- /// <summary>
- /// The length of the neck, which is from the upper area of the neck to the lower area of the neck.
- /// </summary>
- public float neckLen;
- /// <summary>
- /// The length of the torso, which is from the lower area of the neck to the navel.
- /// </summary>
- public float torsoLen;
- /// <summary>
- /// The length of the hip, which is from the navel to the center of the upper area of the upper leg.
- /// </summary>
- public float hipLen;
- /// <summary>
- /// The length of the upper leg, which from the hip to the knee-joint.
- /// </summary>
- public float upperLegLen;
- /// <summary>
- /// The length of the lower leg, which is from the knee-joint to the ankle.
- /// </summary>
- public float lowerLegLen;
- /// <summary>
- /// The length of the foot, which is from the ankle to the tiptoe.
- /// </summary>
- public float footLen;
- /// <summary>
- /// The length of the shoulder, which is between the left and right shoulder joints.
- /// </summary>
- public float shoulderLen;
- /// <summary>
- /// The length of the upper arm, which is from the sholder joint to the elbow joint.
- /// </summary>
- public float upperArmLen;
- /// <summary>
- /// The length of the lower arm, which is from the elbow joint to the wrist.
- /// </summary>
- public float lowerArmLen;
- /// <summary>
- /// The length of the hand, which is from the wrist to the finger tip.
- /// </summary>
- public float handLen;
- }
- public enum AdaptiveResolutionPowerSetting
- {
- HIGH_QUALITY, // performance factor = 0.9
- BALANCED, // performance factor = 0.8
- BATTERY_SAVING // performance factor = 0.7
- }
- public struct FoveationParams
- {
- public float foveationGainX;
- public float foveationGainY;
- public float foveationArea;
- public float foveationMinimum;
- }
- [StructLayout(LayoutKind.Sequential)]
- public struct EyeTrackingGazeRay
- {
- public Vector3 direction;
- public bool isValid;
- public Vector3 origin;
- }
- [StructLayout(LayoutKind.Sequential)]
- public struct PxrSensorState
- {
- public int status;
- public PxrPosef pose;
- public PxrVector3f angularVelocity;
- public PxrVector3f linearVelocity;
- public PxrVector3f angularAcceleration;
- public PxrVector3f linearAcceleration;
- public UInt64 poseTimeStampNs;
- }
- [StructLayout(LayoutKind.Sequential)]
- public struct PxrSensorState2
- {
- public int status;
- public PxrPosef pose;
- public PxrPosef globalPose;
- public PxrVector3f angularVelocity;
- public PxrVector3f linearVelocity;
- public PxrVector3f angularAcceleration;
- public PxrVector3f linearAcceleration;
- public UInt64 poseTimeStampNs;
- }
- [StructLayout(LayoutKind.Sequential)]
- public struct PxrControllerTracking
- {
- public PxrSensorState localControllerPose;
- public PxrSensorState globalControllerPose;
- }
- public enum PxrControllerType
- {
- PxrInputG2 = 3,
- PxrInputNeo2 = 4,
- PxrInputNeo3 = 5,
- PxrInputPICO_4 = 6
- }
- public enum PxrControllerDof
- {
- PxrController3Dof,
- PxrController6Dof
- }
- public enum PxrControllerBond
- {
- PxrControllerIsBond,
- PxrControllerUnBond
- }
- public enum PxrBlendFactor
- {
- PxrBlendFactorZero = 0,
- PxrBlendFactorOne = 1,
- PxrBlendFactorSrcAlpha = 2,
- PxrBlendFactorOneMinusSrcAlpha = 3,
- PxrBlendFactorDstAlpha = 4,
- PxrBlendFactorOneMinusDstAlpha = 5
- };
- public enum PxrDeviceAbilities
- {
- PxrTrackingModeRotationBit,
- PxrTrackingModePositionBit,
- PxrTrackingModeEyeBit,
- PxrTrackingModeFaceBit,
- PxrTrackingModeBroadBandMontorBit,
- PxrTrackingModeHandBit
- }
- public enum FaceTrackingMode {
- None,
- Hybrid,
- FaceOnly,
- LipsyncOnly
- }
- public enum SkipInitSettingFlag {
- SkipHandleConnectionTeaching = 1,
- SkipTriggerKeyTeaching = 1 << 1,
- SkipLanguage = 1 << 2,
- SkipCountry = 1 << 3,
- SkipWIFI = 1 << 4,
- SkipQuickSetting = 1 << 5
- }
-
- public enum PxrPerfSettings {
- CPU = 1,
- GPU = 2,
- }
-
- public enum PxrSettingsLevel {
- POWER_SAVINGS = 0,
- SUSTAINED_LOW = 1,
- SUSTAINED_HIGH = 3,
- BOOST = 5,
- }
- public enum PxrFtLipsyncValue
- {
- STOP_FT,
- STOP_LIPSYNC,
- START_FT,
- START_LIPSYNC,
- }
- public enum PxrGazeType
- {
- Never,
- DuringMotion,
- Always
- }
- public enum PxrArmModelType
- {
- Controller,
- Wrist,
- Elbow,
- Shoulder
- }
- public enum SharpeningMode
- {
- None,
- Normal,
- Quality
- }
- public enum SharpeningEnhance
- {
- None,
- FixedFoveated,
- SelfAdaptive,
- Both
- }
-
- [StructLayout(LayoutKind.Sequential)]
- public struct PxrControllerCapability
- {
- public PxrControllerType type;
- public PxrControllerDof inputDof;
- public PxrControllerBond inputBond;
- public UInt64 Abilities;
- }
- [StructLayout(LayoutKind.Sequential)]
- public struct PxrLayerParam
- {
- public int layerId;
- public PXR_OverLay.OverlayShape layerShape;
- public PXR_OverLay.OverlayType layerType;
- public PXR_OverLay.LayerLayout layerLayout;
- public UInt64 format;
- public UInt32 width;
- public UInt32 height;
- public UInt32 sampleCount;
- public UInt32 faceCount;
- public UInt32 arraySize;
- public UInt32 mipmapCount;
- public UInt32 layerFlags;
- public UInt32 externalImageCount;
- public IntPtr leftExternalImages;
- public IntPtr rightExternalImages;
- };
- [StructLayout(LayoutKind.Sequential)]
- public struct PxrVector4f
- {
- public float x;
- public float y;
- public float z;
- public float w;
- };
- [StructLayout(LayoutKind.Sequential)]
- public struct PxrVector3f
- {
- public float x;
- public float y;
- public float z;
- };
- [StructLayout(LayoutKind.Sequential)]
- public struct PxrVector2f
- {
- public float x;
- public float y;
- };
- [StructLayout(LayoutKind.Sequential)]
- public struct PxrBoundaryTriggerInfo
- {
- public bool isTriggering;
- public float closestDistance;
- public PxrVector3f closestPoint;
- public PxrVector3f closestPointNormal;
- public bool valid;
- };
- [StructLayout(LayoutKind.Sequential)]
- public struct PxrPosef
- {
- public PxrVector4f orientation;
- public PxrVector3f position;
- };
- [StructLayout(LayoutKind.Sequential)]
- public struct PxrRecti
- {
- public int x;
- public int y;
- public int width;
- public int height;
- };
- [StructLayout(LayoutKind.Sequential)]
- public struct PxrLayerBlend
- {
- public PxrBlendFactor srcColor;
- public PxrBlendFactor dstColor;
- public PxrBlendFactor srcAlpha;
- public PxrBlendFactor dstAlpha;
- };
- [StructLayout(LayoutKind.Sequential)]
- public struct PxrLayerHeader
- {
- public int layerId;
- public UInt32 layerFlags;
- public float colorScaleX;
- public float colorScaleY;
- public float colorScaleZ;
- public float colorScaleW;
- public float colorBiasX;
- public float colorBiasY;
- public float colorBiasZ;
- public float colorBiasW;
- public int compositionDepth;
- public int sensorFrameIndex;
- public int imageIndex;
- public PxrPosef headPose;
- };
- [StructLayout(LayoutKind.Sequential)]
- public struct PxrLayerHeader2
- {
- public int layerId;
- public UInt32 layerFlags;
- public float colorScaleX;
- public float colorScaleY;
- public float colorScaleZ;
- public float colorScaleW;
- public float colorBiasX;
- public float colorBiasY;
- public float colorBiasZ;
- public float colorBiasW;
- public int compositionDepth;
- public int sensorFrameIndex;
- public int imageIndex;
- public PxrPosef headPose;
- public PXR_OverLay.OverlayShape layerShape;
- public UInt32 useLayerBlend;
- public PxrLayerBlend layerBlend;
- public UInt32 useImageRect;
- public PxrRecti imageRectLeft;
- public PxrRecti imageRectRight;
- public UInt64 reserved0;
- public UInt64 reserved1;
- public UInt64 reserved2;
- public UInt64 reserved3;
- };
- [StructLayout(LayoutKind.Sequential)]
- public struct PxrLayerQuad
- {
- public PxrLayerHeader header;
- public PxrPosef pose;
- public float width;
- public float height;
- };
- [StructLayout(LayoutKind.Sequential)]
- public struct PxrLayerQuad2
- {
- public PxrLayerHeader2 header;
- public PxrPosef poseLeft;
- public PxrPosef poseRight;
- public PxrVector2f sizeLeft;
- public PxrVector2f sizeRight;
- };
- [StructLayout(LayoutKind.Sequential)]
- public struct PxrLayerCylinder
- {
- public PxrLayerHeader header;
- public PxrPosef pose;
- public float radius;
- public float centralAngle;
- public float height;
- };
- [StructLayout(LayoutKind.Sequential)]
- public struct PxrLayerCylinder2
- {
- public PxrLayerHeader2 header;
- public PxrPosef poseLeft;
- public PxrPosef poseRight;
- public float radiusLeft;
- public float radiusRight;
- public float centralAngleLeft;
- public float centralAngleRight;
- public float heightLeft;
- public float heightRight;
- };
- [StructLayout(LayoutKind.Sequential)]
- public struct PxrLayerEquirect
- {
- public PxrLayerHeader2 header;
- public PxrPosef poseLeft;
- public PxrPosef poseRight;
- public float radiusLeft;
- public float radiusRight;
- public float scaleXLeft;
- public float scaleXRight;
- public float scaleYLeft;
- public float scaleYRight;
- public float biasXLeft;
- public float biasXRight;
- public float biasYLeft;
- public float biasYRight;
- };
- [StructLayout(LayoutKind.Sequential)]
- public struct PxrLayerEquirect2
- {
- public PxrLayerHeader2 header;
- public PxrPosef poseLeft;
- public PxrPosef poseRight;
- public float radiusLeft;
- public float radiusRight;
- public float centralHorizontalAngleLeft;
- public float centralHorizontalAngleRight;
- public float upperVerticalAngleLeft;
- public float upperVerticalAngleRight;
- public float lowerVerticalAngleLeft;
- public float lowerVerticalAngleRight;
- };
- [StructLayout(LayoutKind.Sequential)]
- public struct PxrLayerCube2
- {
- public PxrLayerHeader2 header;
- public PxrPosef poseLeft;
- public PxrPosef poseRight;
- };
- [StructLayout(LayoutKind.Sequential)]
- public struct PxrLayerEac2
- {
- public PxrLayerHeader2 header;
- public PxrPosef poseLeft;
- public PxrPosef poseRight;
- public PxrVector3f offsetPosLeft;
- public PxrVector3f offsetPosRight;
- public PxrVector4f offsetRotLeft;
- public PxrVector4f offsetRotRight;
- public UInt32 degreeType;
- public float overlapFactor;
- public UInt64 timestamp;
- };
- [StructLayout(LayoutKind.Sequential)]
- public struct AudioClipData
- {
- public int slot;//手柄
- public UInt64 buffersize;//数据大小
- public int sampleRate;// 采样率
- public int channelCounts;//通道数
- public int bitrate;//bit率
- public int reversal;//反转
- public int isCache;//是否缓存
- };
- [StructLayout(LayoutKind.Sequential)]
- public struct VibrateInfo {
- public uint slot;
- public uint reversal;
- public float amp;
- };
- [StructLayout(LayoutKind.Sequential)]
- public struct PxrPhfParams {
- public UInt64 frameseq;
- public UInt16 play;
- public UInt16 frequency;
- public UInt16 loop;
- public float gain;
- };
- [StructLayout(LayoutKind.Sequential)]
- public struct PxrPhfFile
- {
- public string phfVersion;
- public int frameDuration;
- public PxrPhfParams[] patternData_L;
- public PxrPhfParams[] patternData_R;
- }
- [StructLayout(LayoutKind.Sequential)]
- public struct PxrPhfParamsNum {
- [MarshalAs(UnmanagedType.ByValArray, SizeConst = 50)]
- public PxrPhfParams[] phfParams;
- }
- [StructLayout(LayoutKind.Sequential)]
- public unsafe struct PxrFaceTrackingInfo
- {
- public Int64 timestamp; // us
- public fixed float blendShapeWeight[72]; //72(52+20)Expression component weight
- public fixed float videoInputValid[10]; // Input validity of upper and lower face
- public float laughingProb; // Coefficient of laughter
- public fixed float emotionProb[10]; // Emotional factor
- public fixed float reserved[128];
- };
- [StructLayout(LayoutKind.Sequential)]
- public struct PxrExtent2Di
- {
- public int width;
- public int height;
- };
- public static class PXR_Plugin
- {
- private const string PXR_SDK_Version = "2.4.3";
- private const string PXR_PLATFORM_DLL = "PxrPlatform";
- public const string PXR_API_DLL = "pxr_api";
- private static int PXR_API_Version = 0;
- #region DLLImports
- //MR
- //new
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern int Pxr_EnablePassthroughStyle(bool value);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern int Pxr_SetPassthroughStyle(PxrLayerEffect type, float value, float duration);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern int Pxr_SetPassthroughLUT(ref byte[] data, int width, int height, int row, int col);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern PxrResult Pxr_CreateAnchorEntity(ref PxrAnchorEntityCreateInfo info, out ulong anchorHandle);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern PxrResult Pxr_DestroyAnchorEntity(ref PxrAnchorEntityDestroyInfo info);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern PxrResult Pxr_GetAnchorPose(ulong anchorHandle, PxrTrackingOrigin origin, out PxrPosef pose);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern PxrResult Pxr_GetAnchorEntityUuid(ulong anchorHandle, out PxrUuid uuid);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern PxrResult Pxr_GetAnchorComponentFlags(ulong anchorHandle,
- out ulong flag);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern PxrResult Pxr_GetAnchorSceneLabel(ulong anchorHandle, out PxrSceneLabel label);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern PxrResult Pxr_GetAnchorPlaneBoundaryInfo(ulong anchorHandle,
- ref PxrAnchorPlaneBoundaryInfo info);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern PxrResult Pxr_GetAnchorPlanePolygonInfo(ulong anchorHandle,
- ref PxrAnchorPlanePolygonInfo info);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern PxrResult Pxr_GetAnchorBoxInfo(ulong anchorHandle, ref PxrAnchorVolumeInfo info);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern PxrResult Pxr_PersistAnchorEntity(ref PxrAnchorEntityPersistInfo info,
- out ulong taskId);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern PxrResult Pxr_UnpersistAnchorEntity(ref PxrAnchorEntityUnPersistInfo info,
- out ulong taskId);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern PxrResult Pxr_ClearPersistedAnchorEntity(ref PxrAnchorEntityClearInfo info,
- out ulong taskId);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern PxrResult Pxr_LoadAnchorEntity(ref PxrAnchorEntityLoadInfo info, out ulong taskId);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern PxrResult Pxr_GetAnchorEntityLoadResults(ulong taskId, ref PxrAnchorEntityLoadResults results);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern PxrResult Pxr_StartSpatialSceneCapture(out ulong taskId);
- //old
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_StartHumanOcclusion();
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_AcquireMeshingInfo(IntPtr maskBuffer,IntPtr verticesBuffer, out uint verticesSize, IntPtr facetsBuffer, out uint facetSize, out bool haveRead);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_StopHumanOcclusion();
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_CreateSpatialAnchor(ref PxrSpatialAnchorCreateInfo info, ref UInt64 handle);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_DestroySpatialAnchor(UInt64 handle);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_SaveSpatialAnchor(ref PxrSpatialAnchorSaveInfo info, ref UInt64 requestId);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_DeleteSpatialAnchor(ref PxrSpatialAnchorDeleteInfo info, ref UInt64 requestId);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_LoadSpatialAnchorById(ref PxrSpatialInstanceLoadByIdInfo info, ref UInt64 requestId);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_GetSpatialAnchorLoadResults(UInt64 requestId,ref PxrSpatialAnchorLoadResults loadResults);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_GetSpatialAnchorPose(UInt64 handle, double predictDisplayTime, PxrReferenceType type, ref PxrPosef pose);
- [DllImport(PXR_PLATFORM_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_GetSpatialAnchorUuid(UInt64 handle, ref PxrSpatialInstanceUuid uuid);
- [DllImport(PXR_PLATFORM_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern bool Pxr_PollEventFromXRPlugin(ref int eventNum, IntPtr[] eventData);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_CreateRoomSceneData(PxrSpatialInstanceUuid anchorUuid, IntPtr roomSceneData, int dataLen, ref ulong roomSceneDataHandle);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_DestroyRoomSceneData(ulong roomSceneDataHandle);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_SaveRoomSceneData(ref PxrRoomSceneDataSaveInfo saveInfo, ref ulong requestId);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_DeleteRoomSceneData(ref PxrRoomSceneDataDeleteInfo deleteInfo, ref ulong requestId);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_LoadRoomScene(ref PxrRoomSceneLoadInfo loadInfo, ref ulong requestId);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_GetRoomSceneLoadResults(ulong requestId, ref PxrRoomSceneLoadResults results);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_StartRoomCapture();
-
- //PassThrough
- [DllImport(PXR_PLATFORM_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern int Pxr_CameraStart();
- [DllImport(PXR_PLATFORM_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern int Pxr_CameraStop();
- [DllImport(PXR_PLATFORM_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern int Pxr_CameraDestroy();
- [DllImport(PXR_PLATFORM_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern IntPtr Pxr_CameraGetRenderEventFunc();
- [DllImport(PXR_PLATFORM_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern void Pxr_CameraSetRenderEventPending();
- [DllImport(PXR_PLATFORM_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern void Pxr_CameraWaitForRenderEvent();
- [DllImport(PXR_PLATFORM_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern int Pxr_CameraUpdateFrame(int eye);
- [DllImport(PXR_PLATFORM_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern int Pxr_CameraCreateTexturesMainThread();
- [DllImport(PXR_PLATFORM_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern int Pxr_CameraDeleteTexturesMainThread();
- [DllImport(PXR_PLATFORM_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern int Pxr_CameraUpdateTexturesMainThread();
- [DllImport(PXR_PLATFORM_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern bool Pxr_SetFoveationLevelEnable(int enable);
- [DllImport(PXR_PLATFORM_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern bool Pxr_SetEyeFoveationLevelEnable(int enable);
- [DllImport(PXR_PLATFORM_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern void Pxr_SetFFRSubsampled(bool enable);
- //System
- [DllImport(PXR_PLATFORM_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern bool Pxr_LoadPlugin();
- [DllImport(PXR_PLATFORM_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern void Pxr_UnloadPlugin();
- [DllImport(PXR_PLATFORM_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern bool Pxr_GetHomeKey();
- [DllImport(PXR_PLATFORM_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern void Pxr_InitHomeKey();
- [DllImport(PXR_PLATFORM_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern bool Pxr_GetMRCEnable();
- [DllImport(PXR_PLATFORM_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern void Pxr_SetUserDefinedSettings(UserDefinedSettings settings);
- [DllImport(PXR_PLATFORM_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern void Pxr_Construct(PXR_Loader.ConvertRotationWith2VectorDelegate fromToRotation);
- [DllImport(PXR_PLATFORM_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern float Pxr_RefreshRateChanged();
- [DllImport(PXR_PLATFORM_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern bool Pxr_GetFocusState();
- [DllImport(PXR_PLATFORM_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern bool Pxr_IsSensorReady();
- [DllImport(PXR_PLATFORM_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern int Pxr_GetSensorStatus();
- [DllImport(PXR_PLATFORM_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern void Pxr_GetLayerImagePtr(int layerId, EyeType eye, int imageIndex, ref IntPtr image);
- [DllImport(PXR_PLATFORM_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern void Pxr_CreateLayerParam(PxrLayerParam layerParam);
- [DllImport(PXR_PLATFORM_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern void Pxr_DestroyLayerByRender(int layerId);
- [DllImport(PXR_PLATFORM_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern void Pxr_EnableEyeTracking(bool enable);
- [DllImport(PXR_PLATFORM_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern void Pxr_EnableFaceTracking(bool enable);
- [DllImport(PXR_PLATFORM_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern void Pxr_EnableLipsync(bool enable);
- [DllImport(PXR_PLATFORM_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern void Pxr_SetInputDeviceChangedCallBack(InputDeviceChangedCallBack callback);
- [DllImport(PXR_PLATFORM_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern void Pxr_SetSeethroughStateChangedCallBack(SeethroughStateChangedCallBack callback);
- [DllImport(PXR_PLATFORM_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern void Pxr_SetFitnessBandNumberOfConnectionsCallBack(FitnessBandNumberOfConnectionsCallBack callback);
- [DllImport(PXR_PLATFORM_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern void Pxr_SetFitnessBandElectricQuantityCallBack(FitnessBandElectricQuantityCallBack callback);
- [DllImport(PXR_PLATFORM_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern void Pxr_SetFitnessBandAbnormalCalibrationDataCallBack(FitnessBandAbnormalCalibrationDataCallBack callback);
- [DllImport(PXR_PLATFORM_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern void Pxr_SetLoglevelChangedCallBack(LoglevelChangedCallBack callback);
-
- [DllImport(PXR_PLATFORM_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern void Pxr_EnablePremultipliedAlpha(bool enable);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern void Pxr_SetGraphicOption(GraphicsAPI option);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_CreateLayer(IntPtr layerParam);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_GetLayerNextImageIndex(int layerId, ref int imageIndex);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_GetLayerImageCount(int layerId, EyeType eye, ref UInt32 imageCount);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_GetLayerImage(int layerId, EyeType eye, int imageIndex, ref UInt64 image);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern int Pxr_SetConfigIntArray(ConfigType configIndex, int[] configSetData, int dataCount);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern int Pxr_SetConfigFloatArray(ConfigType configIndex, float[] configSetData, int dataCount);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_GetLayerAndroidSurface(int layerId, EyeType eye, ref IntPtr androidSurface);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_DestroyLayer(int layerId);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_SubmitLayer(IntPtr layer);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_SubmitLayerQuad(PxrLayerQuad layer);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_SubmitLayerQuad2(PxrLayerQuad2 layer);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_SubmitLayerCylinder(PxrLayerCylinder layer);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_SubmitLayerCylinder2(PxrLayerCylinder2 layer);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_SubmitLayerEquirect(PxrLayerEquirect layer);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_SubmitLayerEquirect2(PxrLayerEquirect2 layer);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_SubmitLayerCube2(PxrLayerCube2 layer);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_SubmitLayerEac2(PxrLayerEac2 layer);
- [DllImport(PXR_PLATFORM_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern void Pxr_SetLayerBlend(bool enable, PxrLayerBlend layerBlend);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern FoveationLevel Pxr_GetFoveationLevel();
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_SetFoveationParams(FoveationParams foveationParams);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern int Pxr_SetFrustum(EyeType eye, float fovLeft, float fovRight, float fovUp, float fovDown, float near, float far);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern int Pxr_GetFrustum(EyeType eye, ref float fovLeft, ref float fovRight, ref float fovUp, ref float fovDown, ref float near, ref float far);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern int Pxr_GetConfigFloat(ConfigType configIndex, ref float value);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern int Pxr_GetConfigInt(ConfigType configIndex, ref int value);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern int Pxr_SetConfigInt(ConfigType configSetIndex, int configSetData);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern int Pxr_SetConfigString(ConfigType configSetIndex, string configSetData);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern int Pxr_SetConfigUint64(ConfigType configSetIndex, UInt64 configSetData);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern int Pxr_ResetSensor(ResetSensorOption option);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern int Pxr_SetSensorLostCustomMode(bool value);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern int Pxr_SetSensorLostCMST(bool value);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern bool Pxr_GetDisplayRefreshRatesAvailable(ref int configCount, ref IntPtr configArray);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern int Pxr_SetDisplayRefreshRate(float refreshRate);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern int Pxr_GetPredictedDisplayTime(ref double predictedDisplayTime);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern bool Pxr_SetExtraLatencyMode(int mode);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern int Pxr_GetTrackingMode(ref UInt64 trackingModeFlags);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
-
- public static extern int Pxr_SetTrackingOrigin(PxrTrackingOrigin mode);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern int Pxr_GetTrackingOrigin(ref PxrTrackingOrigin mode);
- [DllImport(PXR_PLATFORM_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern void Pxr_UpdateContentProtectState(int state);
- //Tracking Sensor
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern int Pxr_GetPredictedMainSensorState2(double predictTimeMs, ref PxrSensorState2 sensorState, ref int sensorFrameIndex);
- //Controller
- [DllImport(PXR_PLATFORM_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern void Pxr_SetControllerOriginOffset(int controllerID, Vector3 offset);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_GetControllerTrackingState(UInt32 deviceID, double predictTime, float[] headSensorData, ref PxrControllerTracking tracking);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_SetControllerMainInputHandle(UInt32 deviceID);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_GetControllerMainInputHandle(ref int deviceID);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_SetControllerVibration(UInt32 deviceID, float strength, int time);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_SetControllerEnableKey(bool isEnable, PxrControllerKeyMap Key);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_ResetController(UInt32 deviceID);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_SetArmModelParameters(PxrGazeType gazetype, PxrArmModelType armmodeltype, float elbowHeight, float elbowDepth, float pointerTiltAngle);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_GetControllerHandness(ref int handness);
- //Vibration
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_SetControllerVibrationEvent(UInt32 deviceID, int frequency, float strength, int time);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_GetControllerCapabilities(UInt32 deviceID, ref PxrControllerCapability capability);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_StopControllerVCMotor(int clientId);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_StartControllerVCMotor(string file, int slot);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_SetControllerAmp(float mode);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_SetControllerDelay(int delay);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern string Pxr_GetVibrateDelayTime(ref int length);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_StartVibrateBySharemF(float[] data, ref AudioClipData parameter, ref int source_id);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_StartVibrateByCache(int clicpid);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_ClearVibrateByCache(int clicpid);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_StartVibrateByPHF(string data, int buffersize, ref int sourceID, ref VibrateInfo vibrateInfo);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_PauseVibrate(int sourceID);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_ResumeVibrate(int sourceID);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_UpdateVibrateParams(int clicp_id, ref VibrateInfo vibrateInfo);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_CreateHapticStream(string phfVersion, UInt32 frameDurationMs, ref VibrateInfo hapticInfo, float speed, ref int id);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_WriteHapticStream(int id, ref PxrPhfParamsNum frames, UInt32 numFrames);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_SetPHFHapticSpeed(int id, float speed);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_GetPHFHapticSpeed(int id, ref float speed);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_GetCurrentFrameSequence(int id, ref UInt64 frameSequence);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_StartPHFHaptic(int source_id);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_StopPHFHaptic(int source_id);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_RemovePHFHaptic(int source_id);
- [DllImport(PXR_PLATFORM_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern void Pxr_SetLogInfoActive(bool value);
- //Boundary
- [DllImport(PXR_PLATFORM_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern int Pxr_GetSeeThroughState();
- [DllImport(PXR_PLATFORM_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern void Pxr_SetVideoSeethroughState(bool value);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern int Pxr_TestNodeIsInBoundary(BoundaryTrackingNode node, bool isPlayArea, ref PxrBoundaryTriggerInfo info);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern int Pxr_TestPointIsInBoundary(ref PxrVector3f point, bool isPlayArea, ref PxrBoundaryTriggerInfo info);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern int Pxr_GetBoundaryGeometry(bool isPlayArea, UInt32 pointsCountInput, ref UInt32 pointsCountOutput, PxrVector3f[] outPoints);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern int Pxr_GetBoundaryDimensions(bool isPlayArea, out PxrVector3f dimension);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern bool Pxr_GetBoundaryConfigured();
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern bool Pxr_GetBoundaryEnabled();
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern int Pxr_SetBoundaryVisible(bool value);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern int Pxr_SetSeeThroughBackground(bool value);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern bool Pxr_GetBoundaryVisible();
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern void Pxr_ResetSensorHard();
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern int Pxr_GetTrackingState();
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern int Pxr_SetGuardianSystemDisable(bool disable);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern int Pxr_ResumeGuardianSystemForSTS();
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern int Pxr_PauseGuardianSystemForSTS();
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern int Pxr_ShutdownSdkGuardianSystem();
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern int Pxr_GetRoomModeState();
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern int Pxr_DisableBoundary();
- //MRC
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern bool Pxr_GetMrcStatus();
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern int Pxr_GetMrcPose(ref PxrPosef pose);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern int Pxr_SetMrcPose(ref PxrPosef pose);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern int Pxr_SetIsSupportMovingMrc(bool support);
- //Face tracking
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern int Pxr_SetTrackingMode(double trackingMode);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern int Pxr_GetFaceTrackingData(Int64 ts, int flags, ref PxrFaceTrackingInfo faceTrackingInfo);
-
- //Application SpaceWarp
- [DllImport(PXR_PLATFORM_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern void Pxr_SetSpaceWarp(int value);
- [DllImport(PXR_PLATFORM_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern void Pxr_SetAppSpacePosition(float x, float y, float z);
- [DllImport(PXR_PLATFORM_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern void Pxr_SetAppSpaceRotation(float x, float y, float z, float w);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern int Pxr_SetTrackingStatus(String key, String value);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern int Pxr_SetPerformanceLevels(PxrPerfSettings which, PxrSettingsLevel level);
-
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern int Pxr_GetPerformanceLevels(PxrPerfSettings which, ref PxrSettingsLevel level);
-
- //Body tracking
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern int Pxr_GetBodyTrackingPose(double predictTime, ref BodyTrackerResult bodyTrackerResult);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern int Pxr_SetBodyTrackingMode(int mode);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern int Pxr_GetFitnessBandConnectState(ref PxrFitnessBandConnectState state);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern int Pxr_GetFitnessBandBattery(int trackerId, ref int battery);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern int Pxr_GetFitnessBandCalibState(ref int calibrated);
-
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern int Pxr_LogSdkApi(string sdkInfo);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_SetBodyTrackingAlgParam(BodyTrackingAlgParamType AlgParamType, ref BodyTrackingAlgParam Param);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- public static extern int Pxr_UpdateAdaptiveResolution(ref PxrExtent2Di dimensions, AdaptiveResolutionPowerSetting powerSetting);
- #endregion
- public static class System
- {
- public static Action RecenterSuccess;
- public static Action FocusStateAcquired;
- public static Action FocusStateLost;
- public static Action SensorReady;
- public static Action<int> InputDeviceChanged;
- public static Action<int> LoglevelChangedChanged;
- public static Action<int> SeethroughStateChangedChanged;
- public static Action<int, int> FitnessBandNumberOfConnections;
- public static Action<int, int> FitnessBandElectricQuantity;
- public static Action<int, int> FitnessBandAbnormalCalibrationData;
- public static void UPxr_SetTrackingOrigin(PxrTrackingOrigin mode)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- Pxr_SetTrackingOrigin(mode);
- #endif
- }
- public static void UPxr_GetTrackingOrigin(ref PxrTrackingOrigin mode)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- Pxr_GetTrackingOrigin(ref mode);
- #endif
- }
- public static bool UPxr_LoadPICOPlugin()
- {
- PLog.d(TAG, "UPxr_Load PICO Plugin");
- #if UNITY_ANDROID && !UNITY_EDITOR
- return Pxr_LoadPlugin();
- #else
- return false;
- #endif
- }
- public static void UPxr_UnloadPICOPlugin()
- {
- PLog.d(TAG, "UPxr_Unload PICO Plugin");
- #if UNITY_ANDROID && !UNITY_EDITOR
- Pxr_UnloadPlugin();
- #endif
- }
- public static bool UPxr_QueryDeviceAbilities(PxrDeviceAbilities abilities)
- {
- UInt64 flags = UInt64.MinValue;
- #if UNITY_ANDROID && !UNITY_EDITOR
- if (UPxr_GetAPIVersion() >= 0x2000304)
- {
- Pxr_GetTrackingMode(ref flags);
- }
- #endif
- switch (abilities)
- {
- case PxrDeviceAbilities.PxrTrackingModeRotationBit:
- {
- return Convert.ToBoolean(flags & 0x00000001);
- }
- case PxrDeviceAbilities.PxrTrackingModePositionBit:
- {
- return Convert.ToBoolean(flags & 0x00000002);
- }
- case PxrDeviceAbilities.PxrTrackingModeEyeBit:
- {
- return Convert.ToBoolean(flags & 0x00000004);
- }
- case PxrDeviceAbilities.PxrTrackingModeFaceBit:
- {
- return Convert.ToBoolean(flags & 0x00000008);
- }
- case PxrDeviceAbilities.PxrTrackingModeBroadBandMontorBit:
- {
- return Convert.ToBoolean(flags & 0x00000010);
- }
- case PxrDeviceAbilities.PxrTrackingModeHandBit:
- {
- return Convert.ToBoolean(flags & 0x00000020);
- }
- default:
- throw new ArgumentOutOfRangeException(nameof(abilities), abilities, null);
- }
- }
- public static void UPxr_InitializeFocusCallback()
- {
- Application.onBeforeRender += UPxr_FocusUpdate;
- Application.onBeforeRender += UPxr_SensorReadyStateUpdate;
- }
- public static void UPxr_DeinitializeFocusCallback()
- {
- Application.onBeforeRender -= UPxr_FocusUpdate;
- Application.onBeforeRender -= UPxr_SensorReadyStateUpdate;
- }
- public static void UPxr_SetInputDeviceChangedCallBack(InputDeviceChangedCallBack callback)
- {
- #if !UNITY_EDITOR && UNITY_ANDROID
- Pxr_SetInputDeviceChangedCallBack(callback);
- #endif
- }
- public static void UPxr_SetSeethroughStateChangedCallBack(SeethroughStateChangedCallBack callback)
- {
- #if !UNITY_EDITOR && UNITY_ANDROID
- Pxr_SetSeethroughStateChangedCallBack(callback);
- #endif
- }
- public static void UPxr_SetFitnessBandNumberOfConnectionsCallBack(FitnessBandNumberOfConnectionsCallBack callback) {
- #if !UNITY_EDITOR && UNITY_ANDROID
- Pxr_SetFitnessBandNumberOfConnectionsCallBack(callback);
- #endif
- }
- public static void UPxr_SetFitnessBandAbnormalCalibrationDataCallBack(FitnessBandAbnormalCalibrationDataCallBack callback)
- {
- #if !UNITY_EDITOR && UNITY_ANDROID
- Pxr_SetFitnessBandAbnormalCalibrationDataCallBack(callback);
- #endif
- }
- public static void UPxr_SetFitnessBandElectricQuantityCallBack(FitnessBandElectricQuantityCallBack callback)
- {
- #if !UNITY_EDITOR && UNITY_ANDROID
- Pxr_SetFitnessBandElectricQuantityCallBack(callback);
- #endif
- }
- public static void UPxr_SetLoglevelChangedCallBack(LoglevelChangedCallBack callback)
- {
- #if !UNITY_EDITOR && UNITY_ANDROID
- Pxr_SetLoglevelChangedCallBack(callback);
- #endif
- }
- public static bool UPxr_GetFocusState()
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- return Pxr_GetFocusState();
- #else
- return false;
- #endif
- }
- public static bool UPxr_IsSensorReady()
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- return Pxr_IsSensorReady();
- #else
- return false;
- #endif
- }
- private static bool lastAppFocusState = false;
- private static void UPxr_FocusUpdate()
- {
- bool appfocus = UPxr_GetFocusState();
- if (appfocus && !lastAppFocusState)
- {
- if (FocusStateAcquired != null)
- {
- FocusStateAcquired();
- }
- }
- if (!appfocus && lastAppFocusState)
- {
- if (FocusStateLost != null)
- {
- FocusStateLost();
- }
- }
- lastAppFocusState = appfocus;
- }
- private static bool lastSensorReadyState = false;
- private static void UPxr_SensorReadyStateUpdate()
- {
- bool sensorReady = UPxr_IsSensorReady();
- if (sensorReady && !lastSensorReadyState)
- {
- if (SensorReady != null)
- {
- SensorReady();
- }
- }
- lastSensorReadyState = sensorReady;
- }
- public static string UPxr_GetSDKVersion()
- {
- return PXR_SDK_Version;
- }
- public static int UPxr_LogSdkApi(string sdkInfo)
- {
- PLog.d(TAG, "UPxr_LogSdkApi() sdkInfo:" + sdkInfo);
- int result = 0;
- #if UNITY_ANDROID && !UNITY_EDITOR
- result = Pxr_LogSdkApi(sdkInfo);
- #endif
- PLog.d(TAG, "UPxr_LogSdkApi() result:" + result);
- return result;
- }
- public static float UPxr_GetSystemDisplayFrequency()
- {
- return UPxr_GetConfigFloat(ConfigType.SystemDisplayRate);
- }
- public static float UPxr_GetMrcY()
- {
- if (PXR_Plugin.System.UPxr_GetAPIVersion() >= 0x2000300)
- {
- return UPxr_GetConfigFloat(ConfigType.PxrMrcPosiyionYOffset);
- }
- else
- {
- return 0;
- }
- }
- public static double UPxr_GetPredictedDisplayTime()
- {
- PLog.d(TAG, "UPxr_GetPredictedDisplayTime()");
- double predictedDisplayTime = 0;
- #if UNITY_ANDROID && !UNITY_EDITOR
- Pxr_GetPredictedDisplayTime(ref predictedDisplayTime);
- #endif
- PLog.d(TAG, "UPxr_GetPredictedDisplayTime() predictedDisplayTime:" + predictedDisplayTime);
- return predictedDisplayTime;
- }
- public static bool UPxr_SetExtraLatencyMode(int mode)
- {
- PLog.d(TAG, "UPxr_SetExtraLatencyMode() mode:" + mode);
- bool result = false;
- #if UNITY_ANDROID && !UNITY_EDITOR
- result = Pxr_SetExtraLatencyMode(mode);
- #endif
- PLog.d(TAG, "UPxr_SetExtraLatencyMode() result:" + result);
- return result;
- }
- public static int UPxr_UpdateAdaptiveResolution(ref int width, AdaptiveResolutionPowerSetting powerSetting)
- {
- int success = 1;
- PxrExtent2Di dim;
- dim.width = width;
- dim.height = width;
- #if !UNITY_EDITOR && UNITY_ANDROID
- success = Pxr_UpdateAdaptiveResolution(ref dim, powerSetting);
- width = dim.width;
- PLog.i(TAG, "UPxr_UpdateAdaptiveResolution :" + width);
- #endif
- return success;
- }
- public static void UPxr_SetUserDefinedSettings(UserDefinedSettings settings)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- Pxr_SetUserDefinedSettings(settings);
- #endif
- }
- public static void UPxr_Construct(PXR_Loader.ConvertRotationWith2VectorDelegate fromToRotation)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- Pxr_Construct(fromToRotation);
- #endif
- }
- public static bool UPxr_GetHomeKey()
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- return Pxr_GetHomeKey();
- #endif
- return false;
- }
- public static void UPxr_InitHomeKey()
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- Pxr_InitHomeKey();
- #endif
- }
- public static bool UPxr_GetMRCEnable()
- {
- bool result = false;
- if (PXR_Plugin.System.UPxr_GetAPIVersion() >= 0x2000300)
- {
- #if !UNITY_EDITOR && UNITY_ANDROID
- result = Pxr_GetMRCEnable();
- #endif
- }
- PLog.d(TAG, "UPxr_GetMRCEnable() result:" + result);
- return result;
- }
- public static int UPxr_SetMRCTextureID(UInt64 IDData)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- Debug.Log("ConfigType.MRCTextureID:"+IDData);
- return Pxr_SetConfigUint64(ConfigType.MRCTextureID, IDData);
- #else
- return 0;
- #endif
- }
- public static int UPxr_SetMRCTextureID2(UInt64 IDData)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- Debug.Log("ConfigType.MRCTextureID2:"+IDData);
- return Pxr_SetConfigUint64(ConfigType.MRCTextureID2, IDData);
- #else
- return 0;
- #endif
- }
- public static int UPxr_SetMrcTextutrWidth(UInt64 width)
- {
- if (PXR_Plugin.System.UPxr_GetAPIVersion() >= 0x2000300)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- return Pxr_SetConfigUint64(ConfigType.PxrMrcTextureWidth, width);
- #endif
- }
- return 0;
- }
- public static int UPxr_SetMrcTextutrHeight(UInt64 height)
- {
- if (PXR_Plugin.System.UPxr_GetAPIVersion() >= 0x2000300)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- return Pxr_SetConfigUint64(ConfigType.PxrMrcTextureHeight, height);
- #endif
- }
- return 0;
- }
- public static bool UPxr_GetMrcPose(ref PxrPosef pose)
- {
- int result = 0;
- if (PXR_Plugin.System.UPxr_GetAPIVersion() >= 0x2000300)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- result = Pxr_GetMrcPose(ref pose);
- #endif
- }
- PLog.d(TAG, "UPxr_GetMrcPose() result:" + result + " pos.x:" + pose.position.x + " pos.y:" + pose.position.y + " pos.z:" + pose.position.z
- + " ori.x:" + pose.orientation.x + " ori.y:" + pose.orientation.y + " ori.z:" + pose.orientation.z + " ori.w:" + pose.orientation.w);
- return result == 0;
- }
- public static bool UPxr_SetMrcPose(ref PxrPosef pose)
- {
- int result = 0;
- if (PXR_Plugin.System.UPxr_GetAPIVersion() >= 0x2000300)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- result = Pxr_SetMrcPose(ref pose);
- #endif
- }
- PLog.d(TAG, "UPxr_SetMrcPose() result:" + result + " pos.x:" + pose.position.x + " pos.y:" + pose.position.y + " pos.z:" + pose.position.z
- + " ori.x:" + pose.orientation.x + " ori.y:" + pose.orientation.y + " ori.z:" + pose.orientation.z + " ori.w:" + pose.orientation.w);
- return result == 0;
- }
- public static void UPxr_SetIsSupportMovingMrc(bool support)
- {
- if (PXR_Plugin.System.UPxr_GetAPIVersion() >= 0x2000306)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- Pxr_SetIsSupportMovingMrc(support);
- #endif
- }
- }
- public static bool UPxr_GetMrcStatus()
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- if(PXR_Plugin.System.UPxr_GetAPIVersion()>= 0x2000300) {
- return Pxr_GetMrcStatus();
- }else{
- return false;
- }
- #else
- return false;
- #endif
- }
- public static void UPxr_EnableEyeTracking(bool enable)
- {
- Debug.Log(TAG + "UPxr_EnableEyeTracking() enable:" + enable);
- #if UNITY_ANDROID && !UNITY_EDITOR
- Pxr_EnableEyeTracking(enable);
- #endif
- }
- public static void UPxr_EnableFaceTracking(bool enable)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- Pxr_EnableFaceTracking(enable);
- #endif
- }
- public static void UPxr_EnableLipSync(bool enable){
- #if UNITY_ANDROID && !UNITY_EDITOR
- Pxr_EnableLipsync(enable);
- #endif
- }
- public static int UPxr_GetFaceTrackingData(Int64 ts, int flags, ref PxrFaceTrackingInfo faceTrackingInfo)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- if(PXR_Plugin.System.UPxr_GetAPIVersion()>= 0x2000309) {
- Pxr_GetFaceTrackingData(ts, flags, ref faceTrackingInfo );
- }
- #endif
- return 0;
- }
- public static int UPxr_SetFaceTrackingStatus(PxrFtLipsyncValue value) {
- int num = 0;
- #if UNITY_ANDROID && !UNITY_EDITOR
- if(PXR_Plugin.System.UPxr_GetAPIVersion()>= 0x200030A) {
-
- num = Pxr_SetTrackingStatus("ft_lipsync_ctl", ((int)value).ToString());
- }
- #endif
- return num;
- }
- private const string TAG = "[PXR_Plugin/System]";
- #if UNITY_ANDROID && !UNITY_EDITOR
- private static AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
- private static AndroidJavaObject currentActivity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
- private static AndroidJavaClass sysActivity = new AndroidJavaClass("com.psmart.aosoperation.SysActivity");
- private static AndroidJavaClass batteryReceiver = new AndroidJavaClass("com.psmart.aosoperation.BatteryReceiver");
- private static AndroidJavaClass audioReceiver = new AndroidJavaClass("com.psmart.aosoperation.AudioReceiver");
- #endif
- public static string UPxr_GetDeviceMode()
- {
- string devicemode = "";
- #if UNITY_ANDROID && !UNITY_EDITOR
- devicemode = SystemInfo.deviceModel;
- #endif
- return devicemode;
- }
- public static float UPxr_GetConfigFloat(ConfigType type)
- {
- PLog.d(TAG, "UPxr_GetConfigFloat() type:" + type);
- float value = 0;
- #if UNITY_ANDROID && !UNITY_EDITOR
- Pxr_GetConfigFloat(type, ref value);
- #endif
- PLog.d(TAG, "UPxr_GetConfigFloat() value:" + value);
- return value;
- }
- public static int UPxr_GetConfigInt(ConfigType type)
- {
- PLog.d(TAG, "UPxr_GetConfigInt() type:" + type);
- int value = 0;
- #if UNITY_ANDROID && !UNITY_EDITOR
- Pxr_GetConfigInt(type, ref value);
- #endif
- PLog.d(TAG, "UPxr_GetConfigInt() value:" + value);
- return value;
- }
- public static int UPxr_SetConfigInt(ConfigType configSetIndex, int configSetData)
- {
- PLog.d(TAG, "UPxr_SetConfigInt() configSetIndex:" + configSetIndex + " configSetData:" + configSetData);
- int result = 0;
- #if UNITY_ANDROID && !UNITY_EDITOR
- result = Pxr_SetConfigInt(configSetIndex, configSetData);
- #endif
- PLog.d(TAG, "UPxr_SetConfigInt() result:" + result);
- return result;
- }
- public static int UPxr_ContentProtect(int data)
- {
- int num = 0;
- #if UNITY_ANDROID && !UNITY_EDITOR
- num = Pxr_SetConfigInt(ConfigType.EnableCPT, data);
- Pxr_UpdateContentProtectState(data);
- #endif
- return num;
- }
- public static int UPxr_SetConfigString(ConfigType configSetIndex, string configSetData)
- {
- PLog.d(TAG, "UPxr_SetConfigString() configSetIndex:" + configSetIndex + " configSetData:" + configSetData);
- int result = 0;
- #if UNITY_ANDROID && !UNITY_EDITOR
- result = Pxr_SetConfigString(configSetIndex, configSetData);
- #endif
- PLog.d(TAG, "UPxr_SetConfigString() result:" + result);
- return result;
- }
- public static int UPxr_SetSystemDisplayFrequency(float rate)
- {
- PLog.d(TAG, "UPxr_SetDisplayRefreshRate() rate:" + rate);
- int result = 0;
- #if UNITY_ANDROID && !UNITY_EDITOR
- result = Pxr_SetDisplayRefreshRate(rate);
- #endif
- PLog.d(TAG, "UPxr_SetDisplayRefreshRate() result:" + result);
- return result;
- }
- public static int UPxr_SetPerformanceLevels(PxrPerfSettings which, PxrSettingsLevel level)
- {
- PLog.d(TAG, "UPxr_SetPerformanceLevels() which:" + which + ", level:" + level);
- int result = 0;
- #if UNITY_ANDROID && !UNITY_EDITOR
- if (PXR_Plugin.System.UPxr_GetAPIVersion() >= 0x200030A)
- {
- result = Pxr_SetPerformanceLevels(which, level);
- }
- #endif
- PLog.d(TAG, "UPxr_SetPerformanceLevels() result:" + result);
- return result;
- }
-
- public static PxrSettingsLevel UPxr_GetPerformanceLevels(PxrPerfSettings which)
- {
- PLog.d(TAG, "UPxr_GetPerformanceLevels() which:" + which);
- int result = 0;
- PxrSettingsLevel level = PxrSettingsLevel.POWER_SAVINGS;
- #if UNITY_ANDROID && !UNITY_EDITOR
- if (PXR_Plugin.System.UPxr_GetAPIVersion() >= 0x200030A)
- {
- result = Pxr_GetPerformanceLevels(which, ref level);
- }
- #endif
- PLog.d(TAG, "UPxr_GetPerformanceLevels() result:" + result + ", level:" + level);
- return level;
- }
- public static string UPxr_GetDeviceSN()
- {
- string serialNum = "UNKONWN";
- #if UNITY_ANDROID && !UNITY_EDITOR
- serialNum = sysActivity.CallStatic<string>("getDeviceSN");
- #endif
- return serialNum;
- }
- public static void UPxr_Sleep()
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- sysActivity.CallStatic("pxr_Sleep");
- #endif
- }
- public static void UPxr_SetSecure(bool isOpen)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- sysActivity.CallStatic("SetSecure",currentActivity,isOpen);
- #endif
- }
- public static int UPxr_GetColorRes(string name)
- {
- int value = -1;
- #if UNITY_ANDROID && !UNITY_EDITOR
- try
- {
- value = sysActivity.CallStatic<int>("getColorRes", currentActivity, name);
- }
- catch (Exception e)
- {
- PLog.e(TAG, "GetColorResError :" + e.ToString());
- }
- #endif
- return value;
- }
- public static int UPxr_GetConfigInt(string name)
- {
- int value = -1;
- #if UNITY_ANDROID && !UNITY_EDITOR
- try
- {
- value = sysActivity.CallStatic<int>("getConfigInt", currentActivity, name);
- }
- catch (Exception e)
- {
- PLog.e(TAG, "GetConfigIntError :" + e.ToString());
- }
- #endif
- return value;
- }
- public static string UPxr_GetConfigString(string name)
- {
- string value = "";
- #if UNITY_ANDROID && !UNITY_EDITOR
- try
- {
- value = sysActivity.CallStatic<string>("getConfigString", currentActivity, name);
- }
- catch (Exception e)
- {
- PLog.e(TAG, "GetConfigStringError :" + e.ToString());
- }
- #endif
- return value;
- }
- public static string UPxr_GetDrawableLocation(string name)
- {
- string value = "";
- #if UNITY_ANDROID && !UNITY_EDITOR
- try
- {
- value = sysActivity.CallStatic<string>("getDrawableLocation", currentActivity, name);
- }
- catch (Exception e)
- {
- PLog.e(TAG, "GetDrawableLocationError :" + e.ToString());
- }
- #endif
- return value;
- }
- public static int UPxr_GetTextSize(string name)
- {
- int value = -1;
- #if UNITY_ANDROID && !UNITY_EDITOR
- try
- {
- value = sysActivity.CallStatic<int>("getTextSize", currentActivity, name);
- }
- catch (Exception e)
- {
- PLog.e(TAG, "GetTextSizeError :" + e.ToString());
- }
- #endif
- return value;
- }
- public static string UPxr_GetLangString(string name)
- {
- string value = "";
- #if UNITY_ANDROID && !UNITY_EDITOR
- try
- {
- value = sysActivity.CallStatic<string>("getLangString", currentActivity, name);
- }
- catch (Exception e)
- {
- PLog.e(TAG, "GetLangStringError :" + e.ToString());
- }
- #endif
- return value;
- }
- public static string UPxr_GetStringValue(string id, int type)
- {
- string value = "";
- #if UNITY_ANDROID && !UNITY_EDITOR
- try
- {
- value = sysActivity.CallStatic<string>("getStringValue", currentActivity, id, type);
- }
- catch (Exception e)
- {
- PLog.e(TAG, "GetStringValueError :" + e.ToString());
- }
- #endif
- return value;
- }
- public static int UPxr_GetIntValue(string id, int type)
- {
- int value = -1;
- #if UNITY_ANDROID && !UNITY_EDITOR
- try
- {
- value = sysActivity.CallStatic<int>("getIntValue", currentActivity, id, type);
- }
- catch (Exception e)
- {
- PLog.e(TAG, "GetIntValueError :" + e.ToString());
- }
- #endif
- return value;
- }
- public static float UPxr_GetFloatValue(string id)
- {
- float value = -1;
- #if UNITY_ANDROID && !UNITY_EDITOR
- try
- {
- value = sysActivity.CallStatic<float>("getFloatValue", currentActivity, id);
- }
- catch (Exception e)
- {
- PLog.e(TAG, "GetFloatValueError :" + e.ToString());
- }
- #endif
- return value;
- }
- public static string UPxr_GetObjectOrArray(string id, int type)
- {
- string value = "";
- #if UNITY_ANDROID && !UNITY_EDITOR
- try
- {
- value = sysActivity.CallStatic<string>("getObjectOrArray", currentActivity, id, type);
- }
- catch (Exception e)
- {
- PLog.e(TAG, "GetObjectOrArrayError :" + e.ToString());
- }
- #endif
- return value;
- }
- public static int UPxr_GetCharSpace(string id)
- {
- int value = -1;
- #if UNITY_ANDROID && !UNITY_EDITOR
- try
- {
- value = sysActivity.CallStatic<int>("getCharSpace", currentActivity, id);
- }
- catch (Exception e)
- {
- PLog.e(TAG, "GetCharSpaceError :" + e.ToString());
- }
- #endif
- return value;
- }
- public static float UPxr_RefreshRateChanged()
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- return Pxr_RefreshRateChanged();
- #else
- return -1.0f;
- #endif
- }
- public static float[] UPxr_GetDisplayFrequenciesAvailable()
- {
- float[] configArray = null;
- #if UNITY_ANDROID && !UNITY_EDITOR
- int configCount = 0;
- IntPtr configHandle = IntPtr.Zero;
- Pxr_GetDisplayRefreshRatesAvailable(ref configCount, ref configHandle);
- configArray = new float[configCount];
- Marshal.Copy(configHandle, configArray, 0, configCount);
- for (int i = 0; i < configCount; i++) {
- Debug.Log("LLRR: UPxr_GetDisplayFrequenciesAvailable " + configArray[i]);
- }
- #endif
- return configArray;
- }
- public static int UPxr_GetSensorStatus()
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- return Pxr_GetSensorStatus();
- #else
- return 0;
- #endif
- }
- public static int UPxr_GetPredictedMainSensorStateNew(ref PxrSensorState2 sensorState, ref int sensorFrameIndex)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- if(UPxr_GetAPIVersion() >= 0x2000201){
- double predictTime = UPxr_GetPredictedDisplayTime();
- return Pxr_GetPredictedMainSensorState2(predictTime, ref sensorState, ref sensorFrameIndex);
- }else
- {
- return 0;
- }
- #else
- return 0;
- #endif
- }
- public static int UPxr_GetAPIVersion()
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- if (PXR_API_Version < 0x0000001)
- {
- PXR_API_Version = UPxr_GetConfigInt(ConfigType.PxrAPIVersion);
- PLog.i(TAG, "API xrVersion :0x" + PXR_API_Version.ToString("X2"));
- }
- return PXR_API_Version;
- #else
- return 0;
- #endif
- }
- public static void UPxr_SetLogInfoActive(bool value)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- Pxr_SetLogInfoActive(value);
- #endif
- }
- public static void UPxr_OpenFitnessBandCalibrationAPP()
- {
- UPxr_OpenFitnessBandCalibrationPackage("com.pvr.swift");
- }
- public static void UPxr_OpenPackage(string pkgName)
- {
- AndroidJavaObject activity;
- AndroidJavaClass UnityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
- activity = UnityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
- using (AndroidJavaObject joPackageManager = activity.Call<AndroidJavaObject>("getPackageManager"))
- {
- using (AndroidJavaObject joIntent = joPackageManager.Call<AndroidJavaObject>("getLaunchIntentForPackage", pkgName))
- {
- if (null != joIntent)
- {
- activity.Call("startActivity", joIntent);
- }
- else
- {
- Debug.Log("This software is not installed: " + pkgName);
- }
- }
- }
- }
- public static void UPxr_OpenFitnessBandCalibrationPackage(string pkgName)
- {
- using (AndroidJavaClass jcPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
- {
- using (AndroidJavaObject joActivity = jcPlayer.GetStatic<AndroidJavaObject>("currentActivity"))
- {
- using (AndroidJavaObject joPackageManager = joActivity.Call<AndroidJavaObject>("getPackageManager"))
- {
- using (AndroidJavaObject joIntent = joPackageManager.Call<AndroidJavaObject>("getLaunchIntentForPackage", pkgName))
- {
- if (null != joIntent)
- {
- //AndroidJavaObject joNIntent = joIntent.Call<AndroidJavaObject>("addFlags", joIntent.GetStatic<int>("FLAG_ACTIVITY_REORDER_TO_FRONT"));
- AndroidJavaObject joNIntent = joIntent.Call<AndroidJavaObject>("putExtra", "enter_flag", Application.identifier);
- joActivity.Call("startActivity", joNIntent);
- joIntent.Dispose();
- }
- else
- {
- string msg = "Package <" + pkgName + "> not exsits on device.";
- Debug.Log(msg);
- using (AndroidJavaClass jT = new AndroidJavaClass("android.widget.Toast"))
- {
- using (AndroidJavaObject jMsg = new AndroidJavaObject("java.lang.String", msg))
- {
- using (AndroidJavaObject jC = joActivity.Call<AndroidJavaObject>("getApplicationContext"))
- {
- int length = jT.GetStatic<int>("LENGTH_SHORT");
- using (AndroidJavaObject toast = jT.CallStatic<AndroidJavaObject>("makeText", jC, jMsg, length))
- {
- toast.Call("show");
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- public static class Boundary
- {
- private const string TAG = "[PXR_Plugin/Boundary]";
- public static PxrBoundaryTriggerInfo UPxr_TestNodeIsInBoundary(BoundaryTrackingNode node, BoundaryType boundaryType)
- {
- PxrBoundaryTriggerInfo testResult = new PxrBoundaryTriggerInfo();
- #if UNITY_ANDROID && !UNITY_EDITOR
- Pxr_TestNodeIsInBoundary(node, boundaryType == BoundaryType.PlayArea, ref testResult);
- testResult.closestPoint.z = -testResult.closestPoint.z;
- testResult.closestPointNormal.z = -testResult.closestPointNormal.z;
- if (!testResult.valid)
- {
- PLog.d(TAG, string.Format("Pxr_TestBoundaryNode({0}, {1}) API call failed!", node, boundaryType));
- }
- #endif
- return testResult;
- }
- public static PxrBoundaryTriggerInfo UPxr_TestPointIsInBoundary(PxrVector3f point, BoundaryType boundaryType)
- {
- PxrBoundaryTriggerInfo testResult = new PxrBoundaryTriggerInfo();
- #if UNITY_ANDROID && !UNITY_EDITOR
- Pxr_TestPointIsInBoundary(ref point, boundaryType == BoundaryType.PlayArea, ref testResult);
- if (!testResult.valid)
- {
- PLog.d(TAG, string.Format("Pxr_TestBoundaryPoint({0}, {1}) API call failed!", point, boundaryType));
- }
- #endif
- return testResult;
- }
- public static Vector3[] UPxr_GetBoundaryGeometry(BoundaryType boundaryType)
- {
- Vector3[] points = new Vector3[1];
- #if UNITY_ANDROID && !UNITY_EDITOR
- UInt32 pointsCountOutput = 0;
- PxrVector3f[] outPointsFirst = null;
- Pxr_GetBoundaryGeometry(boundaryType == BoundaryType.PlayArea, 0, ref pointsCountOutput, outPointsFirst);
- if (pointsCountOutput <= 0)
- {
- PLog.d(TAG, "Boundary geometry point count = " + pointsCountOutput);
- return null;
- }
- PxrVector3f[] outPoints = new PxrVector3f[pointsCountOutput];
- Pxr_GetBoundaryGeometry(boundaryType == BoundaryType.PlayArea, pointsCountOutput, ref pointsCountOutput, outPoints);
- points = new Vector3[pointsCountOutput];
- for (int i = 0; i < pointsCountOutput; i++)
- {
- points[i] = new Vector3()
- {
- x = outPoints[i].x,
- y = outPoints[i].y,
- z = -outPoints[i].z,
- };
- }
- #endif
- return points;
- }
- public static Vector3 UPxr_GetBoundaryDimensions(BoundaryType boundaryType)
- {
- // float x = 0, y = 0, z = 0;
- PxrVector3f dimension = new PxrVector3f();
- #if UNITY_ANDROID && !UNITY_EDITOR
- int ret = 0;
- Pxr_GetBoundaryDimensions( boundaryType == BoundaryType.PlayArea, out dimension);
- #endif
- return new Vector3(dimension.x, dimension.y, dimension.z);
- }
- public static void UPxr_SetBoundaryVisiable(bool value)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- Pxr_SetBoundaryVisible(value);
- #endif
- }
- public static bool UPxr_GetBoundaryVisiable()
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- return Pxr_GetBoundaryVisible();
- #else
- return true;
- #endif
- }
- public static bool UPxr_GetBoundaryConfigured()
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- return Pxr_GetBoundaryConfigured();
- #else
- return true;
- #endif
- }
- public static bool UPxr_GetBoundaryEnabled()
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- return Pxr_GetBoundaryEnabled();
- #else
- return true;
- #endif
- }
- public static int UPxr_SetSeeThroughBackground(bool value)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- return Pxr_SetSeeThroughBackground(value);
- #else
- return 0;
- #endif
- }
- public static int UPxr_GetSeeThroughState()
- {
- var state = 0;
- #if UNITY_ANDROID && !UNITY_EDITOR
- try
- {
- state = Pxr_GetSeeThroughState();
- PLog.d(TAG, "UPxr_GetSeeThroughState() state:" + state);
- }
- catch (Exception e)
- {
- Debug.Log("PXRLog UPxr_GetSeeThroughState :" + e.ToString());
- }
- #endif
- return state;
- }
- public static void UPxr_SetSeeThroughState(bool value)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- Pxr_SetVideoSeethroughState(value);
- #endif
- }
- public static void UPxr_ResetSeeThroughSensor()
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- if (PXR_Plugin.System.UPxr_GetAPIVersion() >= 0x2000301)
- {
- Pxr_ResetSensorHard();
- }
- #endif
- }
- public static PxrTrackingState UPxr_GetSeeThroughTrackingState()
- {
- int state = 0;
- #if UNITY_ANDROID && !UNITY_EDITOR
- if (PXR_Plugin.System.UPxr_GetAPIVersion() >= 0x2000301)
- {
- state = Pxr_GetTrackingState();
- }
- #endif
- return (PxrTrackingState)state;
- }
- public static int UPxr_SetGuardianSystemDisable(bool value)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- return Pxr_SetGuardianSystemDisable(value);
- #else
- return 0;
- #endif
- }
- public static int UPxr_ResumeGuardianSystemForSTS()
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- return Pxr_ResumeGuardianSystemForSTS();
- #else
- return 0;
- #endif
- }
- public static int UPxr_PauseGuardianSystemForSTS()
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- return Pxr_PauseGuardianSystemForSTS();
- #else
- return 0;
- #endif
- }
- public static int UPxr_ShutdownSdkGuardianSystem()
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- return Pxr_ShutdownSdkGuardianSystem();
- #else
- return 0;
- #endif
- }
- public static int UPxr_GetRoomModeState()
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- return Pxr_GetRoomModeState();
- #else
- return 0;
- #endif
- }
- public static int UPxr_DisableBoundary()
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- return Pxr_DisableBoundary();
- #else
- return 0;
- #endif
- }
- }
- public static class Render
- {
- private const string TAG = "[PXR_Plugin/Render]";
- public static bool UPxr_SetFoveationLevel(FoveationLevel level)
- {
- bool result = true;
- #if UNITY_ANDROID && !UNITY_EDITOR
- result = Pxr_SetFoveationLevelEnable((int)level);
- #endif
- PLog.i(TAG, "UPxr_SetFoveationLevel() level:" + level + " result:" + result);
- return result;
- }
- public static bool UPxr_SetEyeFoveationLevel(FoveationLevel level)
- {
- bool result = true;
- #if UNITY_ANDROID && !UNITY_EDITOR
- result = Pxr_SetEyeFoveationLevelEnable((int)level);
- #endif
- PLog.i(TAG, "UPxr_SetEyeFoveationLevel() level:" + level + " result:" + result);
- return result;
- }
- public static void UPxr_SetFFRSubsampled(bool enable)
- {
- PLog.d(TAG, "UPxr_SetFFRSubsampled() level:" + enable);
- #if UNITY_ANDROID && !UNITY_EDITOR
- Pxr_SetFFRSubsampled(enable);
- #endif
- }
- public static FoveationLevel UPxr_GetFoveationLevel()
- {
- FoveationLevel result = FoveationLevel.None;
- #if UNITY_ANDROID && !UNITY_EDITOR
- result = Pxr_GetFoveationLevel();
- #endif
- PLog.d(TAG, "UPxr_GetFoveationLevel() result:" + result);
- return result;
- }
- public static int UPxr_SetFoveationParameters(float foveationGainX, float foveationGainY, float foveationArea, float foveationMinimum)
- {
- PLog.d(TAG, "UPxr_SetFoveationParameters() foveationGainX:" + foveationGainX + " foveationGainY:" + foveationGainY + " foveationArea:" + foveationArea + " foveationMinimum:" + foveationMinimum);
- int result = 0;
- #if UNITY_ANDROID && !UNITY_EDITOR
- FoveationParams foveationParams = new FoveationParams();
- foveationParams.foveationGainX = foveationGainX;
- foveationParams.foveationGainY = foveationGainY;
- foveationParams.foveationArea = foveationArea;
- foveationParams.foveationMinimum = foveationMinimum;
- result = Pxr_SetFoveationParams(foveationParams);
- #endif
- PLog.d(TAG, "UPxr_SetFoveationParameters() result:" + result);
- return result;
- }
- public static int UPxr_GetFrustum(EyeType eye, ref float fovLeft, ref float fovRight, ref float fovUp, ref float fovDown, ref float near, ref float far)
- {
- int result = 0;
- #if UNITY_ANDROID && !UNITY_EDITOR
- result = Pxr_GetFrustum(eye, ref fovLeft, ref fovRight, ref fovUp, ref fovDown, ref near, ref far);
- #endif
- PLog.d(TAG, "UPxr_GetFrustum() result:" + result + " eye:" + eye + " fovLeft:" + fovLeft + " fovRight:" + fovRight + " fovUp:" + fovUp + " fovDown:" + fovDown + " near:" + near + " far:" + far);
- return result;
- }
- public static int UPxr_SetFrustum(EyeType eye, float fovLeft, float fovRight, float fovUp, float fovDown, float near, float far)
- {
- int result = 1;
- #if UNITY_ANDROID && !UNITY_EDITOR
- result = Pxr_SetFrustum(eye, fovLeft, fovRight, fovUp, fovDown, near, far);
- #endif
- PLog.d(TAG, "UPxr_SetFrustum() result:" + result + " eye:" + eye + " fovLeft:" + fovLeft + " fovRight:" + fovRight + " fovUp:" + fovUp + " fovDown:" + fovDown + " near:" + near + " far:" + far);
- return result;
- }
-
- public static int UPxr_SetEyeFOV(EyeType eye, float fovLeft, float fovRight, float fovUp, float fovDown)
- {
- int result = 0;
- ConfigType type;
- switch (eye)
- {
- case EyeType.EyeLeft:
- type = ConfigType.PxrLeftEyeFOV;
- break;
- case EyeType.EyeRight:
- type = ConfigType.PxrRightEyeFOV;
- break;
- default:
- type = ConfigType.PxrBothEyeFOV;
- break;
- }
- float[] fovData = new float[4];
- fovData[0] = -Mathf.Deg2Rad * fovLeft;
- fovData[1] = Mathf.Deg2Rad * fovRight;
- fovData[2] = Mathf.Deg2Rad * fovUp;
- fovData[3] = -Mathf.Deg2Rad * fovDown;
- #if UNITY_ANDROID && !UNITY_EDITOR
- if (PXR_Plugin.System.UPxr_GetAPIVersion() >= 0x2000300)
- {
- result = Pxr_SetConfigFloatArray(type, fovData, 4);
- }
- #endif
- PLog.d(TAG, string.Format("UPxr_SetEyeFOV Pxr_SetConfigFloatArray type = {0}, fovData[0] = {1}, fovData[1] = {2}, fovData[2] = {3}, fovData[3] = {4}, result = {5}", type, fovData[0], fovData[1], fovData[2], fovData[3], result));
- return result;
- }
- public static void UPxr_CreateLayer(IntPtr layerParam)
- {
- PLog.d(TAG, "UPxr_CreateLayer() ");
- #if UNITY_ANDROID && !UNITY_EDITOR
- Pxr_CreateLayer(layerParam);
- #endif
- }
- public static void UPxr_CreateLayerParam(PxrLayerParam layerParam)
- {
- PLog.d(TAG, "UPxr_CreateLayerParam() ");
- #if UNITY_ANDROID && !UNITY_EDITOR
- Pxr_CreateLayerParam(layerParam);
- #endif
- }
- public static int UPxr_GetLayerNextImageIndex(int layerId, ref int imageIndex)
- {
- int result = 0;
- #if UNITY_ANDROID && !UNITY_EDITOR
- result = Pxr_GetLayerNextImageIndex(layerId, ref imageIndex);
- #endif
- PLog.d(TAG, "UPxr_GetLayerNextImageIndex() layerId:" + layerId + " imageIndex:" + imageIndex + " result:" + result);
- return result;
- }
- public static int UPxr_GetLayerImageCount(int layerId, EyeType eye, ref UInt32 imageCount)
- {
- int result = 0;
- #if UNITY_ANDROID && !UNITY_EDITOR
- result = Pxr_GetLayerImageCount(layerId, eye, ref imageCount);
- #endif
- PLog.d(TAG, "UPxr_GetLayerImageCount() layerId:" + layerId + " eye:" + eye + " imageCount:" + imageCount + " result:" + result);
- return result;
- }
- public static int UPxr_GetLayerImage(int layerId, EyeType eye, int imageIndex, ref UInt64 image)
- {
- int result = 0;
- #if UNITY_ANDROID && !UNITY_EDITOR
- result = Pxr_GetLayerImage(layerId, eye, imageIndex, ref image);
- #endif
- PLog.d(TAG, "UPxr_GetLayerImage() layerId:" + layerId + " eye:" + eye + " imageIndex:" + imageIndex + " image:" + image + " result:" + result);
- return result;
- }
- public static void UPxr_GetLayerImagePtr(int layerId, EyeType eye, int imageIndex, ref IntPtr image)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- Pxr_GetLayerImagePtr(layerId, eye, imageIndex, ref image);
- #endif
- PLog.d(TAG, "UPxr_GetLayerImagePtr() layerId:" + layerId + " eye:" + eye + " imageIndex:" + imageIndex + " image:" + image);
- }
- public static int UPxr_SetConfigIntArray(int[] configSetData)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- if (PXR_Plugin.System.UPxr_GetAPIVersion() >= 0x2000300)
- {
- return Pxr_SetConfigIntArray(ConfigType.PxrAndroidLayerDimensions, configSetData, 3);
- }
- #endif
- return 0;
- }
- public static int UPxr_SetConfigFloatArray(ConfigType configIndex, float[] configSetData, int dataCount)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- if (PXR_Plugin.System.UPxr_GetAPIVersion() >= 0x2000300)
- {
- return Pxr_SetConfigFloatArray(configIndex, configSetData, dataCount);
- }
- #endif
- return 0;
- }
- public static int UPxr_GetLayerAndroidSurface(int layerId, EyeType eye, ref IntPtr androidSurface)
- {
- int result = 0;
- #if UNITY_ANDROID && !UNITY_EDITOR
- result = Pxr_GetLayerAndroidSurface(layerId, eye, ref androidSurface);
- #endif
- PLog.d(TAG, "UPxr_GetLayerAndroidSurface() layerId:" + layerId + " eye:" + eye + " androidSurface:" + androidSurface + " result:" + result);
- return result;
- }
- public static int UPxr_DestroyLayer(int layerId)
- {
- int result = 0;
- #if UNITY_ANDROID && !UNITY_EDITOR
- result = Pxr_DestroyLayer(layerId);
- #endif
- PLog.d(TAG, "UPxr_DestroyLayer() layerId:" + layerId + " result:" + result);
- return result;
- }
- public static void UPxr_DestroyLayerByRender(int layerId)
- {
- PLog.d(TAG, "UPxr_DestroyLayerByRender() layerId:" + layerId);
- #if UNITY_ANDROID && !UNITY_EDITOR
- Pxr_DestroyLayerByRender(layerId);
- #endif
- }
- public static int UPxr_SubmitLayer(IntPtr layer)
- {
- int result = 0;
- #if UNITY_ANDROID && !UNITY_EDITOR
- result = Pxr_SubmitLayer(layer);
- #endif
- PLog.d(TAG, "UPxr_SubmitLayer() layer:" + layer + " result:" + result);
- return result;
- }
- public static int UPxr_SubmitLayerQuad(PxrLayerQuad layer)
- {
- int result = 0;
- #if UNITY_ANDROID && !UNITY_EDITOR
- result = Pxr_SubmitLayerQuad(layer);
- #endif
- PLog.d(TAG, "UPxr_SubmitLayerQuad() layer:" + layer + " result:" + result);
- return result;
- }
- public static bool UPxr_SubmitLayerQuad2(PxrLayerQuad2 layer)
- {
- int result = 0;
- #if UNITY_ANDROID && !UNITY_EDITOR
- result = Pxr_SubmitLayerQuad2(layer);
- #endif
- PLog.d(TAG, "UPxr_SubmitLayerQuad2() layer:" + layer + " result:" + result);
- return result == -8;
- }
- public static int UPxr_SubmitLayerCylinder(PxrLayerCylinder layer)
- {
- int result = 0;
- #if UNITY_ANDROID && !UNITY_EDITOR
- result = Pxr_SubmitLayerCylinder(layer);
- #endif
- PLog.d(TAG, "UPxr_SubmitLayerCylinder() layer:" + layer + " result:" + result);
- return result;
- }
- public static bool UPxr_SubmitLayerCylinder2(PxrLayerCylinder2 layer)
- {
- int result = 0;
- #if UNITY_ANDROID && !UNITY_EDITOR
- result = Pxr_SubmitLayerCylinder2(layer);
- #endif
- PLog.d(TAG, "UPxr_SubmitLayerCylinder2() layer:" + layer + " result:" + result);
- return result == -8;
- }
- public static bool UPxr_SubmitLayerEquirect(PxrLayerEquirect layer) // shape 3
- {
- int result = 0;
- #if UNITY_ANDROID && !UNITY_EDITOR
- result = Pxr_SubmitLayerEquirect(layer);
- #endif
- PLog.d(TAG, "UPxr_SubmitLayerEquirect() layer:" + layer + " result:" + result);
- return result == -8;
- }
- public static bool UPxr_SubmitLayerEquirect2(PxrLayerEquirect2 layer) // shape 4
- {
- int result = 0;
- #if UNITY_ANDROID && !UNITY_EDITOR
- result = Pxr_SubmitLayerEquirect2(layer);
- #endif
- PLog.d(TAG, "UPxr_SubmitLayerEquirect2() layer:" + layer + " result:" + result);
- return result == -8;
- }
- public static int UPxr_SubmitLayerCube2(PxrLayerCube2 layer)
- {
- int result = 0;
- #if UNITY_ANDROID && !UNITY_EDITOR
- result = Pxr_SubmitLayerCube2(layer);
- #endif
- PLog.d(TAG, "UPxr_SubmitLayerCube2() layer:" + layer + " result:" + result);
- return result;
- }
- public static int UPxr_SubmitLayerEac2(PxrLayerEac2 layer)
- {
- int result = 0;
- #if UNITY_ANDROID && !UNITY_EDITOR
- result = Pxr_SubmitLayerEac2(layer);
- #endif
- PLog.d(TAG, "UPxr_SubmitLayerEac2() layer:" + layer + " result:" + result);
- return result;
- }
- public static void UPxr_SetLayerBlend(bool enable, PxrLayerBlend layerBlend)
- {
- PLog.d(TAG, "UPxr_SetLayerBlend() enable:" + enable + " layerBlend.srcColor:" + layerBlend.srcColor + " dstColor:" + layerBlend.dstColor + " srcAlpha:" + layerBlend.srcAlpha + " dstAlpha:" + layerBlend.dstAlpha);
- #if UNITY_ANDROID && !UNITY_EDITOR
- Pxr_SetLayerBlend(enable, layerBlend);
- #endif
- }
- public static void UPxr_SetSpaceWarp(bool value)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- Pxr_SetSpaceWarp(value?1:0);
- #endif
- PLog.d(TAG, "UPxr_SetSpaceWarp " + value);
- }
- public static void UPxr_SetAppSpacePosition(float x, float y, float z)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- Pxr_SetAppSpacePosition(x, y, z);
- #endif
- }
- public static void UPxr_SetAppSpaceRotation(float x, float y, float z, float w)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- Pxr_SetAppSpaceRotation(x, y, z, w);
- #endif
- }
- public static void UPxr_EnablePremultipliedAlpha(bool enable)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- Pxr_EnablePremultipliedAlpha(enable);
- #endif
- PLog.i(TAG, "Pxr_EnablePremultipliedAlpha " + enable);
- }
- }
- public static class Sensor
- {
- private const string TAG = "[PXR_Plugin/Sensor]";
- #if UNITY_ANDROID && !UNITY_EDITOR
- private static AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
- private static AndroidJavaObject currentActivity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
- private static AndroidJavaClass sysActivity = new AndroidJavaClass("com.psmart.aosoperation.SysActivity");
- #endif
- public static int UPxr_ResetSensor(ResetSensorOption resetSensorOption)
- {
- PLog.d(TAG, string.Format("UPxr_ResetSensor : {0}", resetSensorOption));
- int result = 0;
- #if UNITY_ANDROID && !UNITY_EDITOR
- result = Pxr_ResetSensor(resetSensorOption);
- #endif
- PLog.d(TAG, string.Format("UPxr_ResetSensor result: {0}", result));
- return result;
- }
- public static int UPvr_Enable6DofModule(bool enable)
- {
- PLog.d(TAG, string.Format("UPvr_Enable6DofModule : {0}", enable));
- #if UNITY_ANDROID && !UNITY_EDITOR
- return Pxr_SetConfigInt(ConfigType.Ability6Dof, enable?1:0);
- #else
- return 0;
- #endif
- }
- public static void UPxr_InitPsensor()
- {
- PLog.d(TAG, "UPxr_InitPsensor()");
- #if UNITY_ANDROID && !UNITY_EDITOR
- try
- {
- sysActivity.CallStatic("initPsensor", currentActivity);
- }
- catch (Exception e)
- {
- PLog.e(TAG, "Error :" + e.ToString());
- }
- #endif
- }
- public static int UPxr_GetPSensorState()
- {
- PLog.d(TAG, "UPxr_GetPSensorState()");
- int psensor = -1;
- #if UNITY_ANDROID && !UNITY_EDITOR
- try
- {
- psensor = sysActivity.CallStatic<int>("getPsensorState");
- }
- catch (Exception e)
- {
- PLog.e(TAG, "Error :" + e.ToString());
- }
- #endif
- PLog.d(TAG, "UPxr_GetPSensorState() psensor:" + psensor);
- return psensor;
- }
- public static void UPxr_UnregisterPsensor()
- {
- PLog.d(TAG, "UPxr_UnregisterPsensor()");
- #if UNITY_ANDROID && !UNITY_EDITOR
- try
- {
- sysActivity.CallStatic("unregisterListener");
- }
- catch (Exception e)
- {
- PLog.e(TAG, "Error :" + e.ToString());
- }
- #endif
- }
- public static int UPxr_SetSensorLostCustomMode(bool value)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- return Pxr_SetSensorLostCustomMode(value);
- #else
- return 0;
- #endif
- }
- public static int UPxr_SetSensorLostCMST(bool value)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- return Pxr_SetSensorLostCMST(value);
- #else
- return 0;
- #endif
- }
- }
- public static class PlatformSetting
- {
- private const string TAG = "[PXR_Plugin/PlatformSetting]";
- #if UNITY_ANDROID && !UNITY_EDITOR
- private static AndroidJavaClass MRCCalibration = new AndroidJavaClass("com.psmart.aosoperation.MRCCalibration");
- private static AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
- private static AndroidJavaObject currentActivity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
- #endif
- public static float[] UPxr_MRCCalibration(string path)
- {
- float[] MRCdata = new float[10];
- if (PXR_Plugin.System.UPxr_GetAPIVersion() >= 0x2000300)
- {
- AndroidJavaObject MrcCalibration = new AndroidJavaObject("com.psmart.aosoperation.MRCCalibration");
- #if UNITY_ANDROID && !UNITY_EDITOR
- MRCdata = MrcCalibration.Call<float[]>("readCalibrationData",path);
- #endif
- }
- return MRCdata;
- }
- }
- public static class Controller
- {
- private const string TAG = "[PXR_Plugin/Controller]";
- public static int UPxr_SetControllerVibration(UInt32 hand, float strength, int time)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- return Pxr_SetControllerVibration(hand,strength, time);
- #else
- return 0;
- #endif
- }
- public static int UPxr_SetControllerEnableKey(bool isEnable, PxrControllerKeyMap Key)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- return Pxr_SetControllerEnableKey(isEnable, Key);
- #else
- return 0;
- #endif
- }
- public static int UPxr_GetBodyTrackingPose(double predictTime, ref BodyTrackerResult bodyTrackerResult)
- {
- int state = 1;
- #if UNITY_ANDROID && !UNITY_EDITOR
- state = Pxr_GetBodyTrackingPose(predictTime,ref bodyTrackerResult);
- for (int i = 0; i < 24; i++) {
- bodyTrackerResult.trackingdata[i].localpose.PosZ = -bodyTrackerResult.trackingdata[i].localpose.PosZ;
- bodyTrackerResult.trackingdata[i].localpose.RotQz = -bodyTrackerResult.trackingdata[i].localpose.RotQz;
- bodyTrackerResult.trackingdata[i].localpose.RotQw = -bodyTrackerResult.trackingdata[i].localpose.RotQw;
- bodyTrackerResult.trackingdata[i].velo[2] = -bodyTrackerResult.trackingdata[i].velo[2];
- bodyTrackerResult.trackingdata[i].acce[2] = -bodyTrackerResult.trackingdata[i].acce[2];
- bodyTrackerResult.trackingdata[i].wvelo[2] = -bodyTrackerResult.trackingdata[i].wvelo[2];
- bodyTrackerResult.trackingdata[i].wacce[2] = -bodyTrackerResult.trackingdata[i].wacce[2];
- }
- #endif
- return state;
- }
- public static int UPxr_SetBodyTrackingMode(int mode) {
- #if UNITY_ANDROID && !UNITY_EDITOR
- return Pxr_SetBodyTrackingMode(mode);
- #endif
- return 0;
- }
- public static int UPxr_GetFitnessBandConnectState(ref PxrFitnessBandConnectState state)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- return Pxr_GetFitnessBandConnectState(ref state);
- #endif
- return 0;
- }
- public static int UPxr_GetFitnessBandBattery(int trackerId, ref int battery) {
- #if UNITY_ANDROID && !UNITY_EDITOR
- return Pxr_GetFitnessBandBattery(trackerId, ref battery);
- #endif
- return 0;
- }
- public static int UPxr_GetFitnessBandCalibState(ref int calibrated) {
- #if UNITY_ANDROID && !UNITY_EDITOR
- return Pxr_GetFitnessBandCalibState(ref calibrated);
- #endif
- return 0;
- }
- public static int UPxr_SetSwiftMode(int mode)
- {
- if (System.UPxr_GetAPIVersion() >= 0x200030C)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- BodyTrackingAlgParam pxrBodyTrackingAlgParam = new BodyTrackingAlgParam();
- pxrBodyTrackingAlgParam.BodyJointSet = mode;
- return Pxr_SetBodyTrackingAlgParam(BodyTrackingAlgParamType.SWIFT_MODE, ref pxrBodyTrackingAlgParam);
- #endif
- }
- return 0;
- }
- public static int UPxr_SetBodyTrackingBoneLength(BodyTrackingBoneLength boneLength)
- {
- if (System.UPxr_GetAPIVersion() >= 0x200030C)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- BodyTrackingAlgParam pxrBodyTrackingAlgParam = new BodyTrackingAlgParam();
- pxrBodyTrackingAlgParam.BodyJointSet = 1;
- pxrBodyTrackingAlgParam.BoneLength = boneLength;
- return Pxr_SetBodyTrackingAlgParam(BodyTrackingAlgParamType.BONE_PARAM, ref pxrBodyTrackingAlgParam);
- #endif
- }
- return 0;
- }
- public static int UPxr_SetControllerVibrationEvent(UInt32 hand, int frequency, float strength, int time)
- {
- if (PXR_Plugin.System.UPxr_GetAPIVersion() >= 0x2000305)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- return Pxr_SetControllerVibrationEvent(hand, frequency,strength, time);
- #endif
- }
- return 0;
- }
- public static int UPxr_GetControllerType()
- {
- var type = 0;
- #if UNITY_ANDROID && !UNITY_EDITOR
- PxrControllerCapability capability = new PxrControllerCapability();
- Pxr_GetControllerCapabilities(0,ref capability);
- type = (int)capability.type;
- #endif
- PLog.d(TAG, "UPxr_GetControllerType()" + type);
- return type;
- }
- //Pxr_StopControllerVCMotor
- public static int UPxr_StopControllerVCMotor(int id)
- {
- if (PXR_Plugin.System.UPxr_GetAPIVersion() >= 0x2000308)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- Debug.Log("[VCMotor_SDK] StopControllerVCMotor :" + id.ToString());
- return Pxr_StopControllerVCMotor(id);
- #endif
- }
- return 0;
- }
- public static int UPxr_StartControllerVCMotor(string file, int slot)
- {
- //0-Left And Right 1-Left 2-Right 3-Left And Right
- //0-Reversal 1-No Reversal
- if (PXR_Plugin.System.UPxr_GetAPIVersion() >= 0x2000308)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- Debug.Log("[VCMotor_SDK] StartControllerVCMotor " + file + " slot: " + slot.ToString());
- return Pxr_StartControllerVCMotor(file,slot);
- #endif
- }
- return 0;
- }
- public static int UPxr_SetControllerAmp(float mode)
- {
- if (PXR_Plugin.System.UPxr_GetAPIVersion() >= 0x2000305)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- return Pxr_SetControllerAmp(mode);
- #endif
- }
- return 0;
- }
- public static int UPxr_SetControllerDelay()
- {
- if (PXR_Plugin.System.UPxr_GetAPIVersion() >= 0x2000305)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- int delay = 3;
- int Length;
- int num;
- AudioSettings.GetDSPBufferSize(out Length, out num);
- if (Length == 256)
- {
- delay = 1;
- }
- else if (Length == 512) {
- delay = 2;
- } else if (Length == 1024) {
- delay = 3;
- }
- Debug.Log("[VCMotor_SDK] UPxr_SetControllerDelay " + delay.ToString());
- return Pxr_SetControllerDelay(delay);
- #endif
- }
- return 0;
- }
- public static string UPxr_GetVibrateDelayTime(ref int x)
- {
- if (PXR_Plugin.System.UPxr_GetAPIVersion() >= 0x2000305)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- return Pxr_GetVibrateDelayTime(ref x);
- #endif
- }
- return " ";
- }
- public static int UPxr_StartVibrateBySharem(float[] data, int slot, int buffersize, int sampleRate, int channelMask, int bitrate ,int channelFlip, ref int sourceId)
- {
- if (PXR_Plugin.System.UPxr_GetAPIVersion() >= 0x2000308)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- AudioClipData audioClipData = new AudioClipData();
- audioClipData.slot = slot;
- audioClipData.channelCounts = channelMask;
- audioClipData.buffersize = (UInt64)buffersize;
- audioClipData.sampleRate = sampleRate;
- audioClipData.reversal = channelFlip;
- audioClipData.bitrate = bitrate;
- audioClipData.isCache = 0;
- Debug.Log("[VCMotor_SDK] Pxr_StartVibrateBySharem " + " slot: " + audioClipData.slot.ToString() + " buffersize:" + audioClipData.buffersize.ToString() + " sampleRate" + audioClipData.sampleRate.ToString() + " channelCounts:" + audioClipData.channelCounts.ToString()+" bitrate:" + audioClipData.bitrate.ToString());
- return Pxr_StartVibrateBySharemF(data, ref audioClipData, ref sourceId);
- #endif
- }
- return 0;
- }
- public static int UPxr_SaveVibrateByCache(float[] data, int slot, int buffersize, int sampleRate, int channelMask, int bitrate, int slotconfig, int enableV , ref int sourceId)
- {
- if (PXR_Plugin.System.UPxr_GetAPIVersion() >= 0x2000308)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- AudioClipData audioClipData = new AudioClipData();
- audioClipData.slot = slot;
- audioClipData.buffersize = (UInt64)buffersize;
- audioClipData.sampleRate = sampleRate;
- audioClipData.channelCounts = channelMask;
- audioClipData.bitrate = bitrate;
- audioClipData.reversal = slotconfig;
- audioClipData.isCache = enableV;
- Debug.Log("[VCMotor_SDK] UPxr_SaveVibrateByCache " + " slot: " + audioClipData.slot.ToString() + " buffersize:" + audioClipData.buffersize.ToString() + " sampleRate" + audioClipData.sampleRate.ToString() + " channelMask:" + audioClipData.channelCounts.ToString() + " bitrate:" + audioClipData.bitrate.ToString());
- return Pxr_StartVibrateBySharemF(data, ref audioClipData, ref sourceId);
- #endif
- }
- return 0;
- }
- public static int UPxr_StartVibrateByCache(int clicpid)
- {
- if (PXR_Plugin.System.UPxr_GetAPIVersion() >= 0x2000308)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- Debug.Log("[VCMotor_SDK] UPxr_StartVibrateByCache " + clicpid.ToString());
- return Pxr_StartVibrateByCache(clicpid);
- #endif
- }
- return 0;
- }
- public static int UPxr_ClearVibrateByCache(int clicpid)
- {
- if (PXR_Plugin.System.UPxr_GetAPIVersion() >= 0x2000308)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- Debug.Log("[VCMotor_SDK] UPxr_ClearVibrateByCache " + clicpid.ToString());
- return Pxr_ClearVibrateByCache(clicpid);
- #endif
- }
- return 0;
- }
- public static int UPxr_StartVibrateByPHF(string data, int buffersize, ref int sourceId, int slot, int reversal, float amp) {
- if (PXR_Plugin.System.UPxr_GetAPIVersion() >= 0x2000308)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- VibrateInfo vibrateInfo = new VibrateInfo();
- vibrateInfo.slot = (uint)slot;
- vibrateInfo.reversal = (uint)reversal;
- vibrateInfo.amp = amp;
- Debug.Log("[VCMotor_SDK] Pxr_StartVibrateByPHF " + buffersize.ToString());
- return Pxr_StartVibrateByPHF(data, buffersize, ref sourceId, ref vibrateInfo);
- #endif
- }
- return 0;
- }
- public static int UPxr_PauseVibrate(int sourceID) {
- if (PXR_Plugin.System.UPxr_GetAPIVersion() >= 0x2000308)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- Debug.Log("[VCMotor_SDK] Pxr_PauseVibrate " + sourceID.ToString());
- return Pxr_PauseVibrate(sourceID);
- #endif
- }
- return 0;
- }
- public static int UPxr_ResumeVibrate(int sourceID) {
- if (PXR_Plugin.System.UPxr_GetAPIVersion() >= 0x2000308)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- Debug.Log("[VCMotor_SDK] Pxr_ResumeVibrate " + sourceID.ToString());
- return Pxr_ResumeVibrate(sourceID);
- #endif
- }
- return 0;
- }
- public static int UPxr_UpdateVibrateParams(int clicp_id,int slot, int reversal, float amp) {
- if (PXR_Plugin.System.UPxr_GetAPIVersion() >= 0x2000308)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- VibrateInfo vibrateInfo = new VibrateInfo();
- vibrateInfo.slot = (uint)slot;
- vibrateInfo.reversal = (uint)reversal;
- vibrateInfo.amp = amp;
- Debug.Log("[VCMotor_SDK] UPxr_UpdateVibrateParams " + clicp_id.ToString() + " solt: " + slot.ToString() + " reversal:" + reversal.ToString() + " AMP:" + amp.ToString());
- return Pxr_UpdateVibrateParams(clicp_id, ref vibrateInfo);
- #endif
- }
- return 0;
- }
- public static int UPxr_CreateHapticStream(string phfVersion, UInt32 frameDurationMs, ref VibrateInfo hapticInfo, float speed, ref int id) {
- if (PXR_Plugin.System.UPxr_GetAPIVersion() >= 0x200030A)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- Debug.Log("[VCMotor_SDK] UPxr_CreateHapticStream ");
- return Pxr_CreateHapticStream(phfVersion, frameDurationMs, ref hapticInfo, speed, ref id);
- #endif
- }
- return 0;
- }
- public static int UPxr_WriteHapticStream(int id, ref PxrPhfParamsNum frames, UInt32 numFrames) {
- if (PXR_Plugin.System.UPxr_GetAPIVersion() >= 0x200030A)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- Debug.Log("[VCMotor_SDK] UPxr_WriteHapticStream ");
- return Pxr_WriteHapticStream( id, ref frames, numFrames);
- #endif
- }
- return 0;
- }
- public static int UPxr_SetPHFHapticSpeed(int id, float speed) {
- if (PXR_Plugin.System.UPxr_GetAPIVersion() >= 0x200030A)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- Debug.Log("[VCMotor_SDK] UPxr_SetPHFHapticSpeed ");
- return Pxr_SetPHFHapticSpeed( id, speed);
- #endif
- }
- return 0;
- }
- public static int UPxr_GetPHFHapticSpeed(int id, ref float speed) {
- if (PXR_Plugin.System.UPxr_GetAPIVersion() >= 0x200030A)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- Debug.Log("[VCMotor_SDK] UPxr_GetPHFHapticSpeed ");
- return Pxr_GetPHFHapticSpeed( id, ref speed);
- #endif
- }
- return 0;
- }
- public static int UPxr_GetCurrentFrameSequence(int id, ref UInt64 frameSequence) {
- if (PXR_Plugin.System.UPxr_GetAPIVersion() >= 0x200030A)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- Debug.Log("[VCMotor_SDK] UPxr_GetCurrentFrameSequence ");
- return Pxr_GetCurrentFrameSequence( id, ref frameSequence);
- #endif
- }
- return 0;
- }
- public static int UPxr_StartPHFHaptic(int source_id) {
- if (PXR_Plugin.System.UPxr_GetAPIVersion() >= 0x200030A)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- Debug.Log("[VCMotor_SDK] UPxr_StartPHFHaptic ");
- return Pxr_StartPHFHaptic(source_id);
- #endif
- }
- return 0;
- }
- public static int UPxr_StopPHFHaptic(int source_id) {
- if (PXR_Plugin.System.UPxr_GetAPIVersion() >= 0x200030A)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- Debug.Log("[VCMotor_SDK] UPxr_StopPHFHaptic ");
- return Pxr_StopPHFHaptic(source_id);
- #endif
- }
- return 0;
- }
- public static int UPxr_RemovePHFHaptic(int source_id) {
- if (PXR_Plugin.System.UPxr_GetAPIVersion() >= 0x200030A)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- Debug.Log("[VCMotor_SDK] UPxr_RemovePHFHaptic ");
- return Pxr_RemovePHFHaptic(source_id);
- #endif
- }
- return 0;
- }
- public static int UPxr_SetControllerMainInputHandle(UInt32 hand)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- return Pxr_SetControllerMainInputHandle(hand);
- #else
- return 0;
- #endif
- }
- public static PXR_Input.Controller UPxr_GetControllerMainInputHandle()
- {
- var hand = 0;
- #if UNITY_ANDROID && !UNITY_EDITOR
- Pxr_GetControllerMainInputHandle(ref hand);
- #endif
- PLog.d(TAG, "Pxr_GetControllerMainInputHandle()" + hand.ToString());
- return (PXR_Input.Controller)hand;
- }
- public static int UPxr_GetControllerTrackingState(UInt32 deviceID, double predictTime, float[] headSensorData, ref PxrControllerTracking tracking)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- return Pxr_GetControllerTrackingState(deviceID,predictTime,headSensorData, ref tracking);
- #else
- return 0;
- #endif
- }
- public static void UPxr_SetControllerOriginOffset(int controllerID, Vector3 offset)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- Pxr_SetControllerOriginOffset(controllerID, offset);
- #endif
- }
- public static void UPxr_ResetController()
- {
- if (System.UPxr_GetAPIVersion() >= 0x200030B)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- Pxr_ResetController(0);
- #endif
- }
- }
- public static void UPxr_SetArmModelParameters(PxrGazeType gazetype, PxrArmModelType armmodeltype, float elbowHeight, float elbowDepth, float pointerTiltAngle)
- {
- if (System.UPxr_GetAPIVersion() >= 0x200030B)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- Pxr_SetArmModelParameters(gazetype, armmodeltype, elbowHeight, elbowDepth, pointerTiltAngle);
- #endif
- }
- }
- public static void UPxr_GetControllerHandness(ref int deviceID)
- {
- if (System.UPxr_GetAPIVersion() >= 0x200030B)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- Pxr_GetControllerHandness(ref deviceID);
- #endif
- }
- }
- }
- public static class HandTracking
- {
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_GetHandTrackerSettingState(ref bool settingState);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_GetHandTrackerActiveInputType(ref ActiveInputDevice activeInputDevice);
- [DllImport(PXR_PLATFORM_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_GetHandTrackerAimState(HandType hand, ref HandAimState aimState);
- [DllImport(PXR_PLATFORM_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_GetHandTrackerJointLocations(HandType hand, ref HandJointLocations jointLocations);
- public static bool UPxr_GetHandTrackerSettingState()
- {
- bool val = false;
- if (System.UPxr_GetAPIVersion() >= 0x2000306)
- {
- #if !UNITY_EDITOR && UNITY_ANDROID
- Pxr_GetHandTrackerSettingState(ref val);
- #endif
- }
- return val;
- }
- public static ActiveInputDevice UPxr_GetHandTrackerActiveInputType()
- {
- ActiveInputDevice val = ActiveInputDevice.HeadActive;
- if (System.UPxr_GetAPIVersion() >= 0x2000307)
- {
- #if !UNITY_EDITOR && UNITY_ANDROID
- Pxr_GetHandTrackerActiveInputType(ref val);
- #endif
- }
- return val;
- }
- public static bool UPxr_GetHandTrackerAimState(HandType hand, ref HandAimState aimState)
- {
- bool val = false;
- if (System.UPxr_GetAPIVersion() >= 0x2000306)
- {
- #if !UNITY_EDITOR && UNITY_ANDROID
- val = Pxr_GetHandTrackerAimState(hand,ref aimState) == 0;
- #endif
- }
- return val;
- }
- public static bool UPxr_GetHandTrackerJointLocations(HandType hand, ref HandJointLocations jointLocations)
- {
- bool val = false;
- if (System.UPxr_GetAPIVersion() >= 0x2000306)
- {
- #if !UNITY_EDITOR && UNITY_ANDROID
- val = Pxr_GetHandTrackerJointLocations(hand, ref jointLocations) == 0;
- #endif
- }
- return val;
- }
- }
- public static class MotionTracking
- {
- #region Eye Tracking
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_WantEyeTrackingService();
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_GetEyeTrackingSupported(ref bool supported, ref int supportedModesCount, ref EyeTrackingMode supportedModes);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_StartEyeTracking1(ref EyeTrackingStartInfo startInfo);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_StopEyeTracking1(ref EyeTrackingStopInfo stopInfo);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_GetEyeTrackingState(ref bool isTracking, ref EyeTrackingState state);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_GetEyeTrackingData1(ref EyeTrackingDataGetInfo getInfo, ref EyeTrackingData data);
- [DllImport(PXR_PLATFORM_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_GetEyeOpenness(ref float leftEyeOpenness, ref float rightEyeOpenness);
- [DllImport(PXR_PLATFORM_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_GetEyePupilInfo(ref EyePupilInfo eyePupilPosition);
- [DllImport(PXR_PLATFORM_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_GetPerEyePose(ref long timestamp, ref Posef leftEyePose, ref Posef rightPose);
- [DllImport(PXR_PLATFORM_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_GetEyeBlink(ref long timestamp, ref bool isLeftBlink, ref bool isRightBlink);
- public static int UPxr_WantEyeTrackingService()
- {
- int val = 0;
- if (System.UPxr_GetAPIVersion() >= 0x200030C)
- {
- #if !UNITY_EDITOR && UNITY_ANDROID
- val = Pxr_WantEyeTrackingService();
- #endif
- }
- return val;
- }
- public static int UPxr_GetEyeTrackingSupported(ref bool supported, ref int supportedModesCount, ref EyeTrackingMode supportedModes)
- {
- int val = -1;
- if (System.UPxr_GetAPIVersion() >= 0x200030C)
- {
- #if !UNITY_EDITOR && UNITY_ANDROID
- val = Pxr_GetEyeTrackingSupported(ref supported, ref supportedModesCount, ref supportedModes);
- #endif
- }
- return val;
- }
- public static int UPxr_StartEyeTracking1(ref EyeTrackingStartInfo startInfo)
- {
- int val = -1;
- if (System.UPxr_GetAPIVersion() >= 0x200030C)
- {
- #if !UNITY_EDITOR && UNITY_ANDROID
- val = Pxr_StartEyeTracking1(ref startInfo);
- #endif
- }
- return val;
- }
- public static int UPxr_StopEyeTracking1(ref EyeTrackingStopInfo stopInfo)
- {
- int val = -1;
- if (System.UPxr_GetAPIVersion() >= 0x200030C)
- {
- #if !UNITY_EDITOR && UNITY_ANDROID
- val = Pxr_StopEyeTracking1(ref stopInfo);
- #endif
- }
- return val;
- }
- public static int UPxr_GetEyeTrackingState(ref bool isTracking, ref EyeTrackingState state)
- {
- int val = -1;
- if (System.UPxr_GetAPIVersion() >= 0x200030C)
- {
- #if !UNITY_EDITOR && UNITY_ANDROID
- val = Pxr_GetEyeTrackingState(ref isTracking, ref state);
- #endif
- }
- return val;
- }
- public static int UPxr_GetEyeTrackingData1(ref EyeTrackingDataGetInfo getInfo, ref EyeTrackingData data)
- {
- int val = -1;
- if (System.UPxr_GetAPIVersion() >= 0x200030C)
- {
- #if !UNITY_EDITOR && UNITY_ANDROID
- val = Pxr_GetEyeTrackingData1(ref getInfo, ref data);
- #endif
- }
- return val;
- }
- public static int UPxr_GetEyeOpenness(ref float leftEyeOpenness, ref float rightEyeOpenness)
- {
- int val = 0;
- if (System.UPxr_GetAPIVersion() >= 0x200030C)
- {
- #if !UNITY_EDITOR && UNITY_ANDROID
- val = Pxr_GetEyeOpenness(ref leftEyeOpenness, ref rightEyeOpenness);
- #endif
- }
- return val;
- }
- public static int UPxr_GetEyePupilInfo(ref EyePupilInfo eyePupilPosition)
- {
- int val = 0;
- if (System.UPxr_GetAPIVersion() >= 0x200030C)
- {
- #if !UNITY_EDITOR && UNITY_ANDROID
- val = Pxr_GetEyePupilInfo(ref eyePupilPosition);
- #endif
- }
- return val;
- }
- public static int UPxr_GetPerEyePose(ref long timestamp, ref Posef leftEyePose, ref Posef rightPose)
- {
- int val = 0;
- if (System.UPxr_GetAPIVersion() >= 0x200030C)
- {
- #if !UNITY_EDITOR && UNITY_ANDROID
- val = Pxr_GetPerEyePose(ref timestamp, ref leftEyePose, ref rightPose);
- #endif
- }
- return val;
- }
- public static int UPxr_GetEyeBlink(ref long timestamp, ref bool isLeftBlink, ref bool isRightBlink)
- {
- int val = 0;
- if (System.UPxr_GetAPIVersion() >= 0x200030C)
- {
- #if !UNITY_EDITOR && UNITY_ANDROID
- val = Pxr_GetEyeBlink(ref timestamp, ref isLeftBlink, ref isRightBlink);
- #endif
- }
- return val;
- }
- #endregion
- #region Face Tracking
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_WantFaceTrackingService();
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_GetFaceTrackingSupported(ref bool supported, ref int supportedModesCount, ref FaceTrackingSupportedMode supportedModes);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_StartFaceTracking(ref FaceTrackingStartInfo startInfo);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_StopFaceTracking(ref FaceTrackingStopInfo stopInfo);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_GetFaceTrackingState(ref bool isTracking, ref FaceTrackingState state);
- [DllImport(PXR_API_DLL, CallingConvention = CallingConvention.Cdecl)]
- private static extern int Pxr_GetFaceTrackingData1(ref FaceTrackingDataGetInfo getInfo, ref FaceTrackingData data);
- public static int UPxr_WantFaceTrackingService()
- {
- int val = -1;
- if (System.UPxr_GetAPIVersion() >= 0x200030C)
- {
- #if !UNITY_EDITOR && UNITY_ANDROID
- val = Pxr_WantFaceTrackingService();
- #endif
- }
- return val;
- }
- public static int UPxr_GetFaceTrackingSupported(ref bool supported, ref int supportedModesCount, ref FaceTrackingSupportedMode supportedModes)
- {
- int val = -1;
- if (System.UPxr_GetAPIVersion() >= 0x200030C)
- {
- #if !UNITY_EDITOR && UNITY_ANDROID
- val = Pxr_GetFaceTrackingSupported(ref supported, ref supportedModesCount, ref supportedModes);
- #endif
- }
- return val;
- }
- public static int UPxr_StartFaceTracking(ref FaceTrackingStartInfo startInfo)
- {
- int val = -1;
- if (System.UPxr_GetAPIVersion() >= 0x200030C)
- {
- #if !UNITY_EDITOR && UNITY_ANDROID
- val = Pxr_StartFaceTracking(ref startInfo);
- #endif
- }
- return val;
- }
- public static int UPxr_StopFaceTracking(ref FaceTrackingStopInfo stopInfo)
- {
- int val = -1;
- if (System.UPxr_GetAPIVersion() >= 0x200030C)
- {
- #if !UNITY_EDITOR && UNITY_ANDROID
- val = Pxr_StopFaceTracking(ref stopInfo);
- #endif
- }
- return val;
- }
- public static int UPxr_GetFaceTrackingState(ref bool isTracking, ref FaceTrackingState state)
- {
- int val = -1;
- if (System.UPxr_GetAPIVersion() >= 0x200030C)
- {
- #if !UNITY_EDITOR && UNITY_ANDROID
- val = Pxr_GetFaceTrackingState(ref isTracking, ref state);
- #endif
- }
- return val;
- }
- public static int UPxr_GetFaceTrackingData1(ref FaceTrackingDataGetInfo getInfo, ref FaceTrackingData data)
- {
- int val = -1;
- if (System.UPxr_GetAPIVersion() >= 0x200030C)
- {
- #if !UNITY_EDITOR && UNITY_ANDROID
- val = Pxr_GetFaceTrackingData1(ref getInfo, ref data);
- #endif
- }
- return val;
- }
- #endregion
- }
- public static class MixedReality
- {
- private const string TAG = "[PXR_Plugin/MixedReality]";
- public static int UPxr_EnableVideoSeeThroughEffect(bool value)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- return Pxr_EnablePassthroughStyle(value);
- #else
- return -1;
- #endif
- }
- public static int UPxr_SetVideoSeeThroughEffect(PxrLayerEffect type, float value, float duration)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- return Pxr_SetPassthroughStyle(type, value, duration);
- #else
- return -1;
- #endif
- }
- public static int UPxr_SetVideoSeeThroughLUT(ref byte[] data, int width, int height, int row, int col)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- return Pxr_SetPassthroughLUT(ref data, width, height, row, col);
- #else
- return -1;
- #endif
- }
- public static PxrResult UPxr_CreateAnchorEntity(ref PxrAnchorEntityCreateInfo info, out ulong anchorHandle)
- {
- anchorHandle = ulong.MinValue;
- #if UNITY_ANDROID && !UNITY_EDITOR
- return Pxr_CreateAnchorEntity(ref info,out anchorHandle);
- #else
- return PxrResult.TIMEOUT_EXPIRED;
- #endif
- }
- public static PxrResult UPxr_DestroyAnchorEntity(ref PxrAnchorEntityDestroyInfo info)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- return Pxr_DestroyAnchorEntity(ref info);
- #else
- return PxrResult.TIMEOUT_EXPIRED;
- #endif
- }
- public static PxrResult UPxr_PersistAnchorEntity(ref PxrAnchorEntityPersistInfo info, out ulong taskId)
- {
- taskId = ulong.MinValue;
- #if UNITY_ANDROID && !UNITY_EDITOR
- return Pxr_PersistAnchorEntity(ref info, out taskId);
- #else
- return PxrResult.TIMEOUT_EXPIRED;
- #endif
- }
- public static PxrResult UPxr_UnpersistAnchorEntity(ref PxrAnchorEntityUnPersistInfo info, out ulong taskId)
- {
- taskId = ulong.MinValue;
- #if UNITY_ANDROID && !UNITY_EDITOR
- return Pxr_UnpersistAnchorEntity(ref info, out taskId);
- #else
- return PxrResult.TIMEOUT_EXPIRED;
- #endif
- }
- public static PxrResult UPxr_ClearPersistedAnchorEntity(ref PxrAnchorEntityClearInfo info, out ulong taskId)
- {
- taskId = ulong.MinValue;
- #if UNITY_ANDROID && !UNITY_EDITOR
- return Pxr_ClearPersistedAnchorEntity(ref info, out taskId);
- #else
- return PxrResult.TIMEOUT_EXPIRED;
- #endif
- }
- public static PxrResult UPxr_GetAnchorPose(ulong anchorHandle, PxrTrackingOrigin origin, out PxrPosef pose)
- {
- pose = new PxrPosef();
- #if UNITY_ANDROID && !UNITY_EDITOR
- return Pxr_GetAnchorPose(anchorHandle,origin, out pose);
- #else
- return PxrResult.TIMEOUT_EXPIRED;
- #endif
- }
- public static PxrResult UPxr_GetAnchorEntityUuid(ulong anchorHandle, out PxrUuid uuid)
- {
- uuid = new PxrUuid();
- #if UNITY_ANDROID && !UNITY_EDITOR
- return Pxr_GetAnchorEntityUuid(anchorHandle, out uuid);
- #else
- return PxrResult.TIMEOUT_EXPIRED;
- #endif
- }
- public static PxrResult UPxr_GetAnchorComponentFlags(ulong anchorHandle, out ulong flag)
- {
- flag = UInt64.MinValue;
- #if UNITY_ANDROID && !UNITY_EDITOR
- return Pxr_GetAnchorComponentFlags(anchorHandle, out flag);
- #else
- return PxrResult.TIMEOUT_EXPIRED;
- #endif
- }
- public static PxrResult UPxr_LoadAnchorEntity(ref PxrAnchorEntityLoadInfo info, out ulong taskId)
- {
- taskId = ulong.MinValue;
- #if UNITY_ANDROID && !UNITY_EDITOR
- return Pxr_LoadAnchorEntity(ref info, out taskId);
- #else
- return PxrResult.TIMEOUT_EXPIRED;
- #endif
- }
- public static PxrResult UPxr_GetAnchorEntityLoadResults(ulong taskId, ref PxrAnchorEntityLoadResults result)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- return Pxr_GetAnchorEntityLoadResults(taskId, ref result);
- #else
- return PxrResult.TIMEOUT_EXPIRED;
- #endif
- }
- public static PxrResult UPxr_StartSpatialSceneCapture(out ulong taskId)
- {
- taskId = ulong.MinValue;
- #if UNITY_ANDROID && !UNITY_EDITOR
- return Pxr_StartSpatialSceneCapture(out taskId);
- #else
- return PxrResult.TIMEOUT_EXPIRED;
- #endif
- }
- public static PxrResult UPxr_GetAnchorVolumeInfo(ulong anchorHandle, ref PxrAnchorVolumeInfo info)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- return Pxr_GetAnchorBoxInfo(anchorHandle, ref info);
- #else
- return PxrResult.TIMEOUT_EXPIRED;
- #endif
- }
- public static PxrResult UPxr_GetAnchorPlanePolygonInfo(ulong anchorHandle, ref PxrAnchorPlanePolygonInfo info)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- return Pxr_GetAnchorPlanePolygonInfo(anchorHandle, ref info);
- #else
- return PxrResult.TIMEOUT_EXPIRED;
- #endif
- }
- public static PxrResult UPxr_GetAnchorPlaneBoundaryInfo(ulong anchorHandle, ref PxrAnchorPlaneBoundaryInfo info)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- return Pxr_GetAnchorPlaneBoundaryInfo(anchorHandle, ref info);
- #else
- return PxrResult.TIMEOUT_EXPIRED;
- #endif
- }
- public static PxrResult UPxr_GetAnchorSceneLabel(ulong anchorHandle, out PxrSceneLabel label)
- {
- label = PxrSceneLabel.UnKnown;
- #if UNITY_ANDROID && !UNITY_EDITOR
- return Pxr_GetAnchorSceneLabel(anchorHandle, out label);
- #else
- return PxrResult.TIMEOUT_EXPIRED;
- #endif
- }
- #region Deprecate
- public static int UPxr_StartHumanOcclusion()
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- return Pxr_StartHumanOcclusion();
- #else
- return -1;
- #endif
- }
- public static int UPxr_AcquireMeshingInfo(IntPtr maskBuffer, IntPtr verticesBuffer, out uint verticesSize, IntPtr facetsBuffer, out uint facetSize, out bool haveRead)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- return Pxr_AcquireMeshingInfo(maskBuffer,verticesBuffer, out verticesSize, facetsBuffer, out facetSize, out haveRead);
- #else
- verticesSize = 0;
- facetSize = 0;
- haveRead = false;
- return -1;
- #endif
- }
- public static int UPxr_StopHumanOcclusion()
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- return Pxr_StopHumanOcclusion();
- #else
- return -1;
- #endif
- }
- public static int UPxr_CreateSpatialAnchor(ref PxrSpatialAnchorCreateInfo info, ref UInt64 handle)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- return Pxr_CreateSpatialAnchor(ref info,ref handle);
- #else
- return -1;
- #endif
- }
- public static int UPxr_DestroySpatialAnchor(UInt64 handle)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- return Pxr_DestroySpatialAnchor(handle);
- #else
- return -1;
- #endif
- }
- public static int UPxr_SaveSpatialAnchor(ref PxrSpatialAnchorSaveInfo info, ref UInt64 requestId)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- return Pxr_SaveSpatialAnchor(ref info,ref requestId);
- #else
- return -1;
- #endif
- }
- public static int UPxr_DeleteSpatialAnchor(ref PxrSpatialAnchorDeleteInfo info, ref UInt64 requestId)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- return Pxr_DeleteSpatialAnchor(ref info,ref requestId);
- #else
- return -1;
- #endif
- }
- public static int UPxr_LoadSpatialAnchorById(ref PxrSpatialInstanceLoadByIdInfo info, ref UInt64 requestId)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- return Pxr_LoadSpatialAnchorById(ref info,ref requestId);
- #else
- return -1;
- #endif
- }
- public static int UPxr_GetSpatialAnchorLoadResults(UInt64 requestId, ref PxrSpatialAnchorLoadResults results)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- return Pxr_GetSpatialAnchorLoadResults(requestId,ref results);
- #else
- return -1;
- #endif
- }
- public static int UPxr_GetSpatialAnchorPose(UInt64 handle, double predictDisplayTime, PxrReferenceType type, ref PxrPosef pose)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- return Pxr_GetSpatialAnchorPose(handle, predictDisplayTime, type, ref pose);
- #else
- return -1;
- #endif
- }
- public static int UPxr_GetSpatialAnchorUuid(UInt64 handle, ref PxrSpatialInstanceUuid uuid)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- return Pxr_GetSpatialAnchorUuid(handle, ref uuid);
- #else
- return -1;
- #endif
- }
- public static int UPxr_CreateRoomSceneData(PxrSpatialInstanceUuid anchorUuid, IntPtr roomSceneData, int dataLen, ref ulong roomSceneDataHandle)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- return Pxr_CreateRoomSceneData(anchorUuid, roomSceneData, dataLen, ref roomSceneDataHandle);
- #else
- return -1;
- #endif
- }
- public static int UPxr_DestroyRoomSceneData(ulong roomSceneDataHandle)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- return Pxr_DestroyRoomSceneData(roomSceneDataHandle);
- #else
- return -1;
- #endif
- }
- public static int UPxr_SaveRoomSceneData(ref PxrRoomSceneDataSaveInfo saveInfo, ref ulong requestId)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- return Pxr_SaveRoomSceneData(ref saveInfo, ref requestId);
- #else
- return -1;
- #endif
- }
- public static int UPxr_DeleteRoomSceneData(ref PxrRoomSceneDataDeleteInfo deleteInfo, ref ulong requestId)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- return Pxr_DeleteRoomSceneData(ref deleteInfo, ref requestId);
- #else
- return -1;
- #endif
- }
- public static int UPxr_LoadRoomScene(ref PxrRoomSceneLoadInfo loadInfo, ref ulong requestId)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- return Pxr_LoadRoomScene(ref loadInfo, ref requestId);
- #else
- return -1;
- #endif
- }
- public static int UPxr_GetRoomSceneLoadResults(ulong requestId, ref PxrRoomSceneLoadResults results)
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- return Pxr_GetRoomSceneLoadResults(requestId, ref results);
- #else
- return -1;
- #endif
- }
- public static int UPxr_StartRoomCapture()
- {
- #if UNITY_ANDROID && !UNITY_EDITOR
- return Pxr_StartRoomCapture();
- #else
- return -1;
- #endif
- }
- #endregion
- private const int MAX_EVENT = 20;
- private static IntPtr[] eventArrayHandle = new IntPtr[MAX_EVENT];
- public static bool UPxr_PollEventQueue(ref List<PxrEventDataBuffer> bufferList)
- {
- bool ret = false;
- #if UNITY_ANDROID && !UNITY_EDITOR
- int eventNum = 0;
- ret = Pxr_PollEventFromXRPlugin(ref eventNum, eventArrayHandle);
- if (ret)
- {
- for (int i = 0; i < eventNum; i++)
- {
- PxrEventDataBuffer buffer = (PxrEventDataBuffer)Marshal.PtrToStructure(eventArrayHandle[i], typeof(PxrEventDataBuffer));
- bufferList.Add(buffer);
- }
- }
- #endif
- return ret;
- }
- }
- }
- }
|