struct qiyu_HeadPoseState
{
qiyu_HeadPose pose; //head pose
int32_t poseStatus; //Bit field (sxrTrackingMode) //indicating pose status
uint64_t poseTimeStampNs; //Time stamp in which the head pose //was generated (nanoseconds)
uint64_t poseFetchTimeNs; //Time stamp when this pose was //retrieved
uint64_t expectedDisplayTimeNs; //Expected time when this pose //should be on screen (nanoseconds)
};
struct qiyu_RenderLayer
{
int32_t imageHandle; //Handle to the texture/image to be rendered
qiyu_TextureType imageType; //Type of texture: Standard Texture or EGL Image
qiyu_RenderLayer_ScreenPosUV imageCoords; //Layout of this layer on the screen
qiyu_RenderLayer_EyeMask eyeMask; //Determines which eye[s] receive this render layer
};
static const int qiyu_RenderLayerMaxCount = 16;
struct qiyu_FrameParam
{
int32_t minVsyncs; //Minimum number of vysnc events before displaying the frame (1=display refresh, 2=half refresh, etc...)
qiyu_RenderLayer renderLayers[qiyu_RenderLayerMaxCount]; //Description of each render layer
qiyu_HeadPoseState headPoseState; //Head pose state used to generate the frame
};
bool qiyu_Init(jobject clazz,
JavaVM* vm,
qiyu_GraphicsApi graphicsApi = qiyu_GraphicsApi::GA_OpenGLES,
qiyu_TrackingOriginMode trackMode = qiyu_TrackingOriginMode::TM_Device,
bool bLogVerbose = false);
- brief //Init QiyuNativeSDK. 'void android_main(struct android_app* app)' is the main entry point of a native application that is using android_native_app_glue. It runs in its own thread, with its own event loop for receiving input events and doing other things.
- @param[in] clazz // The object handle of activity which is 'ANativeActivity' object instance that this 'android_app' is running in. eg.'android_app->activity->clazz;''
- @param[in] vm // The global handle on the process's Java VM in 'ANativeActivity' in 'android_app'. eg.'android_app->activity->vm;'
- @param[in] graphicsApi - the graphics API。please refer to 'enum class qiyu_GraphicsApi'.
- @param[in] trackMode - the tracking mode for device or ground, please refer to 'enum class qiyu_TrackingOriginMode'.
- @param[in] bLogVerbose // Output the verbose log. Note this will output many unuseful log, just open this to fix bug while debug.
- @return //True if succeed, False if fail.
bool qiyu_Release();
- brief //Release QiyuNativeSDK, normally called while APP_CMD_DESTROY/APP_CMD_TERM_WINDOW, etc. Please refer to the Samples.
- @return //True if succeed, False if fail.
bool qiyu_StartVR(ANativeWindow* nativeWindow, qiyu_PerfLevel cpuPerfLevel, qiyu_PerfLevel gpuPerfLevel);
- @brief //Start VR service, normally called in the main loop while APP_CMD_START/APP_CMD_RESUME/APP_CMD_INIT_WINDOW, etc. Please refer to the Samples.
- @param[in] nativeWindow // The window surface that the 'android_app' can draw in. eg.'android_app->window;'
- @param[in] cpuPerfLevel // CPU performance level.
- @param[in] gpuPerfLevel // GPU performance level.
- @return //True if succeed, False if fail.
bool qiyu_EndVR();
- brief //Terminate VR service, normally called while APP_CMD_PAUSE, etc. Please refer to the Samples.
- @return //True if succeed; False if fail.
bool bool qiyu_StartEye(bool isMultiView, qiyu_Eye eyeType, qiyu_TextureType imageType);
- @brief //Prepare rendering for one eye, called AFTER eye buffer is Bind but BEFORE rendering, normally called after renderState is set.
- @param[in] isMultiView // When the value is set true, the MultiView is used, otherwise the MultiPass is used.
- @param[in] imageType // Setting the image type, please refer to'enum qiyu_TextureType'.
- @param[in] eyeType // Specify left/right eye buffer to be rendered on.
- @return //True if succeed; False if fail.
bool bool qiyu_EndEye(bool isMultiView, qiyu_Eye eyeType, qiyu_TextureType imageType);
- @brief //Finish rendering for one eye, called AFTER eye buffer is rendered but BEFORE eye buffer is Unbind and submit frame.
- @param[in] isMultiView // When the value is set true, the MultiView is used, otherwise the MultiPass is used.
- @param[in] imageType // Setting the image type, please refer to'enum qiyu_TextureType'.
- @param[in] eyeType // Specify left/right eye buffer was rendered on.
- @return //True if succeed; False if fail.
bool bool qiyu_SubmitFrame(const qiyu_FrameParam& frameParam);
- @brief //Submit one frame, by default submit to ATW(asynchronous time warp), called after render finished.
- @param[in] frameParam // Please refer to qiyu_FrameParam.
- @return //True if succeed; False if fail.
qiyu_Update(float deltaTime);
- @brief //Update, normally called before render or in another thread other rendering-thread.
- @param[in] deltaTime //(in seconds) time between two frames.
bool qiyu_SetFoveation(qiyu_FoveationLevel foveatLevel, const qiyu_FoveationParam* customFoveatParam = nullptr);
- @brief //set foveation
- @param[in] foveatLevel // please refer to'enum qiyu_FoveationLevel'。
- @param[in] customFoveatParam // only set when foveatLevel==FL_Custom. Please refer to'struct qiyu_FoveationParam'。
- @return //True if succeed; False if fail.
bool qiyu_GetFoveation(qiyu_FoveationLevel& foveatLevel, qiyu_FoveationParam& foveatParam);
- @brief // Get foveation
- @param[out] foveatLevel // please refer to 'enum qiyu_FoveationLevel'。
- @param[out] foveatParam // please refer to 'struct qiyu_FoveationParam'。
- @return //True if succeed; False if fail.
bool qiyu_GetViewMatrix(qiyu_Matrix4& outLeftEyeViewMatrix, qiyu_Matrix4& outRightEyeViewMatrix, float& outDistanceToGround, const qiyu_HeadPoseState& poseState, const qiyu_Quaternion& eyeRotationLeft, const qiyu_Quaternion& eyeRotationRight);
- @brief //Get updated view matrix for both eyes, called before rendering and submitFrame which means before qiyu_StartEye. Use the updated lastes IPD inside.
- @param[inout] outLeftEyeViewMatrix // Return the view matrix for left eye.
- @param[inout] outRightEyeViewMatrix // Return the view matrix for right eye.
- @param[inout] outTrackingOffset(in meters) // Return value of TrackingOffset which take care of HeadsetToGround and the height of recenter. HeadsetToGround is the distance from headset down to the ground so the value is minus. NOTE this value should be used to adjust the position of controllers.
- @param[in] poseState // Head pose state, normally use the value get from qiyu_PredictHeadPose.
- @param[in] eyeRotationLeft // Rotation offset for left eye.
- @param[in] eyeRotationRight // Rotation offset for right eye.
- @return //True if succeed; False if fail.
float qiyu_PredictDisplayTime();
- @brief //Get the predicted time when current frame be displayed.
- @return //Predicted display time(in milliseconds).
qiyu_HeadPoseState qiyu_PredictHeadPose(float predicteDisplayTime);
- @brief //Predicte head pose based on the predicteDisplayTime pass in, normally called before qiyu_GetViewMatrix.
- @param[in] predicteDisplayTime(in milliseconds) // Time ahead of current time to predict the head pose.
- @return qiyu_HeadPoseState // Predicted head pose. Please check 'struct qiyu_HeadPoseState'.
void qiyu_PostSetEyeBufferSize(int width, int height)
- @brief //Please call this API after setting the size of EyeBuffer everytime, otherwise, the data of QIYU perfromance Tool will be shown errors.Please note! The EyeBuffer is managed by developer compeletly, this API is for QIYU performance tool to collect the data.
- @param[in] width // EyeBuffer's Width.
- @param[in] height // EyeBuffer's Height.
qiyu_GraphicsApi qiyu_GetGraphicsApi();
- @brief //Get graphic API,which need to be set in qiyu_Init, and the value can be gained by using qiyu_GetGraphicsApi after initialization.
- @return qiyu_GraphicsApi // return the graphic API. Please refer to 'enum class qiyu_GraphicsApi'.
void qiyu_SetTrackingOriginMode(qiyu_TrackingOriginMode trackMode);
- @brief //Set trackingOrigin mode, mode is pass in qiyu_Init then can be changed by this function.
- @param[in] trackMode // Specify the mode to be device or ground. Please check 'enum class qiyu_TrackingOriginMode'.
qiyu_TrackingOriginMode qiyu_GetTrackingOriginMode();
- @brief //Get trackingOrigin mode, mode is pass in qiyu_Init then can be changed by qiyu_SetTrackingOriginMode.
- @return qiyu_TrackingOriginMode // Return the mode of device or ground. Please check 'enum class qiyu_TrackingOriginMode'.
A value of 0.7(recommended) will use the default eye texture resolution specified by the device. The lower scale value, the lower resolution eye textures, which can improve performance at the expense of a less sharp image. The higher scale value, the higher resolution eye textures, resulting in a potentially sharper image at a cost to performance and increased memory usage. Please not exceed 1.0.
qiyu_DeviceInfo.iEyeTargetWidth * Scale
qiyu_DeviceInfo.iEyeTargetHeight * Scale
Please refer to the qiyu_GetDeviceInfo and QYApp_InitEyeBuffers of QYApp_Init in the QiyuVR_NativeActivity Sample code, there are two different scale of EyeBuffer which can be switched by pressing X or Y button.
bool qiyu_IsControllerInit();
- @brief //Is controller module initialized, called and check the return value before all other controller related api was called.
- @return //True if initialized, False if not initialized.
void qiyu_GetControllerData(qiyu_ControllerData* left, qiyu_ControllerData* right);
- @brief //Get updated controller data. Please check 'struct qiyu_ControllerData'.
- @param[inout] left // Return data for left controller.
- @param[inout] right // Return data for right controller.
void qiyu_Platform_Init(const char* app_id, const char* app_secret, PCallback_Init callback);
- @brief // Init platform APIs, which should be called before all other Platform APIs.
- @param[in] app_id // Application ID.
- @param[in] app_secret // Application secret key.
- @param[in] callback // Callback.
app_id, app_secret
Please log in to the QIYU developer Platform(opens new window) and click "Manage - My Apps - +New" to create your app. The system will generate an unique app_id and app_secret for each application. Click「API」to view the App information.
# 4.7.4 Qiyu PlayerPrefs (A requirement to pass our QA Review)
void qiyu_Prefs_Init();
- @brief //it will prompt storage permission window before calling the archive API.
//it should be called before using other APIs.
//The external storage permission is needed.
int qiyu_Prefs_GetInt(const char* key, int defaultValue);
- @brief //Get Int Playerprefs, if not exist, return defaultValue.
- @param[in] key // Key word.
- @param[in] defaultValue // Default value.
- @return //Return int value.
bool qiyu_Prefs_HasKey(const char* key);
- @brief //If the Key exist in PlayerPrefs, return True, otherwise, return False
- @param[in] key // Key word.
- @return //return true or false.
void qiyu_Prefs_Save();
- @brief //Save, which write the PlayerPrefs to disk, should be called after all modifications.
void qiyu_Prefs_DeleteAll();
- @brief //Delete all the PlayerPrefs.
void qiyu_Prefs_DeleteKey(const char* key);
- @brief //Delete the Key in PlayerPrefs.
- @param[in] key // Key word.
void qiyu_Prefs_SetFloat(const char* key, float value);
- @brief // Set float PlayerPrefs for specific Key.
- @param[in] key // Key word.
- @param[in] value // Value.
void qiyu_Prefs_SetInt(const char* key, int value);
- @brief //Set int PlayerPrefs for specific Key.
- @param[in] key // Key word.
- @param[in] value // Value.
void qiyu_Prefs_SetString(const char* key, const char* value);
- @brief // Set String PlayerPrefs for specific Key.
- @param[in] key // Key word.
- @param[in] value // Value.