Scene graph export method, device, terminal device, and storage medium

Through the block rendering and copying method, the large-scale scene map is split into chunks that can be supported by the rendering engine, coordinate translation transformation and synthesis of the overall scene bitmap, solving the problem that large-scale scene maps cannot be directly rendered and saved in the existing technology, and realizing direct rendering and exporting of large-scale scene maps.

CN114549292BActive Publication Date: 2025-07-25WEBANK (CHINA)
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210174285.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-02-24
Publication Date
2025-07-25
Estimated Expiration
2042-02-24

AI Technical Summary

Technical Problem

The existing technology cannot directly render and save large-scale scene maps, especially scene maps with width and height of more than 100,000*100,000 pixels, and cannot render the entire large scene map in memory at one time and export and save.

Method used

Through the block rendering and copying method, the large-scale scene map is split into several scene chunks that can be supported by the rendering engine, coordinate translation is performed and rendered and copied to the corresponding position in the scene bitmap, and finally synthesize the overall scene bitmap and export it to save.

Benefits of technology

The direct rendering, exporting and saving of large-scale scene maps is realized, and the problem of not being able to directly store large scene maps in the prior art is solved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114549292B_ABST
    Figure CN114549292B_ABST
Patent Text Reader

Abstract

The present invention discloses a method, apparatus, terminal device, and storage medium for exporting a scene graph. By obtaining a scene graph to be processed; identifying the size of the scene graph to be processed and allocating memory for a scene bitmap according to the size of the scene graph; calculating the number of scene blocks according to the size of the scene graph to be processed to obtain each scene block; performing coordinate translation transformation on each scene block and rendering and copying it to the corresponding position in the scene bitmap to obtain an overall scene bitmap for exporting and saving the overall scene bitmap. The present invention realizes the direct rendering, exporting, and saving of a large-scale scene graph.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of graphics processing, and particularly to a method, device, terminal device, and storage medium for exporting a scene graph. Background Art

[0002] In risk control modeling software and graphic editing software, large-scale scene graphs are often involved. The width and height of these scene graphs in the software editing display window may exceed 100,000 * 100,000 pixels. When the software displays these large scene graphs, it is necessary to scroll the window to display each area in the scene. If these large scene graphs need to be saved as bitmaps to a hard disk file, it is necessary to first draw the bitmap of the entire scene graph in memory and then save it. However, the coordinate ranges supported by most rendering engines cannot directly render the entire large scene graph, and thus cannot be directly stored.

[0003] Therefore, it is necessary to propose a solution for directly rendering and exporting and saving a large-scale scene graph.

[0004] The above content is only used to assist in understanding the technical solution of the present invention, and does not represent an admission that the above content is prior art. Summary of the Invention

[0005] The main purpose of the present invention is to provide a method, device, terminal device, and storage medium for exporting a scene graph, aiming to solve the technical problem of directly rendering and exporting and saving a large-scale scene graph.

[0006] To achieve the above object, the present invention provides a method for exporting a scene graph, the method for exporting a scene graph including:

[0007] Obtain a scene graph to be processed;

[0008] Identify the size of the scene graph to be processed, and allocate memory for the scene bitmap according to the size of the scene graph;

[0009] Calculate the number of scene blocks according to the size of the scene graph to be processed, and obtain each scene block;

[0010] Perform coordinate translation transformation on each scene block, and render and copy it to the corresponding position in the scene bitmap to obtain an overall scene bitmap for exporting and saving the overall scene bitmap.

[0011] Optionally, the step of identifying the size of the scene graph to be processed and allocating memory for the scene bitmap according to the size of the scene graph includes:

[0012] Identify the size of the scene graph to be processed, where the size of the scene graph to be processed includes width and height;

[0013] Allocate the memory for the scene bitmap in the storage module according to the width and height of the scene graph.

[0014] Optionally, before the step of calculating the number of scene blocks according to the size of the to-be-processed scene graph to obtain each scene block, the following steps are further included:

[0015] Set the block range according to the rendering engine, where the block range includes the block width and height.

[0016] Optionally, the step of calculating the number of scene blocks according to the size of the to-be-processed scene graph to obtain each scene block includes:

[0017] Based on the block range, calculate the number of scene blocks according to the size of the to-be-processed scene graph;

[0018] Slice the to-be-processed scene graph according to the number of scene blocks to obtain each scene block.

[0019] Optionally, before the step of performing coordinate translation transformation on each scene block, rendering and copying it to the corresponding position in the scene bitmap to obtain the overall scene bitmap, the following steps are further included:

[0020] Determine whether the coordinate values of the scene block are within a preset range;

[0021] If the coordinate values of the scene block are within the preset range, directly render and copy the scene block to the corresponding position in the scene bitmap;

[0022] If the coordinate values of the scene block are not within the preset range, perform coordinate translation transformation on the scene block.

[0023] Optionally, the step of performing coordinate translation transformation on each scene block, rendering and copying it to the corresponding position in the scene bitmap to obtain the overall scene bitmap includes:

[0024] Convert the abscissa and ordinate of each scene block according to a preset translation algorithm to obtain the abscissa and ordinate within the preset range;

[0025] Translate each scene block according to the abscissa and ordinate within the preset range to obtain each renderable scene block;

[0026] Render each renderable scene block in sequence to obtain each rendered scene block;

[0027] Copy each rendered scene block to the corresponding position in the scene bitmap in sequence to form the overall scene bitmap.

[0028] Optionally, after the step of performing coordinate translation transformation on each of the scene blocks and rendering and copying them to corresponding positions in the scene bitmap to obtain an overall scene bitmap, the following steps are further included:

[0029] Export the overall scene bitmap in the required format and save it to the hard disk.

[0030] In addition, to achieve the above object, the present invention further provides a scene graph export device, which includes:

[0031] An acquisition module, configured to acquire a scene graph to be processed;

[0032] An identification module, configured to identify the size of the scene graph to be processed and allocate memory for the scene bitmap according to the size of the scene graph;

[0033] A calculation module, configured to calculate the number of scene blocks according to the size of the scene graph to be processed to obtain each scene block;

[0034] A rendering module, configured to perform coordinate translation transformation on each of the scene blocks and render and copy them to corresponding positions in the scene bitmap to obtain an overall scene bitmap for exporting and saving the overall scene bitmap.

[0035] In addition, to achieve the above object, the present invention further provides a terminal device, which includes a memory, a processor, and a scene graph export program stored on the memory and executable on the processor. When the scene graph export program is executed by the processor, the steps of the above-mentioned scene graph export method are implemented.

[0036] In addition, to achieve the above object, the present invention further provides a computer-readable storage medium, on which a scene graph export program is stored. When the scene graph export program is executed by a processor, the steps of the above-mentioned scene graph export method are implemented.

[0037] A method, apparatus, terminal device, and storage medium for exporting a scene graph according to an embodiment of the present invention. By obtaining a scene graph to be processed; identifying the size of the scene graph to be processed, and allocating memory for the scene bitmap according to the size of the scene graph; calculating the number of scene blocks according to the size of the scene graph to be processed to obtain each scene block; performing coordinate translation transformation on each scene block, and rendering and copying it to the corresponding position in the scene bitmap to obtain an overall scene bitmap for exporting and saving the overall scene bitmap. By calculating the number of scene blocks according to the size of the scene graph to be processed to obtain each scene block, a large-scale scene graph can be split into several scene blocks supported by a rendering engine, and then the split scene blocks are subjected to translation transformation, and then rendered and copied to the corresponding position of the scene bitmap to obtain an overall scene bitmap and export and save it, thereby realizing the direct rendering, export, and saving of a large-scale scene graph. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] Figure 1 It is a schematic diagram of the functional modules of the terminal device to which the scene graph export apparatus of the present invention belongs;

[0039] Figure 2 It is a schematic flowchart of an exemplary embodiment of the method for exporting a scene graph of the present invention;

[0040] Figure 3 For Figure 2 In the embodiment, step S30 calculates the number of scene blocks according to the size of the scene graph to be processed to obtain each scene block, and it is a specific flowchart;

[0041] Figure 4 For Figure 2 In the embodiment, step S40 performs coordinate translation transformation on each scene block, and renders and copies it to the corresponding position in the scene bitmap to obtain an overall scene bitmap, and it is a specific flowchart.

[0042] The realization, functional characteristics, and advantages of the object of the present invention will be further described with reference to the embodiments and the accompanying drawings. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0043] It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.

[0044] The main solution of the embodiment of the present invention is as follows: Obtain the scene graph to be processed; identify the size of the scene graph to be processed, and allocate memory for the scene bitmap according to the size of the scene graph; calculate the number of scene chunks based on the size of the scene graph to be processed to obtain each scene chunk; perform coordinate translation transformation on each scene chunk, and render and copy it to the corresponding position in the scene bitmap to obtain the overall scene bitmap for exporting and saving the overall scene bitmap. By calculating the number of scene chunks based on the size of the scene graph to be processed to obtain each scene chunk, a large-scale scene graph can be split into several scene chunks supported by the rendering engine, and then perform translation transformation on the split scene chunks, and then render and copy them to the corresponding positions of the scene bitmap to obtain the overall scene bitmap and export and save it, thus realizing the direct rendering, exporting and saving of the large-scale scene graph.

