XR_ANDROID_light_estimation_cubemap
Name String
XR_ANDROID_light_estimation_cubemap
ประเภทส่วนขยาย
ส่วนขยายอินสแตนซ์
หมายเลขต่อที่ลงทะเบียนไว้
722
การแก้ไข
1
สถานะการให้สัตยาบัน
ไม่ได้รับการให้สัตยาบัน
ทรัพยากร Dependency ของส่วนขยายและเวอร์ชัน
XR_ANDROID_light_estimation
วันที่แก้ไขล่าสุด
2025-08-06
สถานะ IP
ไม่มีการอ้างสิทธิ์ IP ที่ทราบ
ผู้เขียน
Salar Khan, Google
Scott Chung, Google
Jared Finder, Google
Spencer Quin, Google
Levana Chen, Google
Nihav Jain, Google
Jürgen Sturm, Google
ภาพรวม
ส่วนขยายนี้ต่อยอดมาจากส่วนขยาย XR_ANDROID_light_estimation พื้นฐาน โดยจะเพิ่มการรองรับการรับค่าประมาณแสงของ Cubemap ซึ่งจะให้ค่าประมาณที่ละเอียดยิ่งขึ้นเกี่ยวกับแสงในสภาพแวดล้อมจริง
หมายเหตุ
กลไกในการรับข้อมูลการประมาณแสงจะเหมือนกับส่วนขยายพื้นฐาน ยกเว้นว่าต้องเชื่อมโยง XrCubemapLightEstimatorCreateInfoANDROID กับ XrLightEstimatorCreateInfoANDROID เมื่อสร้างแฮนเดิลเครื่องมือประมาณแสง
ตรวจสอบความสามารถของระบบ
typedef struct XrSystemCubemapLightEstimationPropertiesANDROID {
XrStructureType type;
void* next;
XrBool32 supportsCubemapLightEstimation;
} XrSystemCubemapLightEstimationPropertiesANDROID;
คำอธิบายสมาชิก
typeคือ XrStructureType ของโครงสร้างนี้nextคือNULLหรือตัวชี้ไปยังโครงสร้างถัดไปในเชนโครงสร้าง ไม่มีการกำหนดโครงสร้างดังกล่าวใน OpenXR หลักหรือส่วนขยายนี้supportsCubemapLightEstimationเป็นXrBool32ซึ่งระบุว่าระบบปัจจุบันรองรับการประมาณแสงแบบคิวบ์แมปหรือไม่
แอปพลิเคชันสามารถตรวจสอบว่าระบบรองรับการประมาณแสง Cubemap หรือไม่โดยขยาย XrSystemProperties ด้วยโครงสร้าง XrSystemCubemapLightEstimationPropertiesANDROID เมื่อเรียกใช้ xrGetSystemProperties
หากรันไทม์แสดงผล XR_FALSE สำหรับ supportsCubemapLightEstimation และ XrCubemapLightEstimatorCreateInfoANDROID เชื่อมโยงกับ XrLightEstimatorCreateInfoANDROID แล้ว รันไทม์ต้องแสดงผล XR_ERROR_FEATURE_UNSUPPORTED จาก xrCreateLightEstimatorANDROID
การใช้งานที่ถูกต้อง (โดยนัย)
- ต้องเปิดใช้ส่วนขยาย
XR_ANDROID_light_estimation_cubemapก่อนใช้ XrSystemCubemapLightEstimationPropertiesANDROID -
typeต้องเป็นXR_TYPE_SYSTEM_CUBEMAP_LIGHT_ESTIMATION_PROPERTIES_ANDROID -
nextต้องเป็นNULLหรือพอยน์เตอร์ที่ถูกต้องไปยังโครงสร้างถัดไปในเชนโครงสร้าง
การรับความละเอียดของคิวบ์แมปที่รองรับ
XrResult xrEnumerateCubemapLightingResolutionsANDROID(
XrInstance instance,
XrSystemId systemId,
uint32_t resolutionCapacityInput,
uint32_t* resolutionCountOutput,
uint32_t* resolutions);
คำอธิบายพารามิเตอร์
instanceคือ XrInstance ที่สร้างไว้ก่อนหน้านี้systemIdคือXrSystemIdที่เรียกข้อมูลมาก่อนหน้านี้โดย xrGetSystem เพื่อรับความละเอียดของ Cubemap ที่รองรับresolutionCapacityInputคือuint32_tที่ระบุจำนวนองค์ประกอบสูงสุดที่สามารถจัดเก็บในอาร์เรย์resolutionsresolutionCountOutputคือตัวชี้ไปยังuint32_tซึ่งตั้งค่าโดยรันไทม์ที่ระบุจำนวนองค์ประกอบที่เขียนลงในอาร์เรย์resolutionsโดยรันไทม์resolutionsคืออาร์เรย์ของuint32_tซึ่งรันไทม์จะป้อนข้อมูลด้วยความละเอียดของคิวบ์แมปที่รองรับ
ความละเอียดของ Cubemap จะระบุความกว้างและความสูงของแต่ละด้านของ Cubemap เป็นพิกเซล สำนวนการเรียก 2 ครั้ง แอปพลิเคชันสามารถเลือกใช้ความละเอียดที่รองรับรายการใดรายการหนึ่งใน XrCubemapLightEstimatorCreateInfoANDROID :: cubemapResolution เมื่อสร้างแฮนเดิลเครื่องมือประมาณแสง แอปพลิเคชันต้องจัดสรรหน่วยความจำในปริมาณที่เหมาะสมสำหรับสมาชิกบัฟเฟอร์รูปภาพของ XrCubemapLightingDataANDROID โดยอิงตามความละเอียดที่เลือกและรูปแบบสี
การใช้งานที่ถูกต้อง (โดยนัย)
- ต้องเปิดใช้ส่วนขยาย
XR_ANDROID_light_estimation_cubemapก่อนเรียกใช้ xrEnumerateCubemapLightingResolutionsANDROID -
instanceต้องเป็นแฮนเดิล XrInstance ที่ถูกต้อง -
resolutionCountOutputต้องเป็นตัวชี้ไปยังค่าuint32_t - หาก
resolutionCapacityInputไม่ใช่0resolutionsต้องเป็นพอยน์เตอร์ไปยังอาร์เรย์ของค่าresolutionCapacityInputuint32_t
รหัสการคืนสินค้า
XR_SUCCESS
XR_ERROR_FUNCTION_UNSUPPORTEDXR_ERROR_HANDLE_INVALIDXR_ERROR_INSTANCE_LOSTXR_ERROR_RUNTIME_FAILUREXR_ERROR_SIZE_INSUFFICIENTXR_ERROR_SYSTEM_INVALIDXR_ERROR_VALIDATION_FAILURE
กำลังรับรูปแบบสี Cubemap ที่รองรับ
การแจงนับ XrCubemapLightingColorFormatANDROID จะระบุรูปแบบสีของแสง Cubemap ที่จะใช้กับรันไทม์
typedef enum XrCubemapLightingColorFormatANDROID {
XR_CUBEMAP_LIGHTING_COLOR_FORMAT_R32G32B32_SFLOAT_ANDROID = 1,
XR_CUBEMAP_LIGHTING_COLOR_FORMAT_R32G32B32A32_SFLOAT_ANDROID = 2,
XR_CUBEMAP_LIGHTING_COLOR_FORMAT_R16G16B16A16_SFLOAT_ANDROID = 3,
XR_CUBEMAP_LIGHTING_COLOR_FORMAT_MAX_ENUM_ANDROID = 0x7FFFFFFF
} XrCubemapLightingColorFormatANDROID;
Enum มีความหมายดังนี้
คำอธิบาย Enum
XR_CUBEMAP_LIGHTING_COLOR_FORMAT_R32G32B32_SFLOAT_ANDROID
รูปแบบสีที่มี 3 ช่องทาง โดยแต่ละช่องทางเป็นค่าจุดลอยตัว 32 บิต
XR_CUBEMAP_LIGHTING_COLOR_FORMAT_R32G32B32A32_SFLOAT_ANDROID
รูปแบบสีที่มี 4 แชแนล โดยแต่ละแชแนลเป็นค่าจุดลอยตัว 32 บิต
XR_CUBEMAP_LIGHTING_COLOR_FORMAT_R16G16B16A16_SFLOAT_ANDROID
รูปแบบสีที่มี 4 ช่องทาง โดยแต่ละช่องทางเป็นค่าจุดลอยตัว 16 บิต
XrResult xrEnumerateCubemapLightingColorFormatsANDROID(
XrInstance instance,
XrSystemId systemId,
uint32_t colorFormatCapacityInput,
uint32_t* colorFormatCountOutput,
XrCubemapLightingColorFormatANDROID* colorFormats);
คำอธิบายพารามิเตอร์
instanceคือ XrInstance ที่สร้างไว้ก่อนหน้านี้systemIdคือXrSystemIdที่เรียกข้อมูลมาก่อนหน้านี้โดย xrGetSystem เพื่อรับความละเอียดของ Cubemap ที่รองรับcolorFormatCapacityInputคือuint32_tที่ระบุจำนวนองค์ประกอบสูงสุดที่สามารถจัดเก็บในอาร์เรย์colorFormatscolorFormatCountOutputคือตัวชี้ไปยังuint32_tซึ่งตั้งค่าโดยรันไทม์ที่ระบุจำนวนองค์ประกอบที่เขียนลงในอาร์เรย์colorFormatsโดยรันไทม์colorFormatsคืออาร์เรย์ของ XrCubemapLightingColorFormatANDROID ซึ่งรันไทม์จะป้อนข้อมูลด้วยรูปแบบสี Cubemap ที่รองรับ
สำนวนการเรียก 2 ครั้ง จากนั้นแอปพลิเคชันสามารถเลือกใช้รูปแบบสีที่รองรับรูปแบบใดรูปแบบหนึ่งใน XrCubemapLightEstimatorCreateInfoANDROID :: colorFormat เมื่อสร้างแฮนเดิลเครื่องมือประมาณแสง แอปพลิเคชันต้องจัดสรรหน่วยความจำในปริมาณที่เหมาะสมสำหรับสมาชิกบัฟเฟอร์รูปภาพของ XrCubemapLightingDataANDROID โดยอิงตามรูปแบบสีที่เลือก
การใช้งานที่ถูกต้อง (โดยนัย)
- ต้องเปิดใช้ส่วนขยาย
XR_ANDROID_light_estimation_cubemapก่อนเรียกใช้ xrEnumerateCubemapLightingColorFormatsANDROID -
instanceต้องเป็นแฮนเดิล XrInstance ที่ถูกต้อง -
colorFormatCountOutputต้องเป็นตัวชี้ไปยังค่าuint32_t - หาก
colorFormatCapacityInputไม่ใช่0colorFormatsต้องเป็นพอยเตอร์ไปยังอาร์เรย์ของค่าcolorFormatCapacityInputXrCubemapLightingColorFormatANDROID
รหัสการคืนสินค้า
XR_SUCCESS
XR_ERROR_FUNCTION_UNSUPPORTEDXR_ERROR_HANDLE_INVALIDXR_ERROR_INSTANCE_LOSTXR_ERROR_RUNTIME_FAILUREXR_ERROR_SIZE_INSUFFICIENTXR_ERROR_SYSTEM_INVALIDXR_ERROR_VALIDATION_FAILURE
สร้างแฮนเดิลเครื่องมือประมาณแสง Cubemap
typedef struct XrCubemapLightEstimatorCreateInfoANDROID {
XrStructureType type;
const void* next;
uint32_t cubemapResolution;
XrCubemapLightingColorFormatANDROID colorFormat;
XrBool32 reproject;
} XrCubemapLightEstimatorCreateInfoANDROID;
คำอธิบายสมาชิก
typeคือ XrStructureType ของโครงสร้างนี้nextคือNULLหรือตัวชี้ไปยังโครงสร้างถัดไปในเชนโครงสร้างcubemapResolutionคือuint32_tที่ระบุความละเอียดของแสง Cubemap ที่จะใช้colorFormatคือ XrCubemapLightingColorFormatANDROID ที่ระบุรูปแบบสีของข้อมูลแสง Cubemap ที่จะใช้reprojectคือXrBool32ที่ระบุว่าควรฉายแสงคิวบ์แมปซ้ำไปยังพื้นที่ฐานของแอปพลิเคชันหรือไม่
โครงสร้าง XrCubemapLightEstimatorCreateInfoANDROID อธิบายข้อมูลเพื่อสร้างแฮนเดิล XrLightEstimatorANDROID ให้สามารถให้ค่าประมาณแสง Cubemap ได้ ต้องตั้งค่าสมาชิก XrCubemapLightEstimatorCreateInfoANDROID :: cubemapResolution ต้องเป็นความละเอียดรายการใดรายการหนึ่งที่ xrEnumerateCubemapLightingResolutionsANDROID แสดงผล ต้องตั้งค่าสมาชิก XrCubemapLightEstimatorCreateInfoANDROID :: colorFormat เป็นรูปแบบสีรูปแบบใดรูปแบบหนึ่งที่ xrEnumerateCubemapLightingColorFormatsANDROID แสดงผล หากแอปพลิเคชันไม่ได้ตั้งค่าความละเอียดเป็นความละเอียดที่รองรับหรือรูปแบบสีเป็นรูปแบบสีที่รองรับ รันไทม์ต้องแสดงผล XR_ERROR_FEATURE_UNSUPPORTED จาก xrCreateLightEstimatorANDROID
การใช้งานที่ถูกต้อง (โดยนัย)
- ต้องเปิดใช้ส่วนขยาย
XR_ANDROID_light_estimation_cubemapก่อนใช้ XrCubemapLightEstimatorCreateInfoANDROID -
typeต้องเป็นXR_TYPE_CUBEMAP_LIGHT_ESTIMATOR_CREATE_INFO_ANDROID -
nextต้องเป็นNULLหรือพอยน์เตอร์ที่ถูกต้องไปยังโครงสร้างถัดไปในเชนโครงสร้าง -
colorFormatต้องเป็นค่า XrCubemapLightingColorFormatANDROID ที่ถูกต้อง
การประมาณแสงคิวบ์แมป
typedef struct XrCubemapLightingDataANDROID {
XrStructureType type;
void* next;
XrLightEstimateStateANDROID state;
uint32_t imageBufferSize;
uint8_t* imageBufferRight;
uint8_t* imageBufferLeft;
uint8_t* imageBufferTop;
uint8_t* imageBufferBottom;
uint8_t* imageBufferFront;
uint8_t* imageBufferBack;
XrQuaternionf rotation;
XrTime centerExposureTime;
} XrCubemapLightingDataANDROID;
คำอธิบายสมาชิก
typeคือ XrStructureType ของโครงสร้างนี้nextคือNULLหรือตัวชี้ไปยังโครงสร้างถัดไปในเชนโครงสร้าง โครงสร้างที่ถูกต้องคือ XrAmbientLightANDROID , XrSphericalHarmonicsANDROID , XrDirectionalLightANDROIDstateคือ XrLightEstimateStateANDROID ที่แสดงสถานะของการประมาณแสงimageBufferSizeคือuint32_tที่ระบุขนาดไบต์ของบัฟเฟอร์รูปภาพแต่ละด้านใน CubemapimageBufferRightคือบัฟเฟอร์uint8_tที่มีรูปภาพด้านขวาของ CubemapimageBufferLeftคือบัฟเฟอร์uint8_tที่มีรูปภาพด้านซ้ายของ CubemapimageBufferTopคือบัฟเฟอร์uint8_tที่มีรูปภาพด้านบนของ CubemapimageBufferBottomคือบัฟเฟอร์uint8_tที่มีรูปภาพด้านล่างของ CubemapimageBufferFrontคือบัฟเฟอร์uint8_tที่มีรูปภาพด้านหน้าของ CubemapimageBufferBackคือบัฟเฟอร์uint8_tที่มีรูปภาพด้านหลังของ Cubemaprotationคือ XrQuaternionf ที่ระบุการหมุนของ CubemapcenterExposureTimeคือXrTimeที่ระบุเวลาที่จับภาพ Cubemap
โครงสร้างนี้สามารถเชื่อมโยงกับ XrLightEstimateANDROID ได้ รันไทม์ต้องป้อนข้อมูลโครงสร้างนี้ใน xrGetLightEstimateANDROID เท่านั้นหากใช้ XrCubemapLightEstimatorCreateInfoANDROID เพื่อสร้างแฮนเดิลเครื่องมือประมาณแสง แอปพลิเคชันต้องจัดสรรหน่วยความจำในปริมาณที่เหมาะสมสำหรับบัฟเฟอร์รูปภาพ ซึ่งขึ้นอยู่กับค่าที่ตั้งไว้ใน XrCubemapLightEstimatorCreateInfoANDROID :: cubemapResolution และ XrCubemapLightEstimatorCreateInfoANDROID :: colorFormat เมื่อสร้างแฮนเดิลเครื่องมือประมาณแสง แอปพลิเคชันต้องตั้งค่า XrCubemapLightingDataANDROID :: imageBufferSize เป็นความจุของบัฟเฟอร์รูปภาพแต่ละด้านในหน่วยไบต์ หากแอปพลิเคชันไม่ได้ใช้การประมาณแสงแบบคิวบ์แมป หรือหาก XrCubemapLightingDataANDROID :: imageBufferSize มีขนาดไม่ใหญ่พอที่รันไทม์จะป้อนข้อมูลบัฟเฟอร์รูปภาพ รันไทม์ต้องตั้งค่า XrCubemapLightingDataANDROID :: state เป็น XR_LIGHT_ESTIMATE_STATE_INVALID_ANDROID
หากแอปพลิเคชันตั้งค่า XrCubemapLightEstimatorCreateInfoANDROID :: reproject เป็น XR_TRUE เมื่อสร้างแฮนเดิลเครื่องมือประมาณแสง รันไทม์ต้องตั้งค่า XrCubemapLightingDataANDROID :: rotation เป็นการหมุนเอกลักษณ์ และตรวจสอบว่าคิวบ์แมปที่หมุนภายในได้รับการฉายภาพใหม่ลงบนใบหน้าของคิวบ์แมปเอกลักษณ์ในพื้นที่ฐานของแอปพลิเคชัน
เลย์เอาต์ของคิวบ์แมปแสงจะเหมือนกับเลย์เอาต์คิวบ์แมป OpenGL ดังที่แสดงในรูปภาพต่อไปนี้
รูปที่ 31 เลย์เอาต์คิวบ์แมป
การใช้งานที่ถูกต้อง (โดยนัย)
- ต้องเปิดใช้ส่วนขยาย
XR_ANDROID_light_estimation_cubemapก่อนใช้ XrCubemapLightingDataANDROID -
typeต้องเป็นXR_TYPE_CUBEMAP_LIGHTING_DATA_ANDROID -
nextต้องเป็นNULLหรือพอยน์เตอร์ที่ถูกต้องไปยังโครงสร้างถัดไปในเชนโครงสร้าง -
stateต้องเป็นค่า XrLightEstimateStateANDROID ที่ถูกต้อง -
imageBufferRightต้องเป็นตัวชี้ไปยังอาร์เรย์ของค่าimageBufferSizeuint8_t -
imageBufferLeftต้องเป็นตัวชี้ไปยังอาร์เรย์ของค่าimageBufferSizeuint8_t -
imageBufferTopต้องเป็นตัวชี้ไปยังอาร์เรย์ของค่าimageBufferSizeuint8_t -
imageBufferBottomต้องเป็นตัวชี้ไปยังอาร์เรย์ของค่าimageBufferSizeuint8_t -
imageBufferFrontต้องเป็นตัวชี้ไปยังอาร์เรย์ของค่าimageBufferSizeuint8_t -
imageBufferBackต้องเป็นตัวชี้ไปยังอาร์เรย์ของค่าimageBufferSizeuint8_t - พารามิเตอร์
imageBufferSizeต้องมากกว่า0
โค้ดตัวอย่างสำหรับการประมาณแสง
โค้ดตัวอย่างต่อไปนี้แสดงวิธีรับปริมาณการประมาณแสงที่เป็นไปได้ทั้งหมดจากรันไทม์
XrSession session; // Created at app startup
XrInstance instance; // Created at app startup
XrSpace appSpace; // Created previously.
XrSystemId systemId; // Retrieved previously by xrGetSystem
PFN_xrCreateLightEstimatorANDROID xrCreateLightEstimatorANDROID; // Created previously.
PFN_xrDestroyLightEstimatorANDROID xrDestroyLightEstimatorANDROID; // Created previously.
PFN_xrGetLightEstimateANDROID xrGetLightEstimateANDROID; // Created previously.
PFN_xrEnumerateCubemapLightingResolutionsANDROID xrEnumerateCubemapLightingResolutionsANDROID; // Created previously.
PFN_xrEnumerateCubemapLightingColorFormatsANDROID xrEnumerateCubemapLightingColorFormatsANDROID; // Created previously.
XrSystemCubemapLightEstimationPropertiesANDROID props = {
.type = XR_TYPE_SYSTEM_CUBEMAP_LIGHT_ESTIMATION_PROPERTIES_ANDROID};
XrSystemProperties base = {.type = XR_TYPE_SYSTEM_PROPERTIES,
.next = &props};
CHK_XR(xrGetSystemProperties(instance, systemId, &base));
if (!props.supportsCubemapLightEstimation) {
// Cubemap light estimation is not supported
}
uint32_t cubemapResolution = 0;
std::vector<uint32_t> supportedCubemapResolutions;
uint32_t resolutionCount;
CHK_XR(xrEnumerateCubemapLightingResolutionsANDROID(
instance, systemId, 0, &resolutionCount, nullptr));
supportedCubemapResolutions.resize(resolutionCount);
if (resolutionCount == 0) {
// No cubemap lighting supported
} else {
CHK_XR(xrEnumerateCubemapLightingResolutionsANDROID(
instance, systemId, 0, &resolutionCount, supportedCubemapResolutions.data()));
cubemapResolution = supportedCubemapResolutions[0];
}
uint32_t pixelCount = cubemapResolution * cubemapResolution;
XrCubemapLightingColorFormatANDROID colorFormat;
std::vector<XrCubemapLightingColorFormatANDROID> supportedColorFormats;
uint32_t colorFormatCount;
CHK_XR(xrEnumerateCubemapLightingColorFormatsANDROID(
instance, systemId, 0, &colorFormatCount, nullptr));
supportedColorFormats.resize(colorFormatCount);
if (colorFormatCount == 0) {
// No supported color formats for cubemap lighting. Cannot use cubemap
// light estimation.
} else {
CHK_XR(xrEnumerateCubemapLightingColorFormatsANDROID(
instance, systemId, 0, &colorFormatCount, supportedColorFormats.data()));
colorFormat = supportedColorFormats[0];
}
uint32_t pixelSize = 0;
switch (colorFormat) {
case XR_CUBEMAP_LIGHTING_COLOR_FORMAT_R32G32B32_SFLOAT_ANDROID:
pixelSize = 3 * sizeof(float);
break;
case XR_CUBEMAP_LIGHTING_COLOR_FORMAT_R32G32B32A32_SFLOAT_ANDROID:
pixelSize = 4 * sizeof(float);
break;
case XR_CUBEMAP_LIGHTING_COLOR_FORMAT_R16G16B16A16_SFLOAT_ANDROID:
pixelSize = 4 * sizeof(uint16_t);
break;
default:
// Should not happen since the color format was validated previously.
break;
}
uint32_t perFaceImageBufferSize = pixelCount * pixelSize;
XrLightEstimatorANDROID estimator;
XrCubemapLightEstimatorCreateInfoANDROID cubemapCreateInfo = {
.type = XR_TYPE_CUBEMAP_LIGHT_ESTIMATOR_CREATE_INFO_ANDROID,
.cubemapResolution = cubemapResolution,
.colorFormat = colorFormat,
.reproject = XR_TRUE
};
XrLightEstimatorCreateInfoANDROID basicCreateInfo = {
.type = XR_TYPE_LIGHT_ESTIMATOR_CREATE_INFO_ANDROID,
.next = &cubemapCreateInfo};
CHK_XR(xrCreateLightEstimatorANDROID(session, &basicCreateInfo, &estimator));
std::vector<uint8_t> cubemapBuffer(perFaceImageBufferSize * 6); // 6 faces * perFaceImageBufferSize
// Every frame
XrTime updateTime; // Time used for the current frame's simulation update.
XrLightEstimateGetInfoANDROID info = {
.type = XR_TYPE_LIGHT_ESTIMATE_GET_INFO_ANDROID,
.space = appSpace,
.time = updateTime,
};
XrCubemapLightingDataANDROID cubemap = {
.type = XR_TYPE_CUBEMAP_LIGHTING_DATA_ANDROID,
.next = nullptr,
.imageBufferSize = perFaceImageBufferSize,
.imageBufferRight = cubemapBuffer.data() + 0 * perFaceImageBufferSize,
.imageBufferLeft = cubemapBuffer.data() + 1 * perFaceImageBufferSize,
.imageBufferTop = cubemapBuffer.data() + 2 * perFaceImageBufferSize,
.imageBufferBottom = cubemapBuffer.data() + 3 * perFaceImageBufferSize,
.imageBufferFront = cubemapBuffer.data() + 4 * perFaceImageBufferSize,
.imageBufferBack = cubemapBuffer.data() + 5 * perFaceImageBufferSize,
};
XrDirectionalLightANDROID directionalLight = {
.type = XR_TYPE_DIRECTIONAL_LIGHT_ANDROID,
.next = &cubemap,
};
XrSphericalHarmonicsANDROID totalSh = {
.type = XR_TYPE_SPHERICAL_HARMONICS_ANDROID,
.next = &directionalLight,
.kind = XR_SPHERICAL_HARMONICS_KIND_TOTAL_ANDROID,
};
XrSphericalHarmonicsANDROID ambientSh = {
.type = XR_TYPE_SPHERICAL_HARMONICS_ANDROID,
.next = &totalSh,
.kind = XR_SPHERICAL_HARMONICS_KIND_AMBIENT_ANDROID,
};
XrAmbientLightANDROID ambientLight = {
.type = XR_TYPE_AMBIENT_LIGHT_ANDROID,
.next = &ambientSh,
};
XrLightEstimateANDROID estimate = {
.type = XR_TYPE_LIGHT_ESTIMATE_ANDROID,
.next = &ambientLight,
};
XrResult result = xrGetLightEstimateANDROID(estimator, &info, &estimate);
if (result == XR_SUCCESS &&
estimate.state == XR_LIGHT_ESTIMATE_STATE_VALID_ANDROID) {
// use cubemap, directionalLight, totalSh, ambientSh, and
// ambientLight if each struct has a valid state field
if (cubemap.state == XR_LIGHT_ESTIMATE_STATE_VALID_ANDROID) {
// use cubemap
if (cubemapCreateInfo.reproject == XR_TRUE) {
XrQuaternionf identityQuaternion = {0.0f, 0.0f, 0.0f, 1.0f};
assert(memcmp(&cubemap.rotation, &identityQuaternion, sizeof(XrQuaternionf)) == 0);
}
}
}
// When you want to disable light estimation
CHK_XR(xrDestroyLightEstimatorANDROID(estimator));
คำสั่งใหม่
โครงสร้างใหม่
การขยาย XrLightEstimateANDROID :
การขยาย XrLightEstimatorCreateInfoANDROID :
การขยาย XrSystemProperties :
Enum ใหม่
ค่าคงที่ Enum ใหม่
XR_ANDROID_LIGHT_ESTIMATION_CUBEMAP_EXTENSION_NAMEXR_ANDROID_light_estimation_cubemap_SPEC_VERSIONการขยาย XrStructureType :
XR_TYPE_CUBEMAP_LIGHTING_DATA_ANDROIDXR_TYPE_CUBEMAP_LIGHT_ESTIMATOR_CREATE_INFO_ANDROIDXR_TYPE_SYSTEM_CUBEMAP_LIGHT_ESTIMATION_PROPERTIES_ANDROID
ปัญหา
ประวัติเวอร์ชัน
ฉบับแก้ไข 1, 2025-12-05 (Salar Khan)
- คำอธิบายส่วนขยายเริ่มต้น