• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            http://hi.baidu.com/zyb_debug/blog/item/aee40a12b5877c896438db9d.html
            不多說了,龍書的材質(zhì)燈光函數(shù)。可重用代碼
            //=========================================
            /**
            @brief  
            @param 定義一些顏色常量
            @return
            */

            //=========================================
            const D3DXCOLOR WHITE(D3DCOLOR_XRGB(255,255,255));
            const D3DXCOLOR BLACK(D3DCOLOR_XRGB(0,0,0));
            const D3DXCOLOR RED(D3DCOLOR_XRGB(255,0,0));
            const D3DXCOLOR GREEN(D3DCOLOR_XRGB(0,255,0));
            const D3DXCOLOR BLUE(D3DCOLOR_XRGB(0,0,255));
            const D3DXCOLOR YELLOW(D3DCOLOR_XRGB(255,255,0));
            const D3DXCOLOR CYAN(D3DCOLOR_XRGB(0,255,255));
            const D3DXCOLOR MAGENTA(D3DCOLOR_XRGB(255,0,255));


            D3DMATERIAL9 InitMtrl(D3DXCOLOR a,D3DXCOLOR d,D3DXCOLOR s,D3DXCOLOR e,
            float p);

            //=========================================
               /**
               @brief  
               @param 定義一些基本常用材質(zhì)
               @return
               
            */

            //=========================================
            const D3DMATERIAL9 WHITE_MTRL = InitMtrl(WHITE,WHITE,WHITE,BLACK,8.0f);
            const D3DMATERIAL9 RED_MTRL = InitMtrl(RED,RED,RED,BLACK,8.0f);
            const D3DMATERIAL9 GREEN_MTRL = InitMtrl(GREEN,GREEN,GREEN,BLACK,8.0f);
            const D3DMATERIAL9 BLUE_MTRL = InitMtrl(BLUE,BLUE,BLUE,BLACK,8.0f);
            const D3DMATERIAL9 YELLOW_MTRL = InitMtrl(YELLOW,YELLOW,YELLOW,BLACK,8.0f);

            //=========================================
               /**
               @brief  
               @param 燈光
               @return
               
            */

            //=========================================
            D3DLIGHT9 InitDirectionalLight(D3DXVECTOR3* direction, D3DXCOLOR* color);
            D3DLIGHT9 InitPointLight(D3DXVECTOR3
            * position, D3DXCOLOR* color);
            D3DLIGHT9 InitSpotLight(D3DXVECTOR3
            * position, D3DXVECTOR3* direction, D3DXCOLOR* color);

            //=========================================
            /**
            @brief  
            @param 初始化材質(zhì)
            @return
            */

            //=========================================
            D3DMATERIAL9 InitMtrl(D3DXCOLOR a,D3DXCOLOR d,D3DXCOLOR s,D3DXCOLOR e,float p)
            {
               D3DMATERIAL9 mtrl;
               mtrl.Ambient 
            = a;
               mtrl.Diffuse 
            = d;
               mtrl.Specular 
            = s;
               mtrl.Emissive 
            = e;
               mtrl.Power 
            = p;
               
            return mtrl;

            }


            //=========================================
               /**
               @brief  
               @param 燈光
               @return
               
            */

            //=========================================

            D3DLIGHT9 InitDirectionalLight(D3DXVECTOR3
            * direction, D3DXCOLOR* color)
            {
               D3DLIGHT9 light;
               ::ZeroMemory(
            &light, sizeof(light));

               light.Type      
            = D3DLIGHT_DIRECTIONAL;
               light.Ambient   
            = *color * 0.4f;
               light.Diffuse   
            = *color;
               light.Specular 
            = *color * 0.6f;
               light.Direction 
            = *direction;

               
            return light;
            }


            D3DLIGHT9 InitPointLight(D3DXVECTOR3
            * position, D3DXCOLOR* color)
            {
               D3DLIGHT9 light;
               ::ZeroMemory(
            &light, sizeof(light));

               light.Type      
            = D3DLIGHT_POINT;
               light.Ambient   
            = *color * 0.4f;
               light.Diffuse   
            = *color;
               light.Specular 
            = *color * 0.6f;
               light.Position 
            = *position;
               light.Range        
            = 1000.0f;
               light.Falloff      
            = 1.0f;
               light.Attenuation0 
            = 1.0f;
               light.Attenuation1 
            = 0.0f;
               light.Attenuation2 
            = 0.0f;

               
            return light;
            }


            D3DLIGHT9 InitSpotLight(D3DXVECTOR3
            * position, D3DXVECTOR3* direction, D3DXCOLOR* color)
            {
               D3DLIGHT9 light;
               ::ZeroMemory(
            &light, sizeof(light));

               light.Type      
            = D3DLIGHT_SPOT;
               light.Ambient   
            = *color * 0.4f;
               light.Diffuse   
            = *color;
               light.Specular 
            = *color * 0.6f;
               light.Position 
            = *position;
               light.Direction 
            = *direction;
               light.Range        
            = 1000.0f;
               light.Falloff      
            = 1.0f;
               light.Attenuation0 
            = 1.0f;
               light.Attenuation1 
            = 0.0f;
               light.Attenuation2 
            = 0.0f;
               light.Theta        
            = 0.5f;
               light.Phi          
            = 0.7f;

               
            return light;
            }


            }
            Posted on 2009-08-15 17:15 zyb_debug 閱讀(1100) 評(píng)論(0)  編輯 收藏 引用

            只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。
            網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


            国内精品久久久久久99蜜桃| 四虎国产精品免费久久| 一本一道久久a久久精品综合| 午夜精品久久久久9999高清| 四虎影视久久久免费| 精品久久久无码21p发布 | 国产精品久久久久久久久久影院| 伊人久久综合精品无码AV专区| 精品无码久久久久久尤物| 久久精品无码一区二区三区| 久久这里都是精品| 狠狠狠色丁香婷婷综合久久五月| 九九久久精品无码专区| 久久亚洲春色中文字幕久久久| 久久se精品一区二区影院| 波多野结衣久久精品| 亚洲国产成人久久精品影视| 色欲综合久久中文字幕网| 久久婷婷五月综合色奶水99啪| 东京热TOKYO综合久久精品| 伊人久久大香线蕉精品不卡| 69久久夜色精品国产69| 国内精品伊人久久久久| 伊人久久大香线焦AV综合影院| 久久久久无码专区亚洲av| 久久久久综合国产欧美一区二区| 久久亚洲国产精品一区二区| 99久久无码一区人妻a黑| 中文字幕亚洲综合久久菠萝蜜| 伊人色综合久久天天| 国产精品美女久久久久网| 久久夜色精品国产噜噜麻豆| 久久久久精品国产亚洲AV无码| 少妇久久久久久被弄到高潮| 精品久久久久中文字| 精品久久久久久无码中文字幕 | 亚洲av伊人久久综合密臀性色| 午夜精品久久久久久| 亚洲国产成人精品无码久久久久久综合| 青青草原综合久久大伊人精品| 免费国产99久久久香蕉|