[0045] Technical terms involved in the embodiment of the present invention:

[0046] Scene graph: A scene displayed on the computer screen in software such as graphic editing, drawing, games, etc.

[0047] Primitive: Each display element in the scene. For example, a door in a building scene graph can be regarded as a primitive.

[0048] In risk control modeling software and graphic editing software, large-scale scene graphs are often involved. The width and height of these scene graphs in the software editing display window may exceed 100000*100000 pixels. When the software displays these large scene graphs, it needs to scroll the window to display each area in the scene. If these large scene graphs need to be saved as bitmaps to hard disk files, the bitmap of the entire scene graph needs to be drawn in memory first and then saved. However, the coordinate range supported by most rendering engines is [0, 32767], so the entire large scene graph cannot be directly rendered, and thus cannot be directly stored.

[0049] For example, in the process of risk control modeling of a bank, there are many interactive operations of algorithm components and visualization of modeling results that need to be displayed in a large-scale scene. For example, in the process of interactive training of the decision tree algorithm, the entire structure of the decision tree needs to be visually displayed, and the number of nodes of some decision trees can exceed 100,000. And each node requires a width and height of more than 100 pixels. Such a decision tree is a super-large-scale scene.

[0050] Two-dimensional graphic rendering engines including Qt, Skia, GDI / GDI+, Cario, Web Canvas, etc. can render a maximum bitmap size of no more than 32767 in width and height. Therefore, the entire large-scale scene graph cannot be directly rendered in memory at one time and exported and saved.

[0051] The present invention provides a solution. When exporting a large-scale scene graph, a method of block rendering, copying, and centralized export is adopted. Specifically, a block with a width and height of 32767*32767 is used as a block, and the large scene graph is sliced. After slicing, a block in the form of a matrix with multiple rows and multiple columns will be formed. Finally, the remaining part with a width and height less than the range of one block is sliced according to the actual width and height.

[0052] Since the range of the horizontal and vertical coordinates supported by the rendering engine is [0, 32767], after slicing, the scene with coordinate values greater than this range cannot be directly rendered. It is necessary to perform coordinate transformation on the scene elements with coordinate values greater than 32767, that is, through translation transformation, move the coordinates of the elements in the scene to the range of [0, 32767]. For example: according to the abscissa, the scene is divided into 10 parts. Then, the X coordinate in the i-th (i = 0, 1,..., 9) block needs to be subtracted by i*32767, that is, X = X - i*32767. The same processing is done for the Y coordinate axis.

[0053] After being able to use the rendering engine to render each block of the large-scale scene graph, it is also necessary to merge these blocks into a complete bitmap. First, allocate a piece of memory in the memory to store the size of the entire scene graph. Then, while rendering the bitmap of each block and copying the bitmap of the block to the corresponding position in the scene graph memory. In this way, after rendering and copying all the blocks, a complete scene graph bitmap is obtained in the memory. At this time, save this large bitmap to the hard disk in the required format, and the required exported bitmap is obtained.

[0054] Specifically, refer to Figure 1 , Figure 1 which is a schematic diagram of the functional modules of the terminal device to which the scene graph export device of the present invention belongs. The scene graph export device can be a device independent of the terminal device and capable of exporting the scene graph, and it can be carried on the terminal device in the form of hardware or software. The terminal device can be an intelligent mobile terminal with data processing functions such as a mobile phone or a tablet computer, and can also be a fixed terminal device or a server with data processing functions, etc.

[0055] In this embodiment, the terminal device to which the scene graph export device belongs at least includes an output module 110, a processor 120, a memory 130, and a communication module 140.

[0056] The operating system and the scene graph export program are stored in the memory 130. The scene graph export device can store information such as the acquired scene graph to be processed, the identified size of the scene graph to be processed, the number of scene blocks calculated according to the size of the scene graph to be processed, the obtained scene blocks, and the overall scene bitmap obtained by performing coordinate translation transformation on each scene block and rendering and copying it to the corresponding position in the scene bitmap in the memory 130; the output module 110 can be a display screen, etc. The communication module 140 can include a WIFI module, a mobile communication module, a Bluetooth module, etc., and communicate with external devices or servers through the communication module 140.

[0057] Among them, when the scene graph export program in the memory 130 is executed by the processor, the following steps are implemented:

[0058] Acquire the scene graph to be processed;

[0059] Identify the size of the scene graph to be processed, and allocate memory for the scene bitmap according to the size of the scene graph;

[0060] Calculate the number of scene blocks according to the size of the scene graph to be processed, and obtain each scene block;

[0061] Perform coordinate translation transformation on each scene block, and render and copy it to the corresponding position in the scene bitmap to obtain the overall scene bitmap for exporting and saving the overall scene bitmap.

[0062] Furthermore, when the scene graph export program in the memory 130 is executed by the processor, the following steps are also implemented:

[0063] Identify the size of the scene graph to be processed, where the size of the scene graph to be processed includes width and height;

[0064] Allocate the memory for the scene bitmap in the storage module according to the width and height of the scene graph.

[0065] Furthermore, when the scene graph export program in the memory 130 is executed by the processor, the following steps are also implemented:

[0066] Set the block range according to the rendering engine, where the block range includes block width and height.

[0067] Furthermore, when the scene graph export program in the memory 130 is executed by the processor, the following steps are also implemented:

[0068] Based on the block range, calculate the number of scene blocks according to the size of the scene graph to be processed;

[0069] Slice the scene graph to be processed according to the number of scene blocks to obtain each scene block.

[0070] Further, when the scene graph export program in the memory 130 is executed by the processor, the following steps are also implemented:

[0071] Determine whether the coordinate value of the scene block is within a preset range;

[0072] If the coordinate value of the scene block is within the preset range, directly render and copy the scene block to the corresponding position in the scene bitmap;

[0073] If the coordinate value of the scene block is not within the preset range, perform coordinate translation transformation on the scene block.

[0074] Further, when the scene graph export program in the memory 130 is executed by the processor, the following steps are also implemented:

[0075] According to a preset translation algorithm, convert the abscissa and ordinate of each scene block to obtain the abscissa and ordinate within the preset range;

[0076] Translate each scene block according to the abscissa and ordinate within the preset range to obtain each renderable scene block;

[0077] Render each of the renderable scene blocks in sequence to obtain each rendered scene block;

[0078] Copy each of the rendered scene blocks to the corresponding position in the scene bitmap in sequence to form the overall scene bitmap.

[0079] Further, when the scene graph export program in the memory 130 is executed by the processor, the following steps are also implemented:

[0080] Export and save the overall scene bitmap to the hard disk in the required format.

[0081] Through the above solution in this embodiment, specifically by obtaining the scene graph to be processed; identifying the size of the scene graph to be processed, and allocating memory for the scene bitmap according to the size of the scene graph; calculating the number of scene blocks based on the size of the scene graph to be processed to obtain each scene block; performing coordinate translation transformation on each scene block and rendering and copying it to the corresponding position in the scene bitmap to obtain the overall scene bitmap for exporting and saving the overall scene bitmap. By calculating the number of scene blocks based on the size of the scene graph to be processed to obtain each scene block, a large-scale scene graph can be split into several scene blocks supported by the rendering engine, then perform translation transformation on the split scene blocks, and then render and copy them to the corresponding positions in the scene bitmap to obtain the overall scene bitmap and export and save it, thereby realizing the direct rendering and export and saving of large-scale scene graphs.

[0082] Based on the above terminal device architecture, but not limited to the above architecture, embodiments of the method of the present invention are proposed.

[0083] The execution subject of the method in this embodiment can be a scene graph export device or a terminal device, etc. This embodiment takes the scene graph export device as an example.

[0084] Referring to Figure 2 , Figure 2 is a schematic flowchart of an exemplary embodiment of the scene graph export method of the present invention. The scene graph export method includes:

[0085] Step S10, obtain a scene graph to be processed;

[0086] In various software such as risk control modeling software and graphic editing software, large-scale scene graphs are often involved. The width and height of these scene graphs in the software editing display window may exceed 100,000*100,000 pixels. When the software displays these large scene graphs, it needs to scroll the window to display each area in the scene. If these large scene graphs need to be saved as bitmaps to a hard disk file, the bitmap of the entire scene graph needs to be drawn in memory first and then saved. However, most rendering engines support a coordinate range of [0, 32767], so the entire large scene graph cannot be directly rendered and thus cannot be directly stored. Therefore, the large-scale scene graph to be exported can be obtained first as the scene graph to be processed, so as to facilitate further recognition and segmentation of the scene graph to be processed.

[0087] Step S20, identify the size of the scene graph to be processed, and allocate memory for the scene bitmap according to the size of the scene graph;

[0088] Identify the size of the scene graph to be processed, where the size of the scene graph to be processed includes width and height;

[0089] Allocate the memory for the scene bitmap in the storage module according to the width and height of the scene graph.

[0090] After obtaining the scene graph to be processed, the size of the scene graph to be processed, including the width and height of the scene graph to be processed, can be identified. At the same time, a piece of memory for storing the size of the entire scene graph needs to be allocated in memory according to the size of the scene graph to be processed.

[0091] Step S30, calculate the number of scene blocks according to the size of the scene graph to be processed, and obtain each scene block;

[0092] Before the step of calculating the number of scene blocks according to the size of the scene graph to be processed and obtaining each scene block, the block range needs to be set according to the rendering engine, where the block range includes block width and height.

[0093] The 2D graphics rendering engines mainly include Qt, Skia, GDI / GDI+, Cairo, Web Canvas, etc. The maximum bitmap size that such rendering engines can render usually does not exceed 32767 in width and height. Therefore, it is impossible to directly render the entire large-scale scene graph in memory at once and export and save it. The maximum bitmap size can be set as the chunk range, and then the scene graph to be processed is chunked based on the chunk range. In the chunking process, as an implementation, a chunk with a width and height of 32767*32767 is used to cut the large scene graph. After cutting, a chunk in the form of a multi-row and multi-column matrix will be formed. Finally, the remaining part with a width and height less than one chunk range is cut according to the actual width and height, so as to obtain each scene chunk.

[0094] In step S40, perform coordinate translation transformation on each of the scene chunks, and render and copy them to the corresponding positions in the scene bitmap to obtain the overall scene bitmap for exporting and saving the overall scene bitmap.

[0095] Before the step of performing coordinate translation transformation on each of the scene chunks and rendering and copying them to the corresponding positions in the scene bitmap to obtain the overall scene bitmap, it is also necessary to execute:

[0096] Judge whether the coordinate values of the scene chunks are within the preset range;

[0097] If the coordinate values of the scene chunks are within the preset range, directly render and copy the scene chunks to the corresponding positions in the scene bitmap;

[0098] If the coordinate values of the scene chunks are not within the preset range, perform coordinate translation transformation on the scene chunks.

[0099] Since the range of the horizontal and vertical coordinates supported by the rendering engine is [0, 32767], after chunking, it is not possible to directly render the scene with coordinate values greater than this range. It is necessary to perform coordinate transformation on the scene elements with coordinate values greater than 32767, that is, through translation transformation, move the coordinates of the elements in the scene to the range of [0, 32767]. Therefore, after cutting out the scene chunks that meet the chunk range of the rendering engine, it is necessary to first judge whether the horizontal and vertical coordinates of the scene chunks are both within the range of [0, 32767]. If the horizontal and vertical coordinates of the scene chunks are both within the range of [0, 32767], then it can be directly rendered and then copied to the corresponding position of the scene bitmap. If there is a part of the horizontal or vertical coordinate of the scene chunk that is not within [0, 32767], then a translation transformation is required.

[0100] During the coordinate translation transformation of the scene blocks, the coordinates of the elements in the scene are moved to the range of [0, 32767]. For example, if the scene is divided into 10 blocks according to the abscissa, then the abscissa X in the i-th (i = 0, 1,..., 9) block needs to be subtracted by i * 32767, that is, X = X - i * 32767. The same processing is done for the ordinate Y. Thus, the blocks that can be rendered by the rendering engine are obtained.

[0101] Further, after each scene block of the scene graph to be processed can be rendered by the rendering engine, these scene blocks need to be merged into a complete bitmap. A piece of memory for storing the size of the entire scene graph is pre-allocated in the memory. Then, the bitmap of each scene block is rendered, and the bitmap of the block is copied to the corresponding position in the scene graph memory. After all the blocks are rendered and copied, the complete scene graph bitmap can be obtained in the memory. At this time, the large bitmap is saved to the hard disk in the required format, and the required exported bitmap is obtained.

[0102] In this embodiment, by obtaining the scene graph to be processed; identifying the size of the scene graph to be processed, and allocating memory for the scene bitmap according to the size of the scene graph; calculating the number of scene blocks according to the size of the scene graph to be processed to obtain each scene block; performing coordinate translation transformation on each scene block, and rendering and copying it to the corresponding position in the scene bitmap to obtain the overall scene bitmap for exporting and saving the overall scene bitmap. By calculating the number of scene blocks according to the size of the scene graph to be processed to obtain each scene block, a large-scale scene graph can be split into several scene blocks supported by the rendering engine, and then the split scene blocks are subjected to translation transformation, and then rendered and copied to the corresponding position of the scene bitmap to obtain the overall scene bitmap and export and save it, thereby realizing the direct rendering and export and saving of the large-scale scene graph.

