Detailed Description
The embodiment of the invention provides an interface hybrid rendering method, device, equipment and storage medium, wherein a game engine loads a preset first interface to be rendered and traverses interface nodes of the first interface to be rendered, wherein the interface nodes comprise a native interface node and an H5 interface node; when the interface node traversed by the game engine is a primary interface node, rendering and drawing are carried out by the game engine according to the primary interface node, so that corresponding first rendering data are obtained; when the interface node traversed by the game engine is an H5 interface node, sending an H5 interface rendering request to a preset browser kernel through the game engine, wherein the H5 interface rendering request comprises H5 interface parameters of the H5 interface node; loading and drawing an H5 interface based on H5 interface parameters in an H5 interface rendering request through a browser kernel to obtain corresponding second rendering data, and transmitting the second rendering data to a game engine; and drawing the first interface to be rendered on a preset front-end interface by the game engine according to the first rendering data and the second rendering data. In the method, when a browser kernel or a game engine rendering process encounters a mixed node, the other party is requested to draw the interfaces, rendering data is finally generated and transmitted back to the requesting party, and the requesting party renders the rendering data.
The terms "first," "second," "third," "fourth" and the like in the description and in the claims and in the above drawings, if any, are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments described herein may be implemented in other sequences than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed or inherent to such process, method, article, or apparatus.
For easy understanding, the following describes a specific flow of an embodiment of the present invention, referring to fig. 1, and a first embodiment of an interface blending rendering method in an embodiment of the present invention includes:
101. loading a preset first interface to be rendered through a game engine and traversing interface nodes of the first interface to be rendered, wherein the interface nodes comprise a native interface node and an H5 interface node;
In this embodiment, before the loading, by the game engine, the preset first interface to be rendered and traversing the interface node of the first interface to be rendered, the method further includes: acquiring input H5 interface parameters, and generating H5 interface nodes according to the H5 interface parameters; and inserting the H5 interface node into a native interface node of the first interface to be rendered.
Specifically, the game engine is a neox game engine, and meanwhile, the scheme can be generally used in other game engines, such as a blurring engine, a unit and the like, and the game engine is not limited in the application. The interface to be rendered in the game engine comprises a plurality of interface nodes, and the interface nodes are interface codes with specific information and functions, such as common buttons, texts, input boxes and pictures. An interface node generally records information such as node position, shape, father-son node and the like to complete rendering operation of the interface node, and each interface node represents a functional module in a game engine. The game engine traverses each interface node for loading and drawing as the native interface is rendered. The invention adds an H5 page node.
102. When the interface node traversed by the game engine is a primary interface node, rendering and drawing are carried out by the game engine according to the primary interface node, so that corresponding first rendering data are obtained;
In this embodiment, the game engine refreshes the display of the game picture by drawing the native interface, when the native interface is drawn, the interface node is traversed, and when the native interface node is traversed, the normal node loading and drawing process is performed to obtain the corresponding first rendering data, where the rendering data refers to the data representing the picture and the display picture in the computer system, each unit in the rendering data is a pixel point, and each pixel point records the color information of the pixel through a specific format.
103. When the interface node traversed by the game engine is an H5 interface node, sending an H5 interface rendering request to a preset browser kernel through the game engine, wherein the H5 interface rendering request comprises H5 interface parameters of the H5 interface node;
in this embodiment, when an H5 page node is encountered, node resources and drawing pictures are not directly loaded, but an H5 interface rendering request is sent to the browser kernel.
104. Loading and drawing an H5 interface based on H5 interface parameters in an H5 interface rendering request through a browser kernel to obtain corresponding second rendering data, and transmitting the second rendering data to a game engine;
in this embodiment, the H5 interface parameter includes resource link information and interface size information; loading and drawing an H5 interface based on H5 interface parameters in the H5 interface rendering request through the browser kernel, and obtaining corresponding second rendering data comprises the following steps: acquiring corresponding H5 interface resources based on the resource link information in the H5 interface rendering request through the browser kernel; loading an H5 interface based on the H5 interface parameter through the browser kernel, and adjusting the interface display effect of the loaded H5 interface according to the interface size information; and drawing by the browser kernel based on the interface display effect, the H5 interface resource of the H5 interface and the interface node to obtain corresponding second rendering data.
Specifically, when the game engine sends an H5 interface rendering request to the browser, resource link information required by loading the H5 interface is transmitted, the browser kernel acquires H5 interface resources through resource links, after the H5 interface resources are loaded into the browser kernel, interface display effects are adjusted through interface size information, and then interface drawing is performed.
In this embodiment, before the drawing, by the browser kernel, based on the interface display effect and the H5 interface resource, to obtain the corresponding second rendering data, the method further includes: judging whether the interface node of the H5 interface comprises a native interface node or not through the browser kernel; if yes, sending a native interface rendering request to the game engine through the browser kernel; rendering and drawing a native interface based on the native interface rendering request through the game engine, generating image data of the native interface, and transmitting the image data to the browser kernel.
Specifically, the H5 interface rendered by the browser kernel also comprises interface nodes, when the interface nodes of the H5 interface comprise native interface elements, a rendering request is sent to the game engine during rendering, the game engine finishes rendering of the native interface, image data generated by rendering is transmitted to the browser kernel, the browser kernel finishes overall rendering on all the interface nodes, and the generated data is returned to the game engine.
Further, the drawing, by the browser kernel, based on the interface display effect, the H5 interface resource of the H5 interface, and the interface node, to obtain the corresponding second rendering data includes: and drawing by the browser kernel based on the interface display effect, the H5 interface resource of the H5 interface and the image data of the original interface node in the interface nodes to obtain corresponding second rendering data.
Specifically, the browser kernel may provide a graphics interface to draw an image by using a rendering interface or a graphics card driver of the system, and display a drawing result on a screen. Taking a windows platform as an example, the browser kernel can utilize a GDI interface of the windows to carry out graphic drawing, and a drawing result can be directly output to a screen for display or can be in a data form to a memory area.
In this embodiment, the transferring the second rendering data to the game engine includes: storing the second rendering data to a preset memory area through the browser kernel; and the second rendering data is led out from the memory area, and is recorded in the game engine.
Specifically, in this embodiment, the GDI interface is used to switch the rendering output target to output to the memory area, and after the rendering is completed, the rendering result is obtained from the memory area to derive the second rendering data, and the second rendering data is recorded in the game engine, so that the game engine obtains the rendering of the H5 interface to generate the second rendering data.
105. And drawing the first interface to be rendered on a preset front-end interface by the game engine according to the first rendering data and the second rendering data.
In this embodiment, the drawing, by the game engine, the first interface to be rendered on a preset front-end interface according to the first rendering data and the second rendering data includes: acquiring a native interface parameter of a native interface node corresponding to the first rendering data; determining the hierarchical relationship between the corresponding native interface node and the corresponding H5 interface node according to the native interface parameter and the H5 interface parameter; adjusting a rendering order between the first rendering data and the second rendering data according to the hierarchical relationship; and drawing the first interface to be rendered on a preset front-end interface according to the rendering sequence, the first rendering data and the second rendering data.
Specifically, after the game engine acquires the second rendering data of the H5 interface and the first rendering data of the original interface, the rendering data are redrawn to be displayed on a screen picture, the game engine adjusts the rendering sequence of the H5 interface node and the original interface node according to the position and the hierarchy relation before drawing, and shielding rejection calculation is performed by using the hierarchy relation in drawing, so that the shielding effect is ensured to be normal.
In this embodiment, loading a preset first interface to be rendered through a game engine and traversing interface nodes of the first interface to be rendered, wherein the interface nodes include a native interface node and an H5 interface node; when the interface node traversed by the game engine is a primary interface node, rendering and drawing are carried out by the game engine according to the primary interface node, so that corresponding first rendering data are obtained; when the interface node traversed by the game engine is an H5 interface node, sending an H5 interface rendering request to a preset browser kernel through the game engine, wherein the H5 interface rendering request comprises H5 interface parameters of the H5 interface node; loading and drawing an H5 interface based on H5 interface parameters in an H5 interface rendering request through a browser kernel to obtain corresponding second rendering data, and transmitting the second rendering data to a game engine; and drawing the first interface to be rendered on a preset front-end interface by the game engine according to the first rendering data and the second rendering data. In the method, when a browser kernel or a game engine rendering process encounters a mixed node, the other party is requested to draw the interfaces, rendering data is finally generated and transmitted back to the requesting party, and the requesting party renders the rendering data.
Referring to fig. 2, a second embodiment of an interface blending rendering method according to an embodiment of the present invention includes:
201. loading a preset second interface to be rendered through a browser kernel and traversing interface nodes of the second interface to be rendered;
in this embodiment, before loading the preset second interface to be rendered through the browser kernel and traversing the interface node of the second interface to be rendered, the method further includes: generating a DOM tree of the second interface to be rendered according to the file format of the second interface to be rendered, wherein DOM nodes in the DOM tree respectively correspond to an interface node; and acquiring the input original interface parameters, and generating DOM nodes corresponding to the H5 interface nodes in the DOM tree according to the original interface parameters.
Specifically, the H5 interface adopts an HTML rich text format, the file format is a DOM tree, each interface is a DOM node in the DOM tree, the invention defines a specific DOM node to represent a native interface node, the native interface node processes and sets node position, size and level information, a game_ui_name identifier is added as a unique identifier of the native interface, and character string information recorded by the game_ui_name is used for associating the native interface in the game,
202. When the interface node traversed by the browser kernel is an H5 interface node, rendering and drawing are carried out through the browser kernel according to the H5 interface node of the second interface to be rendered, and corresponding third rendering data are obtained;
203. when the interface node traversed by the browser kernel is a native interface node, sending a native interface rendering request to the game engine through the browser kernel, wherein the native interface rendering request comprises a native interface parameter of the native interface node;
in this embodiment, when the browser loads the native interface node, a native interface rendering request is sent to the game engine, and the game engine carries the game_ui_name record information, loads the native interface through the game_ui_name to render, returns a rendering result to the browser to render, after loading the H5 page by the browser kernel, analyzes the DOM to draw the page element, and when the native interface node is analyzed, sends the native interface rendering request to the game engine.
204. Determining and loading a designated original interface based on an interface unique identifier in the original interface parameters through a game engine to obtain fourth rendering data corresponding to the designated original interface, and transmitting the fourth rendering data to a browser kernel;
In this embodiment, when the game engine receives a request for rendering a native interface of the browser, the game engine loads and draws a designated native according to the unique interface identifier in the request. Different rendering modes can be selected according to the client operation platform, and the rendering is generally performed by utilizing a graphics principle, so that a rendering result can be output to a buffer zone by utilizing off-screen rendering of graphics, and the fourth rendering data of the rendering is read through the buffer zone.
205. And drawing the second interface to be rendered on the front-end interface through the browser kernel according to the third rendering data and the fourth rendering data.
In this embodiment, the drawing, by the browser kernel, the second interface to be rendered on the front-end interface according to the third rendering data and the fourth rendering data includes: determining corresponding DOM nodes of the third rendering data and the fourth rendering data in the DOM tree, and acquiring an interface CSS configuration table of the second interface to be rendered; and drawing the second interface to be rendered on the front end interface according to the third rendering data, the fourth rendering data, the DOM node corresponding to the third rendering data, the position relation of the DOM node corresponding to the fourth rendering data in the DOM tree and the interface CSS configuration table.
Specifically, the game engine generates resource links for the image data, the resource links are transmitted to the browser kernel, the browser kernel loads the image data through the resource links for drawing, and after the browsing kernel loads the image resources, the image data are rendered into an H5 picture according to the position of the nodes in the DOM tree, the interface CSS configuration table and other information, so that the normal shielding relation of the picture is ensured.
In this embodiment, loading a preset second interface to be rendered through a browser kernel and traversing interface nodes of the second interface to be rendered; when the interface node traversed by the browser kernel is an H5 interface node, rendering and drawing are carried out by the browser kernel according to the H5 interface node of the second interface to be rendered, so that corresponding third rendering data are obtained; when the interface node traversed by the browser kernel is a native interface node, sending a native interface rendering request to the game engine through the browser kernel, wherein the native interface rendering request comprises a native interface parameter of the native interface node; determining and loading a designated primary interface based on an interface unique identifier in the primary interface parameters through the game engine to obtain fourth rendering data corresponding to the designated primary interface, and transmitting the fourth rendering data to the browser kernel; and drawing the second interface to be rendered on the front-end interface through the browser kernel according to the third rendering data and the fourth rendering data. In the method, when a browser kernel or a game engine rendering process encounters a mixed node, the other party is requested to draw the interfaces, rendering data is finally generated and transmitted back to the requesting party, and the requesting party renders the rendering data.
The method for rendering an interface in the embodiment of the present invention is described above, and the apparatus for rendering an interface in the embodiment of the present invention is described below, referring to fig. 3, where an embodiment of the apparatus for rendering an interface in the embodiment of the present invention includes:
the node traversing module 301 is configured to load a preset first interface to be rendered through a game engine and traverse interface nodes of the first interface to be rendered, where the interface nodes include a native interface node and an H5 interface node;
the first rendering module 302 is configured to render and draw according to the native interface node by using the game engine when the interface node traversed by the game engine is the native interface node, so as to obtain corresponding first rendering data;
the request sending module 303 is configured to send, when the interface node traversed by the game engine is an H5 interface node, an H5 interface rendering request to a preset browser kernel through the game engine, where the H5 interface rendering request includes H5 interface parameters of the H5 interface node;
the second rendering module 304 is configured to load and draw an H5 interface based on an H5 interface parameter in the H5 interface rendering request through the browser kernel, obtain corresponding second rendering data, and transmit the second rendering data to the game engine;
The interface drawing module 305 is configured to draw, by the game engine, the first interface to be rendered on a preset front-end interface according to the first rendering data and the second rendering data.
In the embodiment of the invention, the interface hybrid rendering device runs the interface hybrid rendering method, loads a preset first interface to be rendered through a game engine and traverses interface nodes of the first interface to be rendered, wherein the interface nodes comprise a native interface node and an H5 interface node; when the interface node traversed by the game engine is a primary interface node, rendering and drawing are carried out by the game engine according to the primary interface node, so that corresponding first rendering data are obtained; when the interface node traversed by the game engine is an H5 interface node, sending an H5 interface rendering request to a preset browser kernel through the game engine, wherein the H5 interface rendering request comprises H5 interface parameters of the H5 interface node; loading and drawing an H5 interface based on H5 interface parameters in an H5 interface rendering request through a browser kernel to obtain corresponding second rendering data, and transmitting the second rendering data to a game engine; and drawing the first interface to be rendered on a preset front-end interface by the game engine according to the first rendering data and the second rendering data. In the method, when a browser kernel or a game engine rendering process encounters a mixed node, the other party is requested to draw the interfaces, rendering data is finally generated and transmitted back to the requesting party, and the requesting party renders the rendering data.
Referring to fig. 4, a second embodiment of an interface mixing rendering apparatus according to an embodiment of the present invention includes:
the node traversing module 301 is configured to load a preset first interface to be rendered through a game engine and traverse interface nodes of the first interface to be rendered, where the interface nodes include a native interface node and an H5 interface node;
the first rendering module 302 is configured to render and draw according to the native interface node by using the game engine when the interface node traversed by the game engine is the native interface node, so as to obtain corresponding first rendering data;
the request sending module 303 is configured to send, when the interface node traversed by the game engine is an H5 interface node, an H5 interface rendering request to a preset browser kernel through the game engine, where the H5 interface rendering request includes H5 interface parameters of the H5 interface node;
the second rendering module 304 is configured to load and draw an H5 interface based on an H5 interface parameter in the H5 interface rendering request through the browser kernel, obtain corresponding second rendering data, and transmit the second rendering data to the game engine;
the interface drawing module 305 is configured to draw, by the game engine, the first interface to be rendered on a preset front-end interface according to the first rendering data and the second rendering data.
In this embodiment, the interface hybrid rendering apparatus further includes an H5 interface node generating module 306, where the H5 interface node generating module 306 is specifically configured to:
acquiring input H5 interface parameters, and generating H5 interface nodes according to the H5 interface parameters;
and inserting the H5 interface node into a native interface node of the first interface to be rendered.
In this embodiment, the H5 interface parameter includes resource link information and interface size information; the second rendering module 304 includes:
a resource obtaining unit 3041, configured to obtain, by using the browser kernel, a corresponding H5 interface resource based on resource link information in the H5 interface rendering request;
the effect adjustment unit 3042 is configured to load an H5 interface based on the H5 interface parameter through the browser kernel, and adjust an interface display effect of the loaded H5 interface according to the interface size information;
and the H5 rendering unit 3043 is configured to draw, by using the browser kernel, based on the interface display effect, the H5 interface resource of the H5 interface, and the interface node, to obtain corresponding second rendering data.
In this embodiment, the second rendering module 304 further includes a native rendering unit 3044, where the native rendering unit 3044 is specifically configured to:
Judging whether the interface node of the H5 interface comprises a native interface node or not through the browser kernel;
if yes, sending a native interface rendering request to the game engine through the browser kernel;
rendering and drawing a native interface based on the native interface rendering request through the game engine, generating image data of the native interface, and transmitting the image data to the browser kernel.
In this embodiment, the H5 rendering unit 3043 is specifically configured to:
and drawing by the browser kernel based on the interface display effect, the H5 interface resource of the H5 interface and the image data of the original interface node in the interface nodes to obtain corresponding second rendering data.
In this embodiment, the transferring the second rendering data to the game engine includes:
storing the second rendering data to a preset memory area through the browser kernel;
and the second rendering data is led out from the memory area, and is recorded in the game engine.
In this embodiment, the interface drawing module 305 is specifically configured to:
acquiring a native interface parameter of a native interface node corresponding to the first rendering data;
Determining the hierarchical relationship between the corresponding native interface node and the corresponding H5 interface node according to the native interface parameter and the H5 interface parameter;
adjusting a rendering order between the first rendering data and the second rendering data according to the hierarchical relationship;
and drawing the first interface to be rendered on a preset front-end interface according to the rendering sequence, the first rendering data and the second rendering data.
In this embodiment, the interface hybrid rendering device further includes an H5 hybrid rendering module 307, where the H5 hybrid rendering module 307 is specifically configured to:
loading a preset second interface to be rendered through a browser kernel and traversing interface nodes of the second interface to be rendered;
when the interface node traversed by the browser kernel is an H5 interface node, rendering and drawing are carried out by the browser kernel according to the H5 interface node of the second interface to be rendered, so that corresponding third rendering data are obtained;
when the interface node traversed by the browser kernel is a native interface node, sending a native interface rendering request to the game engine through the browser kernel, wherein the native interface rendering request comprises a native interface parameter of the native interface node;
Determining and loading a designated primary interface based on an interface unique identifier in the primary interface parameters through the game engine to obtain fourth rendering data corresponding to the designated primary interface, and transmitting the fourth rendering data to the browser kernel;
and drawing the second interface to be rendered on the front-end interface through the browser kernel according to the third rendering data and the fourth rendering data.
In this embodiment, the H5 hybrid rendering module 307 is specifically further configured to:
generating a DOM tree of the second interface to be rendered according to the file format of the second interface to be rendered, wherein DOM nodes in the DOM tree respectively correspond to an interface node;
and acquiring the input original interface parameters, and generating DOM nodes corresponding to the H5 interface nodes in the DOM tree according to the original interface parameters.
In this embodiment, the drawing, by the browser kernel, the second interface to be rendered on the front-end interface according to the third rendering data and the fourth rendering data includes:
determining corresponding DOM nodes of the third rendering data and the fourth rendering data in the DOM tree, and acquiring an interface CSS configuration table of the second interface to be rendered;
And drawing the second interface to be rendered on the front end interface according to the third rendering data, the fourth rendering data, the DOM node corresponding to the third rendering data, the position relation of the DOM node corresponding to the fourth rendering data in the DOM tree and the interface CSS configuration table.
The embodiment describes the specific functions of each module and the unit constitution of part of the modules in detail on the basis of the previous embodiment, and controls the game engine to load the preset first interface to be rendered and traverse the interface nodes of the first interface to be rendered through the modules and the unit constitution of the modules, wherein the interface nodes comprise a native interface node and an H5 interface node; when the interface node traversed by the game engine is a primary interface node, rendering and drawing are carried out by the game engine according to the primary interface node, so that corresponding first rendering data are obtained; when the interface node traversed by the game engine is an H5 interface node, sending an H5 interface rendering request to a preset browser kernel through the game engine, wherein the H5 interface rendering request comprises H5 interface parameters of the H5 interface node; loading and drawing an H5 interface based on H5 interface parameters in an H5 interface rendering request through a browser kernel to obtain corresponding second rendering data, and transmitting the second rendering data to a game engine; and drawing the first interface to be rendered on a preset front-end interface by the game engine according to the first rendering data and the second rendering data. In the method, when a browser kernel or a game engine rendering process encounters a mixed node, the other party is requested to draw the interfaces, rendering data is finally generated and transmitted back to the requesting party, and the requesting party renders the rendering data.
The above fig. 3 and fig. 4 describe the middle interface hybrid rendering device in the embodiment of the present invention in detail from the point of view of modularized functional entities, and the following describes the interface hybrid rendering device in the embodiment of the present invention in detail from the point of view of hardware processing.
Fig. 5 is a schematic structural diagram of an interface hybrid rendering device according to an embodiment of the present invention, where the interface hybrid rendering device 500 may have a relatively large difference due to different configurations or performances, and may include one or more processors (central processing units, CPU) 510 (e.g., one or more processors) and a memory 520, and one or more storage media 530 (e.g., one or more mass storage devices) storing application programs 533 or data 532. Wherein memory 520 and storage medium 530 may be transitory or persistent storage. The program stored in the storage medium 530 may include one or more modules (not shown), each of which may include a series of instruction operations in the interface hybrid rendering device 500. Still further, the processor 510 may be configured to communicate with the storage medium 530, and execute a series of instruction operations in the storage medium 530 on the interface hybrid rendering device 500 to implement the following steps:
Loading a preset first interface to be rendered through a game engine and traversing interface nodes of the first interface to be rendered, wherein the interface nodes comprise a native interface node and an H5 interface node;
when the interface node traversed by the game engine is a primary interface node, rendering and drawing are carried out by the game engine according to the primary interface node, so that corresponding first rendering data are obtained;
when the interface node traversed by the game engine is an H5 interface node, sending an H5 interface rendering request to a preset browser kernel through the game engine, wherein the H5 interface rendering request comprises H5 interface parameters of the H5 interface node;
loading and drawing an H5 interface based on H5 interface parameters in the H5 interface rendering request through the browser kernel to obtain corresponding second rendering data, and transmitting the second rendering data to the game engine;
and drawing the first interface to be rendered on a preset front-end interface by the game engine according to the first rendering data and the second rendering data.
Optionally, before loading a preset first interface to be rendered by the game engine and traversing the interface node of the first interface to be rendered, the method further includes:
Acquiring input H5 interface parameters, and generating H5 interface nodes according to the H5 interface parameters;
and inserting the H5 interface node into a native interface node of the first interface to be rendered.
Optionally, the H5 interface parameter includes resource link information and interface size information;
loading and drawing an H5 interface based on H5 interface parameters in the H5 interface rendering request through the browser kernel, and obtaining corresponding second rendering data comprises the following steps:
acquiring corresponding H5 interface resources based on the resource link information in the H5 interface rendering request through the browser kernel;
loading an H5 interface based on the H5 interface parameter through the browser kernel, and adjusting the interface display effect of the loaded H5 interface according to the interface size information;
and drawing by the browser kernel based on the interface display effect, the H5 interface resource of the H5 interface and the interface node to obtain corresponding second rendering data.
Optionally, before the drawing is performed by the browser kernel based on the interface display effect and the H5 interface resource, the method further includes:
judging whether the interface node of the H5 interface comprises a native interface node or not through the browser kernel;
If yes, sending a native interface rendering request to the game engine through the browser kernel;
rendering and drawing a native interface based on the native interface rendering request through the game engine, generating image data of the native interface, and transmitting the image data to the browser kernel.
Optionally, the drawing, by the browser kernel, based on the interface display effect, the H5 interface resource of the H5 interface, and the interface node, to obtain the corresponding second rendering data includes:
and drawing by the browser kernel based on the interface display effect, the H5 interface resource of the H5 interface and the image data of the original interface node in the interface nodes to obtain corresponding second rendering data.
Optionally, the transferring the second rendering data to the game engine includes:
storing the second rendering data to a preset memory area through the browser kernel;
and the second rendering data is led out from the memory area, and is recorded in the game engine.
Optionally, the drawing, by the game engine, the first interface to be rendered on a preset front-end interface according to the first rendering data and the second rendering data includes:
Acquiring a native interface parameter of a native interface node corresponding to the first rendering data;
determining the hierarchical relationship between the corresponding native interface node and the corresponding H5 interface node according to the native interface parameter and the H5 interface parameter;
adjusting a rendering order between the first rendering data and the second rendering data according to the hierarchical relationship;
and drawing the first interface to be rendered on a preset front-end interface according to the rendering sequence, the first rendering data and the second rendering data.
Optionally, the hybrid rendering method further includes:
loading a preset second interface to be rendered through a browser kernel and traversing interface nodes of the second interface to be rendered;
when the interface node traversed by the browser kernel is an H5 interface node, rendering and drawing are carried out by the browser kernel according to the H5 interface node of the second interface to be rendered, so that corresponding third rendering data are obtained;
when the interface node traversed by the browser kernel is a native interface node, sending a native interface rendering request to the game engine through the browser kernel, wherein the native interface rendering request comprises a native interface parameter of the native interface node;
Determining and loading a designated primary interface based on an interface unique identifier in the primary interface parameters through the game engine to obtain fourth rendering data corresponding to the designated primary interface, and transmitting the fourth rendering data to the browser kernel;
and drawing the second interface to be rendered on the front-end interface through the browser kernel according to the third rendering data and the fourth rendering data.
Optionally, before loading the preset second interface to be rendered through the browser kernel and traversing the interface node of the second interface to be rendered, the method further includes:
generating a DOM tree of the second interface to be rendered according to the file format of the second interface to be rendered, wherein DOM nodes in the DOM tree respectively correspond to an interface node;
and acquiring the input original interface parameters, and generating DOM nodes corresponding to the H5 interface nodes in the DOM tree according to the original interface parameters.
Optionally, the drawing, by the browser kernel, the second interface to be rendered on the front-end interface according to the third rendering data and the fourth rendering data includes:
determining corresponding DOM nodes of the third rendering data and the fourth rendering data in the DOM tree, and acquiring an interface CSS configuration table of the second interface to be rendered;
And drawing the second interface to be rendered on the front end interface according to the third rendering data, the fourth rendering data, the DOM node corresponding to the third rendering data, the position relation of the DOM node corresponding to the fourth rendering data in the DOM tree and the interface CSS configuration table.
The interface hybrid rendering device 500 may also include one or more power supplies 540, one or more wired or wireless network interfaces 550, one or more input/output interfaces 560, and/or one or more operating systems 531, such as Windows Serve, mac OS X, unix, linux, freeBSD, and the like. It will be appreciated by those skilled in the art that the interface mixing rendering device structure shown in fig. 5 is not limiting of the interface mixing rendering device provided by the present invention, and may include more or fewer components than shown, or may combine certain components, or may be a different arrangement of components.
The present invention also provides a computer readable storage medium, which may be a non-volatile computer readable storage medium, and which may also be a volatile computer readable storage medium, the computer readable storage medium having instructions stored therein which, when executed on a computer, cause the computer to perform the steps of:
Loading a preset first interface to be rendered through a game engine and traversing interface nodes of the first interface to be rendered, wherein the interface nodes comprise a native interface node and an H5 interface node;
when the interface node traversed by the game engine is a primary interface node, rendering and drawing are carried out by the game engine according to the primary interface node, so that corresponding first rendering data are obtained;
when the interface node traversed by the game engine is an H5 interface node, sending an H5 interface rendering request to a preset browser kernel through the game engine, wherein the H5 interface rendering request comprises H5 interface parameters of the H5 interface node;
loading and drawing an H5 interface based on H5 interface parameters in the H5 interface rendering request through the browser kernel to obtain corresponding second rendering data, and transmitting the second rendering data to the game engine;
and drawing the first interface to be rendered on a preset front-end interface by the game engine according to the first rendering data and the second rendering data.
Optionally, before loading a preset first interface to be rendered by the game engine and traversing the interface node of the first interface to be rendered, the method further includes:
Acquiring input H5 interface parameters, and generating H5 interface nodes according to the H5 interface parameters;
and inserting the H5 interface node into a native interface node of the first interface to be rendered.
Optionally, the H5 interface parameter includes resource link information and interface size information;
loading and drawing an H5 interface based on H5 interface parameters in the H5 interface rendering request through the browser kernel, and obtaining corresponding second rendering data comprises the following steps:
acquiring corresponding H5 interface resources based on the resource link information in the H5 interface rendering request through the browser kernel;
loading an H5 interface based on the H5 interface parameter through the browser kernel, and adjusting the interface display effect of the loaded H5 interface according to the interface size information;
and drawing by the browser kernel based on the interface display effect, the H5 interface resource of the H5 interface and the interface node to obtain corresponding second rendering data.
Optionally, before the drawing is performed by the browser kernel based on the interface display effect and the H5 interface resource, the method further includes:
judging whether the interface node of the H5 interface comprises a native interface node or not through the browser kernel;
If yes, sending a native interface rendering request to the game engine through the browser kernel;
rendering and drawing a native interface based on the native interface rendering request through the game engine, generating image data of the native interface, and transmitting the image data to the browser kernel.
Optionally, the drawing, by the browser kernel, based on the interface display effect, the H5 interface resource of the H5 interface, and the interface node, to obtain the corresponding second rendering data includes:
and drawing by the browser kernel based on the interface display effect, the H5 interface resource of the H5 interface and the image data of the original interface node in the interface nodes to obtain corresponding second rendering data.
Optionally, the transferring the second rendering data to the game engine includes:
storing the second rendering data to a preset memory area through the browser kernel;
and the second rendering data is led out from the memory area, and is recorded in the game engine.
Optionally, the drawing, by the game engine, the first interface to be rendered on a preset front-end interface according to the first rendering data and the second rendering data includes:
Acquiring a native interface parameter of a native interface node corresponding to the first rendering data;
determining the hierarchical relationship between the corresponding native interface node and the corresponding H5 interface node according to the native interface parameter and the H5 interface parameter;
adjusting a rendering order between the first rendering data and the second rendering data according to the hierarchical relationship;
and drawing the first interface to be rendered on a preset front-end interface according to the rendering sequence, the first rendering data and the second rendering data.
Optionally, the hybrid rendering method further includes:
loading a preset second interface to be rendered through a browser kernel and traversing interface nodes of the second interface to be rendered;
when the interface node traversed by the browser kernel is an H5 interface node, rendering and drawing are carried out by the browser kernel according to the H5 interface node of the second interface to be rendered, so that corresponding third rendering data are obtained;
when the interface node traversed by the browser kernel is a native interface node, sending a native interface rendering request to the game engine through the browser kernel, wherein the native interface rendering request comprises a native interface parameter of the native interface node;
Determining and loading a designated primary interface based on an interface unique identifier in the primary interface parameters through the game engine to obtain fourth rendering data corresponding to the designated primary interface, and transmitting the fourth rendering data to the browser kernel;
and drawing the second interface to be rendered on the front-end interface through the browser kernel according to the third rendering data and the fourth rendering data.
Optionally, before loading the preset second interface to be rendered through the browser kernel and traversing the interface node of the second interface to be rendered, the method further includes:
generating a DOM tree of the second interface to be rendered according to the file format of the second interface to be rendered, wherein DOM nodes in the DOM tree respectively correspond to an interface node;
and acquiring the input original interface parameters, and generating DOM nodes corresponding to the H5 interface nodes in the DOM tree according to the original interface parameters.
Optionally, the drawing, by the browser kernel, the second interface to be rendered on the front-end interface according to the third rendering data and the fourth rendering data includes:
determining corresponding DOM nodes of the third rendering data and the fourth rendering data in the DOM tree, and acquiring an interface CSS configuration table of the second interface to be rendered;
And drawing the second interface to be rendered on the front end interface according to the third rendering data, the fourth rendering data, the DOM node corresponding to the third rendering data, the position relation of the DOM node corresponding to the fourth rendering data in the DOM tree and the interface CSS configuration table.
It will be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working process of the system or apparatus and unit described above may refer to the corresponding process in the foregoing method embodiment, which is not repeated herein.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied essentially or in part or all of the technical solution or in part in the form of a software product stored in a storage medium, including instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a read-only memory (ROM), a random access memory (random access memory, RAM), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
The above embodiments are only for illustrating the technical solution of the present invention, and not for limiting the same; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention.