高级纹理映射技术(6)

2023-11-03

高级纹理映射技术(6)

对一些特殊的应用需要对纹理坐标进行处理,主要包括纹理坐标自动生成和纹理坐标变换。下图显示了纹理坐标的来源、处理过程以及到达光栅处理器的过程。

 

纹理坐标自动生成

在Direct3D程序中,不仅可以在模型载入阶段或渲染阶段指定物体的纹理坐标,还可以通过Direct3D渲染引擎自动生成纹理坐标,用于诸如环境映射等特殊的视觉效果。与手动设置纹理坐标相比,纹理坐标自动生成在Direct3D坐标 变换和光照流水线中完成,执行速度更快。

Direct3D系统可以使用经过变换的摄像机空间顶点位置坐标、法线信息来生成纹理坐标。如果使用纹理坐标自动生成,那么在顶点中就可以不用包含纹理坐标数据,从而可以降低图形渲染时的数据传输量。纹理坐标自动生成主要用于产生一些特殊效果,在大多数情况下还是手工为每个顶点指定纹理坐标。

通过调用SetTextureStageState()并将第二个参数设置为D3DTSS_TEXCOORDINDEX来控制Direct3D系统如何自动生成纹理坐标。

D3DTSS_TEXCOORDINDEX
Index of the texture coordinate set to use with this texture stage. You can specify up to eight sets of texture coordinates per vertex. If a vertex does not include a set of texture coordinates at the specified index, the system defaults to the u and v coordinates (0,0).

When rendering using vertex shaders, each stage's texture coordinate index must be set to its default value. The default index for each stage is equal to the stage index. Set this state to the zero-based index of the coordinate set for each vertex that this texture stage uses.

Additionally, applications can include, as logical OR with the index being set, one of the constants to request that Direct3D automatically generate the input texture coordinates for a texture transformation. For a list of all the constants, see D3DTSS_TCI.

With the exception of D3DTSS_TCI_PASSTHRU, which resolves to zero, if any of the following values is included with the index being set, the system uses the index strictly to determine texture wrapping mode. These flags are most useful when performing environment mapping.

其中第三个参数可以设为下列列表中的成员:

D3DTSS_TCI

Driver texture coordinate capability flags.

#define Value Description
D3DTSS_TCI_PASSTHRU 0x00000000L Use the specified texture coordinates contained within the vertex format. This value resolves to zero.
D3DTSS_TCI_CAMERASPACENORMAL 0x00010000L Use the vertex normal, transformed to camera space, as the input texture coordinates for this stage's texture transformation.
D3DTSS_TCI_CAMERASPACEPOSITION 0x00020000L Use the vertex position, transformed to camera space, as the input texture coordinates for this stage's texture transformation.
D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR 0x00030000L Use the reflection vector, transformed to camera space, as the input texture coordinate for this stage's texture transformation. The reflection vector is computed from the input vertex position and normal vector.
D3DTSS_TCI_SPHEREMAP 0x00040000L Use the specified texture coordinates for sphere mapping.

These constants are used by D3DTSS_TEXCOORDINDEX.

D3DTSS_TEXCOORDINDEX用于指定特定纹理层使用顶点中的第几组纹理坐标,但如果指定了上表中的成员值,Direct3D将忽略顶点中的纹理坐标,转而使用自动生成的纹理坐标。

D3DTSS_TEXTURETRANSFORMFLAGS用来控制生成的纹理坐标的输出,在大多数情况下纹理坐标是二维的,即将D3DTSS_TEXTURETRANSFORMFLAGS设置为D3DTTFF_COUNT2。但当绘制线段或三维纹理时,纹理坐标可能是一维或三维的。

D3DTSS_TEXTURETRANSFORMFLAGS
Member of the D3DTEXTURETRANSFORMFLAGS enumerated type that controls the transformation of texture coordinates for this texture stage. The default value is D3DTTFF_DISABLE.

输出的纹理坐标维数由枚举类型D3DTSS_TEXTURETRANSFORMFLAGS指定,其定义如下:

Defines texture coordinate transformation values.

typedef enum D3DTEXTURETRANSFORMFLAGS
{
    D3DTTFF_DISABLE = 0,
    D3DTTFF_COUNT1 = 1,
    D3DTTFF_COUNT2 = 2,
    D3DTTFF_COUNT3 = 3,
    D3DTTFF_COUNT4 = 4,
    D3DTTFF_PROJECTED = 256,
    D3DTTFF_FORCE_DWORD = 0x7fffffff,
} D3DTEXTURETRANSFORMFLAGS, *LPD3DTEXTURETRANSFORMFLAGS;

