// Copyright 2023 drey7925 // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // SPDX-License-Identifier: Apache-2.0 syntax = "proto3"; package perovskite.protocol.render; message TextureReference { string texture_name = 1; // Only supported for rendering blocks, not supported in inventory or popups yet TextureCrop crop = 2; } // If set, the texture will be cropped to the given coordinates. // Use ranges 0-1 for the full texture message TextureCrop { float left = 1; float top = 2; float right = 3; float bottom = 4; // If set, the rectangle defined by the four fields above will // be cropped *further* by this dynamic rule DynamicCrop dynamic = 5; } // The rule defining how to crop a texture based on its variant message DynamicCrop { // AND the variant with this value to get the horizontal grid cell (the 1 bits must be contiguous)... uint32 x_selector_bits = 1; // out of this many grid cells total. Values range from [0..x_cells-1] // with 0 leftmost in the texture uint32 x_cells = 2; // Do the same thing with these fields to get the vertical grid cell // (0 is topmost, TODO check) uint32 y_selector_bits = 3; uint32 y_cells = 4; // If variant AND this is nonzero, flip the selected grid cell horizontally uint32 flip_x_bit = 5; // If variant AND this is nonzero, flip the selected grid cell vertically uint32 flip_y_bit = 6; // If set, invert the logic of flip_x_bit bool extra_flip_x = 7; // If set, invert the logic of flip_y_bit bool extra_flip_y = 8; } message CustomMesh { // The texture to apply to the mesh TextureReference texture = 1; // Parallel arrays of vertices. All of these must have the same length // In vulkan's coordinate system, with Y going down. repeated float x = 2; repeated float y = 3; repeated float z = 4; // Parallel arrays of texture coordinates, relative to the texture field. // These will be internally rescaled to fit the position of the texture in // any texture atlases // u is in [0..1] going left to right repeated float u = 5; // v is in [0..1] going top to bottom repeated float v = 6; // Parallel arrays of vertex normals repeated float nx = 7; repeated float ny = 8; repeated float nz = 9; // This list's length must be divisible by 3 // Each three entries in this list define a triangle // All values must be <= the number of vertices in the parallel arrays above. repeated uint32 indices = 10; }