金鲨银鲨(无错版)【源码】

[复制链接]

该用户从未签到

2380

主题

2433

帖子

9139

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
9139
QQ
跳转到指定楼层
楼主
发表于 2017-6-13 11:18:05 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

想要查看内容赶紧注册登陆吧!

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
#include "StdAfx.h"
#include ".\d3dtextureindex.h"

CD3DTextureIndex::CD3DTextureIndex(void)
{
    m_nWidthNumber = 0;
    m_nHeightNumber = 0;
}

CD3DTextureIndex::~CD3DTextureIndex(void)
{

}

//加载判断
bool CD3DTextureIndex::IsNull()
{
    return CD3DTexture::IsNull();
}

//加载纹理
bool CD3DTextureIndex:oadImage( CD3DDevice * pD3DDevice, HINSTANCE hInstance, LPCTSTR pszResource, DWORD dwColorKey, int nWidthNumber, int nHeightNumber )
{
    //条件判断
    ASSERT(nWidthNumber > 0 && nHeightNumber>0);

    //设置变量
    m_nWidthNumber = nWidthNumber;
    m_nHeightNumber = nHeightNumber;

    //载入图片
    return CD3DTexture:oadImage( pD3DDevice, hInstance, pszResource, dwColorKey );
}

//加载纹理
bool CD3DTextureIndex:oadImage( CD3DDevice * pD3DDevice, HINSTANCE hInstance, LPCTSTR pszResource, LPCTSTR pszTypeName, int nWidthNumber, int nHeightNumber )
{
    //条件判断
    ASSERT(nWidthNumber > 0 && nHeightNumber>0);

    //设置变量
    m_nWidthNumber = nWidthNumber;
    m_nHeightNumber = nHeightNumber;

    //载入图片
    return CD3DTexture:oadImage( pD3DDevice, hInstance, pszResource, pszTypeName );
}

////加载纹理
//bool CD3DTextureIndex:oadImage( CD3DDevice * pD3DDevice, LPCTSTR pszTextureName, BOOL bCreateCache, int nWidthNumber, int nHeightNumber )
//{
//    //条件判断
//    ASSERT(nWidthNumber > 0 && nHeightNumber>0);
//
//    //设置变量
//    m_nWidthNumber = nWidthNumber;
//    m_nHeightNumber = nHeightNumber;
//
//    //载入图片
//    return CD3DTexture:oadImage( pD3DDevice, pszTextureName, bCreateCache );
//}

//绘画图片
bool CD3DTextureIndex:rawImage( CD3DDevice * pD3DDevice, int nXDest, int nYDest, int nIndex )
{
    //超过索引 画全图
    if ( nIndex >= m_nWidthNumber * m_nHeightNumber )
        return CD3DTexture:rawImage( pD3DDevice, nXDest, nYDest );

    //设置变量
    int nXSource = (nIndex%m_nWidthNumber) * GetWidth();
    int nYSource = (nIndex/m_nWidthNumber) * GetHeight();
    int nSourceWidth = GetWidth();
    int nSourceHeight = GetHeight();

    //画图
    return CD3DTexture:rawImage( pD3DDevice, nXDest, nYDest, nSourceWidth, nSourceHeight, nXSource, nYSource );
}

//绘画图片
bool CD3DTextureIndex:rawImage(CD3DDevice * pD3DDevice, int nXDest, int nYDest, int nDestWidth, int nDestHeight, int nIndex)
{
    //超过索引 画全图
    if ( nIndex >= m_nWidthNumber * m_nHeightNumber )
        return CD3DTexture:rawImage( pD3DDevice, nXDest, nYDest );

    //设置变量
    int nXSource = (nIndex%m_nWidthNumber) * GetWidth();
    int nYSource = (nIndex/m_nWidthNumber) * GetHeight();
    int nSourceWidth = GetWidth();
    int nSourceHeight = GetHeight();

    //画图
    return CD3DTexture:rawImage( pD3DDevice, nXDest, nYDest, nDestWidth, nDestHeight, nXSource, nYSource, nSourceWidth, nSourceHeight );
}

//绘画图片
bool CD3DTextureIndex:rawImage( CD3DDevice * pD3DDevice, int nXDest, int nYDest, int nDestWidth, int nDestHeight, int nXSource, int nYSource, int nSourceWidth, int nSourceHeight )
{
    //画图
    return CD3DTexture:rawImage( pD3DDevice, nXDest, nYDest, nDestWidth, nDestHeight, nXSource, nYSource, nSourceWidth, nSourceHeight );
}