Constants

D3DTTFF_DISABLE
Texture coordinates are passed directly to the rasterizer.
D3DTTFF_COUNT1
The rasterizer should expect 1D texture coordinates. This value is used by fixed function vertex processing; it should be set to 0 when using a programmable vertex shader.
D3DTTFF_COUNT2
The rasterizer should expect 2D texture coordinates. This value is used by fixed function vertex processing; it should be set to 0 when using a programmable vertex shader.
D3DTTFF_COUNT3
The rasterizer should expect 3D texture coordinates. This value is used by fixed function vertex processing; it should be set to 0 when using a programmable vertex shader.
D3DTTFF_COUNT4
The rasterizer should expect 4D texture coordinates. This value is used by fixed function vertex processing; it should be set to 0 when using a programmable vertex shader.
D3DTTFF_PROJECTED
This flag is honored by the fixed function pixel pipeline, as well as the programmable pixel pipeline in versions ps_1_1 to ps_1_3. When texture projection is enabled for a texture stage, all four floating point values must be written to the corresponding texture register. Each texture coordinate is divided by the last element before being passed to the rasterizer. For example, if this flag is specified with the D3DTTFF_COUNT3 flag, the first and second texture coordinates are divided by the third coordinate before being passed to the rasterizer.
D3DTTFF_FORCE_DWORD
Forces this enumeration to compile to 32 bits in size. Without this value, some compilers would allow this enumeration to compile to a size other than 32 bits. This value is not used.

Remarks

Texture coordinates can be transformed using a 4 x 4 matrix before the results are passed to the rasterizer. The texture coordinate transforms are set by calling IDirect3DDevice9::SetTextureStageState, and by passing in the D3DTSS_TEXTURETRANSFORMFLAGS texture stage state and one of the values from D3DTEXTURETRANSFORMFLAGS. For more information about texture transforms, see Texture Coordinate Transformations (Direct3D 9).

首先,我们定义顶点结构和格式:

struct sCustomVertex
{
	float x, y, z;
};
#define D3DFVF_CUSTOM_VERTEX	D3DFVF_XYZ

接着生成顶点数据,顶点数据中没有包含纹理坐标:

// create vertex buffer and fill data
sCustomVertex vertices[] = 	
{
    { -1.0f, -1.0f,  0.0f},
    { -1.0f,  1.0f,  0.0f},
    {  1.0f, -1.0f,  0.0f},
    {  1.0f,  1.0f,  0.0f}
};
pd3dDevice->CreateVertexBuffer(sizeof(vertices), 0, D3DFVF_CUSTOM_VERTEX, D3DPOOL_MANAGED, &g_vertex_buffer, NULL);
void* ptr;
g_vertex_buffer->Lock(0, sizeof(vertices), (void**)&ptr, 0);
memcpy(ptr, vertices, sizeof(vertices));
g_vertex_buffer->Unlock();

然后让Direct3D自动生成纹理坐标:

// create texture coordinate using vertex position in camera space 
pd3dDevice->SetTextureStageState(0, D3DTSS_TEXCOORDINDEX, D3DTSS_TCI_CAMERASPACEPOSITION);
pd3dDevice->SetTextureStageState(0, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_COUNT2);

运行效果:

若设置D3DTSS_TEXCOORDINDEX为以下D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR,则效果为:

若设置D3DTSS_TEXCOORDINDEX为以下D3DTSS_TCI_SPHEREMAP,则效果为:

 

主程序:

#include  " dxstdafx.h "
#include 
" resource.h "

#pragma warning(disable : 
4127   4995   4996 )

#define  release_com(p)    do { if(p) { (p)->Release(); (p) = NULL; } } while(0)

#define  IDC_TOGGLE_FULLSCREEN        1
#define  IDC_TOGGLE_REF                2
#define  IDC_CHANGE_DEVICE            3

struct  sCustomVertex
{
    
float  x, y, z;
};

#define  D3DFVF_CUSTOM_VERTEX    D3DFVF_XYZ

const  D3DXCOLOR FONT_COLOR( 0.55f 0.85f 0.65f 1.0f );

CDXUTDialogResourceManager    g_dlg_resource_manager;
CD3DSettingsDlg                g_settings_dlg;
CDXUTDialog                    g_button_dlg;

IDirect3DVertexBuffer9
*         g_vertex_buffer;
IDirect3DTexture9
*             g_texture;

ID3DXFont
*         g_font;
ID3DXSprite
*     g_text_sprite;
bool             g_show_help;

// --------------------------------------------------------------------------------------
//  Rejects any devices that aren't acceptable by returning false
// --------------------------------------------------------------------------------------
bool  CALLBACK IsDeviceAcceptable( D3DCAPS9 *  pCaps, D3DFORMAT AdapterFormat, 
                                  D3DFORMAT BackBufferFormat, 
bool  bWindowed,  void *  pUserContext )
{
    
//  Typically want to skip backbuffer formats that don't support alpha blending

    IDirect3D9
*  pD3D  =  DXUTGetD3DObject(); 

    
if ( FAILED( pD3D -> CheckDeviceFormat( pCaps -> AdapterOrdinal, pCaps -> DeviceType, AdapterFormat, 
                    D3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING, D3DRTYPE_TEXTURE, BackBufferFormat ) ) )
        
return   false ;

    
return   true ;
}


// --------------------------------------------------------------------------------------
//  Before a device is created, modify the device settings as needed.
// --------------------------------------------------------------------------------------
bool  CALLBACK ModifyDeviceSettings( DXUTDeviceSettings *  pDeviceSettings,  const  D3DCAPS9 *  pCaps,  void *  pUserContext )
{
    
//  If video card does not support hardware vertex processing, then uses sofaware vertex processing.
     if ((pCaps -> DevCaps  &  D3DDEVCAPS_HWTRANSFORMANDLIGHT)  ==   0 )
        pDeviceSettings
-> BehaviorFlags  =  D3DCREATE_SOFTWARE_VERTEXPROCESSING;

    
static   bool  is_first_time  =   true ;

    
if (is_first_time)
    {
        is_first_time 
=   false ;

        
//  if using reference device, then pop a warning message box.
         if (pDeviceSettings -> DeviceType  ==  D3DDEVTYPE_REF)
            DXUTDisplaySwitchingToREFWarning();
    }

    
return   true ;
}


// --------------------------------------------------------------------------------------
//  Create any D3DPOOL_MANAGED resources here 
// --------------------------------------------------------------------------------------
HRESULT CALLBACK OnCreateDevice( IDirect3DDevice9 *  pd3dDevice, 
                                 
const  D3DSURFACE_DESC *  pBackBufferSurfaceDesc, 
                                 
void *  pUserContext )
{
    HRESULT    hr;

    V_RETURN(g_dlg_resource_manager.OnCreateDevice(pd3dDevice));
    V_RETURN(g_settings_dlg.OnCreateDevice(pd3dDevice));

    D3DXCreateFont(pd3dDevice, 
18 0 , FW_BOLD,  1 , FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY,
                   DEFAULT_PITCH 
|  FF_DONTCARE, L " Arial " & g_font);

    V_RETURN(D3DXCreateTextureFromFile(pd3dDevice, L
" texture.jpg " ,     & g_texture));
    
    
//  create vertex buffer and fill data

    sCustomVertex vertices[] 
=      
    {
        { 
- 1.0f - 1.0f ,   0.0f },
        { 
- 1.0f ,   1.0f ,   0.0f },
        {  
1.0f - 1.0f ,   0.0f },
        {  
1.0f ,   1.0f ,   0.0f }
    };

    pd3dDevice
-> CreateVertexBuffer( sizeof (vertices),  0 , D3DFVF_CUSTOM_VERTEX, D3DPOOL_MANAGED,  & g_vertex_buffer, NULL);

    
void *  ptr;
    g_vertex_buffer
-> Lock( 0 sizeof (vertices), ( void ** ) & ptr,  0 );
    memcpy(ptr, vertices, 
sizeof (vertices));
    g_vertex_buffer
-> Unlock();

    
return  S_OK;
}


// --------------------------------------------------------------------------------------
//  Create any D3DPOOL_DEFAULT resources here 
// --------------------------------------------------------------------------------------
HRESULT CALLBACK OnResetDevice( IDirect3DDevice9 *  pd3dDevice, 
                                
const  D3DSURFACE_DESC *  pBackBufferSurfaceDesc, 
                                
void *  pUserContext )
{
    HRESULT hr;

    V_RETURN(g_dlg_resource_manager.OnResetDevice());
    V_RETURN(g_settings_dlg.OnResetDevice());
    V_RETURN(g_font
-> OnResetDevice());
    V_RETURN(D3DXCreateSprite(pd3dDevice, 
& g_text_sprite));

    
//  set dialog position and size

    g_button_dlg.SetLocation(pBackBufferSurfaceDesc
-> Width  -   170 0 );
    g_button_dlg.SetSize(
170 170 );

    
//  setup world matrix
    D3DXMATRIX mat_world;
    D3DXMatrixIdentity(
& mat_world);
    pd3dDevice
-> SetTransform(D3DTS_WORLD,  & mat_world);

    
//  setup view matrix

    D3DXMATRIX mat_view;
    D3DXVECTOR3 eye(
0.0f 0.0f - 3.0f );
    D3DXVECTOR3  at(
0.0f 0.0f ,   0.0f );
    D3DXVECTOR3  up(
0.0f 1.0f ,   0.0f );

    D3DXMatrixLookAtLH(
& mat_view,  & eye,  & at,  & up);
    pd3dDevice
-> SetTransform(D3DTS_VIEW,  & mat_view);

    
//  set projection matrix
    D3DXMATRIX mat_proj;
    
float  aspect  =  ( float )pBackBufferSurfaceDesc -> Width  /  pBackBufferSurfaceDesc -> Height;
    D3DXMatrixPerspectiveFovLH(
& mat_proj, D3DX_PI / 4 , aspect,  1.0f 100.0f );
    pd3dDevice
-> SetTransform(D3DTS_PROJECTION,  & mat_proj);

    pd3dDevice
-> SetRenderState(D3DRS_LIGHTING, FALSE);

    
//  set texture color blend method, disalbe alpha blend.

    pd3dDevice
-> SetTexture( 0 , g_texture);    
    pd3dDevice
-> SetTextureStageState( 0 , D3DTSS_COLORARG1,        D3DTA_TEXTURE);    
    pd3dDevice
-> SetTextureStageState( 0 , D3DTSS_COLOROP,            D3DTOP_SELECTARG1);    
    pd3dDevice
-> SetTextureStageState( 0 , D3DTSS_ALPHAOP,            D3DTOP_DISABLE);

    
//  create texture coordinate using vertex position in camera space 
    pd3dDevice -> SetTextureStageState( 0 , D3DTSS_TEXCOORDINDEX,            D3DTSS_TCI_CAMERASPACEPOSITION);
    
// pd3dDevice->SetTextureStageState(0, D3DTSS_TEXCOORDINDEX,            D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR);
    
// pd3dDevice->SetTextureStageState(0, D3DTSS_TEXCOORDINDEX,            D3DTSS_TCI_SPHEREMAP);    
    pd3dDevice -> SetTextureStageState( 0 , D3DTSS_TEXTURETRANSFORMFLAGS,    D3DTTFF_COUNT2);

    
return  S_OK;
}

// --------------------------------------------------------------------------------------
//  Release resources created in the OnResetDevice callback here 
// --------------------------------------------------------------------------------------
void  CALLBACK OnLostDevice(  void *  pUserContext )
{
    g_dlg_resource_manager.OnLostDevice();
    g_settings_dlg.OnLostDevice();
    g_font
-> OnLostDevice();

    release_com(g_text_sprite);
}


// --------------------------------------------------------------------------------------
//  Release resources created in the OnCreateDevice callback here
// --------------------------------------------------------------------------------------
void  CALLBACK OnDestroyDevice(  void *  pUserContext )
{
    g_dlg_resource_manager.OnDestroyDevice();
    g_settings_dlg.OnDestroyDevice();    

    release_com(g_font);
    release_com(g_vertex_buffer);
    release_com(g_texture);
}

// --------------------------------------------------------------------------------------
//  Handle updates to the scene
// --------------------------------------------------------------------------------------
void  CALLBACK OnFrameMove( IDirect3DDevice9 *  pd3dDevice,  double  fTime,  float  fElapsedTime,  void *  pUserContext )
{
}

// --------------------------------------------------------------------------------------
//  Render the helper information
// --------------------------------------------------------------------------------------
void  RenderText()
{
    CDXUTTextHelper text_helper(g_font, g_text_sprite, 
20 );
    
    text_helper.Begin();

    
//  show frame and device states
    text_helper.SetInsertionPos( 5 5 );
    text_helper.SetForegroundColor(FONT_COLOR);
    text_helper.DrawTextLine( DXUTGetFrameStats(
true ) );
    text_helper.DrawTextLine( DXUTGetDeviceStats() );

    
//  show other simple information
    text_helper.SetForegroundColor( D3DXCOLOR( 1.0f 1.0f 1.0f 1.0f ) );
    text_helper.DrawTextLine(L
" Texture Coordinate Automatic Generate " );

    
//  show helper information
    
    
const  D3DSURFACE_DESC *  surface_desc  =  DXUTGetBackBufferSurfaceDesc();

    
if (g_show_help)
    {
        text_helper.SetInsertionPos(
10 , surface_desc -> Height  -   18   *   5 );
        text_helper.SetForegroundColor(FONT_COLOR);
        text_helper.DrawTextLine(L
" Controls (F1 to hide): " );
        
        text_helper.SetInsertionPos(
40 , surface_desc -> Height  -   18   *   4 );
        text_helper.DrawTextLine(L
" Quit: ESC " );
    }
    
else
    {
        text_helper.SetInsertionPos(
10 , surface_desc -> Height  -   15   *   4 );
        text_helper.SetForegroundColor( D3DXCOLOR(
1.0f 1.0f 1.0f 1.0f ) );
        text_helper.DrawTextLine(L
" Press F1 for help " );
    }

    text_helper.End();
}

