Method for three-dimensional rendering of two-dimensional vector

文档序号:21340 发布日期:2021-09-21 浏览:33次 中文

阅读说明:本技术 一种将二维矢量进行三维渲染的方法 (Method for three-dimensional rendering of two-dimensional vector ) 是由 宋江 于 2021-07-21 设计创作,主要内容包括:本发明公开了一种将二维矢量进行三维渲染的方法,包括以下步骤:S1、从shp文件中获取shp数据,对shp数据进行数据坐标转换,转换成build.json文件并保存所有数据目录;S2、根据建筑信息的字段内容,对建筑进行归类;S3、读取build.json文件,获取矢量面坐标点和高度信息;S4、根据矢量面坐标点和高度信息,计算三维建筑的顶点要素信息;S5、根据三维建筑得顶点要素信息、样式分类信息、排列顶点信息、颜色信息和法向量信息创建分组,根据分组创建一个bufferGeometry对象;S6、获取buffGeometry对象对应的坐标信息;S7、根据bufferGeometry和材质数组materials创建一个mesh对象,并根据坐标信息添加到三维场景中进行渲染。(The invention discloses a method for three-dimensionally rendering a two-dimensional vector, which comprises the following steps: s1, acquiring shp data from the shp file, performing data coordinate conversion on the shp data, converting the shp data into build. S2, classifying the buildings according to the field content of the building information; s3, reading the build. S4, calculating the vertex element information of the three-dimensional building according to the coordinate point and the height information of the vector surface; s5, creating a group according to the three-dimensional building, namely the vertex element information, the style classification information, the arrangement vertex information, the color information and the normal vector information, and creating a buffer geometry object according to the group; s6, acquiring coordinate information corresponding to the buffGeometry object; s7, creating a mesh object according to the bufferegeometry and the material array materials, and adding the mesh object into the three-dimensional scene for rendering according to the coordinate information.)

1. A method for three-dimensional rendering of a two-dimensional vector is characterized by comprising the following steps:

s1, acquiring shp data from an shp file through a processor, establishing a corresponding first storage space in a storage medium, and storing the acquired shp data into the first storage space; cutting the stored shp data according to a spatial range, performing data coordinate conversion on the shp data, converting the shp data into build.json files, establishing corresponding second storage spaces in a storage medium, and storing all data directories of the build.json files into the second storage spaces;

s2, classifying the buildings according to the field content of the building information, and acquiring and storing the stylized parameters and classification conditions of the buildings;

s3, reading the build.json file according to a build.json file data directory stored in the second storage space by the processor, acquiring the content of each slice file pbf in the build.json file, analyzing the content into geojson data, acquiring a coordinate origin, acquiring each vector surface element, classifying the vector surface elements according to the classification conditions of the building in the step S2, and acquiring vector surface coordinate points and height information;

s4, calculating the vertex element information of the three-dimensional building according to the coordinate point and the height information of the vector surface;

s5, creating groups according to the three-dimensional building vertex element information, the style classification information, the arrangement vertex information, the color information and the normal vector information, and creating a bufferegeometry object in the storage medium according to the groups;

s6, acquiring coordinate information corresponding to the buffGeometry object;

s7, creating a mesh object according to the bufferegeometry and the material array materials, and adding the mesh object into the three-dimensional scene for rendering according to the coordinate information.

2. The method for three-dimensional rendering of two-dimensional vectors according to claim 1, wherein said step S1 comprises:

the shp data in the shp file is cut into sets of arrays of vector elements according to spatial extent,

and assigning a fixed coordinate origin O (lon, lat) for each set array;

establishing a vector plane, determining the position of a coordinate origin O (lon, lat), marking a point in the vector plane as A (lon, lat), and converting all the A point into relative offset coordinates A1(x, y) relative to the O (lon, lat) origin according to the longitude and latitude coordinates and the internal coordinate conversion relation of threejs, wherein x and y are the horizontal and longitudinal coordinate difference of the coordinates of the point A and the threejs corresponding to O;

and converting the coordinate origin 0, the vector point A and the converted coordinate A1 into geojson data, converting the geojson data into pbf data, and automatically recording all the paths of the slice files in one json, wherein the paths are recorded as build.

3. The method for three-dimensional rendering of two-dimensional vectors according to claim 1, wherein said step S2 comprises:

and creating corresponding building material objects according to the style, wherein one building style corresponds to two building material objects, namely the top material and the side material.

4. The method for three-dimensional rendering of two-dimensional vectors according to claim 1, wherein said step S3 comprises:

coordinate points of the vector plane are acquired and set as Array [ p1, p2, p3, …, pn ], and height information is acquired and set as h.

5. The method for three-dimensional rendering of two-dimensional vectors according to claim 1, wherein said step S4 comprises:

acquiring positioning coordinate positions, vertex coloring information colors and vertex map coordinates;

a coordinate point string Array [ p1, p2, p3, …, pn ] traversing a single vector plane, two adjacent points can be combined into two triangles such as (p1, p2, p1_ H) and (p1_ H, p2, p2_ H), wherein p1_ H, p2_ H, p3_ H … pn _ H is obtained by modifying the z value of Array [ p1, p2, p3, …, pn ] to be set as the height H;

the vertex information for the triangle patch is stored in positions, colors and uvs in vertex order.

6. The method of claim 5, wherein the vertex order comprises:

the position, color and texture coordinates of each vertex are relative and ordered.

7. The method for three-dimensional rendering of two-dimensional vectors according to claim 1, wherein said step S5 comprises:

s5.1, generating an Array [ t1, t2, t3 … tn ] of a triangular net by adopting an algorithm of generating the triangular net by using discrete points according to a coordinate point Array [ p1, p2, p3, …, pn ] of a vector plane;

s5.2, each triangular surface contains 3 pieces of vertex information t [ pm, pm, pw ];

and S5.3, repeating the step S4, and calculating the information of the elements positions, colors and uvs of the triangular patch of the top surface of the three-dimensional building.

8. The method for three-dimensional rendering of two-dimensional vectors according to claim 1, wherein said step S6 comprises:

and orderly storing the material objects in the group into a new array, and adding the material objects into the scene of threejs according to the corresponding coordinates and mesh.

9. The method for three-dimensional rendering of two-dimensional vectors according to claim 1, wherein said step S7 comprises:

the vector slice coordinate is the coordinate difference between the coordinate of the original longitude and latitude coordinate corresponding to threjs and the coordinate of the original point coordinate corresponding to threjs.

Technical Field

The invention relates to the technical field of visualization, in particular to a method for three-dimensionally rendering a two-dimensional vector.

Background

With the continuous development of GIS visualization technology, the visual display of the city-level three-dimensional building is more and more extensive, and different styles can be used for the visual display of different types of buildings; and performing efficient building preview and smooth operation by taking pages as carriers in webgis.

For model support of visual display of three-dimensional building data, there are currently several ways:

1. collecting oblique photography data by an unmanned aerial vehicle;

2. laser point cloud model data;

3. manually modeling data;

4. and the vector roof is subjected to high-degree stretching display according to the building height attribute.

However, the acquisition cost of the data such as oblique photography, laser point cloud, artificial modeling and the like is relatively high, and the acquisition cost of the data at a city level is basically at the level of ten million. The general project is completely unbearable. The method of automatically stretching the vector roof according to the building height is adopted, and then the differentiated style rendering is carried out according to different building conditions, so that the visual display mode which saves the cost most at present is formed. How to perform three-dimensional stretching on the city-level vector building and perform efficient differentiated style display is a problem mainly solved by the inventor.

Aiming at the problems, the most adopted method is to use related software to produce 3 dtles data of a vector building, the produced data is real three-dimensional object data, data style information can be stored in the data, and then a procession three-dimensional map engine is used for performing visual rendering. However, firstly, the method needs to convert the vector building into a 3D model for caching, the style needs to be preset, and the vector building cannot be stylized and expressed in software at will; secondly, the performance of the 3D tiles data rendering by the procession cannot meet the requirements of an ordinary PC, the problem of blockage occurs, and finally, the visualization rendering of the procession engine has a certain gap compared with the threejs engine.

Therefore, a method for rendering two-dimensional vectors in three dimensions is needed to solve the above technical problems.

Disclosure of Invention

In order to solve the problems in the prior art, the invention provides a method for three-dimensionally rendering a two-dimensional vector, which has higher building rendering performance.

In order to achieve the purpose, the invention adopts the technical scheme that: a method for three-dimensional rendering of two-dimensional vectors, comprising the steps of:

s1, acquiring shp data from an shp file through a processor, establishing a corresponding first storage space in a storage medium, and storing the acquired shp data into the first storage space; cutting the stored shp data according to a spatial range, performing data coordinate conversion on the shp data, converting the shp data into build.json files, establishing corresponding second storage spaces in a storage medium, and storing all data directories of the build.json files into the second storage spaces;

s2, classifying the buildings according to the field content of the building information, and acquiring and storing the stylized parameters and classification conditions of the buildings;

s3, reading the build.json file according to a build.json file data directory stored in the second storage space by the processor, acquiring the content of each slice file pbf in the build.json file, analyzing the content into geojson data, acquiring a coordinate origin, acquiring each vector surface element, classifying the vector surface elements according to the classification conditions of the building in the step S2, and acquiring vector surface coordinate points and height information;

s4, calculating the vertex element information of the three-dimensional building according to the coordinate point and the height information of the vector surface;

s5, creating groups according to the three-dimensional building vertex element information, the style classification information, the arrangement vertex information, the color information and the normal vector information, and creating a bufferegeometry object in the storage medium according to the groups;

s6, acquiring coordinate information corresponding to the buffGeometry object;

s7, creating a mesh object according to the bufferegeometry and the material array materials, and adding the mesh object into the three-dimensional scene for rendering according to the coordinate information.

In the technical scheme, data processing is firstly carried out, an origin coordinate is selected for each slice, and the description of all vector slice coordinates is the coordinate difference between the coordinate of the original longitude and latitude coordinate corresponding to threejs and the coordinate of the original origin coordinate corresponding to threejs. Then, a mesh object is created by all vector surfaces in a single slice, and stylized setting can be carried out according to different conditions. And storing the vertex information in an index-free ordered storage mode to provide the establishment speed of the initialization model. And finally, stretching the three-dimensional positioning information into three-dimensional positioning information according to the two-dimensional vector plane through height.

In a further aspect, step S1 includes:

cutting shp data in an shp file into a plurality of sets of vector elements according to a space range, and assigning a fixed coordinate origin O (lon, lat) for each set of vector elements;

establishing a vector plane, determining the position of a coordinate origin O (lon, lat), marking a point in the vector plane as A (lon, lat), and converting all the A point into relative offset coordinates A1(x, y) relative to the O (lon, lat) origin according to the longitude and latitude coordinates and the internal coordinate conversion relation of threejs, wherein x and y are the horizontal and longitudinal coordinate difference of the coordinates of the point A and the threejs corresponding to O;

and converting the coordinate origin 0, the vector point A and the converted coordinate A1 into geojson data, converting the geojson data into pbf data, and automatically recording all the paths of the slice files in one json, wherein the paths are recorded as build.

In the technical scheme, data in a shp file is cut into a plurality of sets of vector elements according to the specified range of a map, a fixed coordinate origin O (lon, lat) is specified for each set array, a point in each vector plane is marked as A (lon, lat), and then the A point is completely converted into a relative offset coordinate A1(x, y) relative to the O (lon, lat) origin according to the longitude and latitude coordinates and the internal coordinate conversion relation of threejs; x and y are the horizontal and vertical coordinate difference of the coordinates of the point A and the point O corresponding to threjs. Then the information is converted into geojson and then into pbf data, and all the slice file paths are automatically recorded in one json, which is build. Therefore, the size of the data file can be reduced, and network transmission is facilitated; and the conversion of all longitude and latitude coordinates in a software layer can be avoided, so that the initialization performance loss is reduced.

In a further aspect, step S2 includes:

and creating corresponding building material objects according to the style, wherein one building style corresponds to two building material objects, namely the top material and the side material.

In the technical scheme, the buildings can be classified according to the field content of the building information, stylized parameters are transmitted, for example, different styles can be rendered according to the height field, corresponding material objects are created according to style styles, one style corresponds to two material objects, and the top material and the side material are respectively as follows: materials [ i ] - { top: topMaterials, wall: wall materials }.

In a further aspect, step S3 includes:

coordinate points of the vector plane are acquired and set as Array [ p1, p2, p3, …, pn ], and height information is acquired and set as h.

In the technical scheme, a build.json file is read, the content of each slice file pbf is obtained, the slice file pbf is analyzed into geojson data, a coordinate origin O (lon, lat) is obtained, each vector surface element is obtained in a traversing manner, classification is performed according to the conditions in the step 2, and then a coordinate point Array [ p1, p2, p3, …, pn ] of the vector surface is obtained, so that height information h is obtained.

In a further aspect, S4 includes:

acquiring positioning coordinate positions, vertex coloring information colors and vertex map coordinates;

a coordinate point string Array [ p1, p2, p3, …, pn ] traversing a single vector plane, two adjacent points can be combined into two triangles such as (p1, p2, p1_ H) and (p1_ H, p2, p2_ H), wherein p1_ H, p2_ H, p3_ H … pn _ H is obtained by modifying the z value of Array [ p1, p2, p3, …, pn ] to be set as the height H;

the vertex information for the triangle patch is stored in positions, colors and uvs in vertex order.

In the technical scheme, vertex element information of the three-dimensional building is calculated according to the height and ground coordinate arrays, namely positioning coordinates positions, vertex coloring information colors and vertex map coordinates uvs, and the coordinate point string Array [ p1, p2, p3, …, pn ] of a single vector plane is traversed, two adjacent points can be combined into two triangles, such as (p1, p2, p1_ H), (p1_ H, p2, p2_ H), wherein the p1_ H, p2_ H, p3_ H … pn _ H is obtained by modifying the z value of the Array [ p1, p2, p3, …, pn ] to be set as H. The vertex information for the triangular patch is stored in positions, colors, uvs in vertex order. Care should be taken not to store the data in the form of vertex indices, which may slow down the performance of three-dimensional building initialization. Directly storing the data according to the vertex order, such as:

postions:[p1.x,p1.y,p1.z,p2.x,p2.y,p2.z,p1_H.x,p1_H.y,p1_H.z,p1_H.x,p1_H.y,p1_H.z,p2.x,p2.y,p2.z,p2_H.x,p2_H.y,p2_H.z…];

colors:[p1.r,p1.b,p1.g,p2.r,p2.b,p2.g,p1_H.r,p1_H.g,p1_H.b,p1_H.r,p1_H.g,p1_H.b,p2.r,p2.g,p2.b,p2_H.r,p2_H.g,p2_H.b…];

uvs, [0,1,1,1,0,0,0,0,1,1,1,0 … ]; and storing texture coordinates at the vertex.

In a further aspect, the vertex order comprises:

the position, color and texture coordinates of each vertex are relative and ordered.

In a further aspect, step S5 includes:

s5.1, generating an Array [ t1, t2, t3 … tn ] of a triangular net by adopting an algorithm of generating the triangular net by using discrete points according to a coordinate point Array [ p1, p2, p3, …, pn ] of a vector plane;

s5.2, each triangular surface contains 3 pieces of vertex information t [ pm, pm, pw ];

and S5.3, repeating the step S4, and calculating the information of the elements positions, colors and uvs of the triangular patch of the top surface of the three-dimensional building.

In the technical scheme, triangular patch element information of the top surface of a building is calculated, firstly, according to a coordinate point Array [ p1, p2, p3, …, pn ] of a vector plane, an algorithm of a triangular net can be generated by adopting discrete points, and an Array [ t1, t2, t3 … tn ] of the triangular net can be generated; each triangle surface contains 3 vertex information t [ pm, pm, pw ]; then, in step S4, information on positions, colors, and uvs is calculated.

In a further aspect, step S6 includes:

and orderly storing the material objects in the group into a new array, and adding the material objects into the scene of threejs according to the corresponding coordinates and mesh.

In the technical scheme, 1 bufferegeometry object is created for positions, colors and uvs obtained in step 4 corresponding to all patterns in a slice, and then is divided into corresponding groups according to the pattern types, wherein it is noted that one pattern corresponds to two groups, and the pattern, the colors and the uvs information correspond to the top and the side respectively.

In a further aspect, step S7 includes:

the vector slice coordinate is the coordinate difference between the coordinate of the original longitude and latitude coordinate corresponding to threjs and the coordinate of the original point coordinate corresponding to threjs.

In the technical scheme, the material objects in the materials are orderly stored in a new array according to the form of top, side, top and side, and the storage method comprises the following steps: m _ materials ═ topMaterials1, wallMaterials1, topMaterials2, wallMaterials2, …. Then, a mesh object is generated according to the material and the bufferegeometry: mesh (buffere geometry, m _ materials); and then adding the corresponding coordinates and the mesh into the scene of threejs.

The invention has the beneficial effects that:

(1) the method can generate the corresponding visual architectural style according to the style conditions transmitted by the interface;

(2) the invention improves the performance of building rendering, reduces the performance loss of the machine and simultaneously improves the fluency of user interaction;

(3) the invention is a visualization rendering scheme based on threejs, and is superior to the visualization effect of other engines in rendering effect.

Drawings

Fig. 1 is a flowchart of a method for three-dimensional rendering of a two-dimensional vector according to the present invention.

Detailed Description

Embodiments of the present invention will be described in detail below with reference to the accompanying drawings.

Example (b):

as shown in fig. 1, the present invention provides a method for three-dimensionally rendering a two-dimensional vector, comprising the following steps:

s1, acquiring shp data from an shp file through a processor, establishing a corresponding first storage space in a storage medium, and storing the acquired shp data into the first storage space; cutting the stored shp data according to a spatial range, performing data coordinate conversion on the shp data, converting the shp data into build.json files, establishing corresponding second storage spaces in a storage medium, and storing all data directories of the build.json files into the second storage spaces;

s2, classifying the buildings according to the field content of the building information, and acquiring and storing the stylized parameters and classification conditions of the buildings;

s3, reading the build.json file according to a build.json file data directory stored in the second storage space by the processor, acquiring the content of each slice file pbf in the build.json file, analyzing the content into geojson data, acquiring a coordinate origin, acquiring each vector surface element, classifying the vector surface elements according to the classification conditions of the building in the step S2, and acquiring vector surface coordinate points and height information;

s4, calculating the vertex element information of the three-dimensional building according to the coordinate point and the height information of the vector surface;

s5, creating groups according to the three-dimensional building vertex element information, the style classification information, the arrangement vertex information, the color information and the normal vector information, and creating a bufferegeometry object in the storage medium according to the groups;

s6, acquiring coordinate information corresponding to the buffGeometry object;

s7, creating a mesh object according to the bufferegeometry and the material array materials, and adding the mesh object into the three-dimensional scene for rendering according to the coordinate information.

In this embodiment, first, data processing is performed, and an origin coordinate is selected for each slice, and all descriptions of the vector slice coordinates are the coordinate difference between the coordinate of the original longitude and latitude coordinate corresponding to threejs and the coordinate of the origin coordinate corresponding to threejs. Then, a mesh object is created by all vector surfaces in a single slice, and stylized setting can be carried out according to different conditions. And storing the vertex information in an index-free ordered storage mode to provide the establishment speed of the initialization model. And finally, stretching the three-dimensional positioning information into three-dimensional positioning information according to the two-dimensional vector plane through height.

In another embodiment, step S1 includes:

cutting shp data in an shp file into a plurality of sets of vector elements according to a space range, and assigning a fixed coordinate origin O (lon, lat) for each set of vector elements;

establishing a vector plane, determining the position of a coordinate origin O (lon, lat), marking a point in the vector plane as A (lon, lat), and converting all the A point into relative offset coordinates A1(x, y) relative to the O (lon, lat) origin according to the longitude and latitude coordinates and the internal coordinate conversion relation of threejs, wherein x and y are the horizontal and longitudinal coordinate difference of the coordinates of the point A and the threejs corresponding to O;

and converting the coordinate origin 0, the vector point A and the converted coordinate A1 into geojson data, converting the geojson data into pbf data, and automatically recording all the paths of the slice files in one json, wherein the paths are recorded as build.

In this embodiment, the data in the shp file is cut into sets of vector elements according to the specified range of the map, and a fixed coordinate origin O (lon, lat) is specified for each set array, the point in each vector plane is marked as a (lon, lat), and then the a points are all converted into relative offset coordinates a1(x, y) relative to the O (lon, lat) origin according to the longitude and latitude coordinates and the internal coordinate conversion relationship of threjs; x and y are the horizontal and vertical coordinate difference of the coordinates of the point A and the point O corresponding to threjs. Then the information is converted into geojson and then into pbf data, and all the slice file paths are automatically recorded in one json, which is build. Therefore, the size of the data file can be reduced, and network transmission is facilitated; and the conversion of all longitude and latitude coordinates in a software layer can be avoided, so that the initialization performance loss is reduced.

In another embodiment, step S2 includes:

and creating corresponding building material objects according to the style, wherein one building style corresponds to two building material objects, namely the top material and the side material.

In this embodiment, according to the field content of the building information, the building may be classified, and stylized parameters may be introduced, for example, different styles of rendering may be performed according to the height field, and corresponding material objects may be created according to style styles, where one style corresponds to two material objects, which are top and side materials, respectively, such as: materials [ i ] - { top: topMaterials, wall: wall materials }.

In another embodiment, step S3 includes:

coordinate points of the vector plane are acquired and set as Array [ p1, p2, p3, …, pn ], and height information is acquired and set as h.

In the present embodiment, a build json file is read, the content of each slice file pbf is acquired, the slice file pbf is analyzed into geojson data, a coordinate origin O (lon, lat) is acquired, each vector surface element is acquired by traversal, classification is performed according to the conditions in step 2, a coordinate point Array [ p1, p2, p3, …, pn ] of the vector surface is acquired, and height information h is acquired.

In another embodiment, S4 includes:

acquiring positioning coordinate positions, vertex coloring information colors and vertex map coordinates;

a coordinate point string Array [ p1, p2, p3, …, pn ] traversing a single vector plane, two adjacent points can be combined into two triangles such as (p1, p2, p1_ H) and (p1_ H, p2, p2_ H), wherein p1_ H, p2_ H, p3_ H … pn _ H is obtained by modifying the z value of Array [ p1, p2, p3, …, pn ] to be set as the height H;

the vertex information for the triangle patch is stored in positions, colors and uvs in vertex order.

In the present embodiment, vertex element information of a three-dimensional building is calculated according to the height and ground coordinate arrays, which are respectively location coordinates positions, vertex coloring information colors, and vertex map coordinates uvs, and the coordinate point string Array [ p1, p2, p3, …, pn ] of a single vector plane is traversed, and two adjacent points can be combined into two triangles, such as (p1, p2, p1_ H), (p1_ H, p2, p2_ H), wherein p1_ H, p2_ H, p3_ H … pn _ H is obtained by modifying the z value of Array [ p1, p2, p3, …, pn ]. The vertex information for the triangular patch is stored in positions, colors, uvs in vertex order. Care should be taken not to store the data in the form of vertex indices, which may slow down the performance of three-dimensional building initialization. Directly storing the data according to the vertex order, such as:

postions:[p1.x,p1.y,p1.z,p2.x,p2.y,p2.z,p1_H.x,p1_H.y,p1_H.z,p1_H.x,p1_H.y,p1_H.z,p2.x,p2.y,p2.z,p2_H.x,p2_H.y,p2_H.z…];

colors:[p1.r,p1.b,p1.g,p2.r,p2.b,p2.g,p1_H.r,p1_H.g,p1_H.b,p1_H.r,p1_H.g,p1_H.b,p2.r,p2.g,p2.b,p2_H.r,p2_H.g,p2_H.b…];

uvs, [0,1,1,1,0,0,0,0,1,1,1,0 … ]; and storing texture coordinates at the vertex.

In another embodiment, the vertex order includes:

the position, color and texture coordinates of each vertex are relative and ordered.

In another embodiment, step S5 includes:

s5.1, generating an Array [ t1, t2, t3 … tn ] of a triangular net by adopting an algorithm of generating the triangular net by using discrete points according to a coordinate point Array [ p1, p2, p3, …, pn ] of a vector plane;

s5.2, each triangular surface contains 3 pieces of vertex information t [ pm, pm, pw ];

and S5.3, repeating the step S4, and calculating the information of the elements positions, colors and uvs of the triangular patch of the top surface of the three-dimensional building.

In this embodiment, triangular patch element information of the building top surface is calculated, and first, according to a coordinate point Array [ p1, p2, p3, …, pn ] of a vector plane, an algorithm of generating a triangular mesh by using discrete points can be adopted, and an Array [ t1, t2, t3 … tn ] of the triangular mesh can be generated; each triangle surface contains 3 vertex information t [ pm, pm, pw ]; then, in step S4, information on positions, colors, and uvs is calculated.

In another embodiment, step S6 includes:

and orderly storing the material objects in the group into a new array, and adding the material objects into the scene of threejs according to the corresponding coordinates and mesh.

In this embodiment, 1 bufferGeometry object is created for positions, colors, and uvs obtained in step 4 corresponding to all patterns in a slice, and then is divided into corresponding groups according to the pattern types, where it should be noted that one style pattern corresponds to two groups, which are position, color, and uvs information corresponding to the top and side, respectively, and the specific manner is as follows:

defining the style as style array, and calculating the information for drawing according to the style information as follows:

assigning the calculated group object to the bufferegeometry object as:

bufferGeometry.group=group;

assigning the element information to the bufferegeometry as:

bufferGeometry.setAttribute('position',new THREE.BufferAttribute(vertices1,3));

bufferGeometry.setAttribute('uv',new THREE.BufferAttribute(uvs1,2));

bufferGeometry.setAttribute('color',new THREE.BufferAttribute(colors1,3))。

in another embodiment, step S7 includes:

the vector slice coordinate is the coordinate difference between the coordinate of the original longitude and latitude coordinate corresponding to threjs and the coordinate of the original point coordinate corresponding to threjs.

In this embodiment, the material objects in the materials are sequentially stored in a new array according to the form of top, side, top, and side: m _ materials ═ topMaterials1, wallMaterials1, topMaterials2, wallMaterials2, …. Then, a mesh object is generated according to the material and the bufferegeometry: mesh (buffere geometry, m _ materials); and then adding the corresponding coordinates and the mesh into the scene of threejs.

The above-mentioned embodiments only express the specific embodiments of the present invention, and the description thereof is more specific and detailed, but not construed as limiting the scope of the present invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the inventive concept, which falls within the scope of the present invention.

13页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种基于体素增长的医学图像三维重建等值面网格加速提取方法

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!