游戏开发论坛

 找回密码
 立即注册
搜索
查看: 2077|回复: 4

哪位高人指点一下落不明D3DMatrixScaling函数

[复制链接]

30

主题

63

帖子

63

积分

注册会员

Rank: 2

积分
63
发表于 2008-3-6 19:53:00 | 显示全部楼层 |阅读模式
有这样一段代码,很简单:
D3DXMATRIX matScale;
D3DXMatrixScaling(&matScale,1.0f,1.0f,5.0f);

程序的结果是返回matScale矩阵,
小弟的疑惑就是这个matScale矩阵是一个单位矩阵经过了缩放操作之后得到的还是matScale矩阵本身经过缩放操作得到的?
谢谢! [em14]

11

主题

650

帖子

651

积分

高级会员

Rank: 4

积分
651
发表于 2008-3-6 19:55:00 | 显示全部楼层

Re:哪位高人指点一下落不明D3DMatrixScaling函数

下落不明- -

1

主题

30

帖子

34

积分

注册会员

Rank: 2

积分
34
发表于 2008-3-7 00:04:00 | 显示全部楼层

Re:哪位高人指点一下落不明D3DMatrixScaling函数

D3DXMatrixScaling
Builds a matrix that scales along the x-axis, the y-axis, and the z-axis.


D3DXMATRIX * D3DXMatrixScaling(
  D3DXMATRIX * pOut,
  FLOAT sx,
  FLOAT sy,
  FLOAT sz
);
Parameters
pOut
[in, out] Pointer to the D3DXMATRIX structure that is the result of the operation.
sx
[in] Scaling factor that is applied along the x-axis.
sy
[in] Scaling factor that is applied along the y-axis.
sz
[in] Scaling factor that is applied along the z-axis.
Return Values
Pointer to the scaling transformation D3DXMATRIX.

Remarks
The return value for this function is the same value returned in the pOut parameter. In this way, the D3DXMatrixScaling function can be used as a parameter for another function.

Requirements
Header: Declared in D3dx9math.h.


从msdn中可以看出,可能是矩阵本身经过缩放操作得到的……

30

主题

63

帖子

63

积分

注册会员

Rank: 2

积分
63
 楼主| 发表于 2008-3-7 16:29:00 | 显示全部楼层

Re: Re:哪位高人指点一下落不明D3DMatrixScaling函数

earlyfly: Re:哪位高人指点一下落不明D3DMatrixScaling函数

D3DXMatrixScaling
Builds a matrix that scales along the x-axis, the y-axis, and the z-axis.


D3...

呵呵,可是我书上有一个程序又像是一个单位矩阵经过一系列的变化得到的,具体代码如下:
一个物体在Z轴方向上放大5倍,然后又绕Y轴旋转60度,最后沿X轴平移30个单位,其实现代码如下:
D3DXMATRIX matWorld;
DEDXMATRIX matTranlate,matRotation,matScale;
DEDXMatrixScaling(&matScale,1.0f,1.0f,5.0f);  //在Z轴方向上放大5倍
FLOAT fAngle=60*(2.0f*D3DX_PI)/360.0f;
D3DXMatrixRotationY(&matRotation,fAngle);    //绕Y轴旋转60度
D3DXMatrixMultiply(&matWorld,&matScale,&matRotation);  //先放大,后旋转的复合
D3DXMatrixTranslation(&matTranlate,30.0f,0.0f,0.0f);  //沿X轴平移30个单位
D3DXMatrixMultiply(&matWorld,&matWold,&matTanlate);//最后结果
g_pd3dDevice->SetTransform(D3DTS_WORLD,&matWorld);
照这个例子看的话,那矩阵又好像是单位矩阵经过变换而来的呀

1

主题

30

帖子

34

积分

注册会员

Rank: 2

积分
34
发表于 2008-3-7 18:22:00 | 显示全部楼层

Re:哪位高人指点一下落不明D3DMatrixScaling函数

我也不明白,本人并没有这方面编程经验。期待高手的分析……
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2025-12-20 09:34

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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