// --------------------------------------------------------------------------------------
//  Render the scene 
// --------------------------------------------------------------------------------------
void  CALLBACK OnFrameRender( IDirect3DDevice9 *  pd3dDevice,  double  fTime,  float  fElapsedTime,  void *  pUserContext )
{
    HRESULT hr;

    
if (g_settings_dlg.IsActive())
    {
        g_settings_dlg.OnRender(fElapsedTime);
        
return ;
    }

    
//  Clear the render target and the zbuffer 
    V( pd3dDevice -> Clear( 0 , NULL, D3DCLEAR_TARGET  |  D3DCLEAR_ZBUFFER, D3DCOLOR_ARGB( 0 0 0 0 ),  1.0f 0 ) );

    
//  Render the scene
     if ( SUCCEEDED( pd3dDevice -> BeginScene() ) )
    {
        pd3dDevice
-> SetStreamSource( 0 , g_vertex_buffer,  0 sizeof (sCustomVertex));
        pd3dDevice
-> SetFVF(D3DFVF_CUSTOM_VERTEX);
        pd3dDevice
-> DrawPrimitive(D3DPT_TRIANGLESTRIP,  0 2 );

        RenderText();

        V(g_button_dlg.OnRender(fElapsedTime));

        V( pd3dDevice
-> EndScene() );
    }
}


// --------------------------------------------------------------------------------------
//  Handle messages to the application 
// --------------------------------------------------------------------------------------
LRESULT CALLBACK MsgProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, 
                          
bool *  pbNoFurtherProcessing,  void *  pUserContext )
{
    
* pbNoFurtherProcessing  =  g_dlg_resource_manager.MsgProc(hWnd, uMsg, wParam, lParam);
    
if ( * pbNoFurtherProcessing)
        
return   0 ;

    
if (g_settings_dlg.IsActive())
    {
        g_settings_dlg.MsgProc(hWnd, uMsg, wParam, lParam);
        
return   0 ;
    }

    
* pbNoFurtherProcessing  =  g_button_dlg.MsgProc(hWnd, uMsg, wParam, lParam);
    
if ( * pbNoFurtherProcessing)
        
return   0 ;

    
return   0 ;
}


// --------------------------------------------------------------------------------------
//  Handle keybaord event
// --------------------------------------------------------------------------------------
void  CALLBACK OnKeyboardProc(UINT charater,  bool  is_key_down,  bool  is_alt_down,  void *  user_context)
{
    
if (is_key_down)
    {
        
switch (charater)
        {
        
case  VK_F1:
            g_show_help 
=   ! g_show_help;
            
break ;
        }
    }
}

// --------------------------------------------------------------------------------------
//  Handle events for controls
// --------------------------------------------------------------------------------------
void  CALLBACK OnGUIEvent(UINT  event int  control_id, CDXUTControl *  control,  void *  user_context)
{
    
switch (control_id)
    {
    
case  IDC_TOGGLE_FULLSCREEN:
        DXUTToggleFullScreen();
        
break ;

    
case  IDC_TOGGLE_REF:
        DXUTToggleREF();
        
break ;

    
case  IDC_CHANGE_DEVICE:
        g_settings_dlg.SetActive(
true );
        
break ;
    }
}

// --------------------------------------------------------------------------------------
//  Initialize dialogs
// --------------------------------------------------------------------------------------
void  InitDialogs()
{
    g_settings_dlg.Init(
& g_dlg_resource_manager);
    g_button_dlg.Init(
& g_dlg_resource_manager);

    g_button_dlg.SetCallback(OnGUIEvent);

    
int  x  =   35 , y  =   10 , width  =   125 , height  =   22 ;

    g_button_dlg.AddButton(IDC_TOGGLE_FULLSCREEN, L
" Toggle full screen " , x, y,         width, height);
    g_button_dlg.AddButton(IDC_TOGGLE_REF,          L
" Toggle REF (F3) " ,     x, y  +=   24 , width, height);
    g_button_dlg.AddButton(IDC_CHANGE_DEVICE,      L
" Change device (F2) " , x, y  +=   24 , width, height, VK_F2);    
}

