1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
syntax = "proto3";
package ucsProcess;
option go_package = "./golang/avvyprotocol";
option csharp_namespace = "AvvyProtocol";
import "avvyprotocol/ucsmodel.proto";
service UCSProcess {
rpc Process(UCSProcessRequest) returns (UCSProcessResponse);
}
message UCSProcessRequest {
// Batch request, one may supply a list of instructions
repeated UCSWorkerInstruction ucsWorkerInstruction = 1;
}
message UCSProcessResponse {
// Batch reply, one for each worker instruction supplied in UCSProcessRequest
repeated UCSProcessInstructionResponse ucsProcessInstructionResponse = 1;
}
message UCSProcessInstructionResponse {
oneof response {
string error = 1;
UCSWorkerResult result = 2;
}
}
/*
This message is serialized and passed directly to worker subprocess.
*/
message UCSWorkerInstruction {
oneof instruction {
ModelImportInstruction modelImportInstruction = 1;
ImageCompressionInstruction imageCompressionInstruction = 2;
BlockCellsCalculationInstruction blockCellsCalculationInstruction = 3;
}
}
/*
This message is created in worker subprocess.
*/
message UCSWorkerResult {
repeated UCSWorkerResultElement elements = 1;
}
message UCSWorkerResultElement {
ucs.UCSObjectId contentId = 1;
ucs.StaticContent content = 2;
}
/*
Files should be passed as RawFile messages to ensure their format is recognized correctly.
*/
message RawFile {
// Only supported input file formats
FileFormats fileFormat = 1;
// File binary data
bytes file = 3;
}
/*
Supported file formats
*/
enum FileFormats {
// Image
FMT_PNG = 0;
// 3D model
FMT_GLB = 1;
}
// INSTRUCTIONS
/*
ModelImportInstruction - upload a 3D model and get SceneObject with materials back, important options:
1. Compress textures in place or leave them as PNG.
*/
message ModelImportInstruction {
// Model itself, at the moment only glb is supported
RawFile model = 1;
// Texture compression options. PNG is useful for wizard first step (texture compression takes a lot of time).
InstrTextureImportOption textureImportOption = 2;
// Do you need block cells calculation?
InstrBlockCellsOption blockCellsOption = 3;
// Should we convert to gpu formats right away?
enum InstrTextureImportOption {
// Convert all exported textures into GPU formats
TXTIMP_COMPRESS_TO_GPU_FORMATS = 0;
// Export textures only as PNG
TXTIMP_IMPORT_ONLY_PNG = 1;
}
// Should we calculate block cells?
enum InstrBlockCellsOption {
// Calculate block cells as regular
BC_CALCULATE_BLOCK_CELLS = 0;
// Skip block cells calculation
BC_SKIP_BLOCK_CELLS_CALCULATION = 1;
}
}
/*
ImageCompressionInstruction - compress an image from PNG to GPU formats. Important options:
1. flipImage options - for model textures we should flip everything, for previews PNG should remain not flipped.
2. textureResizeOption options - should we resize images (useful for previews).
3. createMipmaps - we do not need mipmaps for previews.
4. textureColorSpaceOption - enforce colorspace RGBA8 (useful for previews).
*/
message ImageCompressionInstruction {
// Image itself, only PNG is supported
RawFile image = 1;
// Should we flip image over Y axis?
InstrFlipImageOption flipImage = 2;
// Should we resize image? If so, small (256*256) or large (512*512) target?
InstrTextureResizeOption textureResizeOption = 3;
// Should we create mipmaps (set false for previews, true for textures)
InstrMipmapsOption mipmapOption = 4;
// Does any additional post-processing needed (e.g. cropping a circle)?
InstrPostprocessingOption postprocessingOption = 5;
// Should we resize image? If so, small (256*256) or large (512*512) target?
enum InstrTextureResizeOption {
// Downscale to 1024*1024 or other smaller closest power of 2
TXT_POWER_OF_TWO = 0;
// No size reduction, use with caution
TXT_NO_RESIZE = 1;
// Create both small 256*256 and large 512*512 previews
TXT_SMALL_AND_LARGE_PREVIEW = 2;
// Small 256*256 preview only
TXT_SMALL_PREVIEW = 3;
// Large 512*512 preview only
TXT_LARGE_PREVIEW = 4;
}
// Should we flip image over Y axis?
enum InstrFlipImageOption {
// Flip all formats, suitable for textures themselves.
FLP_FLIP_ALL = 0;
// Flip only gpu formats (dxt / etc2 / basis / ...), leave PNG with original export. Suitable for previews.
FLP_FLIP_ONLY_GPU_TEX = 1;
// No flip, use with caution
FLP_NO_FLIP = 2;
}
// Should we create mipmaps
enum InstrMipmapsOption {
// Calculate all mipmaps down to 1px - suitable for material textures
MM_ALL_MIPMAPS = 0;
// No mipmaps - suitable for previews
MM_NO_MIPMAPS = 1;
}
// Should we do something special about the image?
enum InstrPostprocessingOption {
// No post-processing
PP_NO_POSTPROCESS = 0;
// Crop a circle - suitable for textures previews
PP_CROP_CIRCLE = 1;
}
}
/*
BlockCellsCalculationInstructions - calculate block cells for an imported mesh model (useful for wizard editor)
*/
message BlockCellsCalculationInstruction {
// Add all meshes here with applied transforms
repeated PositionedMesh positionedMeshes = 1;
message PositionedMesh {
// 4*4 matrix
repeated float transform = 1;
// Provide vertices and faces
ucs.Mesh mesh = 2;
}
}