-
Notifications
You must be signed in to change notification settings - Fork 3
/
Object.cpp
60 lines (46 loc) · 1.16 KB
/
Object.cpp
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
56
57
58
59
60
// Copyright 2022 The Khronos Group
// SPDX-License-Identifier: Apache-2.0
#include "Object.h"
// std
#include <atomic>
#include <cstdarg>
namespace visionaray {
// Object definitions /////////////////////////////////////////////////////////
Object::Object(ANARIDataType type, VisionarayGlobalState *s)
: helium::BaseObject(type, s)
{
helium::BaseObject::markUpdated();
s->commitBufferAddObject(this);
}
void Object::commit()
{
// no-op
}
bool Object::getProperty(
const std::string_view &name, ANARIDataType type, void *ptr, uint32_t flags)
{
if (name == "valid" && type == ANARI_BOOL) {
helium::writeToVoidP(ptr, isValid());
return true;
}
return false;
}
bool Object::isValid() const
{
return true;
}
VisionarayGlobalState *Object::deviceState() const
{
return (VisionarayGlobalState *)helium::BaseObject::m_state;
}
// UnknownObject definitions //////////////////////////////////////////////////
UnknownObject::UnknownObject(ANARIDataType type, VisionarayGlobalState *s)
: Object(type, s)
{
}
bool UnknownObject::isValid() const
{
return false;
}
} // namespace visionaray
VISIONARAY_ANARI_TYPEFOR_DEFINITION(visionaray::Object *);