// --------------------------------------------------------------------------------------
//  Initialize everything and go into a render loop
// --------------------------------------------------------------------------------------
INT WINAPI WinMain( HINSTANCE, HINSTANCE, LPSTR,  int  )
{
    
//  Enable run-time memory check for debug builds.
#if  defined(DEBUG) | defined(_DEBUG)
    _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF 
|  _CRTDBG_LEAK_CHECK_DF );
#endif

    
//  Set the callback functions
    DXUTSetCallbackDeviceCreated( OnCreateDevice );
    DXUTSetCallbackDeviceReset( OnResetDevice );
    DXUTSetCallbackDeviceLost( OnLostDevice );
    DXUTSetCallbackDeviceDestroyed( OnDestroyDevice );
    DXUTSetCallbackMsgProc( MsgProc );
    DXUTSetCallbackFrameRender( OnFrameRender );
    DXUTSetCallbackFrameMove( OnFrameMove );
    DXUTSetCallbackKeyboard(OnKeyboardProc);
   
    
//  TODO: Perform any application-level initialization here
    InitDialogs();

    
//  Initialize DXUT and create the desired Win32 window and Direct3D device for the application
    DXUTInit(  true true true  );  //  Parse the command line, handle the default hotkeys, and show msgboxes
    DXUTSetCursorSettings(  true true  );  //  Show the cursor and clip it when in full screen
    DXUTCreateWindow( L " Texture Color And Alpha Blend "  );
    DXUTCreateDevice( D3DADAPTER_DEFAULT, 
true 640 480 , IsDeviceAcceptable, ModifyDeviceSettings );

    
//  Start the render loop
    DXUTMainLoop();

    
//  TODO: Perform any application-level cleanup here

    
return  DXUTGetExitCode();
}

 

下载示例工程

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

高级纹理映射技术(6) 的相关文章

  • D3D纹理

    纹理映射是一种将图形施加到表面的技术 以简单的一堵墙为例 这种技术可以只需要两个绘制有砖纹理的三角形即可 这样就可以为表面增加大量的细节 而不必使用大量的多边形 纹理映射使用了图像数据并将图像数据绘制 映射 到表面上 该表面看上去就像有一幅
  • 码农干货系列【1】--方向包围盒(OBB)碰撞检测

    码农干货系列 1 方向包围盒 OBB 碰撞检测 2012 06 07 11 40 by 当耐特 9251 阅读 20 评论 收藏 编辑 干货 最近一直在删文章 不是要关博洗手什么的 而是被删的文章没有达到 干货 的标准 干货的反义词是水货
  • 使用CopperCube(IrrEdit)创建Irrlicht场景

    使用CopperCube IrrEdit 创建Irrlicht场景 标签 Irrlicht游戏引擎 2013 11 22 19 32 3384人阅读 评论 7 收藏 举报 分类 Irrlicht 13 版权声明 本文为博主原创文章 未经博主
  • Direct3D VertexBuffer Lock() and Unlock() function

    Stack Overflow is a question and answer site for professional and enthusiast programmers It s 100 free no registration r
  • d3d制作场景地形

    一般可以先用d3d做地形的mesh 比如做一个100 100的网格 然后用photoshop做高度图 然后再程序里读取高度图数据 让mesh的每个顶点对应一个高度 http download csdn net source 855296 这
  • 成功编译RenderingPluginExample53的cpp项目的步骤

    备忘 unity中调用d3d功能的示例项目 两个方面的配置 1 为了在项目中能够找到d3d12 h d3d11 h d3d9 h等 做如下操作 在项目属性中 VC 目录 包含目录 中添加 C Program Files x86 Window
  • 3D MAX导出插件编写

    转 3D MAX导出插件编写 2011 6 9阅读1667 评论0 文章版权归博客园 BigCoder所有 转载请于明显位置标明原文作者及出处 以示尊重 原文出处 http www cnblogs com csyisong archive
  • 高级纹理映射技术(6)

    高级纹理映射技术 6 对一些特殊的应用需要对纹理坐标进行处理 主要包括纹理坐标自动生成和纹理坐标变换 下图显示了纹理坐标的来源 处理过程以及到达光栅处理器的过程 纹理坐标自动生成 在Direct3D程序中 不仅可以在模型载入阶段或渲染阶段指
  • orge工具

    tortoisehg 3 2 1 x64 msi mercurial 3 2 1 x64 msi
  • 手把手教你如何配置和编译ogre 1.7.0 + cegui 0.7.1

    oiramario 博客园 首页 新随笔 联系 订阅 管理 随笔 423 文章 1 评论 838 手把手教你如何配置和编译ogre 1 7 0 cegui 0 7 1 ogre 1 7 0的下载 配置和编译指南 1 ogre 1 7 0的下
  • 使用GDI/GDI+绘制到D3D9缓冲区的方法

    这个其实是3D绘图里嵌入2D绘图的传统方式 D3D9直接使用GDI GDI 就可以画图 只不过需要额外的设置 而且只支持RGB和XRGB 不支持ARGB 因此这种方法比较适合合成UI元素和不透明的纹理贴图 不适合将要进行AlphaBlend
  • D3D9Texture::_loadNormTex

    D3D9Texture loadNormTex D3D9Texture loadImpl
  • 深入理解Direct3D9

    String Of Brilliant Blue QQ群 8082814 随笔 34 文章 32 评论 136 博客园 首页 新随笔 联系 管理 深入理解Direct3D9 深入理解D3D9对图形程序员来说意义重大 我把以前的一些学习笔记都
  • GT1030和730哪个好?GT1030与GT730区别对比 (全文)

    对于显卡硬件厂商来说 当属NVIDIA可谓异常活跃 我们知道在游戏领域 N卡一直占据着绝大部分市场 旗下的显卡定位也非常明确 如最新的10系显卡 今年5月份NVIDIA低调发布了定位入门级显卡 GT1030 这款显卡上市之后立马引起了不少玩
  • 欧拉角与四元数

    以下文章摘自wiki百科 对于在三维空间里的一个参考系 任何坐标系的取向 都可以用三个欧拉角来表现 参考系又称为全局坐标系 是静止不动的 而局部坐标系则固定于刚体 随着刚体的旋转而旋转 参閲右图 设定 x y z轴为全局坐标系的参考轴 称
  • Texture::getSourceFileType()

    Texture getSourceFileType
  • cocos2d-x 卡牌翻牌效果的实现

    cocos2d x 卡牌翻牌效果的实现 2012年07月25日 综合 共 3085字 字号 小 中 大 评论关闭 猴子原创 欢迎转载 转载请注明 转载自Cocos2D开发网 Cocos2Dev com 谢谢 原文地址 http www co
  • mesa 教程

    只有这个是靠谱的 Compiling and Installing The Mesa 3D Graphics Library latest documentation
  • OpenGL图形管线和坐标变换

    1 OpenGL 渲染管线 OpenGL渲染管线分为两大部分 模型观测变换 ModelView Transformation 和投影变换 Projection Transformation 做个比喻 计算机图形开发就像我们照相一样 目的就是
  • opengl 学习<二>

    opengl 学习 lt 二 gt 在学习opengl过程中 我是用了 交互式的计算机图形学 自顶向下的分析 这本书着实不错 是一本理论兼opengl实践的图形学教程 在学习上 我总会是杂乱无章的学 为什么呢 我一般是在需要某个理论的时候才

随机推荐

  • 微信分享链接出现config:invalid signature错误的解决方法

    当开发微信时需要做特定的页面做分享时 根据官方提供的jssdk php文件创建的签名数据包调试时 大家碰到的最多的错误而且解决最麻烦的大概就是signature错误了 如下图 分享时提示错误 errMsg config invalid si
  • JSP中的内置对象pageContext的作用

    1 当作当前页面域对象使用 2 可以获取到jsp中其他8个内置对象 jsp中其实可以直接用其他内置对象 但再el表达式中可以尝试使用 因为request response session servletContext servletConf
  • 小程序-报错 xxx is not defined (已解决)

    小程序 报错 xxx is not defined 已解决 问题情境 这样一段代码 微信的小程序报错 is not defined 我 wxml 想这样调用 wxml 代码
  • 力扣每日一题【用户分组】

    题目链接 用户分组 视频连接 用户分组 C 代码 class Solution public vector
  • CTO六大能力模型

    一个公司的CTO面临着许多难题和尴尬处境 他们整天忙得焦头烂额 跟CEO肩并肩共同应对各种困难 他们跟其它高管紧密配合 提供强大的技术后盾 他们不断学习新技术 制定符合企业的技术战略 想要成为一名优秀的CTO 究竟要具备哪些方面的能力素质
  • 如何评估大型语言模型(LLM)?

    编者按 近期几乎每隔一段时间 就有新的大语言模型发布 但是当下仍然没有一个通用的标准来评估这些大型语言模型的质量 我们急需一个可靠的 综合的LLM评估框架 本文说明了为什么我们需要一个全面的大模型评估框架 并介绍了市面上这些现有的评估框架
  • 地址解析协议 (ARP)

    地址解析协议 ARP 是互联网协议 IP 套件的关键第 2 层协议 可将 IP 地址转换为媒体访问控制 MAC 地址 IP MAC ARP 在实现网络连接方面发挥着不可或缺的作用 能够发现本地网络上设备的硬件地址并将其映射到其 IP 地址
  • STM32F429 不断重复复位

    之前做过一块STM32F429的板子 板子搭载SDRAM和NAND flash 刚开始板子还是好好的 用了一段时间之后 板子变得很奇怪 开机后SDRAM和NAND初始化之后 运行SDRAM的测试代码 大概运行10S左右就会出现一次复位 我在
  • html设置一段文字颜色,用span css设置div内部分字体颜色

    用span标签设置div内放一段文字中的一小部分文字字体色采方式 一段笔墨放在DIV内或P内 当咱们配置div或p设置字体色彩 内里全体笔墨的字体色调就会变成咱们所配置字体色彩 通常会结构一段翰墨中个中几个字或一小块字的字体色采不同 此时就
  • Hibernate学习(2)- hibernate.cfg.xml详解

    1 主配置文件主要分为三部分 注意 通常情况下 一个session factory节点代表一个数据库 1 1 第一部分 数据库连接部分 注意 hibernate connection driver class 中间的 1 2 第二部分 其他
  • LintCode 202. Segment Tree Query (线段树经典题!)

    Segment Tree Query 中文English For an integer array index from 0 to n 1 where n is the size of this array in the correspon
  • 玩转ChatGPT:视频制作

    一 写在前面 最近 在码深度学习图像识别的相关知识和代码 这一part 看看能否用小Chat搞一个介绍视频 简单问小Chat 咒语 我怎么使用你做一个视频 需要配合什么软件生成 大意就是 惊呆了 这不是我想要的 还是先半自动 后全自动吧 二
  • flink启动报错Failed to construct kafka producer

    flink local模式下启动 sink2kafka报错 具体报错如下 apache kafka common KafkaException Failed to construct kafka producer at org apache
  • python谁是卧底、猜词语

    python谁是卧底 谁是卧底也是深受很多人喜欢的游戏 起码要三人以上才能玩 大致分为几个阶段 1 分配平民词语和卧底词语 gt 2 玩家依次发言 gt 3 根据发言投票认为谁是卧底 gt 4 得到票数最多的玩家出局 gt 5 出局玩家刚好
  • 网络安全—攻防

    招聘需求 尝试通过收集招聘平台的相关职业岗位描述DJ 进行相关方面能力学习 攻防安全 认证 TCSP证书 CISM证书 CISP证书 CISSP证书 CISP PTE证书 CISP DSG证书 CISP A证书 CISD证书 CCSRP证书
  • 2020-10-14 KIBANA7 配置(搜索、可视化组件和仪表板)导出导入

    需求描述 线上Kibana的可视化图表跟仪表盘配置意外丢失了 还好测试环境有相同的配置 根据Kibana的功能进行配置的导出 gt 导入 避免手工一个一个重新配置的繁琐跟配置错误疏漏等情况 也同时进行下配置文件的导出备份工作 参考资料 官方
  • 好分数阅卷3.0_自考阅卷老师是怎么打分的?

    距离十月自考还有一个月 又到了全国考生转发考神的时间 但还有一招更有用 解密阅卷老师 往年很多同学查分后 都会有这么几个疑问 在答题的时候 感觉每道题都答得不错 为什么分数只有这么点 56 57这种分数 搞不懂老师为什么就不能多给我几分 俗
  • Matlab如何打包成jar并给java使用(混合编程)

    Matlab如何打包成jar并给java使用 由于期末数字图像课程设计需求 使用matlab码好了函数可是没有界面 所以打算用jsp随便搞一搞 可是这样就要跨语言编程了 说得很高大上其实就是打成jar然后丢到项目lib包里面去 这时就需要打
  • H5——连连看小游戏实现思路及源码

    部门要求推广新产品用连连看小游戏的方式 设计那边UI还没有排期 先撸个功能demo 正好记录一下 连连看都玩过 程序的关键在于判断连续点击的两张图片是否能够消除 两个图片消除的条件有两个 图片相同 两张图之间连线的转角数不超过2 第一个条件
  • 高级纹理映射技术(6)

    高级纹理映射技术 6 对一些特殊的应用需要对纹理坐标进行处理 主要包括纹理坐标自动生成和纹理坐标变换 下图显示了纹理坐标的来源 处理过程以及到达光栅处理器的过程 纹理坐标自动生成 在Direct3D程序中 不仅可以在模型载入阶段或渲染阶段指