use crate::Float;
use crate::core::geometry::{Normal3f, Point2f, Point3f, Vector3f};
use crate::utils::Ptr;
use crate::utils::Transform;
use crate::utils::sampling::DevicePiecewiseConstant2D;

#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct DeviceTriangleMesh {
    pub n_triangles: u32,
    pub n_vertices: u32,
    pub vertex_indices: Ptr<u32>,
    pub p: Ptr<Point3f>,
    pub n: Ptr<Normal3f>,
    pub s: Ptr<Vector3f>,
    pub uv: Ptr<Point2f>,
    pub face_indices: Ptr<u32>,
    pub reverse_orientation: bool,
    pub transform_swaps_handedness: bool,
}

#[repr(C)]
#[derive(Debug, Clone, Copy)]
pub struct DeviceBilinearPatchMesh {
    pub n_patches: u32,
    pub n_vertices: u32,
    pub vertex_indices: Ptr<u32>,
    pub p: Ptr<Point3f>,
    pub n: Ptr<Normal3f>,
    pub uv: Ptr<Point2f>,
    pub reverse_orientation: bool,
    pub transform_swaps_handedness: bool,
    pub image_distribution: Ptr<DevicePiecewiseConstant2D>,
}

unsafe impl Send for DeviceTriangleMesh {}
unsafe impl Sync for DeviceTriangleMesh {}
unsafe impl Send for DeviceBilinearPatchMesh {}
unsafe impl Sync for DeviceBilinearPatchMesh {}
