From 4bb419031c130402a5589ff698e28e230a0c123a Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 19 Aug 2022 01:45:47 +0300 Subject: SL-17653 Basic local gltf materials --- indra/newview/lltinygltfhelper.h | 55 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 indra/newview/lltinygltfhelper.h (limited to 'indra/newview/lltinygltfhelper.h') diff --git a/indra/newview/lltinygltfhelper.h b/indra/newview/lltinygltfhelper.h new file mode 100644 index 0000000000..a25fdac41d --- /dev/null +++ b/indra/newview/lltinygltfhelper.h @@ -0,0 +1,55 @@ +/** + * @file lltinygltfhelper.h + * + * $LicenseInfo:firstyear=2022&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2022, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + + +#pragma once + +#include "llgltfmaterial.h" +#include "llpointer.h" +#include "tinygltf/tiny_gltf.h" + +class LLImageRaw; +class LLViewerFetchedTexture; + +namespace LLTinyGLTFHelper +{ + void setFromModel(LLGLTFMaterial* mat, tinygltf::Model& model); + LLColor4 getColor(const std::vector& in); + const tinygltf::Image* getImageFromTextureIndex(const tinygltf::Model& model, S32 texture_index); + LLImageRaw* getTexture(const std::string& folder, const tinygltf::Model& model, S32 texture_index, std::string& name); + LLImageRaw* getTexture(const std::string& folder, const tinygltf::Model& model, S32 texture_index); + + void initFetchedTextures(tinygltf::Material& material, + LLPointer& albedo_img, + LLPointer& normal_img, + LLPointer& mr_img, + LLPointer& emissive_img, + LLPointer& occlusion_img, + LLPointer& albedo_tex, + LLPointer& normal_tex, + LLPointer& mr_tex, + LLPointer& emissive_tex); +} + -- cgit v1.2.3