//绘画图片
bool CD3DTextureIndex:rawImage( CD3DDevice * pD3DDevice, int nXDest, int nYDest, BYTE cbAlpha, int nIndex )
{
    //超过索引 画全图
    if ( nIndex >= m_nWidthNumber * m_nHeightNumber )
        return CD3DTexture:rawImage( pD3DDevice, nXDest, nYDest, cbAlpha );

    //设置变量
    int nXSource = (nIndex%m_nWidthNumber) * GetWidth();
    int nYSource = (nIndex/m_nWidthNumber) * GetHeight();
    int nSourceWidth = GetWidth();
    int nSourceHeight = GetHeight();

    //画图
    return CD3DTexture::DrawImage( pD3DDevice, nXDest, nYDest, nSourceWidth, nSourceHeight, nXSource, nYSource, cbAlpha );
}

//绘画图片
bool CD3DTextureIndex::DrawImage(CD3DDevice * pD3DDevice, int nXDest, int nYDest, int nDestWidth, int nDestHeight, BYTE cbAlpha, int nIndex)
{
    //超过索引 画全图
    if ( nIndex >= m_nWidthNumber * m_nHeightNumber )
        return CD3DTexture::DrawImage( pD3DDevice, nXDest, nYDest, cbAlpha );

    //设置变量
    int nXSource = (nIndex%m_nWidthNumber) * GetWidth();
    int nYSource = (nIndex/m_nWidthNumber) * GetHeight();
    int nSourceWidth = GetWidth();
    int nSourceHeight = GetHeight();

    //画图
    return CD3DTexture::DrawImage( pD3DDevice, nXDest, nYDest, nDestWidth, nDestHeight, nXSource, nYSource, nSourceWidth, nSourceHeight, cbAlpha );
}

//绘画图片
bool CD3DTextureIndex::DrawImage( CD3DDevice * pD3DDevice, int nXDest, int nYDest, int nDestWidth, int nDestHeight, int nXSource, int nYSource, int nSourceWidth, int nSourceHeight, BYTE cbAlpha )
{
    //画图
    return CD3DTexture::DrawImage( pD3DDevice, nXDest, nYDest, nDestWidth, nDestHeight, nXSource, nYSource, nSourceWidth, nSourceHeight, cbAlpha );
}

//绘画图片
bool CD3DTextureIndex::DrawImage( CD3DDevice * pD3DDevice, CPoint ptRotationOffset, FLOAT fRadian, CHAR chDirection, int nXDest, int nYDest, int nIndex )
{
    //超过索引 画全图
    if ( nIndex >= m_nWidthNumber * m_nHeightNumber )
        return CD3DTexture::DrawImage( pD3DDevice, ptRotationOffset, fRadian, chDirection, nXDest, nYDest );

    //设置变量
    int nXSource = (nIndex%m_nWidthNumber) * GetWidth();
    int nYSource = (nIndex/m_nWidthNumber) * GetHeight();
    int nSourceWidth = GetWidth();
    int nSourceHeight = GetHeight();

    //画图
    return CD3DTexture::DrawImage( pD3DDevice, ptRotationOffset, fRadian, chDirection, nXDest, nYDest, nSourceWidth, nSourceHeight, nXSource, nYSource );
}

//绘画图片
bool CD3DTextureIndex::DrawImage(CD3DDevice * pD3DDevice, CPoint ptRotationOffset, FLOAT fRadian, CHAR chDirection, int nXDest, int nYDest, int nDestWidth, int nDestHeight, int nIndex)
{
    //超过索引 画全图
    if ( nIndex >= m_nWidthNumber * m_nHeightNumber )
        return CD3DTexture::DrawImage( pD3DDevice, ptRotationOffset, fRadian, chDirection, nXDest, nYDest );

    //设置变量
    int nXSource = (nIndex%m_nWidthNumber) * GetWidth();
    int nYSource = (nIndex/m_nWidthNumber) * GetHeight();
    int nSourceWidth = GetWidth();
    int nSourceHeight = GetHeight();

    //画图
    return CD3DTexture::DrawImage( pD3DDevice, ptRotationOffset, fRadian, chDirection, nXDest, nYDest, nDestWidth, nDestHeight, nXSource, nYSource, nSourceWidth, nSourceHeight );
}

//绘画图片
bool CD3DTextureIndex::DrawImage( CD3DDevice * pD3DDevice, CPoint ptRotationOffset, FLOAT fRadian, CHAR chDirection, int nXDest, int nYDest, int nDestWidth, int nDestHeight, int nXSource, int nYSource, int nSourceWidth, int nSourceHeight )
{
    //画图
    return CD3DTexture::DrawImage( pD3DDevice, ptRotationOffset, fRadian, chDirection, nXDest, nYDest, nDestWidth, nDestHeight, nXSource, nYSource, nSourceWidth, nSourceHeight );
}

//绘画图片
bool CD3DTextureIndex::DrawImage( CD3DDevice * pD3DDevice, CPoint ptRotationOffset, FLOAT fRadian, CHAR chDirection, int nXDest, int nYDest, BYTE cbAlpha, int nIndex )
{
    //超过索引 画全图
    if ( nIndex >= m_nWidthNumber * m_nHeightNumber )
        return CD3DTexture::DrawImage( pD3DDevice, ptRotationOffset, fRadian, chDirection, nXDest, nYDest, cbAlpha );

    //设置变量
    int nXSource = (nIndex%m_nWidthNumber) * GetWidth();
    int nYSource = (nIndex/m_nWidthNumber) * GetHeight();
    int nSourceWidth = GetWidth();
    int nSourceHeight = GetHeight();

    //画图
    return CD3DTexture::DrawImage( pD3DDevice, ptRotationOffset, fRadian, chDirection, nXDest, nYDest, nSourceWidth, nSourceHeight, nXSource, nYSource, cbAlpha );

}

//绘画图片
bool CD3DTextureIndex::DrawImage(CD3DDevice * pD3DDevice, CPoint ptRotationOffset, FLOAT fRadian, CHAR chDirection, int nXDest, int nYDest, int nDestWidth, int nDestHeight, BYTE cbAlpha, int nIndex)
{
    //超过索引 画全图
    if ( nIndex >= m_nWidthNumber * m_nHeightNumber )
        return CD3DTexture::DrawImage( pD3DDevice, ptRotationOffset, fRadian, chDirection, nXDest, nYDest, cbAlpha );

    //设置变量
    int nXSource = (nIndex%m_nWidthNumber) * GetWidth();
    int nYSource = (nIndex/m_nWidthNumber) * GetHeight();
    int nSourceWidth = GetWidth();
    int nSourceHeight = GetHeight();

    //画图
    return CD3DTexture::DrawImage( pD3DDevice, ptRotationOffset, fRadian, chDirection, nXDest, nYDest, nDestWidth, nDestHeight, nXSource, nYSource, nSourceWidth, nSourceHeight, cbAlpha );

}

//绘画图片
bool CD3DTextureIndex::DrawImage( CD3DDevice * pD3DDevice, CPoint ptRotationOffset, FLOAT fRadian, CHAR chDirection, int nXDest, int nYDest, int nDestWidth, int nDestHeight, int nXSource, int nYSource, int nSourceWidth, int nSourceHeight, BYTE cbAlpha )
{
    //画图
    return CD3DTexture::DrawImage( pD3DDevice, ptRotationOffset, fRadian, chDirection, nXDest, nYDest, nDestWidth, nDestHeight, nXSource, nYSource, nSourceWidth, nSourceHeight, cbAlpha );
}

//-------------------------------------------------------------------------------------
//滤色函数
//
//绘画滤色图片
bool CD3DTextureIndex::DrawColourFilterImage( CD3DDevice * pD3DDevice, int nXDest, int nYDest, int nIndex )
{
    //超过索引 画全图
    if ( nIndex >= m_nWidthNumber * m_nHeightNumber )
        return CD3DTexture::DrawImage( pD3DDevice, nXDest, nYDest );

    //设置变量
    int nXSource = (nIndex%m_nWidthNumber) * GetWidth();
    int nYSource = (nIndex/m_nWidthNumber) * GetHeight();
    int nSourceWidth = GetWidth();
    int nSourceHeight = GetHeight();

    //画图
    return CD3DTexture::DrawImage( pD3DDevice, nXDest, nYDest, nSourceWidth, nSourceHeight, nXSource, nYSource );
}

//绘画滤色图片
bool CD3DTextureIndex::DrawColourFilterImage(CD3DDevice * pD3DDevice, int nXDest, int nYDest, int nDestWidth, int nDestHeight, int nIndex)
{
    //超过索引 画全图
    if ( nIndex >= m_nWidthNumber * m_nHeightNumber )
        return CD3DTexture::DrawImage( pD3DDevice, nXDest, nYDest );

    //设置变量
    int nXSource = (nIndex%m_nWidthNumber) * GetWidth();
    int nYSource = (nIndex/m_nWidthNumber) * GetHeight();
    int nSourceWidth = GetWidth();
    int nSourceHeight = GetHeight();

    //画图
    return CD3DTexture::DrawImage( pD3DDevice, nXDest, nYDest, nDestWidth, nDestHeight, nXSource, nYSource, nSourceWidth, nSourceHeight );
}

//绘画滤色图片
bool CD3DTextureIndex::DrawColourFilterImage( CD3DDevice * pD3DDevice, int nXDest, int nYDest, int nDestWidth, int nDestHeight, int nXSource, int nYSource, int nSourceWidth, int nSourceHeight )
{
    //画图
    return CD3DTexture::DrawImage( pD3DDevice, nXDest, nYDest, nDestWidth, nDestHeight, nXSource, nYSource, nSourceWidth, nSourceHeight );
}

//绘画滤色图片
bool CD3DTextureIndex::DrawColourFilterImage( CD3DDevice * pD3DDevice, int nXDest, int nYDest, BYTE cbAlpha, int nIndex )
{
    //超过索引 画全图
    if ( nIndex >= m_nWidthNumber * m_nHeightNumber )
        return CD3DTexture::DrawImage( pD3DDevice, nXDest, nYDest, cbAlpha );

    //设置变量
    int nXSource = (nIndex%m_nWidthNumber) * GetWidth();
    int nYSource = (nIndex/m_nWidthNumber) * GetHeight();
    int nSourceWidth = GetWidth();
    int nSourceHeight = GetHeight();

    //画图
    return CD3DTexture::DrawImage( pD3DDevice, nXDest, nYDest, nSourceWidth, nSourceHeight, nXSource, nYSource, cbAlpha );
}

//绘画滤色图片
bool CD3DTextureIndex::DrawColourFilterImage(CD3DDevice * pD3DDevice, int nXDest, int nYDest, int nDestWidth, int nDestHeight, BYTE cbAlpha, int nIndex)
{
    //超过索引 画全图
    if ( nIndex >= m_nWidthNumber * m_nHeightNumber )
        return CD3DTexture::DrawImage( pD3DDevice, nXDest, nYDest, cbAlpha );

    //设置变量
    int nXSource = (nIndex%m_nWidthNumber) * GetWidth();
    int nYSource = (nIndex/m_nWidthNumber) * GetHeight();
    int nSourceWidth = GetWidth();
    int nSourceHeight = GetHeight();

    //画图
    return CD3DTexture::DrawImage( pD3DDevice, nXDest, nYDest, nDestWidth, nDestHeight, nXSource, nYSource, nSourceWidth, nSourceHeight, cbAlpha );

}

//绘画滤色图片
bool CD3DTextureIndex::DrawColourFilterImage( CD3DDevice * pD3DDevice, int nXDest, int nYDest, int nDestWidth, int nDestHeight, int nXSource, int nYSource, int nSourceWidth, int nSourceHeight, BYTE cbAlpha )
{
    //画图
    return CD3DTexture::DrawImage( pD3DDevice, nXDest, nYDest, nDestWidth, nDestHeight, nXSource, nYSource, nSourceWidth, nSourceHeight, cbAlpha );
}

//绘画滤色图片
bool CD3DTextureIndex::DrawColourFilterImage( CD3DDevice * pD3DDevice, CPoint ptRotationOffset, FLOAT fRadian, CHAR chDirection, int nXDest, int nYDest, int nIndex )
{
    //超过索引 画全图
    if ( nIndex >= m_nWidthNumber * m_nHeightNumber )
        return CD3DTexture::DrawImage( pD3DDevice, ptRotationOffset, fRadian, chDirection, nXDest, nYDest );

    //设置变量
    int nXSource = (nIndex%m_nWidthNumber) * GetWidth();
    int nYSource = (nIndex/m_nWidthNumber) * GetHeight();
    int nSourceWidth = GetWidth();
    int nSourceHeight = GetHeight();

    //画图
    return CD3DTexture::DrawImage( pD3DDevice, ptRotationOffset, fRadian, chDirection, nXDest, nYDest, nSourceWidth, nSourceHeight, nXSource, nYSource );

}

//绘画滤色图片
bool CD3DTextureIndex::DrawColourFilterImage(CD3DDevice * pD3DDevice, CPoint ptRotationOffset, FLOAT fRadian, CHAR chDirection, int nXDest, int nYDest, int nDestWidth, int nDestHeight, int nIndex)
{
    //超过索引 画全图
    if ( nIndex >= m_nWidthNumber * m_nHeightNumber )
        return CD3DTexture::DrawImage( pD3DDevice, ptRotationOffset, fRadian, chDirection, nXDest, nYDest );

    //设置变量
    int nXSource = (nIndex%m_nWidthNumber) * GetWidth();
    int nYSource = (nIndex/m_nWidthNumber) * GetHeight();
    int nSourceWidth = GetWidth();
    int nSourceHeight = GetHeight();

    //画图
    return CD3DTexture::DrawImage( pD3DDevice, ptRotationOffset, fRadian, chDirection, nXDest, nYDest, nDestWidth, nDestHeight, nXSource, nYSource, nSourceWidth, nSourceHeight );

}


//绘画滤色图片
bool CD3DTextureIndex::DrawColourFilterImage( CD3DDevice * pD3DDevice, CPoint ptRotationOffset, FLOAT fRadian, CHAR chDirection, int nXDest, int nYDest, int nDestWidth, int nDestHeight, int nXSource, int nYSource, int nSourceWidth, int nSourceHeight )
{
    //画图
    return CD3DTexture::DrawImage( pD3DDevice, ptRotationOffset, fRadian, chDirection, nXDest, nYDest, nDestWidth, nDestHeight, nXSource, nYSource, nSourceWidth, nSourceHeight );
}

//绘画滤色图片
bool CD3DTextureIndex::DrawColourFilterImage( CD3DDevice * pD3DDevice, CPoint ptRotationOffset, FLOAT fRadian, CHAR chDirection, int nXDest, int nYDest, BYTE cbAlpha, int nIndex )
{
    //超过索引 画全图
    if ( nIndex >= m_nWidthNumber * m_nHeightNumber )
        return CD3DTexture::DrawImage( pD3DDevice, ptRotationOffset, fRadian, chDirection, nXDest, nYDest, cbAlpha );

    //设置变量
    int nXSource = (nIndex%m_nWidthNumber) * GetWidth();
    int nYSource = (nIndex/m_nWidthNumber) * GetHeight();
    int nSourceWidth = GetWidth();
    int nSourceHeight = GetHeight();

    //画图
    return CD3DTexture::DrawImage( pD3DDevice, ptRotationOffset, fRadian, chDirection, nXDest, nYDest, nSourceWidth, nSourceHeight, nXSource, nYSource, cbAlpha );

}

//绘画滤色图片
bool CD3DTextureIndex::DrawColourFilterImage(CD3DDevice * pD3DDevice, CPoint ptRotationOffset, FLOAT fRadian, CHAR chDirection, int nXDest, int nYDest, int nDestWidth, int nDestHeight, BYTE cbAlpha, int nIndex)
{
    //超过索引 画全图
    if ( nIndex >= m_nWidthNumber * m_nHeightNumber )
        return CD3DTexture::DrawImage( pD3DDevice, ptRotationOffset, fRadian, chDirection, nXDest, nYDest, cbAlpha );

    //设置变量
    int nXSource = (nIndex%m_nWidthNumber) * GetWidth();
    int nYSource = (nIndex/m_nWidthNumber) * GetHeight();
    int nSourceWidth = GetWidth();
    int nSourceHeight = GetHeight();

    //画图
    return CD3DTexture::DrawImage( pD3DDevice, ptRotationOffset, fRadian, chDirection, nXDest, nYDest, nDestWidth, nDestHeight, nXSource, nYSource, nSourceWidth, nSourceHeight, cbAlpha );

}

//绘画滤色图片
bool CD3DTextureIndex::DrawColourFilterImage( CD3DDevice * pD3DDevice, CPoint ptRotationOffset, FLOAT fRadian, CHAR chDirection, int nXDest, int nYDest, int nDestWidth, int nDestHeight, int nXSource, int nYSource, int nSourceWidth, int nSourceHeight, BYTE cbAlpha )
{
    //画图
    return CD3DTexture::DrawImage( pD3DDevice, ptRotationOffset, fRadian, chDirection, nXDest, nYDest, nDestWidth, nDestHeight, nXSource, nYSource, nSourceWidth, nSourceHeight, cbAlpha );
}

分享到:  QQ好友和群QQ好友和群
收藏收藏
回复

使用道具 举报

快速回复高级模式
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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