Skip to content

Commit

Permalink
Merge branch 'master' into world-anchor
Browse files Browse the repository at this point in the history
  • Loading branch information
timoore committed Mar 20, 2024
2 parents aa02134 + 874468e commit 0a11e39
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 31 deletions.
4 changes: 3 additions & 1 deletion src/vsgCs/GltfLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ using namespace vsgCs;
GltfLoader::GltfLoader(vsg::ref_ptr<RuntimeEnvironment> in_env)
: env(in_env)
{
readerOptions.ktx2TranscodeTargets = env->features.ktx2TranscodeTargets;
}

struct ParseGltfResult
Expand Down Expand Up @@ -74,7 +75,8 @@ CesiumAsync::Future<GltfLoader::ReadGltfResult> GltfLoader::loadGltfNode(std::st
{
std::vector<CesiumAsync::IAssetAccessor::THeader> headers;
auto accessor = env-> getAssetAccessor();
return reader.loadGltf(getAsyncSystem(), uri, headers, accessor)
return reader.loadGltf(getAsyncSystem(), uri, headers, accessor,
readerOptions)
.thenInWorkerThread([this](CesiumGltfReader::GltfReaderResult&& gltfResult)
{
CreateModelOptions modelOptions{};
Expand Down
1 change: 1 addition & 0 deletions src/vsgCs/GltfLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,6 @@ namespace vsgCs
CesiumAsync::Future<ReadGltfResult> loadGltfNode(std::string uri) const;
vsg::ref_ptr<RuntimeEnvironment> env;
CesiumGltfReader::GltfReader reader;
CesiumGltfReader::GltfReaderOptions readerOptions;
};
}
25 changes: 0 additions & 25 deletions src/vsgCs/UrlAssetAccessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,31 +189,6 @@ UrlAssetAccessor::~UrlAssetAccessor()
curl_global_cleanup();
}

class CurlHandle
{
public:
explicit CurlHandle(UrlAssetAccessor* in_accessor)
: _accessor(in_accessor)

{
_curl = _accessor->curlCache.get();
}

~CurlHandle()
{
_accessor->curlCache.release(_curl);
}

CURL* operator()() const
{
return _curl;
}

private:
UrlAssetAccessor* _accessor;
CURL* _curl;
};

template <typename TC>
curl_slist* setCommonOptions(CURL* curl, const std::string& url, const std::string& userAgent,
const TC& headers)
Expand Down
13 changes: 8 additions & 5 deletions src/vsgCs/runtimeSupport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -376,22 +376,25 @@ namespace
vsg::ref_ptr<vsg::Data>
makeArray(uint32_t width, uint32_t height, void* data, vsg::Data::Properties in_properties)
{
auto [block_width, block_height] = getBlockSize(in_properties.format);
auto mem_width = width / block_width;
auto mem_height = height / block_height;
switch (in_properties.format)
{
case VK_FORMAT_R8_SRGB:
case VK_FORMAT_R8_UNORM:
return vsg::ubyteArray2D::create(width, height,
return vsg::ubyteArray2D::create(mem_width, mem_height,
reinterpret_cast<vsg::ubyteArray2D::value_type*>(data),
in_properties);
case VK_FORMAT_R8G8_SRGB:
case VK_FORMAT_R8G8_UNORM:
return vsg::ubvec2Array2D::create(width, height,
return vsg::ubvec2Array2D::create(mem_width, mem_height,
reinterpret_cast<vsg::ubvec2Array2D::value_type*>(data),
in_properties);

case VK_FORMAT_R8G8B8A8_SRGB:
case VK_FORMAT_R8G8B8A8_UNORM:
return vsg::ubvec4Array2D::create(width, height,
return vsg::ubvec4Array2D::create(mem_width, mem_height,
reinterpret_cast<vsg::ubvec4Array2D::value_type*>(data),
in_properties);
case VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK:
Expand All @@ -402,7 +405,7 @@ namespace
case VK_FORMAT_PVRTC2_4BPP_SRGB_BLOCK_IMG:
case VK_FORMAT_PVRTC2_4BPP_UNORM_BLOCK_IMG:
case VK_FORMAT_EAC_R11_UNORM_BLOCK:
return vsg::block64Array2D::create(width, height,
return vsg::block64Array2D::create(mem_width, mem_height,
reinterpret_cast<vsg::block64Array2D::value_type*>(data),
in_properties);
case VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK:
Expand All @@ -415,7 +418,7 @@ namespace
case VK_FORMAT_ASTC_4x4_SRGB_BLOCK:
case VK_FORMAT_ASTC_4x4_UNORM_BLOCK:
case VK_FORMAT_EAC_R11G11_UNORM_BLOCK:
return vsg::block128Array2D::create(width, height,
return vsg::block128Array2D::create(mem_width, mem_height,
reinterpret_cast<vsg::block128Array2D::value_type*>(data),
in_properties);
default:
Expand Down

0 comments on commit 0a11e39

Please sign in to comment.