File: scene_user_geometry.cpp

package info (click to toggle)
embree 4.4.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 99,492 kB
  • sloc: cpp: 224,036; xml: 40,944; ansic: 2,731; python: 812; sh: 639; makefile: 228; csh: 42
file content (55 lines) | stat: -rw-r--r-- 1,519 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Copyright 2009-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0

#include "scene_user_geometry.h"
#include "scene.h"

namespace embree
{
#if defined(EMBREE_LOWEST_ISA)

  UserGeometry::UserGeometry (Device* device, unsigned int items, unsigned int numTimeSteps) 
    : AccelSet(device,Geometry::GTY_USER_GEOMETRY,items,numTimeSteps) {}

  void UserGeometry::addElementsToCount (GeometryCounts & counts) const
  {
    if (numTimeSteps == 1) counts.numUserGeometries += numPrimitives;
    else                   counts.numMBUserGeometries += numPrimitives;
  }
  
  void UserGeometry::setMask (unsigned mask) 
  {
    this->mask = mask; 
    Geometry::update();
  }

  void UserGeometry::setBoundsFunction (RTCBoundsFunction bounds, void* userPtr) {
    this->boundsFunc = bounds;
  }

  void UserGeometry::setIntersectFunctionN (RTCIntersectFunctionN intersect) {
    intersectorN.intersect = intersect;
  }

  void UserGeometry::setOccludedFunctionN (RTCOccludedFunctionN occluded) {
    intersectorN.occluded = occluded;
  }

  size_t UserGeometry::getGeometryDataDeviceByteSize() const {
    return 16 * ((sizeof(UserGeometry) + 15) / 16);
  }

  void UserGeometry::convertToDeviceRepresentation(size_t offset, char* data_host, char* data_device) const {
    std::memcpy(data_host + offset, (void*)this, sizeof(UserGeometry));
    offset += sizeof(Instance);
  }

#endif

  namespace isa
  {
    UserGeometry* createUserGeometry(Device* device) {
      return new UserGeometryISA(device);
    }
  }
}