初始提交: UE5.3项目基础框架
This commit is contained in:
@ -0,0 +1,48 @@
|
||||
// Copyright 2020-2024 CesiumGS, Inc. and Contributors
|
||||
|
||||
#include "CesiumPrimitiveMetadata.h"
|
||||
#include "CesiumGltf/AccessorView.h"
|
||||
#include "CesiumGltf/ExtensionMeshPrimitiveExtStructuralMetadata.h"
|
||||
#include "CesiumGltf/Model.h"
|
||||
#include "CesiumGltfPrimitiveComponent.h"
|
||||
|
||||
static FCesiumPrimitiveMetadata EmptyPrimitiveMetadata;
|
||||
|
||||
FCesiumPrimitiveMetadata::FCesiumPrimitiveMetadata(
|
||||
const CesiumGltf::MeshPrimitive& Primitive,
|
||||
const CesiumGltf::ExtensionMeshPrimitiveExtStructuralMetadata& Metadata)
|
||||
: _propertyTextureIndices(), _propertyAttributeIndices() {
|
||||
this->_propertyTextureIndices.Reserve(Metadata.propertyTextures.size());
|
||||
for (const int64 propertyTextureIndex : Metadata.propertyTextures) {
|
||||
this->_propertyTextureIndices.Emplace(propertyTextureIndex);
|
||||
}
|
||||
|
||||
this->_propertyAttributeIndices.Reserve(Metadata.propertyAttributes.size());
|
||||
for (const int64 propertyAttributeIndex : Metadata.propertyAttributes) {
|
||||
this->_propertyAttributeIndices.Emplace(propertyAttributeIndex);
|
||||
}
|
||||
}
|
||||
|
||||
const FCesiumPrimitiveMetadata&
|
||||
UCesiumPrimitiveMetadataBlueprintLibrary::GetPrimitiveMetadata(
|
||||
const UPrimitiveComponent* component) {
|
||||
const UCesiumGltfPrimitiveComponent* pGltfComponent =
|
||||
Cast<UCesiumGltfPrimitiveComponent>(component);
|
||||
if (!IsValid(pGltfComponent)) {
|
||||
return EmptyPrimitiveMetadata;
|
||||
}
|
||||
|
||||
return pGltfComponent->getPrimitiveData().Metadata;
|
||||
}
|
||||
|
||||
const TArray<int64>&
|
||||
UCesiumPrimitiveMetadataBlueprintLibrary::GetPropertyTextureIndices(
|
||||
UPARAM(ref) const FCesiumPrimitiveMetadata& PrimitiveMetadata) {
|
||||
return PrimitiveMetadata._propertyTextureIndices;
|
||||
}
|
||||
|
||||
const TArray<int64>&
|
||||
UCesiumPrimitiveMetadataBlueprintLibrary::GetPropertyAttributeIndices(
|
||||
UPARAM(ref) const FCesiumPrimitiveMetadata& PrimitiveMetadata) {
|
||||
return PrimitiveMetadata._propertyAttributeIndices;
|
||||
}
|
||||
Reference in New Issue
Block a user