Image sampling method, point display method and vehicle terminal
Patent Information
- Application Number
- CN202611044067.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-14
- Publication Date
- 2026-09-25
AI Technical Summary
[0003]但是,现有的指示点展示需要依赖中央处理器(Central Processing Unit,CPU)在应用层进行频繁的组件尺寸修改和重新布局计算,还需要对多张切图进行来回替换,动态缩放和滚动计算会给中央处理器带来渲染压力,导致动画掉帧、反馈延迟,使用户在操作时产生明显的视觉粘滞感,界面效果不够流畅
通过贴图保留参数将原始贴图划分为保留区域和待裁剪区域,得到保留区域和待裁剪区域分别对应的尺寸参数,再根据区域显示参数将待裁剪区域划分为显示区域和偏移区域,得到显示区域和偏移区域分别对应的尺寸参数,从而根据尺寸参数确定保留区域和显示区域所组成的目标区域的采样坐标,按照采样坐标对原始贴图进行采样,得到指示点贴图。这样,通过位于图像处理器的片元着色器按照采样坐标进行采样,得到由目标区域组成的指示点贴图,直接跳过不需要显示的偏移区域,相较于中央处理器的图像工具,本申请利用图像处理器的片元着色器生成指示点贴图,从而减少中央处理器的图形渲染压力,减少动画掉帧、反馈延迟等现象,提高指示点的显示效果。
Smart Images

Figure CN122820902A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of fragment shader technology, specifically to an image sampling method, an indicator point display method, and a vehicle terminal. Background Technology
[0002] In the interactive interfaces of intelligent terminals such as in-vehicle central control systems, when multiple card pages need to be swiped to switch, indicator points are usually placed at the bottom of the page to indicate the user's current page position and the total number of pages. The implementation methods include: First, displaying all indicator points flat results in extremely small spacing between them when there are many pages, making it difficult for users to click and interact. Second, displaying only a portion of the indicator points saves interface space, but users cannot intuitively perceive the total number of pages, and the scaling animation of indicator points at the edges can easily lead to visual misunderstandings. Third, directly displaying numerical proportions or using fixed thin bars to replace indicator points lacks intuitiveness, making the human-computer interaction less vivid and intuitive. To solve the problems of the above implementation methods, many central control interfaces now adopt a dynamic indicator point design. The indicator point for the currently selected page appears as a stretched strip, while the unselected indicator point appears as a contracted dot.
[0003] However, the existing indicator display relies on the central processing unit (CPU) to frequently modify component sizes and re-layout calculations at the application layer. It also requires replacing multiple slices of images back and forth. Dynamic scaling and scrolling calculations put rendering pressure on the CPU, resulting in dropped animation frames and delayed feedback, causing users to experience obvious visual stickiness and making the interface less smooth. Summary of the Invention
[0004] To provide a basic understanding of some aspects of the disclosed embodiments, a brief summary is given below. This summary is not intended as a general commentary, nor is it intended to identify key / important components or describe the scope of protection of these embodiments, but rather as a prelude to the detailed description that follows.
[0005] In view of the shortcomings of the prior art described above, this application provides an image sampling method, an indicator point display method, and a vehicle terminal to improve the display effect of indicator points.
[0006] In a first aspect, this application provides an image sampling method applied to a fragment shader. The image sampling method includes: acquiring an original texture and shader parameters, wherein the shader parameters include texture retention parameters and region display parameters; calculating size parameters corresponding to a retained region and a region to be cropped based on the texture retention parameters and the size parameters of the original texture, wherein the original texture includes the retained region and the region to be cropped; calculating size parameters corresponding to a display region and an offset region based on the region display parameters and the size parameters of the region to be cropped, wherein the region to be cropped includes the display region and the offset region; and determining the sampling coordinates of a target region based on the size parameters corresponding to the retained region, the display region, and the offset region, wherein the target region includes only the retained region and the display region. The original texture is sampled according to the sampling coordinates to obtain an indicator point texture composed of the target area.
[0007] In one embodiment of this application, the calculation of size parameters corresponding to the retained area and the area to be cropped based on the texture retention parameters and the size parameters of the original texture includes: if the texture retention parameters are used to characterize the size ratio between the retained area and the original texture, then the size parameters corresponding to the retained area are calculated based on the texture retention parameters and the size parameters of the original texture, and the size parameters corresponding to the area to be cropped are calculated based on the size parameters of the retained area and the size parameters of the original texture; if the texture retention parameters are used to characterize the size parameters corresponding to the retained area, then the size parameters corresponding to the area to be cropped are calculated based on the texture retention parameters and the size parameters of the original texture.
[0008] In one embodiment of this application, the calculation of size parameters corresponding to the display area and the offset area based on the area display parameters and the size parameters of the area to be clipped includes: if the area display parameters are used to characterize the size ratio between the display area and the area to be clipped, then the size parameters corresponding to the display area are calculated based on the area display parameters and the size parameters corresponding to the area to be clipped; furthermore, the size ratio between the offset area and the area to be clipped is determined based on the area display parameters, so that the size parameters corresponding to the offset area are calculated based on the size ratio between the offset area and the area to be clipped and the size parameters corresponding to the area to be clipped; if the area display parameters are used to characterize the size parameters corresponding to the display area, then the size parameters corresponding to the offset area are calculated based on the area display parameters and the size parameters corresponding to the area to be clipped.
[0009] In one embodiment of this application, determining the sampling coordinates of the target region based on the size parameters corresponding to the reserved region, the display region, and the offset region includes: calculating a coordinate determination interval based on the size parameters corresponding to the reserved region and the display region, wherein the coordinate determination interval includes a lower limit and an upper limit; using a step function to determine whether the fragment texture coordinates of the fragment shader are located between the lower limit and the upper limit of the coordinate interval; if the fragment texture coordinates are located between the lower limit and the upper limit of the coordinate interval, then calculating the sampling coordinates based on the fragment texture coordinates and the size parameters corresponding to the offset region; otherwise, using the fragment texture coordinates as the sampling coordinates.
[0010] In one embodiment of this application, sampling the original texture according to the sampling coordinates to obtain an indicator point texture composed of the target area includes: extracting the texture color value corresponding to the sampling coordinates from the original texture, and using a step function to determine whether the sampling coordinates are less than or equal to the maximum value of the texture coordinates, wherein the maximum value of the texture coordinates is calculated based on the size parameters corresponding to the reserved area and the size parameters corresponding to the display area; if the fragment texture coordinates are less than or equal to the maximum value of the texture coordinates, then outputting the fragment color according to the texture color value corresponding to the sampling coordinates, so as to form an indicator point texture based on the output fragment color.
[0011] Secondly, this application provides a method for displaying indicator points, comprising: acquiring multiple card pages; dividing each card page into multiple target pages, and setting shader parameters corresponding to each target page, wherein the shader parameters are different from each other; generating indicator point maps corresponding to each card page based on the same original texture using the image sampling method described above; and displaying the indicator points as indicator points corresponding to each card page.
[0012] In one embodiment of this application, each card page is divided into multiple target pages, including: obtaining a state machine, wherein the state machine includes an activation state corresponding to each card page; taking the card page and / or the indicator point as a target object, listening to the selection event corresponding to the target object, and switching the activation state corresponding to each target object according to the listened selection event; responding to the activation state corresponding to any card page, taking the card page corresponding to the activation state as the selection page in the target page, and taking the card pages other than the selection page as the original pages in the target page.
[0013] In one embodiment of this application, the display parameter of the region corresponding to the selected page is greater than the display parameter of the region corresponding to the original page.
[0014] In one embodiment of this application, displaying the indicator point includes: creating an indicator point preset using a preset interactive interface development tool; creating child nodes corresponding to each indicator point under the same parent node, and setting each child node to reference the indicator point preset; and displaying each child node through the interactive interface development tool to display the indicator point.
[0015] Thirdly, this application provides a vehicle terminal, including: a processor and a memory; the memory is used to store a computer program, and the processor is used to execute the computer program stored in the memory to cause the vehicle terminal to perform the image sampling method as described above, or to perform the indicator point display method as described above.
[0016] The beneficial effects of this application are: The original texture is divided into a retention area and a cropping area by using texture retention parameters, and the size parameters corresponding to the retention area and the cropping area are obtained respectively. Then, the cropping area is divided into a display area and an offset area according to the area display parameters, and the size parameters corresponding to the display area and the offset area are obtained respectively. Based on the size parameters, the sampling coordinates of the target area composed of the retention area and the display area are determined. The original texture is sampled according to the sampling coordinates to obtain the indicator point texture. In this way, the indicator point texture composed of the target area is obtained by sampling by the fragment shader located in the image processor according to the sampling coordinates, and the offset area that does not need to be displayed is directly skipped. Compared with the image tools of the central processing unit, this application uses the fragment shader of the image processor to generate the indicator point texture, thereby reducing the graphics rendering pressure of the central processing unit, reducing animation frame drops, feedback delays and other phenomena, and improving the display effect of the indicator points. Attached Figure Description
[0017] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application. It is obvious that the drawings described below are merely some embodiments of this application, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort.
[0018] In the attached diagram: Figure 1 This is a flowchart illustrating an image sampling method in an embodiment of this application; Figure 2 This is a schematic diagram of the structure of an original texture in an embodiment of this application; Figure 3 This is a schematic diagram of the structure of another original texture in an embodiment of this application; Figure 4This is a flowchart illustrating the method for calculating the size parameters of a region to be cut in an embodiment of this application. Figure 5 This is a flowchart illustrating the calculation method for the size parameters corresponding to a display area and an offset area in an embodiment of this application. Figure 6 This is a flowchart illustrating the method for calculating the sampling coordinates of a target region in an embodiment of this application. Figure 7 This is a flowchart illustrating a sampling method for an indicator point map in an embodiment of this application; Figure 8 This is a flowchart illustrating another image sampling method in an embodiment of this application; Figure 9 This is a flowchart illustrating a method for displaying an indicator point in an embodiment of this application; Figure 10 This is a schematic diagram of an indicator point in an embodiment of this application; Figure 11 This is a schematic diagram of the structure of a computer system for a vehicle terminal in an embodiment of this application. Detailed Implementation
[0019] The following specific examples illustrate the implementation of this application. Those skilled in the art can easily understand other advantages and effects of this application from the content disclosed in this specification. This application can also be implemented or applied through other different specific embodiments. Various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of this application. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.
[0020] It should be noted that the illustrations provided in the following embodiments are only schematic representations of the basic concept of this application. The drawings only show the components related to this application and are not drawn according to the actual number, shape and size of the components in the actual implementation. In the actual implementation, the form, quantity and proportion of each component can be arbitrarily changed, and the layout of the components may also be more complex.
[0021] In the following description, numerous details are explored to provide a more thorough explanation of embodiments of the present application. However, it will be apparent to those skilled in the art that embodiments of the present application may be practiced without these specific details. In other embodiments, well-known structures and devices are shown in block diagram form rather than in detail to avoid obscuring embodiments of the present application.
[0022] The terms "second," "third," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate for the embodiments of this application described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion.
[0023] Unless otherwise stated, the term "multiple" means two or more.
[0024] In this application, the character " / " indicates that the objects before and after it are in an "or" relationship. For example, A / B means: A or B.
[0025] The term "and / or" describes an association between objects, indicating that three relationships can exist. For example, A and / or B means: A or B, or A and B.
[0026] The human-machine interface of the in-vehicle central control system contains multiple card pages that users can swipe through. To indicate the currently active page and the total number of pages, the interface displays indicator points corresponding to each card page. Currently, the visual appearance of different indicator points is achieved by loading their respective indicator point textures, resulting in the need to store a large number of indicator point textures, which incurs storage costs. Alternatively, the CPU can use application-layer image tools to perform dynamic scaling and scrolling calculations, which can generate different indicator point textures based on a single texture. However, while this method saves storage costs, it is limited by the CPU's limited graphics processing capabilities. Dynamic scaling and scrolling calculations put rendering pressure on the CPU, causing animation frame drops and feedback delays, resulting in a noticeable visual stickiness for the user and an unsmooth interface.
[0027] To solve the above problems, combined with Figure 1 As shown, this application provides an image sampling method applied to a fragment shader. The image sampling method includes: Step S101: Obtain the original texture and shader parameters; In some embodiments, the vehicle terminal is equipped with a graphics processing unit (GPU), and a fragment shader is part of the GPU rendering pipeline used to output the color value of each fragment on the screen. The fragment shader is equipped with code pre-developed using the GLSL (OpenGL Shading Language) language to implement the image sampling method. In some embodiments, the fragment shader receives an externally passed-in raw texture, which is a pre-designed single-source image that serves as the reference image for all indicator point textures; In some embodiments, shader parameters include texture retention parameters. and area display parameters Texture Preservation Parameters Parameters used to characterize the size of the retained area, or the size ratio between the retained area and the original texture; area display parameters. Used to characterize the size parameters corresponding to the display area, or to characterize the size ratio between the display area and the area to be cropped.
[0028] Step S102: Calculate the size parameters corresponding to the retained area and the area to be cropped based on the texture retention parameters and the size parameters of the original texture. In some embodiments, the original texture includes a reserved region and a cropped region. When the fragment shader samples the original texture, it can identify the reserved region from the original texture according to the texture retention parameters. The reserved region is the smallest component of the indicator point texture and will be sampled and displayed by the fragment shader. The original texture outside the reserved region is the cropped region, which is the largest area that the fragment shader can offset during sampling.
[0029] Step S103: Calculate the size parameters corresponding to the display area and the offset area based on the area display parameters and the size parameters of the area to be cut. In some embodiments, the region to be clipped includes a display region and an offset region. The fragment shader identifies the display region from the region to be clipped based on the region display parameters. This display region is sampled and displayed by the fragment shader. The region in the region to be clipped other than the display region is taken as the offset region, which is all the regions that the fragment shader will offset during sampling.
[0030] Step S104: Determine the sampling coordinates of the target area based on the size parameters corresponding to the reserved area, display area, and offset area respectively; The target area includes only the reserved area and the display area.
[0031] Step S105: Sample the original texture according to the sampling coordinates to obtain an indicator point texture composed of the target area; In some embodiments, since the sampling coordinates of the fragment shader correspond to the target region consisting only of the reserved region and the display region, the offset region is offset during sampling. That is, the fragment shader skips the sampling of the offset region. In this way, the fragment shader only samples the reserved region and the display region in the original texture to obtain the indicator point texture.
[0032] The image sampling method provided in this application divides the original texture into a retention area and a cropping area using texture retention parameters, obtaining the size parameters corresponding to the retention area and the cropping area respectively. Then, based on the area display parameters, the cropping area is divided into a display area and an offset area, obtaining the size parameters corresponding to the display area and the offset area respectively. Based on the size parameters, the sampling coordinates of the target area composed of the retention area and the display area are determined. The original texture is then sampled according to the sampling coordinates to obtain the indicator point texture. In this way, the fragment shader located in the image processor samples according to the sampling coordinates to obtain the indicator point texture composed of the target area, directly skipping the offset area that does not need to be displayed. Compared to the image tools of the central processing unit, this application utilizes the fragment shader of the image processor to generate the indicator point texture, thereby reducing the graphics rendering pressure on the central processing unit, reducing animation frame drops and feedback delays, and improving the display effect of the indicator points.
[0033] In some embodiments, at least a portion of the code for implementing the image sampling method is as follows: void main() { / / Step 1: Data preprocessing; float center = 1.0 - 2.0 * st; / / Used to calculate the size parameter center corresponding to the area to be cut; / / 1.0 is the normalized total height of the original texture in the vertical direction. In the UV coordinate system, the normalized total height of the original texture in the vertical direction is always between 0.0 and 1.0. / / center represents the size parameter corresponding to the area to be cut; / / st is the size parameter corresponding to the reserved region, which is passed in from the outside. The number of reserved regions is 2. float actualHeight = center * height; / / Used to calculate the actualHeight parameter corresponding to the display area; / / height is the size parameter corresponding to the offset region, which is passed in from outside. The size parameter corresponding to the offset region is used to represent the size ratio between the offset region and the original texture. float delta = center * (1.0 - height); / / Used to calculate offset delta / / Step 2: Obtain the sampling coordinates; float y = vTexCoord.y + step(st+actualHeight,vTexCoord.y) * step(vTexCoord.y,2.0 * st+actualHeight) * delta; / / step(st+actualHeight,vTexCoord.y) is used to determine whether the fragment texture coordinates are greater than or equal to the lower limit of the coordinate interval min.y; / / step(vTexCoord.y,2.0 * st+actualHeight) is used to determine whether the fragment texture coordinates are less than the upper limit of the coordinate range max.y; / / Step 3: Output fragment colors; vec4 color = texture2D(Texture, vec2(vTexCoord.x,y)); / / Sampling the original texture using the sampling coordinate y to obtain the color value; gl_FragColor = color.a * step(vTexCoord.y,2.0 * st+actualHeight)*CurveColor * BlendIntensity; / / step(vTexCoord.y,2.0 * st+actualHeight) is used to ensure that the vertices of the indicator point texture are less than the upper limit of the coordinate interval max.y; / / Combining the Alpha channel color.a, the color curve mapping CurveColor, and the blend intensity BlendIntensity, output the indicator point texture; } In some embodiments, the specific implementation of the image sampling method includes: combining Figure 2 As shown, this application provides an original texture map. Using the vertical direction of the UV (U and V coordinates, a texture coordinate system including the U and V axes) coordinate system as the region division direction, the original texture map is sequentially divided into a first region, a second region, and a third region. The first and third regions are semi-circular graphics with the same height, and the second region is a rectangular graphic located between the first and third regions. The graphic height refers to the length of the graphic in the vertical direction of the UV coordinate system, and the size parameter refers to the height ratio of the graphic in the original texture map. The first and third regions are respectively designated as reserved regions, and the second region is designated as the region to be cropped. If the texture retention parameter... Texture retention parameters are used to characterize the size ratio between the retained area and the original texture. The value range is (0, 0.5). The texture parameters are preserved using the HMI tool. Setting it to 0.22 means that the height ratio between the first region and the original texture is 22%, which corresponds to the size parameter of the area to be cropped. It is 0.56; if the region displays the parameter The area display parameter is used to characterize the size ratio between the display area and the area to be cropped. =0 indicates that the entire area to be clipped is an offset area. The final indicator point map sampled by the fragment shader consists only of the first and third areas, presenting a circular pattern. (Region display parameter) =0.8 indicates that the height ratio between the display area and the area to be clipped is 80%. The final indicator point map sampled by the fragment shader includes not only the first and third areas, but also the display area in the second area, presenting a long strip pattern.
[0034] In some embodiments, depending on the method of dividing the original texture, the resulting retained area, cropped area, display area, and offset area will also be different, so that the final indicator point texture can be any shape other than circular or rectangular patterns, for example, combined with Figure 3 As shown, the original texture is divided into five regions vertically: region four, region five, region six, region seven, and region eight. Regions four and eight are semicircles of the same height. Region six contains a custom pattern (e.g., a fixed icon or highlight) located at the center of the indicator point. Region five and region seven are rectangular shapes between regions four and six. Regions four, six, and eight are retained, while regions five and seven are cropped. The texture retention parameters are two-dimensional vectors containing the height percentage of the semicircles in regions four and eight and the height percentage of the fixed element in region six. Through image sampling, regions four, six, and eight do not deform during cropping, while only regions five and seven are dynamically cropped. This method is suitable for complex interface design scenarios where a fixed element is always displayed at the center of the indicator point.
[0035] Combination Figure 4 As shown, step S102 above, "calculating based on the texture retention parameters and the original texture size parameters to obtain the size parameters corresponding to the retention area and the area to be cropped," can be implemented through the following sub-steps: Step S401: If the texture retention parameters are used to characterize the size ratio between the retained area and the original texture, then the size parameters corresponding to the retained area are calculated based on the texture retention parameters and the size parameters of the original texture. Step S402: Calculate the size parameters of the area to be cropped based on the size parameters of the area to be retained and the size parameters of the original texture. Among them, it is applied to, for example Figure 2 The original texture shown is used to calculate the size parameters of the area to be clipped using formula (1). Formula (1) In formula (1), These are the size parameters corresponding to the area to be cropped, used to characterize the size ratio between the area to be cropped and the original texture. The parameters for preserving the texture are used to characterize the size ratio between the preserved area and the original texture. Size parameters for all reserved areas (i.e., the first and third areas).
[0036] In some embodiments, the step S102 described above, "calculating based on the texture retention parameters and the size parameters of the original texture to obtain the size parameters corresponding to the retained area and the area to be clipped respectively", can also be implemented through the following sub-steps: if the texture retention parameters are used to characterize the size parameters corresponding to the retained area, then the size parameters corresponding to the area to be clipped are calculated based on the texture retention parameters and the size parameters of the original texture.
[0037] Combination Figure 5 As shown, the step S103 above, "calculating based on the area display parameters and the size parameters of the area to be cropped to obtain the size parameters corresponding to the display area and the offset area respectively," can be implemented through the following sub-steps: Step S501: If the area display parameters are used to characterize the size ratio between the display area and the area to be cropped, then the size parameters corresponding to the display area are calculated based on the area display parameters and the size parameters corresponding to the area to be cropped. Among them, the size parameters corresponding to the display area are calculated using formula (2). Formula (2) In formula (2), These are the size parameters corresponding to the display area, used to characterize the size ratio between the display area and the original texture. These are the dimensional parameters corresponding to the area to be cut. This is a region display parameter used to characterize the size ratio between the display area and the area to be cropped; Step S502: Determine the size ratio between the offset area and the area to be cut based on the area display parameters, and calculate the size parameters corresponding to the offset area based on the size ratio between the offset area and the area to be cut and the size parameters corresponding to the area to be cut. Among them, the size parameters corresponding to the offset region are calculated by formula (3). Formula (3) In formula (3), These are the size parameters corresponding to the offset region, used to characterize the size ratio between the offset region and the original texture. This refers to the size ratio between the offset area and the area to be cropped, for example, if the area display parameters... Setting it to 0.8 will result in a display area size parameter of 0.448 and an offset area size parameter of 0.448. It is 0.112.
[0038] In some embodiments, the step S103 described above, "calculating based on the region display parameters and the size parameters of the area to be cropped to obtain the size parameters corresponding to the display area and the offset area respectively", can also be implemented through the following sub-steps: if the region display parameters are used to characterize the size parameters corresponding to the display area, then the size parameters corresponding to the offset area are calculated based on the region display parameters and the size parameters corresponding to the area to be cropped.
[0039] Combination Figure 6 As shown, step S104 above, "determining the sampling coordinates of the target area based on the size parameters corresponding to the reserved area, display area, and offset area," can be implemented through the following sub-steps: Step S601: Calculate the coordinate determination interval based on the size parameters corresponding to the reserved area and the size parameters corresponding to the display area; The coordinate determination interval includes the lower limit and the upper limit of the coordinate interval; Among them, the lower limit and upper limit of the coordinate interval are calculated by formula (4). Formula (4) In formula (4), The lower limit of the coordinate interval The upper limit of the coordinate range; Step S602: Use the step function to determine whether the fragment texture coordinates of the fragment shader are located between the lower limit and the upper limit of the coordinate interval; Wherein, step function It is expressed as, if Greater than or equal to If the condition is met, output 1; otherwise, output 0. Among them, the fragment texture coordinates of the fragment shader The value range is [0,1], where if the fragment texture coordinates If the value is 0, it means the fragment texture coordinates are located at the bottom of the original texture. If the fragment texture coordinates are 0, it means the fragment texture coordinates are located at the bottom of the original texture. If the value is 1, it means that the fragment texture coordinates are located at the very top of the original texture. Step S603: If the fragment texture coordinates are located between the lower limit and the upper limit of the coordinate interval, the sampling coordinates are calculated based on the fragment texture coordinates and the size parameters corresponding to the offset region; otherwise, the fragment texture coordinates are used as the sampling coordinates. The sampling coordinates are calculated using formula (5). Formula (5) In formula (5), For sampling coordinates, These are the fragment texture coordinates for the fragment shader; This means that if the fragment texture coordinates are greater than or equal to the lower limit of the coordinate range, output 1; otherwise, output 0. This means that if the fragment texture coordinates are less than the upper limit of the coordinate range, output 1; otherwise, output 0. This indicates that if the fragment texture coordinates Located at the lower limit of the coordinate interval and upper limit of coordinate range Between, then output Otherwise, output 0; Based on formula (5), it can be seen that only when the fragment texture coordinates are greater than or equal to the lower limit of the coordinate interval... And less than the upper limit of the coordinate interval hour, Only then will the output of the size parameters corresponding to the offset region be achieved, making the sampling coordinates... Otherwise, sampling coordinates .
[0040] In some embodiments, the indicator point map is less than the lower limit of the coordinate interval. In areas where the original texture needs to be sampled, the fragment texture coordinates must be consistent with the sampled coordinates; while the indicator point texture is within the coordinate range greater than or equal to the lower limit. And less than the upper limit of the coordinate interval The region is sampled directly from the reserved area of the original texture (i.e., the first or third region). Therefore, when the fragment texture coordinates are greater than or equal to the lower limit of the coordinate interval... And less than the upper limit of the coordinate interval Then, an offset (i.e., the size parameter corresponding to the offset region) needs to be added to the fragment texture coordinates so that the obtained sampling coordinates directly skip the offset region and sample the reserved area of the original texture. In this way, by using the size parameter corresponding to the offset region as the offset, the sampling coordinates are only within the lower limit of the coordinate range. and upper limit of coordinate range Sampling is performed between these points, allowing the indicator point map to skip the offset area and display correctly, avoiding truncation or stretching of the indicator point map content.
[0041] In some embodiments, the core computing unit of a graphics processor (GPU) in its hardware architecture adopts a Single Instruction Multiple Threads (SIMT) or Single Instruction Multiple Data (SIMD) execution model. In this model, the GPU divides the pixels on the screen into multiple pixel blocks, and all threads within the same thread bundle must execute the exact same instructions within the same clock cycle. If an if-else conditional branch statement is used in the fragment shader to determine whether the fragment texture coordinates are between the lower and upper limits of the coordinate range, branch divergence will occur because some pixels in the same thread bundle satisfy the if condition while others do not. In branch divergence, the GPU's hardware scheduler cannot execute two different branch paths simultaneously. It must first activate the threads that satisfy the if condition, execute the addition instruction to calculate the offset, and simultaneously disable the threads that do not satisfy the condition. Then, it activates the threads that satisfy the else condition, executes the assignment instruction, and simultaneously disables the threads that satisfy the if condition. This results in the execution time of the thread bundle being equal to the sum of the execution times of the if and else branches, reducing the GPU's computational efficiency. Unlike the if-else conditions mentioned above, this application uses a step function. Mathematical operations replace conditional judgments. Step functions are usually implemented as a single built-in hardware instruction in the graphics processor instruction set, without involving program counter jumps. Therefore, all threads in the thread bundle execute the exact same multiplication and addition arithmetic logic unit instructions, thereby avoiding the graphics processor being in a branching state, reducing the graphics processor's register usage and instruction issue overhead, shortening the fragment processing time of a single indicator point, thereby improving texture clipping efficiency and ensuring smooth interface effects.
[0042] Combination Figure 7 As shown, step S105 above, "sampling the original texture according to the sampling coordinates to obtain an indicator point texture composed of the target area," can be implemented through the following sub-steps: Step S701: Extract the texture color value corresponding to the sampling coordinates from the original texture; In the GLSL language environment, the original texture and sampling coordinates are taken as input parameters and passed to the sampling code texture2D() to extract the texture color value corresponding to the sampling coordinates from the original texture. Step S702: Use the step function to determine whether the sampled coordinates are less than or equal to the maximum value of the texture coordinates; The maximum value of the texture coordinates is calculated based on the size parameters of the reserved area and the size parameters of the display area. Step S703: If the fragment texture coordinates are less than or equal to the maximum value of the texture coordinates, then the fragment color is output according to the texture color value corresponding to the sampling coordinates, so as to form an indicator point texture based on the output fragment color. Among them, through the step function This makes the pixel transparency value of the sampled coordinates that are greater than the maximum value of the texture coordinates 0, thus making the fragment transparent; combined with the alpha channel, the preset color curve mapping, and the preset blending intensity, an indicator point texture is output.
[0043] Combination Figure 8 As shown, this application provides an image sampling method, including: Step S801: Obtain the original texture; Step S802: Divide the original texture into a retainable area and a cropping area, and then divide the cropping area into a display area and an offset area. Step S803: Set the texture retention parameters corresponding to the retention area and set the area display parameters corresponding to the display area. Pass the original texture, texture retention parameters and area display parameters into the fragment shader. Among them, the texture retention parameter is used to characterize the size ratio between the retained area and the original texture; Among them, the area display parameter is used to characterize the size ratio between the display area and the area to be cropped; In step S804, the fragment shader calculates the size parameters corresponding to the area to be clipped based on the texture retention parameters, and then jumps to steps S805 and S806. In step S805, the fragment shader calculates the size parameters corresponding to the display area based on the area display parameters and the size parameters corresponding to the area to be clipped, and then jumps to step S808. Step S806: The fragment shader calculates the size ratio between the offset region and the region to be clipped based on the region display parameters; In step S807, the fragment shader calculates the size parameters corresponding to the offset region based on the size ratio between the offset region and the region to be clipped and the size parameters corresponding to the region to be clipped, and then jumps to step S808. In step S808, the fragment shader calculates the lower limit and upper limit of the coordinate interval based on the size parameters corresponding to the reserved area and the size parameters corresponding to the display area. Step S809: Determine whether the fragment texture coordinates are between the lower limit and the upper limit of the coordinate interval. If yes, proceed to step S810; otherwise, proceed to step S811. In step S810, the fragment shader calculates the sampling coordinates based on the fragment texture coordinates and the size parameters corresponding to the offset region, and then jumps to step S812. In step S811, the fragment shader uses the fragment texture coordinates as the sampling coordinates and jumps to step S812. In step S812, the fragment shader samples the original texture according to the sampling coordinates to obtain an indicator point texture composed of the target area.
[0044] Combination Figure 9 As shown, this application provides a method for displaying indicator points, including: Step S901: Obtain multiple card pages; Step S902: Divide each card page into multiple target pages and set the shader parameters corresponding to each target page. The parameters of each shader are different; Step S903: Based on the same original texture, generate indicator point textures for each card page using the image sampling method described above; Step S904: Use the indicator point texture as the corresponding indicator point for each card page and display the indicator point.
[0045] The indicator point display method provided in this application divides each card page into multiple target pages, sets shader parameters for each target page, and uses a fragment shader to perform an image sampling method to generate indicator point maps for each card page based on the same original texture. These indicator point maps are then used as the indicator points for each card page for display. This not only reduces the graphics rendering load on the central processing unit by using image sampling, thus reducing animation frame drops and feedback delays, but also, compared to setting separate textures for each type of indicator point, reduces the number of textures that need to be stored by offset sampling of the same original texture, thereby reducing the storage pressure on the vehicle.
[0046] In some embodiments, the vehicle terminal includes a central processing unit, a graphics processor, a memory, and an in-vehicle display screen.
[0047] The central processing unit is equipped with an operating system that includes an interactive interface development tool (HMI tool, Human-Machine Interface Tool) for executing at least some of the following instructions: monitoring user input events on card pages; running state machine logic based on the monitored input events to determine the activation state corresponding to each card page; generating shader parameters based on the activation state corresponding to each card page, and sending the shader parameters to the graphics processor.
[0048] The graphics processor is configured with a fragment shader, which receives shader parameters sent by the central processing unit and executes shader code to implement an image sampling method, displaying the output indicator point map on the vehicle display screen.
[0049] The memory is used to store the original texture.
[0050] The in-vehicle display screen is used to show card pages and indicator dots, and to receive user input events for the card pages.
[0051] Optionally, displaying indicator points includes: creating indicator point presets using a pre-defined HMI tool; creating child nodes corresponding to each indicator point under the same parent node, and setting each child node to reference the indicator point preset; and displaying each child node through the HMI tool to display the indicator points.
[0052] In some embodiments, a parent node is created in a preset HMI tool. This parent node contains multiple child nodes, each corresponding to an indicator point. Since the display effect of each indicator point is the same, each child node references a created preset CardPoint. The position of each indicator point is set in the HMI tool, and each indicator point is placed in an adaptive node, thereby achieving a uniform distribution of indicator points within the adaptive node, making the interface more aesthetically pleasing and clearer. If the texture maps corresponding to the selection page and the original page are directly displayed through the HMI tool, the display area of the indicator points is small, making them prone to blurring. Furthermore, each indicator point requires loading an image, which consumes significant performance resources. However, using the image sampling method provided in this application, offset sampling can be performed based on the same original texture map, enabling custom cropping of the texture map and generating indicator point texture maps corresponding to the selection page and the original page, respectively. In this way, the image sampling method allows a single original texture map to be used for all indicator points, ensuring that the texture sampling between each indicator point is identical. The parameters between the selection page and the original page can also be adjusted, thereby reducing rendering pressure and making the animation effects of the vehicle's central control interface smoother.
[0053] Optionally, each card page is divided into multiple target pages, including: obtaining a state machine, wherein the state machine includes the activation state corresponding to each card page; taking the card page and / or indicator point as the target object, listening to the selection event corresponding to the target object, and switching the activation state corresponding to each target object according to the listened selection event; responding to the activation state corresponding to any card page, taking the card page corresponding to the activation state as the selection page in the target page, and taking the card pages other than the selection page as the original pages in the target page.
[0054] In some embodiments, if there are 6 indicator points, a state machine is built in the HMI tool, and the state values corresponding to the 6 active states are set in the state machine. For example, when the state value is 1, the active state corresponding to the first card page is switched, the first card page is used as the selection page, and the second to sixth card pages are used as the original pages.
[0055] Optionally, the display parameters for the selected page's corresponding area are greater than the display parameters for the original page's corresponding area.
[0056] In some embodiments, the indicator point for selecting a page via the HMI tool interface is denoted as "icon0". The display parameter for the area corresponding to the selected page is set to 0.7, and the display parameter for the area corresponding to the original page is set to 0. This causes the indicator point for the selected page to appear as a long strip, while the indicator point for the original page only contains the first and third areas and appears as a circular pattern. The display interface of the indicator point is as follows: Figure 10 As shown; if the vehicle's central control system includes a list interface with 12 swiping card pages, then 12 instances of indicator point presets (CardPoint) are created using the interface display tool and placed under a parent node of a vertically adaptive layout. The state machine is correspondingly set to contain 12 states. When the user swipes to the 5th card page, the state machine listens for this selection event and switches its own state to the active state corresponding to the 5th card page. The state machine determines the 5th indicator point node as the indicator point corresponding to the selected page and sends the region display parameters to its fragment shader. =0.7, and at the same time, the 1st to 4th and 6th to 12th indicator point nodes are determined as the indicator points corresponding to the original page, and the region display parameters are issued to their fragment shaders. =0.0; Finally, on the vehicle display screen, the 5th indicator point is rendered as a strip using the texture clipping method of this application, while the remaining 11 indicator points are rendered as circles, thereby indicating the current page position to the user.
[0057] This application also provides a vehicle terminal, including: a processor and a memory; the memory is used to store a computer program, and the processor is used to execute the computer program stored in the memory, so that the vehicle terminal performs the above-described method.
[0058] Figure 11 A schematic diagram of a computer system suitable for implementing the vehicle terminal embodiments of this application is shown. It should be noted that... Figure 11 The computer system 1100 of the vehicle terminal shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.
[0059] like Figure 11 As shown, the computer system 1100 includes a Central Processing Unit (CPU) 1101, which can perform various appropriate actions and processes, such as executing the methods described in the above embodiments, based on programs stored in Read-Only Memory (ROM) 1102 or programs loaded from storage portion 1108 into Random Access Memory (RAM) 1103. The RAM 1103 also stores various programs and data required for system operation. The CPU 1101, ROM 1102, and RAM 1103 are interconnected via a bus 1104. An Input / Output (I / O) interface 1105 is also connected to the bus 1104.
[0060] The following components are connected to I / O interface 1105: an input section 1106 including a keyboard, mouse, etc.; an output section 1107 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 1108 including a hard disk, etc.; and a communication section 1109 including a network interface card such as a LAN (Local Area Network) card, modem, etc. The communication section 1109 performs communication processing via a network such as the Internet. A drive 1110 is also connected to I / O interface 1105 as needed. Removable media 1111, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., are installed on drive 1110 as needed so that computer programs read from them can be installed into storage section 1108 as needed.
[0061] The vehicle terminal disclosed in this embodiment includes a processor, a memory, a transceiver, and a communication interface. The memory and communication interface are connected to the processor and transceiver and complete communication between them. The memory is used to store computer programs, the communication interface is used for communication, and the processor and transceiver are used to run the computer programs, enabling the vehicle terminal to perform the various steps of the above method. The above description and drawings fully illustrate the embodiments of this disclosure to enable those skilled in the art to practice them. Other embodiments may include structural, logical, electrical, procedural, and other changes. The embodiments represent only possible variations. Unless explicitly required, individual components and functions are optional, and the order of operation may vary. Parts and subsamples of some embodiments may be included in or replace parts and subsamples of other embodiments. Moreover, the terminology used in this application is only for describing embodiments and is not intended to limit the claims. As used in the description of embodiments and claims, the singular forms “a,” “an,” and “the” are intended to equally include the plural forms unless the context clearly indicates otherwise. Similarly, the term “and / or” as used in this application means including one or more of the associated listed items and all possible combinations thereof. Additionally, when used in this application, the term "comprise" and its variations "comprises" and / or "comprising" refer to the presence of stated subsamples, wholes, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other subsamples, wholes, steps, operations, elements, components, and / or groups thereof. Without further limitations, an element defined by the phrase "comprising a..." does not exclude the presence of other identical elements in the process, method, or apparatus that includes the element. In this document, each embodiment may focus on the differences from other embodiments, and similar or identical parts between embodiments can be referred to mutually. For methods, products, etc., disclosed in the embodiments, if they correspond to the method section disclosed in the embodiments, the relevant parts can be referred to the description of the method section.
[0062] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0063] The methods and products (including but not limited to devices and equipment) disclosed in the embodiments herein can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For instance, the division of units may be merely a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some sub-samples may be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or units may be electrical, mechanical, or other forms. Units described as separate components may or may not be physically separate, and components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to implement this embodiment according to actual needs. Furthermore, the functional units in this application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0064] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of the systems, methods, and computer program products according to this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing the specified logical function. In some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. In the descriptions corresponding to the flowcharts and block diagrams in the accompanying drawings, the operations or steps corresponding to different blocks may also occur in a different order than those disclosed in the description; sometimes there is no specific order between different operations or steps. For example, two consecutive operations or steps may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. Each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
Claims
1. An image sampling method, characterized in that, The image sampling method, applied to the fragment shader, includes: Obtain the original texture and shader parameters, wherein the shader parameters include texture preservation parameters and region display parameters; The size parameters corresponding to the retained area and the area to be cropped are calculated based on the texture retention parameters and the size parameters of the original texture. The original texture includes the retained area and the area to be cropped. The size parameters corresponding to the display area and the offset area are calculated based on the area display parameters and the size parameters of the area to be cropped, respectively. The area to be cropped includes the display area and the offset area. Based on the size parameters corresponding to the reserved area, the display area, and the offset area, the sampling coordinates of the target area are determined, wherein the target area includes only the reserved area and the display area; The original texture is sampled according to the sampling coordinates to obtain an indicator point texture composed of the target area.
2. The image sampling method according to claim 1, characterized in that, Based on the texture retention parameters and the size parameters of the original texture, the size parameters corresponding to the retention area and the area to be cropped are calculated, including: If the texture retention parameter is used to characterize the size ratio between the retained area and the original texture, then the size parameter corresponding to the retained area is calculated based on the texture retention parameter and the size parameter of the original texture, and the size parameter corresponding to the area to be cropped is calculated based on the size parameter of the retained area and the size parameter of the original texture. If the texture retention parameter is used to characterize the size parameter corresponding to the retained area, then the size parameter corresponding to the area to be cropped is calculated based on the texture retention parameter and the size parameter of the original texture.
3. The image sampling method according to claim 1, characterized in that, Based on the region display parameters and the size parameters of the region to be cropped, the size parameters corresponding to the display region and the offset region are calculated, including: If the area display parameter is used to characterize the size ratio between the display area and the area to be cropped, then the size parameter corresponding to the display area is calculated based on the area display parameter and the size parameter corresponding to the area to be cropped. Furthermore, the size ratio between the offset area and the area to be cropped is determined based on the area display parameter, so that the size parameter corresponding to the offset area is calculated based on the size ratio between the offset area and the area to be cropped and the size parameter corresponding to the area to be cropped. If the area display parameters are used to characterize the size parameters corresponding to the display area, then the size parameters corresponding to the offset area are calculated based on the area display parameters and the size parameters corresponding to the area to be cropped.
4. The image sampling method according to claim 1, characterized in that, Based on the size parameters corresponding to the reserved area, the display area, and the offset area, the sampling coordinates of the target area are determined, including: The coordinate determination interval is calculated based on the size parameters corresponding to the reserved area and the size parameters corresponding to the display area. The coordinate determination interval includes a lower limit and an upper limit. The step function is used to determine whether the fragment texture coordinates of the fragment shader are located between the lower limit and the upper limit of the coordinate interval. If the fragment texture coordinates are located between the lower limit and the upper limit of the coordinate interval, the sampling coordinates are calculated based on the fragment texture coordinates and the size parameters corresponding to the offset region; otherwise, the fragment texture coordinates are used as the sampling coordinates.
5. The image sampling method according to claim 4, characterized in that, The original texture is sampled according to the sampling coordinates to obtain an indicator point texture composed of the target region, including: Extract the texture color value corresponding to the sampling coordinate from the original texture, and use a step function to determine whether the sampling coordinate is less than or equal to the maximum value of the texture coordinate. The maximum value of the texture coordinate is calculated based on the size parameters corresponding to the reserved area and the size parameters corresponding to the display area. If the fragment texture coordinates are less than or equal to the maximum value of the texture coordinates, then the fragment color is output according to the texture color value corresponding to the sampling coordinates, so as to form an indicator point texture based on the output fragment color.
6. A method for displaying indicator points, characterized in that, include: Get multiple card pages; Each card page is divided into multiple target pages, and shader parameters are set for each target page, wherein the shader parameters are different from each other. Based on the same original texture, the indicator point textures corresponding to each of the card pages are generated using the image sampling method described in any one of claims 1 to 5; The indicator point image is used as the indicator point corresponding to each of the card pages, and the indicator point is displayed.
7. The indicator point display method according to claim 6, characterized in that, Each of the aforementioned card pages is divided into multiple target pages, including: Obtain the state machine, wherein the state machine includes the activation state corresponding to each of the card pages; The card page and / or the indicator point are taken as target objects, and the selection event corresponding to the target object is listened to, so as to switch the activation state corresponding to each target object according to the listened selection event; In response to the activation state of any card page, the card page corresponding to the activation state is taken as the selected page in the target page, and the card pages other than the selected page are taken as the original pages in the target page.
8. The indicator point display method according to claim 7, characterized in that, The display parameters for the selected page are greater than the display parameters for the original page.
9. The indicator point display method according to any one of claims 6 to 8, characterized in that, Displaying the indicated point includes: Use the pre-defined interactive interface development tool to create indicator point presets; Create child nodes corresponding to each of the indicated points under the same parent node, and set each of the child nodes to reference the indicated point preset; The child nodes are displayed through the interactive interface development tool to show the indicator points.
10. A vehicle terminal, comprising: Processor and memory; The memory is used to store a computer program, and the processor is used to execute the computer program stored in the memory to cause the vehicle terminal to perform the image sampling method as described in any one of claims 1 to 5, or to perform the indicator point display method as described in any one of claims 6 to 9.