CN108744520A - Determine the method, apparatus and electronic equipment of game model placement position - Google Patents

Determine the method, apparatus and electronic equipment of game model placement position Download PDF

Info

Publication number
CN108744520A
CN108744520A CN201810574364.9A CN201810574364A CN108744520A CN 108744520 A CN108744520 A CN 108744520A CN 201810574364 A CN201810574364 A CN 201810574364A CN 108744520 A CN108744520 A CN 108744520A
Authority
CN
China
Prior art keywords
game model
game
model
convex closure
target network
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201810574364.9A
Other languages
Chinese (zh)
Other versions
CN108744520B (en
Inventor
周金
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Netease Hangzhou Network Co Ltd
Original Assignee
Netease Hangzhou Network Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Netease Hangzhou Network Co Ltd filed Critical Netease Hangzhou Network Co Ltd
Priority to CN201810574364.9A priority Critical patent/CN108744520B/en
Publication of CN108744520A publication Critical patent/CN108744520A/en
Application granted granted Critical
Publication of CN108744520B publication Critical patent/CN108744520B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F13/00Video games, i.e. games using an electronically generated display having two or more dimensions
    • A63F13/60Generating or modifying game content before or while executing the game program, e.g. authoring tools specially adapted for game development or game-integrated level editor
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F2300/00Features of games using an electronically generated display having two or more dimensions, e.g. on a television screen, showing representations related to the game
    • A63F2300/60Methods for processing data by generating or executing the game program
    • A63F2300/6009Methods for processing data by generating or executing the game program for importing or creating game content, e.g. authoring tools during game development, adapting content to different platforms, use of a scripting language to create content

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Processing Or Creating Images (AREA)

Abstract

An embodiment of the present invention provides a kind of method, apparatus and electronic equipment of determining game model placement position, the method includes:Obtain the vertex data of game model;Based on the vertex data, convex closure of the game model in world space is calculated;It is grid by preset game editing machine scene partitioning, the grid includes multiple mesh points;According to convex closure of the game model in world space, the target network lattice point inside the game model is determined;According to the target network lattice point, the placement position of the game model is determined.The present embodiment is by uploading game model to editing machine of playing, can it is automatic by game editing machine, accurately and accurately calculate the specific placement position of the game model in the scene, it is anticipated without doing others to game model, the efficiency for not only increasing determining game model position also improves the accuracy of position calculating.

Description

Determine the method, apparatus and electronic equipment of game model placement position
Technical field
The present invention relates to game technical fields, more particularly to a kind of method, one kind of determining game model placement position Determine the device and a kind of electronic equipment of game model placement position.
Background technology
Editing machine of playing is a kind of tool for being supplied to player freely to edit game content or scene.Game editor Device additionally provides a plurality of types of editing machine models, such as personage, flowers and plants, trees etc. simultaneously.By in editing machine of playing Above-mentioned model is rendered, player can be according to the thinking design games of oneself.
It overlaps between each object in the scene of game ultimately generated in order to prevent, before being rendered to model, Firstly the need of placement position of each model of determination in editing machine of playing.Currently, determining that model puts position in the prior art It sets and is mainly realized by following several modes.First, determining model center according to the coordinate on each vertex of model, then Rectangle or the circle that one can surround the model completely are determined to mark the size of model with the center, and then determine mould The placement position of type.Second is that game player or designer by calculating model size by way of retouching side to model manually, Then the placement position of model is determined.But above two mode is required for determining the size of model first, can not play Model is dynamically increased in editing machine.Moreover, when model is the special shapes such as triangle, it is also easy to make using first way At the waste in space.On the other hand, although the waste in space can be avoided using second of disposing way, artificial use is needed Additional paintbrush tool to each model do it is very careful retouch side, take time and effort.
Invention content
In view of the above problems, it is proposed that the embodiment of the present invention overcoming the above problem or at least partly in order to provide one kind A kind of method of the determining game model placement position to solve the above problems, a kind of determining game model placement position device and Corresponding a kind of electronic equipment.
To solve the above-mentioned problems, the embodiment of the invention discloses a kind of method of determining game model placement position, packets It includes:
Obtain the vertex data of game model;
Based on the vertex data, convex closure of the game model in world space is calculated;
It is grid by preset game editing machine scene partitioning, the grid includes multiple mesh points;
According to convex closure of the game model in world space, the target gridding inside the game model is determined Point;
According to the target network lattice point, the placement position of the game model is determined.
Optionally, the step of vertex data for obtaining game model includes:
Obtain game model file;
The game model file is parsed, to obtain the vertex data in local space.
Optionally, described the step of being based on the vertex data, calculating convex closure of the game model in world space Including:
Height is gone to handle the vertex data in the local space, to generate representative points data;
Using the representative points data, convex closure of the game model in the local space is calculated;
Based on the convex closure in the local space, convex closure of the game model in world space is calculated.
Optionally, described to use the representative points data, it is convex in the local space to calculate the game model The step of packet includes:
Extract the representative points that abscissa value is minimum and maximum in the representative points data;
The minimum and maximum representative points of the abscissa value are connected, target line is generated;
Based on the target line, multiple representative points are divided into positive direction point set and negative direction point set;
According to the positive direction point set and negative direction point set, the convex closure in the local space is calculated.
Optionally, the convex closure based in the local space, it is convex in world space to calculate the game model The step of packet includes:
Determine world space matrix of the game model in the world space;
By the coordinate value of multiple representative points and the world space matrix multiple, to obtain in the world space Convex closure.
Optionally, described to include for the step of grid by preset game editing machine scene partitioning:
Determine that the dividing precision of grid, the dividing precision are less than or equal to the minimal size of the game model;
It is multiple grids by preset game editing machine scene partitioning according to the dividing precision.
Optionally, the convex closure according to the game model in world space determines inside the game model Target network lattice point the step of include:
For any mesh point, using the mesh point as endpoint, X-direction is that direction generates ray;
Determine the intersection number of the ray and the convex closure in the world space;
It is target network lattice point to extract the mesh point that the intersection number is odd-times.
Optionally, described according to the target network lattice point, the step of placement position for determining the game model, includes:
Determine whether the target network lattice point is occupied by other game models;
If the target network lattice point is not occupied by other game models, by the corresponding location determination of the target network lattice point For the placement position of the game model.
To solve the above-mentioned problems, the embodiment of the invention discloses a kind of device of determining game model placement position, packets It includes:
Vertex data acquisition module, the vertex data for obtaining game model;
Convex closure computing module calculates convex closure of the game model in world space for being based on the vertex data;
Mesh generation module, for being grid by preset game editing machine scene partitioning, the grid includes multiple nets Lattice point;
Target network lattice point determining module is determined for the convex closure according to the game model in world space described Target network lattice point inside game model;
Placement position determining module, for according to the target network lattice point, determining the placement position of the game model.
Optionally, the vertex data acquisition module includes:
Game model file acquisition submodule, for obtaining game model file;
Game model document analysis submodule, for parsing the game model file, to obtain the top in local space Point data.
Optionally, the convex closure computing module includes:
Representative points data generate submodule, for going height to handle the vertex data in the local space, with Generate representative points data;
Local space convex closure computational submodule calculates the game model in institute for using the representative points data State the convex closure in local space;
World space convex closure computational submodule, for based on the convex closure in the local space, calculating the game model Convex closure in world space.
Optionally, the local space convex closure computational submodule includes:
Representative points extraction unit, for extracting the target top that abscissa value is minimum and maximum in the representative points data Point;
It is straight to generate target for target line generation unit, the representative points minimum and maximum for connecting the abscissa value Line;
Multiple representative points are divided into positive direction point set by representative points division unit for being based on the target line With negative direction point set;
Local space convex closure computing unit, for according to the positive direction point set and negative direction point set, calculating the part Convex closure in space.
Optionally, the world space convex closure computational submodule includes:
World space matrix determination unit, for determining world space square of the game model in the world space Battle array;
World space convex closure computing unit is used for the coordinate value of multiple representative points and the world space matrix phase Multiply, to obtain the convex closure in the world space.
Optionally, the mesh generation module includes:
Dividing precision determination sub-module, the dividing precision for determining grid, the dividing precision are less than or equal to the trip The minimal size of play model;
Mesh generation submodule, for being multiple by preset game editing machine scene partitioning according to the dividing precision Grid.
Optionally, the target network lattice point determining module includes:
Ray generates submodule, for for any mesh point, using the mesh point as endpoint, X-direction to be given birth to for direction At ray;
Intersect number determination sub-module, the intersection number for determining the ray and the convex closure in the world space;
Target network lattice point extracting sub-module is target gridding for extracting the mesh point that the intersection number is odd-times Point.
Optionally, the placement position determining module includes:
Target network lattice point occupies determination sub-module, for determining whether the target network lattice point is accounted for by other game models With;
Game model placement position determination sub-module, if not occupied by other game models for the target network lattice point, It is then the placement position of the game model by the corresponding location determination of the target network lattice point.
To solve the above-mentioned problems, the embodiment of the invention discloses a kind of device of determining game model placement position, packets Having included memory and one, either more than one program one of them or more than one program is stored in memory, And be configured to by one or more than one processor execute the one or more programs include for carry out with The instruction of lower operation:
Obtain the vertex data of game model;
Based on the vertex data, convex closure of the game model in world space is calculated;
It is grid by preset game editing machine scene partitioning, the grid includes multiple mesh points;
According to convex closure of the game model in world space, the target gridding inside the game model is determined Point;
According to the target network lattice point, the placement position of the game model is determined.
To solve the above-mentioned problems, it the embodiment of the invention discloses a kind of electronic equipment, including processor, memory and deposits Storage is on the memory and is configured the computer program run on the processor, and the computer program is by the place Manage the step of realizing the method such as above-mentioned determination game model placement position when device executes.
Compared with the background art, the embodiment of the present invention includes following advantages:
The embodiment of the present invention may then based on above-mentioned vertex data, calculate by obtaining the vertex data of game model Go out convex closure of the game model in world space, and be grid by preset game editing machine scene partitioning, obtains multiple nets After lattice point, the target network lattice point inside game model can be determined according to convex closure of the game model in world space, into And according to target network lattice point, determine the placement position of game model.The present embodiment by uploading game model to editing machine of playing, Can it is automatic by game editing machine, accurately and accurately calculate the specific placement position of the game model in the scene, without pair Game model does others and anticipates, and solves to waste at the placement position of computation model in the prior art and largely puts sky Between, and the problem of need pre-defined model size, not only increase the efficiency of determining game model position, also improve position Set the accuracy of calculating.
Description of the drawings
Fig. 1 is a kind of step flow signal of the method for determining game model placement position of one embodiment of the invention Figure;
Fig. 2 is the step flow signal that the another kind of one embodiment of the invention determines the method for game model placement position Figure;
Fig. 3 is a kind of schematic structure frame of the device of determining game model placement position of one embodiment of the invention Figure.
Specific implementation mode
In order to make the foregoing objectives, features and advantages of the present invention clearer and more comprehensible, below in conjunction with the accompanying drawings and specific real Applying mode, the present invention is described in further detail.
Referring to Fig.1, the step of showing a kind of method of determining game model placement position of one embodiment of the invention Flow diagram can specifically include following steps:
Step 101, the vertex data of game model is obtained;
It should be noted that above-mentioned game model can be a kind of threedimensional model, compiled by the way that the model is uploaded to game It collects in device, and by the rendering of GPU, the various game elements such as personage, trees, the stone in 3D game can be showed.
In general, the model for being overlapped or overlapping in editing machine scene of playing is presented on actual trip after rendering Respective objects in play scene also will appear overlapping, to influence game visual effect.Therefore, in order to avoid different models it Between overlapping, need the placement position for determining game model one by one.
When determining the placement position of game, the vertex data of each game model can be obtained first.
In embodiments of the present invention, game model can be the object with specific shape to complete under a certain scene Body object.For example, certain 3D game model can be by small triangular one by one at each vertex of a triangle is in coordinate Coordinate value under system is the vertex data of the game model.
In general, the vertex data of game model can be obtained by parsing game model file.
Step 102, it is based on the vertex data, calculates convex closure of the game model in world space;
In general, each game model is completed in certain spatial dimension, the sky of the game model is made Between can regard local space as.
It, generally can be using the central point of the game model as the coordinate origin of local space for local space.In office In portion space, record has the spatial information of the game model itself.
After game model is placed into game editing machine, the scene space corresponding to editing machine of playing can be referred to as generation Boundary space.
In embodiments of the present invention, after getting the vertex data of game model, above-mentioned vertex data, meter can be based on Calculate convex closure of the game model in world space.
Convex closure (Convex Hull) is the concept in a computational geometry (graphics), in a real vector SPACE V In, the convex closure of X is referred to as given set X, the intersection S of all convex sets comprising X.
In the concrete realization, it can be primarily based on the vertex data of game model, calculate the game model in local sky Between in convex closure, then on this basis, then calculate convex closure of the game model in world space.
Certainly, those skilled in the art can calculate game model in the world using appropriate method according to actual needs Convex closure in space, the present embodiment are not construed as limiting this.
Step 103, it is grid by preset game editing machine scene partitioning, the grid includes multiple mesh points;
In embodiments of the present invention, it in order to determine game model specific placement position in editing machine of playing, can incite somebody to action The scene space subdivision of the game editing machine is multiple grids, and obtains multiple mesh points.Above-mentioned mesh point can be used for dividing Crosspoint between arbitrary two straight lines for editing machine scene of playing.
In the concrete realization, the minimal size of game model can be less than or equal to by dividing the precision of game editing machine scene.
For example, if the bounding box size of game model is 0.4*0.4, in order to more accurately determine occupied by the game model Grid which includes, should according to the precision no more than above-mentioned 0.4*0.4 to game editing machine scene divide.
Step 104, the convex closure according to the game model in world space determines the mesh inside the game model Mark mesh point;
In general, convex closure of the game model in world space is generally irregular polygon, each net in world space Lattice point is also not necessarily all in the inside of game model.Therefore, it is being grid to game editing machine scene partitioning and is obtaining multiple After mesh point, the target network lattice point inside game model can also be further extracted.
Euclidean space theorem has demonstration, when the number that ray passes through Polygonal Boundary is even number, all even numbers Secondary passing through for (including last time) is pierced by, and correspondingly, all passing through for odd-times (including first time) penetrate. Therefore, in the concrete realization, it can determine which mesh point belongs to the target inside model based on Euclidean space theorem Mesh point.
That is, making ray with some mesh point, when the number for passing through convex closure boundary in certain direction is odd-times, can recognize It is the target network lattice point inside model for the mesh point.
Step 105, according to the target network lattice point, the placement position of the game model is determined.
In embodiments of the present invention, it is finding out after all target network lattice points inside game model, it can be determined that Whether above-mentioned target network lattice point is occupied in editing machine scene space of playing by other game models, if target complete mesh point It is not occupied by other game models, then position can be put in the corresponding position of above-mentioned target network lattice point as the game model It sets.
In embodiments of the present invention, by the vertex data of acquisition game model, above-mentioned vertex data is may then based on, Convex closure of the game model in world space is calculated, and is being grid by preset game editing machine scene partitioning, is obtained more After a mesh point, the target gridding inside game model can be determined according to convex closure of the game model in world space Point, and then according to target network lattice point, determine the placement position of game model.The present embodiment is compiled by uploading game model to playing Volume device, can it is automatic by game editing machine, accurately and accurately calculate the specific placement position of the game model in the scene, It is anticipated without doing others to game model, solves and wasted largely at the placement position of computation model in the prior art Placing space, and the problem of need pre-defined model size, not only increase the efficiency of determining game model position, also carry The accuracy that high position calculates.
With reference to Fig. 2, show that the another kind of one embodiment of the invention determines the step of the method for game model placement position Rapid flow diagram, can specifically include following steps:
Step 201, game model file is obtained;
In embodiments of the present invention, game model file can be used for recording the various information of the game model.Above-mentioned trip Model of playing can be a kind of threedimensional model, by the way that the model is uploaded to game editing machine, game player or game designer It can be according to the wish design games of oneself.
Step 202, the game model file is parsed, to obtain the vertex data in local space;
In embodiments of the present invention, local space can refer to for making the game model space, the part Space is usually using the central point of game model as the coordinate origin in space.Each vertex of game model is in the local space Coordinate value be vertex data of the game model in local space.
It should be noted that game model can be divided into band animation (i.e. dynamic model) and without animation (i.e. static models) Two types.For the game model without animation, vertex data is in local space will not be changed.And for Game model with animation, vertex may change, and therefore, the vertex data of the game model with animation can refer to this The initial vertex data on each vertex of the corresponding subject of model under static state.
In general, but under normal circumstances, for the game model with animation, the vertex of small radian changes the mistake put in model In poor range.Therefore, as long as the vertex non-overlapping copies for the game model put in editing machine of playing, object for appreciation is presented to after rendering In the interface of family, each object will not overlap.It therefore, can be in order to avoid the overlapping between different models The vertex data of each game model is obtained, and determines the placement position of game model one by one accordingly.
In the concrete realization, the vertex data general record of game model is in the Mesh files of model, by analysis The data structure of Mesh files is stated, the vertex data on each vertex of game model can be obtained.
Step 203, height is gone to handle the vertex data in the local space, to generate representative points data;
In embodiments of the present invention, vertex data of the 3d gaming model in local space should also be as being three-dimensional data, The numerical value such as including length, width and height.It therefore, can be to the vertex data after obtaining vertex data of the game model in local space It goes height to handle, generates representative points data.
It should be noted that in field of play, altitude information is generally the data in the centre position of D coordinates value.Example Such as, if the vertex data on some vertex is (3,9,4), then the representative points data obtained after going height to handle are (3,0,4).
Step 204, using the representative points data, convex closure of the game model in the local space is calculated;
After the embodiment of the present invention, the number for representative points data only include length and width both direction that treated due to going height According to.Therefore when calculating convex closure of the game model in local space using above-mentioned representative points data, it is believed that be to use Above-mentioned data calculate convex closure of the game model in two-dimensional space.
In the concrete realization, the representative points that abscissa value is minimum and maximum in representative points data can be extracted first, The representative points minimum and maximum by connecting above-mentioned abscissa value generate target line, and are based on target line, can will be more A representative points are divided into positive direction point set and negative direction point set, then can be counted according to positive direction point set and negative direction point set Calculate the convex closure in local space.
For example, can first by all representative points in abscissa direction (i.e. X-direction) according to from as low as longer spread. According to the property of convex closure it is found that the minimum and maximum point one of abscissa value is scheduled on convex closure.Assuming that above-mentioned abscissa value maximum and Two minimum representative points are respectively a (x1, y1) and b (x2, y2), then the straight line of 2 points of ab of connection can be by target complete Vertex partition is positive direction and negative direction two parts.
Assuming that exist point c (c3, y3), if in a counterclockwise direction be positive direction, using point a as fixed point, then vector ab along Counterclockwise rotation is to c points, and inswept place is in the parallelogram of vectorial ac and vector ab compositions.So, this is flat The determinant (cross product of vectorial ac and vector ab) of row quadrangle is just.The value of area is just i.e. in following formula:
Area=x1*y2+x3*y1+x2*y3-x3*y2-x2*y1-x1*y3
For either objective vertex, by calculating its area value, if just, then the point is positive direction point set;If area values It is negative, then the point is negative direction point set.
For positive direction point set, the point farthest apart from straight line ab (i.e. the maximum point of area values) is found, by the property of convex closure It is found that the point in the triangle of 3 points of compositions of anb can not possibly be the point on convex closure, so straight line an, nb subregion takes positive direction Point set, recurrence is done to above step, and same processing is done to the point set of negative direction, game model can be calculated in part Convex closure in space.
Step 205, based on the convex closure in the local space, convex closure of the game model in world space is calculated;
After calculating convex closure of the game model in local space, the trip can be further calculated out on this basis Convex closure of the play model in world space.
In the concrete realization, world space matrix of the game model in world space can be determined first, it then will be more The coordinate value of a representative points and world space matrix multiple, to obtain the convex closure in world space.
Local space matrix record of the game model in local space has occupied information of the model in local space, It can directly be obtained by parsing game model file.On this basis, game model, can be with this part after being put into scene Space matrix translates, rotation, and the processing such as scaling ultimately produce world space matrix.Then, by the coordinate value on each vertex with Above-mentioned world space matrix multiple just can obtain convex closure of the game model in world space.
Step 206, it is grid by preset game editing machine scene partitioning, the grid includes multiple mesh points;
In embodiments of the present invention, before the editing machine scene partitioning that will play is grid, drawing for grid can be determined first Divide precision.
Usually, the dividing precision of grid should be less than or equal to the minimal size of game model, and above-mentioned minimal size can be with It refer to the minimum area size of the bounding box of game model.
For example, if the bounding box size of game model is 0.4*0.4, then dividing precision should be not more than 0.4*0.4.
It, can be according to above-mentioned dividing precision, by preset game editing machine scene after determining specific dividing precision Multiple grids are divided into, and obtain multiple mesh points.
Step 207, the convex closure according to the game model in world space determines the mesh inside the game model Mark mesh point;
In general, convex closure of the game model in world space is generally irregular polygon, each net in world space Lattice point is also not necessarily all in the inside of game model.Therefore, it is being grid to game editing machine scene partitioning and is obtaining multiple After mesh point, the target network lattice point inside game model can also be further extracted.
In embodiments of the present invention, can be using the mesh point as endpoint for any mesh point, X-direction is given birth to for direction At ray, the intersection number of the ray and the convex closure in world space is then determined, be odd number so as to extract intersection number Secondary mesh point is target network lattice point.
Step 208, determine whether the target network lattice point is occupied by other game models;
In embodiments of the present invention, after determining which mesh point belongs to the target network lattice point inside model, it is also necessary to Determine whether these target network lattice points are occupied by other game models.
Step 209, if the target network lattice point is not occupied by other game models, the target network lattice point is corresponding Location determination is the placement position of the game model.
If total-grid point is not occupied by other any game models, then it represents that the corresponding position of above-mentioned target network lattice point It can be used for putting current game model.
It in embodiments of the present invention, can be with after game model to be placed into the corresponding position of above-mentioned target network lattice point The mesh point that the game model occupies is labeled as having occupied, to forbid other game models to be placed in the mesh point.
It should be noted that if mobile or other operations have been carried out to the game model put, so as to cause the game The placement position of model is changed, and can also be marked the occupancy for the mesh point that the game model formerly occupies and be deleted It removes, so that other models can be put in above-mentioned mesh point.
In embodiments of the present invention, by parsing game model file, the game model can be obtained in local space Vertex data, above-mentioned vertex data is gone height handle after, game model can be calculated accordingly in local space Two-dimentional convex closure, and then convex closure of the game model in the corresponding world space of game editing machine scene space can be obtained.? Editing machine scene partitioning will be played according to certain dividing precision as that after grid, can be determined according to the convex closure in world space Which mesh point is located inside game model, if the mesh point inside game model is not accounted for by other game models With, then it represents that the mesh point is in blank state, can put game model here.The present embodiment passes through editing machine of playing Automatically the specific placement position of the game model in the scene is calculated, is anticipated without doing others to game model, no The efficiency for improving only determining game model position also improves the accuracy of position calculating.
It should be noted that for embodiment of the method, for simple description, therefore it is all expressed as a series of action group It closes, but those skilled in the art should understand that, the embodiment of the present invention is not limited by the described action sequence, because according to According to the embodiment of the present invention, certain steps can be performed in other orders or simultaneously.Secondly, those skilled in the art also should Know, embodiment described in this description belongs to preferred embodiment, and the involved action not necessarily present invention is implemented Necessary to example.
With reference to Fig. 3, a kind of signal of the device of determining game model placement position of one embodiment of the invention is shown Property structure diagram, can specifically include following module:
Vertex data acquisition module 301, the vertex data for obtaining game model;
It is convex in world space to calculate the game model for being based on the vertex data for convex closure computing module 302 Packet;
Mesh generation module 303, for being grid by preset game editing machine scene partitioning, the grid may include Multiple mesh points;
Target network lattice point determining module 304 is determined for the convex closure according to the game model in world space in institute State the target network lattice point inside game model;
Placement position determining module 305, for according to the target network lattice point, determine the game model to put position It sets.
In embodiments of the present invention, the vertex data acquisition module 301 can specifically include following submodule:
Game model file acquisition submodule, for obtaining game model file;
Game model document analysis submodule, for parsing the game model file, to obtain the top in local space Point data.
In embodiments of the present invention, the convex closure computing module 302 can specifically include following submodule:
Representative points data generate submodule, for going height to handle the vertex data in the local space, with Generate representative points data;
Local space convex closure computational submodule calculates the game model in institute for using the representative points data State the convex closure in local space;
World space convex closure computational submodule, for based on the convex closure in the local space, calculating the game model Convex closure in world space.
In embodiments of the present invention, the local space convex closure computational submodule can specifically include such as lower unit:
Representative points extraction unit, for extracting the target top that abscissa value is minimum and maximum in the representative points data Point;
It is straight to generate target for target line generation unit, the representative points minimum and maximum for connecting the abscissa value Line;
Multiple representative points are divided into positive direction point set by representative points division unit for being based on the target line With negative direction point set;
Local space convex closure computing unit, for according to the positive direction point set and negative direction point set, calculating the part Convex closure in space.
In embodiments of the present invention, the world space convex closure computational submodule can specifically include such as lower unit:
World space matrix determination unit, for determining world space square of the game model in the world space Battle array;
World space convex closure computing unit is used for the coordinate value of multiple representative points and the world space matrix phase Multiply, to obtain the convex closure in the world space.
In embodiments of the present invention, the mesh generation module 303 can specifically include following submodule:
Dividing precision determination sub-module, the dividing precision for determining grid, the dividing precision are less than or equal to the trip The minimal size of play model;
Mesh generation submodule, for being multiple by preset game editing machine scene partitioning according to the dividing precision Grid.
In embodiments of the present invention, the target network lattice point determining module 304 can specifically include following submodule:
Ray generates submodule, for for any mesh point, using the mesh point as endpoint, X-direction to be given birth to for direction At ray;
Intersect number determination sub-module, the intersection number for determining the ray and the convex closure in the world space;
Target network lattice point extracting sub-module is target gridding for extracting the mesh point that the intersection number is odd-times Point.
In embodiments of the present invention, the placement position determining module 305 can specifically include following submodule:
Target network lattice point occupies determination sub-module, for determining whether the target network lattice point is accounted for by other game models With;
Game model placement position determination sub-module, if not occupied by other game models for the target network lattice point, It is then the placement position of the game model by the corresponding location determination of the target network lattice point.
The invention also discloses a kind of device of determining game model placement position, include memory and one or The more than one program of person, one of them either more than one program be stored in memory and be configured to by one or It includes the instruction for being operated below that more than one processor, which executes the one or more programs,:Obtain game The vertex data of model;Based on the vertex data, convex closure of the game model in world space is calculated;By preset trip Play editing machine scene partitioning is grid, and the grid includes multiple mesh points;According to the game model in world space Convex closure determines the target network lattice point inside the game model;According to the target network lattice point, the game model is determined Placement position.
Optionally, the one or more programs are also configured to by one or the execution of more than one processor The one or more programs include the instruction for being operated below:Obtain game model file;Described in parsing Game model file, to obtain the vertex data in local space.
Optionally, the one or more programs are also configured to by one or the execution of more than one processor The one or more programs include the instruction for being operated below:To the vertex data in the local space Height is gone to handle, to generate representative points data;Using the representative points data, the game model is calculated in the office Convex closure in portion space;Based on the convex closure in the local space, convex closure of the game model in world space is calculated.
Optionally, the one or more programs are also configured to by one or the execution of more than one processor The one or more programs include the instruction for being operated below:Extract horizontal seat in the representative points data The minimum and maximum representative points of scale value;The minimum and maximum representative points of the abscissa value are connected, target line is generated;Base In the target line, multiple representative points are divided into positive direction point set and negative direction point set;According to the positive direction point set With negative direction point set, the convex closure in the local space is calculated.
Optionally, the one or more programs are also configured to by one or the execution of more than one processor The one or more programs include the instruction for being operated below:Determine the game model in the world World space matrix in space;By the coordinate value of multiple representative points and the world space matrix multiple, to obtain in institute State the convex closure in world space.
Optionally, the one or more programs are also configured to by one or the execution of more than one processor The one or more programs include the instruction for being operated below:Determine the dividing precision of grid, described stroke The minimal size for dividing precision to be less than or equal to the game model;According to the dividing precision, by preset game editing machine scene It is divided into multiple grids.
Optionally, the one or more programs are also configured to by one or the execution of more than one processor The one or more programs include the instruction for being operated below:For any mesh point, with the grid Point is endpoint, and X-direction is that direction generates ray;Determine the intersection number of the ray and the convex closure in the world space; It is target network lattice point to extract the mesh point that the intersection number is odd-times.
Optionally, the one or more programs are also configured to by one or the execution of more than one processor The one or more programs include the instruction for being operated below:Determine the target network lattice point whether by it He occupies game model;If the target network lattice point is not occupied by other game models, and the target network lattice point is corresponding Location determination is the placement position of the game model.
For device embodiments, since it is basically similar to the method embodiment, so fairly simple, the correlation of description Place illustrates referring to the part of embodiment of the method.
The invention also discloses a kind of electronic equipment, including processor, memory and it is stored on the memory and passes through The computer program run on the processor is configured, is realized as above-mentioned when the computer program is executed by the processor Determination game model placement position method the step of.
Each embodiment in this specification is described in a progressive manner, the highlights of each of the examples are with The difference of other embodiment, the same or similar parts between the embodiments can be referred to each other.
It should be understood by those skilled in the art that, the embodiment of the embodiment of the present invention can be provided as method, apparatus or calculate Machine program product.Therefore, the embodiment of the present invention can be used complete hardware embodiment, complete software embodiment or combine software and The form of the embodiment of hardware aspect.Moreover, the embodiment of the present invention can be used one or more wherein include computer can With in the computer-usable storage medium (including but not limited to magnetic disk storage, CD-ROM, optical memory etc.) of program code The form of the computer program product of implementation.
The embodiment of the present invention be with reference to according to the method for the embodiment of the present invention, terminal device (system) and computer program The flowchart and/or the block diagram of product describes.It should be understood that flowchart and/or the block diagram can be realized by computer program instructions In each flow and/or block and flowchart and/or the block diagram in flow and/or box combination.These can be provided Computer program instructions are set to all-purpose computer, special purpose computer, Embedded Processor or other programmable data processing terminals Standby processor is to generate a machine so that is held by the processor of computer or other programmable data processing terminal equipments Capable instruction generates for realizing in one flow of flow chart or multiple flows and/or one box of block diagram or multiple boxes The device of specified function.
These computer program instructions, which may also be stored in, can guide computer or other programmable data processing terminal equipments In computer-readable memory operate in a specific manner so that instruction stored in the computer readable memory generates packet The manufacture of command device is included, which realizes in one flow of flow chart or multiple flows and/or one side of block diagram The function of being specified in frame or multiple boxes.
These computer program instructions can be also loaded into computer or other programmable data processing terminal equipments so that Series of operation steps are executed on computer or other programmable terminal equipments to generate computer implemented processing, thus The instruction executed on computer or other programmable terminal equipments is provided for realizing in one flow of flow chart or multiple flows And/or in one box of block diagram or multiple boxes specify function the step of.
Although the preferred embodiment of the embodiment of the present invention has been described, once a person skilled in the art knows bases This creative concept, then additional changes and modifications can be made to these embodiments.So the following claims are intended to be interpreted as Including preferred embodiment and fall into all change and modification of range of embodiment of the invention.
Finally, it is to be noted that, herein, relational terms such as first and second and the like be used merely to by One entity or operation are distinguished with another entity or operation, without necessarily requiring or implying these entities or operation Between there are any actual relationship or orders.Moreover, the terms "include", "comprise" or its any other variant meaning Covering non-exclusive inclusion, so that process, method, article or terminal device including a series of elements not only wrap Those elements are included, but also include other elements that are not explicitly listed, or further include for this process, method, article Or the element that terminal device is intrinsic.In the absence of more restrictions, being wanted by what sentence "including a ..." limited Element, it is not excluded that there is also other identical elements in process, method, article or the terminal device including the element.
A kind of method of determining game model placement position provided by the present invention, a kind of determining game model are put above The device and a kind of electronic equipment for putting position, are described in detail, and specific case used herein is to the principle of the present invention And embodiment is expounded, the explanation of above example is only intended to help to understand that the method for the present invention and its core are thought Think;Meanwhile for those of ordinary skill in the art, according to the thought of the present invention, in specific embodiments and applications There will be changes, in conclusion the content of the present specification should not be construed as limiting the invention.

Claims (11)

1. a kind of method of determining game model placement position, which is characterized in that including:
Obtain the vertex data of game model;
Based on the vertex data, convex closure of the game model in world space is calculated;
It is grid by preset game editing machine scene partitioning, the grid includes multiple mesh points;
According to convex closure of the game model in world space, the target network lattice point inside the game model is determined;
According to the target network lattice point, the placement position of the game model is determined.
2. according to the method described in claim 1, it is characterized in that, it is described obtain game model vertex data the step of wrap It includes:
Obtain game model file;
The game model file is parsed, to obtain the vertex data in local space.
3. according to the method described in claim 2, it is characterized in that, it is described be based on the vertex data, calculate the game mould The step of convex closure of the type in world space includes:
Height is gone to handle the vertex data in the local space, to generate representative points data;
Using the representative points data, convex closure of the game model in the local space is calculated;
Based on the convex closure in the local space, convex closure of the game model in world space is calculated.
4. according to the method described in claim 3, it is characterized in that, the use representative points data, calculate the trip Play convex closure of the model in the local space the step of include:
Extract the representative points that abscissa value is minimum and maximum in the representative points data;
The minimum and maximum representative points of the abscissa value are connected, target line is generated;
Based on the target line, multiple representative points are divided into positive direction point set and negative direction point set;
According to the positive direction point set and negative direction point set, the convex closure in the local space is calculated.
5. according to the method described in claim 3, it is characterized in that, the convex closure based in the local space, calculates institute The step of stating convex closure of the game model in world space include:
Determine world space matrix of the game model in the world space;
It is convex in the world space to obtain by the coordinate value of multiple representative points and the world space matrix multiple Packet.
6. according to the method described in claim 1, it is characterized in that, it is described by preset game editing machine scene partitioning be grid The step of include:
Determine that the dividing precision of grid, the dividing precision are less than or equal to the minimal size of the game model;
It is multiple grids by preset game editing machine scene partitioning according to the dividing precision.
7. according to the method described in claim 6, it is characterized in that, described convex in world space according to the game model Packet, the step of determining target network lattice point inside the game model include:
For any mesh point, using the mesh point as endpoint, X-direction is that direction generates ray;
Determine the intersection number of the ray and the convex closure in the world space;
It is target network lattice point to extract the mesh point that the intersection number is odd-times.
8. the method according to the description of claim 7 is characterized in that described according to the target network lattice point, the game is determined The step of placement position of model includes:
Determine whether the target network lattice point is occupied by other game models;
It is institute by the corresponding location determination of the target network lattice point if the target network lattice point is not occupied by other game models State the placement position of game model.
9. a kind of device of determining game model placement position, which is characterized in that including:
Vertex data acquisition module, the vertex data for obtaining game model;
Convex closure computing module calculates convex closure of the game model in world space for being based on the vertex data;
Mesh generation module, for being grid by preset game editing machine scene partitioning, the grid includes multiple mesh points;
Target network lattice point determining module is determined for the convex closure according to the game model in world space in the game Target network lattice point inside model;
Placement position determining module, for according to the target network lattice point, determining the placement position of the game model.
10. a kind of device of determining game model placement position, which is characterized in that include memory and one or one A above program, either more than one program is stored in memory and is configured to by one or one for one of them It includes the instruction for being operated below that the above processor, which executes the one or more programs,:
Obtain the vertex data of game model;
Based on the vertex data, convex closure of the game model in world space is calculated;
It is grid by preset game editing machine scene partitioning, the grid includes multiple mesh points;
According to convex closure of the game model in world space, the target network lattice point inside the game model is determined;
According to the target network lattice point, the placement position of the game model is determined.
11. a kind of electronic equipment, which is characterized in that including processor, memory and be stored on the memory and be configured The computer program run on the processor realizes such as claim when the computer program is executed by the processor The step of method of determination game model placement position described in any one of 1 to 8.
CN201810574364.9A 2018-06-05 2018-06-05 Method and device for determining placement position of game model and electronic equipment Active CN108744520B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810574364.9A CN108744520B (en) 2018-06-05 2018-06-05 Method and device for determining placement position of game model and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810574364.9A CN108744520B (en) 2018-06-05 2018-06-05 Method and device for determining placement position of game model and electronic equipment

Publications (2)

Publication Number Publication Date
CN108744520A true CN108744520A (en) 2018-11-06
CN108744520B CN108744520B (en) 2022-02-22

Family

ID=63999998

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810574364.9A Active CN108744520B (en) 2018-06-05 2018-06-05 Method and device for determining placement position of game model and electronic equipment

Country Status (1)

Country Link
CN (1) CN108744520B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109920023A (en) * 2019-03-28 2019-06-21 网易(杭州)网络有限公司 The method and apparatus that model is put in a kind of game
CN112057854A (en) * 2020-09-10 2020-12-11 网易(杭州)网络有限公司 Game object processing method and device, electronic equipment and computer readable medium
CN113808238A (en) * 2021-09-24 2021-12-17 北京有竹居网络技术有限公司 Animation rendering method and device, readable medium and electronic equipment

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103258345A (en) * 2013-04-18 2013-08-21 中国林业科学研究院资源信息研究所 Method for extracting parameters of tree branches based on ground laser radar three-dimensional scanning
CN103295216A (en) * 2012-02-24 2013-09-11 富士通株式会社 Method and equipment for identifying space in three-dimensional model and image processing system
CN103885788A (en) * 2014-04-14 2014-06-25 焦点科技股份有限公司 Dynamic WEB 3D virtual reality scene construction method and system based on model componentization
CN104112017A (en) * 2014-07-21 2014-10-22 无锡梵天信息技术股份有限公司 Method of realizing script model exporting based on 3D MAX (Three-dimensional Studio Max)
CN104700433A (en) * 2015-03-24 2015-06-10 中国人民解放军国防科学技术大学 Vision-based real-time general movement capturing method and system for human body
CN105931296A (en) * 2016-04-19 2016-09-07 中山大学 Fast layout method of 3D printed object based on contour and device thereof
CN106373184A (en) * 2016-08-30 2017-02-01 苏州紫金港智能制造装备有限公司 Three-dimensional printing model placing required support amount rapid estimation method
CN106918311A (en) * 2017-01-20 2017-07-04 山东科技大学 Isolated tree crown mapping area automatic calculating method based on vehicle-mounted laser cloud data
US20180095276A1 (en) * 2016-10-05 2018-04-05 Magic Leap, Inc. Surface modeling systems and methods

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103295216A (en) * 2012-02-24 2013-09-11 富士通株式会社 Method and equipment for identifying space in three-dimensional model and image processing system
CN103258345A (en) * 2013-04-18 2013-08-21 中国林业科学研究院资源信息研究所 Method for extracting parameters of tree branches based on ground laser radar three-dimensional scanning
CN103885788A (en) * 2014-04-14 2014-06-25 焦点科技股份有限公司 Dynamic WEB 3D virtual reality scene construction method and system based on model componentization
CN104112017A (en) * 2014-07-21 2014-10-22 无锡梵天信息技术股份有限公司 Method of realizing script model exporting based on 3D MAX (Three-dimensional Studio Max)
CN104700433A (en) * 2015-03-24 2015-06-10 中国人民解放军国防科学技术大学 Vision-based real-time general movement capturing method and system for human body
CN105931296A (en) * 2016-04-19 2016-09-07 中山大学 Fast layout method of 3D printed object based on contour and device thereof
CN106373184A (en) * 2016-08-30 2017-02-01 苏州紫金港智能制造装备有限公司 Three-dimensional printing model placing required support amount rapid estimation method
US20180095276A1 (en) * 2016-10-05 2018-04-05 Magic Leap, Inc. Surface modeling systems and methods
CN106918311A (en) * 2017-01-20 2017-07-04 山东科技大学 Isolated tree crown mapping area automatic calculating method based on vehicle-mounted laser cloud data

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
FENG: "Unity3D游戏之创建基本游戏场景一", 《HTTPS://GAMEINSTITUTE.QQ.COM/COMMUNITY/DETAIL/118582》 *

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109920023A (en) * 2019-03-28 2019-06-21 网易(杭州)网络有限公司 The method and apparatus that model is put in a kind of game
CN109920023B (en) * 2019-03-28 2024-01-26 网易(杭州)网络有限公司 Method and device for placing models in game
CN112057854A (en) * 2020-09-10 2020-12-11 网易(杭州)网络有限公司 Game object processing method and device, electronic equipment and computer readable medium
CN112057854B (en) * 2020-09-10 2024-07-12 网易(杭州)网络有限公司 Game object processing method, game object processing device, electronic equipment and computer readable medium
CN113808238A (en) * 2021-09-24 2021-12-17 北京有竹居网络技术有限公司 Animation rendering method and device, readable medium and electronic equipment

Also Published As

Publication number Publication date
CN108744520B (en) 2022-02-22

Similar Documents

Publication Publication Date Title
US11574438B2 (en) Generating three-dimensional virtual scene
CN103761397B (en) Three-dimensional model slice for surface exposure additive forming and projection plane generating method
CN106780709B (en) A kind of method and device of determining global illumination information
US20160275209A1 (en) Interactive dimensioning of parametric models
CN105469440B (en) Method and apparatus for generating and traversing acceleration structures
EP2927877B1 (en) Method and apparatus for rendering same regions of multi frames
CN108744520A (en) Determine the method, apparatus and electronic equipment of game model placement position
CN108876910A (en) A kind of three-dimensional modeling method, device, equipment and computer readable storage medium
CN104200506A (en) Method and device for rendering three-dimensional GIS mass vector data
CN104781852A (en) A computer graphics method for rendering three dimensional scenes
CN110163831A (en) The object Dynamic Display method, apparatus and terminal device of three-dimensional sand table
CN112632683A (en) Digital twin city space positioning method and device based on illusion engine and storage medium
CN114255160B (en) Data processing method, device, equipment and storage medium
CN110738722A (en) thermodynamic diagram texture generation method, device and equipment
CN109816792A (en) Localization method and device in a kind of three-dimensional scenic
CN111047682A (en) Three-dimensional lane model generation method and system
CN110120087A (en) The label for labelling method, apparatus and terminal device of three-dimensional sand table
CN109499067B (en) Terrain texture drawing method and device, electronic equipment and storage medium
CN110110132A (en) A kind of method, apparatus that establishing space lattice system and remote sensing image processing system
CN103295266A (en) Three-dimension model edge collapse simplification method based on distance weighted minimum collapse cost
CN103295267A (en) Three-dimensional model side folding simplification method based on minimum folding price
CN107393019B (en) Particle-based cloth simulation method and device
Luo et al. Quad-tree atlas ray casting: a gpu based framework for terrain visualization and its applications
CN110038302A (en) Grid generation method and device based on Unity3D
CN113181642B (en) Method and device for generating wall model with mixed materials

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant