⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 readme.txt

📁 windows游戏编程中关于“草”的源码及源程序
💻 TXT
字号:
//-----------------------------------------------------------------------------
// Name: Grass Sample
// 
// Copyright (c) 2002 ATI Technologies Inc. All rights reserved.
//-----------------------------------------------------------------------------


Description
===========
   The Grass sample demonstrates the use of vertex and pixel shaders to
   create the effect of a grass waving in the wind.

   The availability of programmable vertex and pixel shaders has allowed
   programmers to re-examine how they implement passive background scene
   geometry.  With the ability to transfer background scene animation
   over to the GPU, previously static background objects can now be
   animated, adding life and realism to the scene.  In this sample, an
   approach is shown for realistically and inexpensively animating grass
   with a combination of vertex and pixel shaders.


Path
====
   Source:        samples\Grass


User's Guide
============
   The following keys are implemented. The dropdown menus can be used
   for some of the same controls.
      <V>         Toggles the vertex shader
      <P>         Toggles the pixel shader
      <Enter>     Starts and stops the scene
      <Space>     Advances the scene by a small increment
      <F2>        Prompts user to select a new rendering device or display mode
      <Alt+Enter> Toggles between fullscreen and windowed modes
      <Esc>       Exits the app.


Programming Notes
=================
   The waving motion of the grass can be accomplished in the vertex
   shader.  Using a traditional method the grass is rendered with
   randomly placed intersecting quads stored in a single vertex buffer.
   The quads are texture mapped and rendered with an alpha test.  In the
   vertex shader, the top two vertices of each quad are animated using a
   combination of four sinusoidal waves.  The waves are approximated
   using a Taylor Series approach.  This combination of sine waves using
   various different frequencies creates a natural waving that does not
   look like an animation or overly repetitious.

   When grass blades wave in the wind they also turn and change their
   orientation with respect to the sunlight.  Because this method
   involves using a textured quad to represent various blades of grass it
   is impossible to change the lighting on individual grass blades.  To
   simulate the change in color that would occur as the blades twist the
   wind, the same sine wave that was used to animate the grass is used to
   oscillate between two colors.  In this case, the green channel of the
   color was changed to make the grass color change from intense green to
   a more yellowish-brown. The pixel shader combines this color with the
   grass texture to produce the final result.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -