Disclosure of Invention
The invention mainly aims to provide a storage method, a storage device, computer equipment and a storage medium for 3D model data, so as to solve the technical problem that the efficiency is low in the storage, transmission and rendering processes caused by large file size, low data security and rendering performance bottleneck in the traditional 3D model storage method.
The invention provides a storage method of 3D model data, which comprises the following steps of obtaining 3D model data, carrying out coding and serialization processing on the 3D model data to obtain a character string capable of completely representing the 3D model data, carrying out segmentation processing on the character string according to a preset segmentation rule to obtain a plurality of sub-character strings, extracting attribute information from each sub-character string, generating attribute character strings corresponding to each sub-character string according to the attribute information, replacing specific content in the attribute character strings by adopting a regular expression, carrying out compression encryption processing on the sub-character strings and the attribute character strings corresponding to the sub-character strings to obtain a plurality of compression encryption files, and storing or transmitting the compression encryption files.
Further, the 3D model data at least comprises picture data and texture data, and after the 3D model data is acquired, the 3D model data storage method further comprises the steps of carrying out preliminary preprocessing on the picture data, removing repeated picture files in the picture data, generating a unique UUID (user identifier) for each picture file in the picture data, replacing mapping data representing the picture files by using a UUID array, determining picture files corresponding to each texture sub-data in the texture data, and replacing the mapping data between the texture sub-data and the picture files by using the UUID array of the picture files.
Further, the 3D model data at least comprises geometric data, and after the 3D model data are acquired, the 3D model data storage method further comprises the steps of acquiring precision adjustment parameters of the geometric data, and optimizing the precision of a normal array, position data and UV attribute data in the geometric data according to the precision adjustment parameters.
Further, the character string is segmented according to a preset segmentation rule to obtain a plurality of sub-character strings, the method comprises the steps of starting to read the character string from the beginning position of the character string, reading the characters with the preset length, determining the first segmentation character existing in the characters with the preset length based on a preset segmentation mark list, determining whether the second segmentation character exists in the characters with the preset length, segmenting the characters with the preset length from the character string to obtain a sub-character string if the second segmentation character does not exist, segmenting the characters between the first segmentation character and the second segmentation character from the character string to obtain a sub-character string if the second segmentation character exists, determining the remaining characters in the character string, and re-executing the step of starting to read the characters with the preset length from the beginning position of the character string based on the remaining characters until the character string is segmented.
Further, attribute information is extracted from each sub-string, attribute strings corresponding to the sub-strings are generated according to the attribute information, an empty data list is created, wherein the data list is used for storing the attribute strings, the currently processed sub-string is initialized, content between a first symbol and a second symbol in the sub-string is extracted, the attribute information corresponding to the sub-string is determined according to the content between the first symbol and the second symbol, the attribute strings corresponding to the sub-string are generated according to the attribute information corresponding to the sub-string, the attribute strings are written into the data list, the sub-string without the attribute information is determined, and the sub-string with the attribute information without the attribute information is adopted to execute the step of initializing the currently processed sub-string until all the attribute strings corresponding to the sub-string are written into the data list.
Further, the regular expression is adopted to replace specific content in the attribute character strings, the method comprises the steps of obtaining a preset attribute character comparison table, wherein the attribute character comparison table comprises a first column and a second column, the first column comprises a plurality of first character strings, the second column comprises a plurality of second character strings, the first character strings correspond to the specific content in the attribute character strings, whether any first character string exists in the attribute character strings or not is recognized based on the attribute character comparison table, and if the first character string exists, the first character string existing in the attribute character strings is replaced with the corresponding second character string based on the attribute character comparison table.
Further, compressing and encrypting the sub-character strings and attribute character strings corresponding to the sub-character strings to obtain a plurality of compressed and encrypted files, and storing or transmitting the compressed and encrypted files, wherein the compressing and encrypting the sub-character strings and the attribute character strings corresponding to the sub-character strings to obtain 3D model compressed data by adopting a gzip algorithm, converting the compressed 3D model compressed data into UTF-16 coding format, generating a pair of public key and private key by using an asymmetric encryption algorithm, encrypting the 3D model compressed data after format conversion by using the public key to obtain 3D model encrypted data, transmitting or storing the 3D model encrypted data in a server, and transmitting the private key to a target object so that the target object decompresses and decodes the 3D model encrypted data.
The invention provides a storage device of 3D model data, which comprises an acquisition unit, a segmentation unit, a replacement unit and an encryption compression unit, wherein the acquisition unit is used for acquiring 3D model data, carrying out coding and serialization processing on the 3D model data to obtain a character string capable of completely representing the 3D model data, the segmentation unit is used for carrying out segmentation processing on the character string according to a preset segmentation rule to obtain a plurality of sub-character strings, the replacement unit is used for extracting attribute information from each sub-character string, generating attribute character strings corresponding to each sub-character string according to the attribute information, replacing specific content in the attribute character strings by adopting a regular expression, and carrying out compression encryption processing on the sub-character strings and the attribute character strings corresponding to the sub-character strings to obtain a plurality of compression encryption files and carrying out storage or transmission processing by adopting the compression encryption files.
The invention also provides a computer device comprising a memory and a processor, the memory having stored therein a computer program, the processor implementing the steps of any of the methods described above when the computer program is executed.
The invention also provides a computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of the method of any of the preceding claims.
According to the storage method, the storage device, the computer equipment and the storage medium for the 3D model data, the 3D model data are obtained, and are encoded and serialized to generate a character string capable of completely representing the 3D model data. This step converts complex 3D model data (e.g., vertices, edges, faces, materials, etc.) into a structured string representation by using, for example, JSON, XML, or binary coding, to facilitate subsequent processing. And then, dividing the character string according to a preset dividing rule to obtain a plurality of sub-character strings. The segmentation rules may segment a large string into a plurality of smaller, manageable sub-strings based on string length or logical structure of the model data (e.g., by model hierarchy, object segmentation), etc. The processing mode is favorable for parallel processing, and reduces the data volume of single operation, thereby improving the processing efficiency. Then, attribute information is extracted from each sub-string, and an attribute string corresponding to each sub-string is generated according to the attribute information. To improve data compression efficiency, regular expressions are also used to replace specific content. The attribute information may include model geometry, material properties, location, etc., and regular expressions are used to match and replace common values or labels to reduce redundant information. And finally, carrying out compression encryption processing on the sub-character strings and the attribute character strings to obtain a plurality of compression encryption files, and storing or transmitting the compression encryption files. Compression algorithms such as gzip or bzip2 may effectively reduce the data volume, while encryption algorithms such as AES or RSA may protect the security of the data. Compressing the encrypted file facilitates secure, efficient storage and transmission.
Compared with the prior art, the method has the advantages that through the steps of segmentation, attribute extraction and regular replacement, the redundancy of 3D model data is obviously reduced, the compression efficiency is improved, the file size is smaller, and the storage and transmission are more efficient. And secondly, encryption operation is carried out while compression processing, so that data leakage and tampering are effectively prevented, and the safety of business information and personal privacy data is protected. And thirdly, the segmented substring enables the rendering engine to load and decode small data blocks in parallel, so that the data volume of single operation is reduced, and the rendering speed and user interaction experience are improved. And finally, the size of the compressed and encrypted file after being segmented is more flexible, so that efficient transmission and storage can be conveniently carried out under different storage media and network environments, and the compressed and encrypted file is suitable for diversified application scenes and requirements.
In conclusion, the technical scheme solves the problems of large file volume, poor safety, low rendering efficiency and the like in the traditional 3D model storage method, and has outstanding substantive characteristics and remarkable progress.
Detailed Description
The present invention will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present invention more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
Referring to fig. 1, an embodiment of the present invention provides a method for storing 3D model data, including the steps of:
S1, acquiring 3D model data, and carrying out coding and serialization processing on the 3D model data to obtain a character string capable of completely representing the 3D model data.
S2, carrying out segmentation processing on the character strings according to a preset segmentation rule to obtain a plurality of sub-character strings.
And S3, extracting attribute information from each sub-string, generating attribute strings corresponding to each sub-string according to the attribute information, and replacing specific contents in the attribute strings by adopting a regular expression.
S4, carrying out compression encryption processing on the sub-character strings and attribute character strings corresponding to the sub-character strings to obtain a plurality of compression encryption files, and carrying out storage or transmission processing by adopting the compression encryption files.
That is, by acquiring 3D model data and performing encoding and serialization processing on the 3D model data, a character string capable of completely representing the 3D model data is generated. This step converts complex 3D model data (e.g., vertices, edges, faces, materials, etc.) into a structured string representation by using, for example, JSON, XML, or binary coding, to facilitate subsequent processing. And then, dividing the character string according to a preset dividing rule to obtain a plurality of sub-character strings. The segmentation rules may segment a large string into a plurality of smaller, manageable sub-strings based on string length or logical structure of the model data (e.g., by model hierarchy, object segmentation), etc. The processing mode is favorable for parallel processing, and reduces the data volume of single operation, thereby improving the processing efficiency. Then, attribute information is extracted from each sub-string, and an attribute string corresponding to each sub-string is generated according to the attribute information. To improve data compression efficiency, regular expressions are also used to replace specific content. The attribute information may include model geometry, material properties, location, etc., and regular expressions are used to match and replace common values or labels to reduce redundant information. And finally, carrying out compression encryption processing on the sub-character strings and the attribute character strings to obtain a plurality of compression encryption files, and storing or transmitting the compression encryption files. Compression algorithms such as gzip or bzip2 may effectively reduce the data volume, while encryption algorithms such as AES or RSA may protect the security of the data. Compressing the encrypted file facilitates secure, efficient storage and transmission.
Compared with the prior art, the method has the advantages that through the steps of segmentation, attribute extraction and regular replacement, the redundancy of 3D model data is obviously reduced, the compression efficiency is improved, the file size is smaller, and the storage and transmission are more efficient. And secondly, encryption operation is carried out while compression processing, so that data leakage and tampering are effectively prevented, and the safety of business information and personal privacy data is protected. And thirdly, the segmented substring enables the rendering engine to load and decode small data blocks in parallel, so that the data volume of single operation is reduced, and the rendering speed and user interaction experience are improved. And finally, the size of the compressed and encrypted file after being segmented is more flexible, so that efficient transmission and storage can be conveniently carried out under different storage media and network environments, and the compressed and encrypted file is suitable for diversified application scenes and requirements.
In conclusion, the technical scheme solves the problems of large file volume, poor safety, low rendering efficiency and the like in the traditional 3D model storage method, and has outstanding substantive characteristics and remarkable progress.
In one example, the 3D model data at least comprises picture data and texture data, and after the 3D model data is acquired, the 3D model data storage method further comprises the steps of carrying out preliminary preprocessing on the picture data, removing repeated picture files in the picture data, generating a unique UUID (user identifier) for each picture file in the picture data, replacing mapping data representing the picture files with UUID arrays, determining picture files corresponding to each texture sub-data in the texture data, and replacing mapping data between the texture sub-data and the picture files with UUID arrays of the picture files.
In this example, the 3D model data includes at least picture data and texture data. After the 3D model data is acquired, first, preliminary preprocessing is performed on the picture data. The preprocessing step comprises removing repeated picture files in the picture data to reduce redundancy and improve storage and processing efficiency. A unique UUID (universal unique identification code) is generated for each picture file in order to ensure that each picture file can be uniquely identified, thereby avoiding confusion and duplication.
Next, mapping data originally representing the image files is replaced with the generated UUID array. This means that where the picture file path or name was originally used directly, these UUIDs are now replaced. The advantage of this is that the data structure is further simplified, and the UUID has the characteristics of uniqueness and globally unique identification, enhancing the reliability of data management.
For each texture sub-data in the texture data, determining the corresponding picture file, and then replacing mapping data between the texture sub-data and the picture file with a UUID array generated before. In this way, the texture sub-data no longer directly references specific picture files, but rather references UUIDs of these picture files. This alternative makes the texture data structure clearer and the corresponding picture files can be located and managed quickly by UUID.
The limitations of this example aim to optimize the storage and management of 3D model data, making the data structure more compact and efficient by removing duplicate picture files, generating unique UUIDs, and replacing the original mapping data, while improving the reliability and consistency of data management. The process not only reduces redundant data, but also ensures consistency and uniqueness of data references, is beneficial to improving efficiency of storage and transmission, and further optimizes the processing flow of 3D model data.
In one example, the 3D model data at least comprises geometric data, and after the 3D model data is acquired, the 3D model data storage method further comprises the steps of acquiring accuracy adjustment parameters of the geometric data, and optimizing the accuracy of a normal array, position data and UV attribute data in the geometric data according to the accuracy adjustment parameters.
In this example, the 3D model data includes at least geometry data. After the acquisition of the 3D model data, the storage method further comprises a precision optimization step. Specifically, this step acquires accuracy adjustment parameters of the geometry data, and performs optimization processing on the normal array, the position data, and the UV attribute data in the geometry data according to the parameters.
The precision adjustment parameter refers to a parameter that can control the fineness of the geometric data. The normal array contains the normal direction of each vertex for illumination calculation, the position data contains the coordinate information of each vertex, the shape of the geometric body is defined, and the UV attribute data contains the texture coordinate information of each vertex for texture mapping. According to the precision adjustment parameters, the data are optimized, the storage space requirement of the data can be reduced by reducing the bit number or sampling frequency of the data, and meanwhile, the storage and processing efficiency is improved on the premise of not obviously influencing the visual effect.
For example, if the precision adjustment parameters indicate that certain details are less important in the current application scenario, the precision of the normal array may be reduced, leaving only the necessary number of bits. Also, the accuracy of the position data and the UV attribute data can be adjusted as needed, such as reducing the decimal number of floating point numbers, thereby compressing the data volume.
It should be noted that the precision adjustment parameter of the geometric data may be a parameter input by a user.
In the technical scheme, the precision optimization processing is further expanded, and a dynamic precision adjustment method is provided for dynamically adjusting the precision of the geometric data based on the application scene and the real-time rendering requirement.
The method comprises the steps of acquiring the geometric data, and simultaneously acquiring the current application scene and rendering requirement information such as the position of a camera, the visual angle, the rendering capability of target equipment, the current frame rate and the like in real time. And calculating dynamic precision adjustment parameters according to the scene and the rendering information. These parameters may be automatically adjusted based on the current viewing angle and device capabilities. For example, when the camera is far from the geometry, the accuracy may be reduced, while the accuracy is increased when viewed at close range, with higher accuracy maintained on high performance devices and reduced accuracy on low performance devices to maintain fluency. And carrying out optimization processing on the normal array, the position data and the UV attribute data in the geometric data according to the dynamic precision adjustment parameters. Specific methods include, but are not limited to, 1, reducing the decimal number of the normal line data or performing a simplified process according to the precision parameter. 2. The vertex coordinate data is simplified, for example using vertex merging or reducing floating point number accuracy. 3. And the texture coordinate data are optimized, the precision of the texture coordinate data is adjusted according to the requirements, and unnecessary high-precision data are avoided.
And finally, updating the geometry data after optimization processing in real time and storing the geometry data into a proper data structure to ensure that the rendering effect is not influenced in the dynamic adjustment process. Meanwhile, a real-time feedback mechanism is established, and precision parameters are continuously adjusted according to user interaction and scene changes, so that self-adaptive precision optimization processing is realized.
In one example, the character string is segmented according to a preset segmentation rule to obtain a plurality of sub-character strings, wherein the sub-character strings comprise a first segmented character which exists in the character string with the preset length and a second segmented character which exists in the character string with the preset length are determined based on a preset segmentation mark list, if the second segmented character does not exist, the character string with the preset length is segmented from the character string to obtain a sub-character string, if the second segmented character exists, the character between the first segmented character and the second segmented character is segmented from the character string to obtain a sub-character string, the remaining characters in the character string are determined, and the step of reading the character with the preset length from the beginning of the character string is re-executed based on the remaining characters until the character string is segmented.
In this example, the character string is divided to obtain a plurality of sub-character strings, and the specific steps are that firstly, the characters with preset lengths are read from the initial position of the character string. For example, if the preset length is 100 characters, the first 100 characters are read from the start position of the character string. Next, based on a preset division mark list (e.g., comma, period, space, etc.), the first appearing divided character is found among the read 100 characters. At the same time, it is checked whether there is a second split character among the 100 characters. If the second split character does not exist in the 100 characters, the 100 characters are split from the character string as a sub-character string. In this case, only the read character needs to be directly segmented, and other segmentation markers do not need to be considered. If there is a second split character in the 100 characters, the character between the first split character and the second split character is split from the character string as a sub-character string. The aim of this is to ensure that the segmentation points are as close as possible to the actual segmentation markers, ensuring the rationality of the substrings.
After a sub-string is divided, the remaining characters in the string are determined, and based on the remaining characters, the step of reading characters of a predetermined length from the position where the string starts is re-performed. This step is repeated until the entire string is completely segmented.
The content defined by this example refines the step of segmenting the string by presetting the segmentation rules and the tag list, ensuring that each segmentation is as reasonable as possible and meets the expected character length. By searching for the segmentation character, the boundary of the substring can be more intelligently determined, and segmentation at an unsuitable position is avoided. The method not only improves the accuracy of segmentation, but also ensures the reasonable length of the substring, and is convenient for subsequent processing and management.
In one example, the method comprises the steps of extracting attribute information from each sub-string and generating attribute strings corresponding to each sub-string according to the attribute information, creating an empty data list, initializing the currently processed sub-string, extracting content between a first symbol and a second symbol in the sub-string, determining the attribute information corresponding to the sub-string according to the content between the first symbol and the second symbol, generating the attribute strings corresponding to the sub-string according to the attribute information corresponding to the sub-string, writing the attribute strings into the data list, determining sub-strings not extracting the attribute information, and executing an initializing current sub-string step by adopting the sub-strings not extracting the attribute information until all the attribute strings corresponding to the sub-strings are written into the data list.
In this example, the attribute information is extracted from each sub-string, and the attribute string corresponding to each sub-string is generated as follows:
First, an empty data list is created for storing the generated attribute strings. This list will hold attribute strings corresponding to all sub-strings. Then, the substring to be processed is initialized, and extraction of attribute information thereof is started. Specifically, content located between the first symbol and the second symbol is found from the substring. For example, the substring may contain a format such as "name, color, size", and the first symbol and the second symbol may be a colon and a comma. In this case, "car", "red", "large", and the like are attribute information that needs to be extracted.
And determining attribute information corresponding to the sub-character strings according to the extracted content, and generating corresponding attribute character strings. For example, if the substring is "name, color, size", the extracted information may include attributes such as "name", "color", "size", etc., and the generated attribute string may be "car: red" or other specified format.
And writing the generated attribute character string into a data list created before. In this way, attribute information of each sub-string is stored in the data list. Next, determining the substring without extracting the attribute information, repeating the steps, initializing the substring processed currently, continuing to extract the attribute information, generating the attribute string, and writing the attribute string into a data list. This process continues until the attribute strings of all sub-strings are extracted and stored in the data list.
The content defined in this example describes in detail how to extract attribute information from the substring and generate an attribute string through systematic steps. The process ensures the accuracy and consistency of data extraction by creating an empty data list to store attribute strings, processing each sub-string one by one, extracting content between specific symbols from the sub-strings, determining attribute information of the sub-strings, and generating corresponding attribute strings. And finally, writing all attribute character strings into a data list to ensure that the attribute information of each sub-character string is effectively processed and stored. The method improves the systematicness and the efficiency of data processing, and ensures that the generated attribute character strings can correctly reflect the attribute information in the sub character strings.
In one example, replacing specific content in the attribute strings by using a regular expression comprises obtaining a preset attribute character comparison table, wherein the attribute character comparison table comprises a first column and a second column, the first column comprises a plurality of first strings, the second column comprises a plurality of second strings, the first strings correspond to the specific content in the attribute strings, whether any first strings exist in the attribute strings or not is recognized based on the attribute character comparison table, and if the first strings exist, the first strings existing in the attribute strings are replaced by the corresponding second strings based on the attribute character comparison table.
In this example, the replacement of specific content in the attribute string with a regular expression proceeds as follows:
firstly, a preset attribute character comparison table is obtained. The comparison table comprises two columns, wherein the first column comprises a plurality of first character strings, and the second column comprises a second character string corresponding to the first character strings. The purpose of the look-up table is to define which strings need to be replaced and what they should be replaced. For example, a first column may contain the strings "red", "blue", "large", and a second column may contain the strings "R", "B", and "L", respectively.
Next, based on this attribute character comparison table, it is checked whether any first character string exists in the attribute character strings. The regular expression plays a key role here because it can quickly and efficiently identify and match specific content in a string. If any first string is found in the attribute strings, the first string present in the attribute string is replaced with a corresponding second string based on the attribute string lookup table. For example, if the attribute string has a content such as "color", and the look-up table defines that "red" corresponds to "R", then "red" is replaced with "R", so that the attribute string becomes "color".
This example details the process of replacing specific content in an attribute string by a combination of regular expressions and attribute character lookup tables. And using a preset attribute character comparison table to determine which character strings need to be replaced and the replacement targets of the character strings. The use of regular expressions ensures the efficiency and accuracy of the replacement operation. Finally, the replacement operation enables specific content in the attribute character string to be normalized and simplified, and subsequent processing and storage are facilitated. The method not only improves the efficiency of data processing, but also ensures the accuracy and consistency of replacement operation.
In one example, compressing and encrypting the sub-strings and attribute strings corresponding to the sub-strings to obtain a plurality of compressed and encrypted files, and storing or transmitting the compressed and encrypted files, wherein the compressing and encrypting files comprise compressing the sub-strings and the attribute strings corresponding to the sub-strings by adopting a gzip algorithm to obtain 3D model compressed data, converting the compressed 3D model compressed data into UTF-16 coding format, generating a pair of public key and private key by using an asymmetric encryption algorithm, encrypting the 3D model compressed data after format conversion by using the public key to obtain 3D model encrypted data, transmitting or storing the 3D model encrypted data in a server, and transmitting the private key to a target object so that the target object decompresses and decodes the 3D model encrypted data.
In this example, the sub-strings and the corresponding attribute strings are subjected to compression encryption processing to obtain a plurality of compression encrypted files and stored or transmitted, and the specific steps are as follows:
Firstly, compressing the sub character strings and the corresponding attribute character strings by adopting a gzip algorithm to generate 3D model compressed data. gzip is a widely used compression algorithm that can effectively reduce the volume of data. The compressed 3D model data is then converted to UTF-16 encoding format, which is done to ensure compatibility of the data when transmitted between different platforms and systems. A pair of public and private keys is then generated using an asymmetric encryption algorithm. Asymmetric encryption algorithms (such as RSA) encrypt and decrypt data using a public key that can be published publicly for encrypting the data and a private key that must be kept secret for decrypting the data. At this step, the generated public key will be used to encrypt the compressed 3D model data.
And encrypting the 3D model compressed data converted into the UTF-16 format by using the generated public key to obtain the 3D model encrypted data. The encryption process ensures that the data is not accessed and tampered with by unauthorized third parties during transmission and storage, thereby protecting the security of the data. The encrypted data (i.e., the 3D model encrypted data) may be securely transmitted or stored in a server. And finally, sending the private key to the target object. The target object may decrypt and decompress the encrypted data using this private key, thereby restoring the original 3D model data. Only the target object with the private key can decrypt the data, so that the safe transmission and storage of the data are ensured.
This example demonstrates how 3D model data can be efficiently transferred and stored while protecting data security by detailing the steps of compression and encryption. And the gzip algorithm is adopted for compression processing, so that the data volume is reduced, and the transmission and storage efficiency is improved. And the public key and the private key are generated by using an asymmetric encryption algorithm, and the public key is utilized to encrypt data, so that the security of the data in the transmission and storage processes is ensured. By sending the private key to the target object, the data can be decrypted and accessed only by the authorized object, thereby achieving the aim of data security protection.
Further, performing multi-stage compression, multi-layer encryption and integrity check processing on the sub-strings and attribute strings corresponding to the sub-strings to obtain a plurality of compressed and encrypted files, and performing storage or transmission processing by adopting the compressed and encrypted files, and may further include:
The method comprises the steps of performing primary compression processing on a sub-character string and an attribute character string by adopting a gzip algorithm to obtain primary compression data, performing secondary compression processing on the primary compression data by using a high-efficiency compression algorithm (such as Brotli or LZMA) to obtain final compression data, converting the final compression data into a UTF-16 coding format, and providing selection of other coding formats such as Base64 or UTF-8 according to requirements.
Generating a pair of public key and private key by using an asymmetric encryption algorithm, generating a symmetric key by using a symmetric encryption algorithm (such as AES), firstly encrypting the coded compressed data by using the symmetric key to obtain symmetric encrypted data, then encrypting the symmetric key by using the public key to obtain final encrypted data, generating a check code (such as SHA-256 hash value) for the final encrypted data, and attaching the check code to the end of the data for checking in the transmission and storage processes.
The final encrypted data is segmented according to a certain size, each segment of data is independently encrypted and checked, and the segmented data is sequentially transmitted or stored into a server, so that each segment of data is ensured to be independently processed. The private key and the encrypted symmetric key are securely sent to the target object for decrypting and decompressing the data, the private key may be transmitted over a secure channel (e.g., HTTPS), and the symmetric key may be transferred over public key encryption.
After receiving the private key and the encrypted symmetric key, the target object decrypts the symmetric key by using the private key, decrypts the received data by using the decrypted symmetric key, decodes and decompresses the data to recover the original 3D model data, and verifies the integrity of the data to ensure that the data is not tampered.
Namely, through multi-level compression, multi-layer encryption and integrity check, the efficiency and the safety of data transmission and storage are enhanced, and the integrity and confidentiality of 3D model data are ensured.
In summary, as shown in fig. 2, the technical scheme provided by the invention is that the 3D resource file is derived by professional modeling software and generally comprises DRC, GLB, OBJ, GLTF formats. Firstly, processing the picture data, removing repeated pictures, and establishing a mapping relation between a UUID of the picture and a UUID array. And then, processing the texture data, and replacing the UUID of the picture in the texture with a corresponding UUID array. For geometry data, the array of normals, positions and UV properties is processed with precision. And generating a character string according to the processed content, and dividing the character string according to a preset dividing rule. The segmentation rules may be based on specific separators, character lengths, or other custom rules, and may result in a number of substrings after segmentation.
The system further processes the sub-character strings obtained by segmentation, and extracts or generates attribute character strings. The attribute string may be a specific portion of the substring, a result of a calculation or conversion, or other information related to the substring. Next, the system performs a replacement operation on the attribute string using the regular expression. The regular replacement replaces specific contents in the attribute character string according to a preset rule, so that the flexibility and accuracy of character string processing are greatly improved.
The attribute character strings after regular replacement processing are recombined into new character strings by the system. In order to improve the transmission efficiency and the storage efficiency of data, the system carries out gzip compression on the newly generated character strings and converts the character strings into UTF-16 coding format, and the mode can reduce the size of the data, so that the transmission bandwidth and the storage space are saved. In order to ensure the safety of the data, the system carries out asymmetric encryption processing on the compressed data. And generating a pair of public key and private key by using an asymmetric encryption algorithm, and encrypting the compressed data by using the public key, so that the security of the data in the transmission and storage processes is ensured, and the data leakage and illegal access are prevented.
Finally, through the above steps, a obt file is generated for data storage based on the new character string. This file can be securely transmitted or stored in the server and the original 3D model data can be restored by sending the private key to the target object so that the target object decompresses and decodes the 3D model encrypted data.
Referring to fig. 3, an embodiment of the present invention provides a storage device for 3D model data, including:
the acquisition unit 1 is used for acquiring 3D model data, and carrying out coding and serialization processing on the 3D model data to obtain a character string capable of completely representing the 3D model data;
A segmentation unit 2, configured to segment the character string according to a preset segmentation rule to obtain a plurality of sub-character strings;
A replacing unit 3, configured to extract attribute information from each sub-string, generate an attribute string corresponding to each sub-string according to the attribute information, and replace specific content in the attribute string by using a regular expression;
And the encryption and compression unit 4 is used for carrying out compression and encryption processing on the sub-character strings and the attribute character strings corresponding to the sub-character strings to obtain a plurality of compression and encryption files, and carrying out storage or transmission processing by adopting the compression and encryption files.
In this embodiment, for specific implementation of each unit in the above embodiment of the apparatus, please refer to the description in the above embodiment of the method, and no further description is given here.
Referring to fig. 4, in an embodiment of the present invention, there is further provided a computer device, which may be a server, and the internal structure of the computer device may be as shown in fig. 4. The computer device includes a processor, a memory, a display screen, an input device, a network interface, and a database connected by a system bus. Wherein the computer is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database of the computer device is used to store the corresponding data in this embodiment. The network interface of the computer device is used for communicating with an external terminal through a network connection. Which computer program, when being executed by a processor, carries out the above-mentioned method.
It will be appreciated by those skilled in the art that the architecture shown in fig. 4 is merely a block diagram of a portion of the architecture in connection with the present inventive arrangements and is not intended to limit the computer devices to which the present inventive arrangements are applicable.
An embodiment of the present invention also provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the above method. It is understood that the computer readable storage medium in this embodiment may be a volatile readable storage medium or a nonvolatile readable storage medium.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium provided by the present invention and used in embodiments may include non-volatile and/or volatile memory. The nonvolatile memory can include Read Only Memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual speed data rate SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (SYNCHLINK) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, apparatus, article, or method that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, apparatus, article, or method. Without further limitation, an element defined by the phrase "comprising one does not exclude the presence of other like elements in a process, apparatus, article, or method that comprises the element.
The foregoing description is only of the preferred embodiments of the present invention and is not intended to limit the scope of the invention, and all equivalent structures or equivalent processes using the descriptions and drawings of the present invention or direct or indirect application in other related technical fields are included in the scope of the present invention.