[0103] Refer to Figure 3 , Figure 3 For Figure 2 the specific flowchart of step S30 in the embodiment for calculating the number of scene blocks according to the size of the scene graph to be processed to obtain each scene block. This embodiment is based on the above Figure 2 shown embodiment. In this embodiment, the above step S30 includes:

[0104] Step S301, based on the block range, calculate the number of scene blocks according to the size of the scene graph to be processed;

[0105] The 2D graphics rendering engines mainly include Qt, Skia, GDI / GDI+, Cairo, Web Canvas, etc. The maximum bitmap size that such rendering engines can render usually does not exceed 32767 in width and height. Therefore, it is impossible to directly render the entire large-scale scene graph in memory at one time and export and save it. The maximum bitmap size can be set as the chunk range, and then the scene graph to be processed can be chunked based on the chunk range. Therefore, before calculating the number of scene chunks according to the size of the scene graph to be processed and obtaining each scene chunk, the chunk range needs to be set according to the rendering engine, where the chunk range includes the chunk width and height.

[0106] After setting the chunk range, the number of scene chunks can be calculated in combination with the size of the scene graph to be processed, that is, the splitting method of each scene chunk is obtained according to the fixed width and height.

[0107] Step S302: Split the scene graph to be processed according to the number of scene chunks to obtain each scene chunk.

[0108] In this embodiment, as an implementation method, a large scene graph is split with 32767*32767 in width and height as one chunk. After splitting, it will form a chunk in the form of a matrix with multiple rows and columns. Finally, the remaining part with width and height less than one chunk range is split according to the actual width and height, so as to obtain each scene chunk.

[0109] Through the above solution in this embodiment, specifically, based on the chunk range, the number of scene chunks is calculated according to the size of the scene graph to be processed; the scene graph to be processed is split according to the number of scene chunks to obtain each scene chunk. By splitting the scene graph to be processed into the scene chunk sizes supported by the rendering engine, it is convenient to process each scene chunk, and the problem that the large-scale scene graph cannot be directly rendered is solved.

[0110] Refer to Figure 4 , Figure 4 For Figure 2 the specific flow diagram of step S40 in the embodiment for performing coordinate translation transformation on each scene chunk, rendering and copying it to the corresponding position in the scene bitmap to obtain the overall scene bitmap. Based on the above Figure 2 shown embodiment, in this embodiment, the above step S40 includes:

[0111] Step S401: Convert the abscissa and ordinate of each scene chunk according to the preset translation algorithm to obtain the abscissa and ordinate within the preset range;

[0112] Since the horizontal and vertical coordinate ranges supported by the rendering engine are [0, 32767], after chunking, scenes with coordinate values greater than this range cannot be directly rendered. After cutting out scene chunks that meet the chunking range of the rendering engine, it is necessary to first determine whether both the horizontal and vertical coordinates of the scene chunk are within the range of [0, 32767]. If both the horizontal and vertical coordinates of the scene chunk are within the range of [0, 32767], it can be directly rendered and then copied to the corresponding position of the scene bitmap. If part of the horizontal or vertical coordinate of the scene chunk is not within [0, 32767], coordinate transformation needs to be performed on the scene elements with coordinate values greater than 32767, that is, through translation transformation, the coordinates of the elements in the scene are moved to within the range of [0, 32767].

[0113] During the coordinate translation transformation of the scene chunk, the coordinates of the elements in the scene are moved to within the range of [0, 32767]. For example: according to the horizontal coordinate, the scene is divided into 10 chunks. Then, the horizontal coordinate X within the i-th (i = 0, 1,..., 9) chunk needs to be subtracted by i * 32767, that is, X = X - i * 32767. The same processing is done for the vertical coordinate Y, so as to obtain the horizontal and vertical coordinates within the renderable range of the rendering engine.

[0114] Step S402, translate each of the scene chunks according to the horizontal and vertical coordinates within the preset range to obtain each renderable scene chunk;

[0115] Furthermore, after obtaining the horizontal and vertical coordinates within the renderable range of the rendering engine, the scene chunks can be translated, so that the scene chunks are translated to the renderable range of the rendering engine. Each scene chunk is traversed in a loop to ensure that the translation transformation is completed for each scene chunk of the scene graph to be processed, and then rendering is performed.

[0116] Step S403, render each of the renderable scene chunks in sequence to obtain each rendered scene chunk;

[0117] After each scene chunk of the scene graph to be processed can be rendered using the rendering engine, these scene chunks still need to be merged into a complete bitmap. A piece of memory for storing the size of the entire scene graph is allocated in advance in the memory, and then the bitmap of each scene chunk is rendered, and further the bitmap of the chunk is copied to the corresponding position in the scene graph memory.

