1// Copyright (C) 2008-2012 NVIDIA Corporation.
2// Copyright (C) 2019 The Qt Company Ltd.
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
4
5
6#include "qssgrendergraphobject_p.h"
7
8QT_BEGIN_NAMESPACE
9
10static const char *asString(QSSGRenderGraphObject::Type type)
11{
12 using Type = QSSGRenderGraphObject::Type;
13#define RETURN_AS_STRING(T) case T: return #T;
14 switch (type) {
15 RETURN_AS_STRING(Type::Unknown)
16 RETURN_AS_STRING(Type::Node)
17 RETURN_AS_STRING(Type::Layer)
18 RETURN_AS_STRING(Type::Joint)
19 RETURN_AS_STRING(Type::Skeleton)
20 RETURN_AS_STRING(Type::ImportScene)
21 RETURN_AS_STRING(Type::ReflectionProbe)
22 RETURN_AS_STRING(Type::DirectionalLight)
23 RETURN_AS_STRING(Type::PointLight)
24 RETURN_AS_STRING(Type::SpotLight)
25 RETURN_AS_STRING(Type::OrthographicCamera)
26 RETURN_AS_STRING(Type::PerspectiveCamera)
27 RETURN_AS_STRING(Type::CustomFrustumCamera)
28 RETURN_AS_STRING(Type::CustomCamera)
29 RETURN_AS_STRING(Type::Model)
30 RETURN_AS_STRING(Type::Item2D)
31 RETURN_AS_STRING(Type::Particles)
32 RETURN_AS_STRING(Type::SceneEnvironment)
33 RETURN_AS_STRING(Type::Effect)
34 RETURN_AS_STRING(Type::Geometry)
35 RETURN_AS_STRING(Type::TextureData)
36 RETURN_AS_STRING(Type::MorphTarget)
37 RETURN_AS_STRING(Type::ModelInstance)
38 RETURN_AS_STRING(Type::ModelBlendParticle)
39 RETURN_AS_STRING(Type::ResourceLoader)
40 RETURN_AS_STRING(Type::DefaultMaterial)
41 RETURN_AS_STRING(Type::PrincipledMaterial)
42 RETURN_AS_STRING(Type::CustomMaterial)
43 RETURN_AS_STRING(Type::SpecularGlossyMaterial)
44 RETURN_AS_STRING(Type::Skin)
45 RETURN_AS_STRING(Type::Image2D)
46 RETURN_AS_STRING(Type::ImageCube)
47 RETURN_AS_STRING(Type::RenderExtension)
48 }
49#undef RETURN_AS_STRING
50 return nullptr;
51}
52
53static QSSGRenderGraphObject::FlagT flagForType(QSSGRenderGraphObject::Type type)
54{
55 const bool hasGraphicsResources = ((type == QSSGRenderGraphObject::Type::Model)
56 || (QSSGRenderGraphObject::isTexture(type))
57 || (type == QSSGRenderGraphObject::Type::Geometry)
58 || (type == QSSGRenderGraphObject::Type::TextureData)
59 || (type == QSSGRenderGraphObject::Type::ResourceLoader));
60 return hasGraphicsResources ? QSSGRenderGraphObject::FlagT(QSSGRenderGraphObject::Flags::HasGraphicsResources)
61 : 0;
62}
63
64QSSGRenderGraphObject::QSSGRenderGraphObject(Type inType)
65 : type(inType)
66 , flags(flagForType(type: inType)) {}
67
68QSSGRenderGraphObject::~QSSGRenderGraphObject() {}
69
70#ifndef QT_NO_DEBUG_STREAM
71QDebug operator<<(QDebug dbg, const QSSGRenderGraphObject::Type type)
72{
73 dbg.nospace() << "QSSGRenderGraphObject" << '{' << asString(type) << '}';
74 return dbg;
75}
76#endif
77
78QT_END_NAMESPACE
79

source code of qtquick3d/src/runtimerender/graphobjects/qssgrendergraphobject.cpp