Path: blob/master/thirdparty/embree/kernels/geometry/curve_intersector_precalculations.h
9905 views
// Copyright 2009-2021 Intel Corporation1// SPDX-License-Identifier: Apache-2.023#pragma once45#include "../common/ray.h"6#include "../common/geometry.h"78namespace embree9{10namespace isa11{12struct CurvePrecalculations113{14float depth_scale;15LinearSpace3fa ray_space;1617__forceinline CurvePrecalculations1() {}1819__forceinline CurvePrecalculations1(const Ray& ray, const void* ptr)20{21depth_scale = rsqrt(dot(ray.dir,ray.dir));22LinearSpace3fa space = frame(depth_scale*ray.dir);23space.vz *= depth_scale;24ray_space = space.transposed();25}26};2728template<int K>29struct CurvePrecalculationsK30{31vfloat<K> depth_scale;32LinearSpace3fa ray_space[K];3334__forceinline CurvePrecalculationsK(const vbool<K>& valid, const RayK<K>& ray)35{36size_t mask = movemask(valid);37depth_scale = rsqrt(dot(ray.dir,ray.dir));38while (mask) {39size_t k = bscf(mask);40Vec3fa ray_dir_k = Vec3fa(ray.dir.x[k],ray.dir.y[k],ray.dir.z[k]);41LinearSpace3fa ray_space_k = frame(depth_scale[k]*ray_dir_k);42ray_space_k.vz *= depth_scale[k];43ray_space[k] = ray_space_k.transposed();44}45}46};47}48}495051