[0118] Step S404, copy each of the rendered scene chunks to the corresponding position in the scene bitmap in sequence to form the overall scene bitmap.

[0119] After traversing all scene chunks in a loop, through coordinate translation transformation and rendering, the rendered scene chunks are obtained. The rendered scene chunks are copied to the corresponding positions in the scene bitmap in memory. Finally, a complete scene bitmap is obtained in memory. At this time, the large bitmap is saved to the hard disk in the required format, and the required exported bitmap is obtained.

[0120] In this embodiment, through the above solution, specifically, the abscissa and ordinate of each of the scene chunks are converted according to a preset translation algorithm to obtain the abscissa and ordinate within the preset range; each of the scene chunks is translated according to the abscissa and ordinate within the preset range to obtain each renderable scene chunk; each of the renderable scene chunks is sequentially rendered to obtain each rendered scene chunk; each of the rendered scene chunks is sequentially copied to the corresponding positions in the scene bitmap to form the overall scene bitmap. By performing translation transformation on the split scene chunks, scene chunks that can be directly rendered by the rendering engine are obtained, so that a complete large-scale scene bitmap can be directly exported and saved.

[0121] In addition, an embodiment of the present invention further provides a scene graph export device, which includes:

[0122] An acquisition module, configured to acquire a scene graph to be processed;

[0123] An identification module, configured to identify the size of the scene graph to be processed and allocate memory for the scene bitmap according to the size of the scene graph;

[0124] A calculation module, configured to calculate the number of scene chunks according to the size of the scene graph to be processed to obtain each scene chunk;

[0125] A rendering module, configured to perform coordinate translation transformation on each of the scene chunks and render and copy them to the corresponding positions in the scene bitmap to obtain an overall scene bitmap for exporting and saving the overall scene bitmap.

[0126] For the principle and implementation process of scene graph export in this embodiment, please refer to the above embodiments and will not be elaborated here.

[0127] In addition, an embodiment of the present invention further provides a terminal device, which includes a memory, a processor, and a scene graph export program stored on the memory and executable on the processor. When the scene graph export program is executed by the processor, the steps of the above-mentioned scene graph export method are implemented.

[0128] Since when the scene graph export program is executed by the processor, all the technical solutions of all the foregoing embodiments are adopted, it has at least all the beneficial effects brought by all the technical solutions of all the foregoing embodiments, which will not be elaborated one by one here.

[0129] In addition, an embodiment of the present invention further provides a computer-readable storage medium, on which a scene graph export program is stored. When the scene graph export program is executed by a processor, the steps of the scene graph export method described above are implemented.

[0130] Since all the technical solutions of all the foregoing embodiments are adopted when the scene graph export program is executed by the processor, it at least has all the beneficial effects brought by all the technical solutions of all the foregoing embodiments, which will not be elaborated herein one by one.

[0131] Compared with the prior art, the scene graph export method, device, terminal device and storage medium provided by the embodiments of the present invention obtain a scene graph to be processed; identify the size of the scene graph to be processed, and allocate memory for a scene bitmap according to the size of the scene graph; calculate the number of scene blocks according to the size of the scene graph to be processed to obtain each scene block; perform coordinate translation transformation on each scene block, and render and copy it to the corresponding position in the scene bitmap to obtain an overall scene bitmap for exporting and saving the overall scene bitmap. By calculating the number of scene blocks according to the size of the scene graph to be processed to obtain each scene block, a large-scale scene graph can be split into several scene blocks supported by a rendering engine, and then the split scene blocks are subjected to translation transformation, and then rendered and copied to the corresponding positions of the scene bitmap to obtain an overall scene bitmap and export and save it, thereby realizing the direct rendering and export and saving of a large-scale scene graph.

[0132] It should be noted that in this article, the terms "include", "comprise" or any other variant thereof are intended to cover a non-exclusive inclusion, so that a process, method, article or system including a series of elements not only includes those elements, but also includes other elements not expressly listed, or further includes elements inherent to such process, method, article or system. Without further limitation, an element defined by the statement "including a..." does not exclude the existence of another identical element in the process, method, article or system including the element.

[0133] The serial numbers of the embodiments of the present application above are only for description and do not represent the advantages and disadvantages of the embodiments.

[0134] Through the description of the above embodiments, those skilled in the art can clearly understand that the above-described example methods can be implemented by means of software plus a necessary general hardware platform. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation. Based on such an understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art can be embodied in the form of a software product. This computer software product is stored in a storage medium as described above (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions for causing a terminal device (which can be a mobile phone, computer, server, controlled terminal, or network device, etc.) to execute the methods of each embodiment of the present application.

[0135] The above are only the preferred embodiments of the present invention, and do not limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made by using the specification and drawings of the present invention, or directly or indirectly applied in other related technical fields, shall be equally included in the patent protection scope of the present invention.

Claims

1. A method for exporting a scene graph, characterized in that, The method for exporting the scene graph includes the following steps: Obtain the scene graph to be processed; Identify the size of the scene graph to be processed, and allocate memory for the scene bitmap according to the size of the scene graph; Calculate the number of scene blocks according to the size of the scene graph to be processed, and obtain each scene block; Perform coordinate translation transformation on each scene block, and render and copy it to the corresponding position in the scene bitmap to obtain the overall scene bitmap for exporting and saving the overall scene bitmap; Before the step of performing coordinate translation transformation on each scene block and rendering and copying it to the corresponding position in the scene bitmap to obtain the overall scene bitmap, it further includes: Determine whether the coordinate value of the scene block is within a preset range; If the coordinate value of the scene block is within the preset range, directly render and copy the scene block to the corresponding position in the scene bitmap; If the coordinate value of the scene block is not within the preset range, perform coordinate translation transformation on the scene block.

2. The scene graph export method according to claim 1, wherein The step of identifying the size of the scene graph to be processed and allocating memory for the scene bitmap according to the size of the scene graph includes: Identify the size of the scene graph to be processed, where the size of the scene graph to be processed includes width and height; Allocate memory for the scene bitmap in the storage module according to the width and height of the scene graph.

3. The scene graph export method according to claim 1, characterized in that, Before the step of calculating the number of scene blocks according to the size of the scene graph to be processed and obtaining each scene block, it further includes: Set the block range according to the rendering engine, where the block range includes block width and height.

4. The scene graph export method according to claim 3, wherein The step of calculating the number of scene blocks according to the size of the scene graph to be processed and obtaining each scene block includes: Based on the block range, calculate the number of scene blocks according to the size of the scene graph to be processed; Slice the scene graph to be processed according to the number of scene blocks to obtain each scene block.

5. The scene graph export method according to claim 1, wherein The step of performing coordinate translation transformation on each scene block and rendering and copying it to the corresponding position in the scene bitmap to obtain the overall scene bitmap includes: Convert the abscissa and ordinate of each scene block according to a preset translation algorithm to obtain the abscissa and ordinate within the preset range; Translate each scene block according to the abscissa and ordinate within the preset range to obtain each renderable scene block; Render each renderable scene block in sequence to obtain each rendered scene block; Copy each rendered scene block to the corresponding position in the scene bitmap in sequence to form the overall scene bitmap.

6. The scene graph export method according to claim 1, characterized in that After the step of performing coordinate translation transformation on each scene block and rendering and copying it to the corresponding position in the scene bitmap to obtain the overall scene bitmap, it further includes: Export and save the overall scene bitmap to the hard disk in the required format.

7. A scene graph export device, characterized in that, The scene graph export device includes: An acquisition module for acquiring the scene graph to be processed; An identification module for identifying the size of the scene graph to be processed and allocating memory for the scene bitmap according to the size of the scene graph; A calculation module for calculating the number of scene blocks according to the size of the scene graph to be processed and obtaining each scene block; A rendering module, configured to perform coordinate translation transformation on each of the scene blocks, and render and copy them to corresponding positions in the scene bitmap to obtain an overall scene bitmap for exporting and saving the overall scene bitmap; Before performing the coordinate translation transformation on each of the scene blocks, rendering and copying them to corresponding positions in the scene bitmap to obtain an overall scene bitmap, the method further includes: Determining whether the coordinate values of the scene blocks are within a preset range; If the coordinate values of the scene blocks are within the preset range, directly rendering and copying the scene blocks to corresponding positions in the scene bitmap; If the coordinate values of the scene blocks are not within the preset range, performing coordinate translation transformation on the scene blocks.

8. A terminal device, characterized in that, The terminal device includes a memory, a processor, and a scene graph export program stored on the memory and executable on the processor. When the scene graph export program is executed by the processor, the steps of the scene graph export method according to any one of claims 1-6 are implemented.

9. A computer-readable storage medium, characterized in that, A scene graph export program is stored on the computer-readable storage medium. When the scene graph export program is executed by the processor, the steps of the scene graph export method according to any one of claims 1-6 are implemented.

Citation Information

Patent Citations

  • Series proportional scale PDF map seamless organization and display method

    CN109859109A