游戏开发论坛

 找回密码
 立即注册
搜索
查看: 1278|回复: 1

ID3DXConstantTable的SetDefualts的疑??

[复制链接]

414

主题

611

帖子

621

积分

高级会员

Rank: 4

积分
621
发表于 2005-12-11 20:18:00 | 显示全部楼层 |阅读模式
HLSL著色器的???(3D??虺淌皆O?入? 第16章)
ID3DXConstantTable的SetDefualts的疑??

?????:
SetDefault直接常?翟O?樗??的??值.??值是?些常?敌?娴某跏贾??方法再??贸淌皆O定?r??艚幸淮

所?的"常?敌?娴某跏贾?quot;是指在"ShaderFile的初始值"或是"程式的初始值"?

Sets the constants to their default values. The default values are declared in the variable declarations in the shader.

HRESULT SetDefaults(
  LPDIRECT3DDEVICE9 pDevice
);

Source Code:
TransformViewProjHandle = TransformConstantTable->GetConstantByName(0, "ViewProjMatrix");
TransformConstantTable->SetDefaults(Device);

Shader FIle Content:
matrix ViewProjMatrix;
vector Blue = {0.0f, 0.0f, 1.0f, 1.0f};
struct VS_INPUT
{
    vector position  : POSITION;
};
struct VS_OUTPUT
{
    vector position : POSITION;
    vector diffuse  : COLOR;
};

VS_OUTPUT Main(VS_INPUT input)
{
    // zero out members of output
    VS_OUTPUT output = (VS_OUTPUT)0;

    // transform to view space and project
    output.position  = mul(input.position, ViewProjMatrix);

    // set vertex diffuse color to blue
    output.diffuse = Blue;

    return output;
}

5

主题

72

帖子

83

积分

注册会员

Rank: 2

积分
83
发表于 2005-12-12 12:10:00 | 显示全部楼层

Re:ID3DXConstantTable的SetDefualts的疑??

按我理解应该是脚本中的缺省值
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

作品发布|文章投稿|广告合作|关于本站|游戏开发论坛 ( 闽ICP备17032699号-3 )

GMT+8, 2026-1-22 23:20

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表