-1

我正在为我的毕业设计制作 RPG 游戏(暗黑破坏神)。我尝试使用 Directx 8 示例编译 Jim Adams 编程 RPG。

忽略他们用其他语言的评论。

/*--------------------------------------------------------------------------
------------------===========================-------------------------------
   IIIIIIII    IIIII     IIII      III       III   IIIII    II      IIIII 
     III  III   III     III III     III     III   III III   II     III III
     III    II  III    III   III     III   III   III  III   II    III  III
     III    II  III   IIIIIIIIIII     III III    III  III   II    III  III 
   IIIIIIII    IIIII III       III     IIII       IIIIII    IIIIII IIIIII
=================||||||||||||||||||||||||||||===============================

(c) Braniselj Klemen 2013 





                    =========================
;;;;;;;;;;;;;;;;;;;/CLASS ZA LEVEL 1 /;;;;;;;;;;;;;;;;;;;;;;
                    **************************
*/

#ifndef _ACT1_H_
#define _ACT1_H_

//DVA TIPA STRUKTURA ALI QUADTREE(ZA LEVELE Z KONSTANTNO VIŠINO ALI OCTREE ZA LEVELE Z SPREMENLJIVO DOLŽINO
enum TreeTypes { QUADTREE = 0, OCTREE };

class cNodeTreeMesh
{
private:
    //Struktura pobere koordinate iz vertex bufferja modela
    typedef struct sVertex { float x, y, z; } sVertex;

    //Textura je izrisana samo enkrat ne 60 na sekuno
    typedef struct sPolygon {
        unsigned long Group; //Skupina teksture
        unsigned long Time;  //kdaj je bila nazadnje izrisana
        unsigned short Vertex[3]; //x, y ,z

        sPolygon() { Group = Time = 0; } //Počisti podatke
        } sPolygon;

    //Struktura ohranja ševilo polygonov v 3D prostoru
    typedef struct sNode {
        unsigned long NumPolygons;
        sPolygon **PolygonList;
        float XPos, YPos, ZPos;
        float Size;
        sNode *Nodes[8];

        //Konstruktor ki počisti spremenljivko
        sNode()
        { 
            NumPolygons = 0;
            PolygonList = NULL;
            XPos = YPos = ZPos = Size = 0.0f;
            for(short i=0; i< 8; i++)
                Nodes[i] = NULL;
        }

        ~sNode()
        {
             delete [] PolygonList;
             for (short i=0; i<8; i++)
                 delete Nodes[i];
        }
    }sNode;

    //Struktura ki grupira polygone ki morajo biti izrisani v vsakem framu
    typedef struct sGroup {
        cVertexBuffer VertexBuffer;
        char *VertexPtr;
        unsigned long NumPolygons;
        unsigned long NumPolygonsToDraw;

        sGroup() { NumPolygons = 0; }
        ~sGroup() { VertexBuffer.Free(); }
    } sGroup;

    int m_TreeType;   //QUAD ALI OCTA

    cGraphics *m_Graphics; 
    cFrustum *m_Frustum;

    unsigned long m_Time;

    float m_Size;
    float m_MaxSize;

    sNode *m_ParentNode;

    unsigned long m_NumGroups;
    sGroup *m_Groups;

    unsigned long  m_NumPolygons;
    unsigned long m_MaxPolygons;
    sPolygon *m_PolygonList;

    sMesh *m_Mesh;
    char *m_VertexPtr;
    unsigned long m_VertexFVF;
    unsigned long m_VertexSize;

    void SortNode(sNode *Node, float XPos, float YPos, float ZPos, float Size);

    void AddNode(sNode *Node);

    BOOL IsPolygonContained(sPolygon *Polygon, float XPos, float YPos, float ZPos, float Size);

    unsigned long CountPolygons( float XPos, float YPos, float ZPos, float Size);

public:
    cNodeTreeMesh(); //konstruktor za model
    ~cNodeTreeMesh(); //dekonstruktor za model


    BOOL Create(cGraphics *Graphics, cMesh *Mesh, int TreeType = OCTREE, float Maxsize = 256.0f, long MaxPolygons = 32);
    BOOL Free();

    BOOL Render(cFrustum *Frustum = NULL, float  ZDistance = 0.0f);

    float GetClosestHeight(float XPos, float YPos, float ZPos);

    float GetHeightBelow(float XPos, float YPos, float ZPos);
    float GetHeightAbove(float XPos, float YPos, float ZPos);

    BOOL CheckIntersect(float XStart, float YStart, float ZStart, float XEnd, float YEnd, float ZEnd, float *Length);



};


#endif // _ACT1_H_

ACT1.cpp

/*-------------------------------------------------------------------
------------------===========================-------------------------------
   IIIIIIII    IIIII     IIII      III       III   IIIII    II      IIIII 
     III  III   III     III III     III     III   III III   II     III III
     III    II  III    III   III     III   III   III  III   II    III  III
     III    II  III   IIIIIIIIIII     III III    III  III   II    III  III 
   IIIIIIII    IIIII III       III     IIII       IIIIII    IIIIII IIIIII
=================||||||||||||||||||||||||||||===============================

Povzeto po Jim Adams Programing role playing games with directx
(c) Braniselj Klemen 2013 



Node = Del levela     

                    =========================
;;;;;;;;;;;;;;;;;;;;;/FUNKCIJE ZA LEVEL 1/;;;;;;;;;;;;;;;;;;;;;;
                    **************************
*/

#include "Core_Global.h"
#include "Frustum.h"
#include "ACT1.h"


#pragma comment(lib, "User32.lib") 
#pragma comment(lib, "gdi32.lib")
#pragma comment(lib,"d3d8.lib")
#pragma comment(lib,"d3dx8.lib")
#pragma comment(lib, "winmm.lib")


#include <Windows.h>
#include <iostream>
#include <stdio.h>
#include "d3d8.h"
#include "d3dx8.h"

using namespace std;

cNodeTreeMesh::cNodeTreeMesh()
{
    m_TreeType = OCTREE;
    m_Graphics = NULL;
    m_ParentNode = NULL;
    m_NumPolygons = 0;
    m_PolygonList = NULL;
    m_NumGroups = 0;
    m_Groups = NULL;
    m_Time = 0;
}

cNodeTreeMesh::~cNodeTreeMesh()
{
    Free();
}

BOOL cNodeTreeMesh::Create(cGraphics *Graphics, cMesh *Mesh, int TreeType, float MaxSize, long MaxPolygons)
{
    ID3DXMesh *LoadMesh;
    unsigned short *IndexPtr;
    DWORD *Attributes;
    unsigned long i;
    float MaxX, MaxY, MaxZ;

    Free();


    if((m_Graphics = Graphics ) == NULL)
        return FALSE;
    if(Mesh == NULL)
        return FALSE;
    if(!Mesh->GetParentMesh()->m_NumMaterials)
        return FALSE;

    //lastnosti modela
    m_Mesh = Mesh->GetParentMesh();
    LoadMesh = m_Mesh->m_Mesh;
    m_VertexFVF = LoadMesh->GetFVF();
    m_VertexSize = D3DXGetFVFVertexSize(m_VertexFVF);
    m_NumPolygons = LoadMesh->GetNumFaces();
    m_MaxPolygons = MaxPolygons;

    //Ustvarimo seznam poljgonov(drevo)
    m_PolygonList = new sPolygon[m_NumPolygons]();
    m_NumGroups = m_Mesh->m_NumMaterials;
    m_Groups = new sGroup[m_NumGroups]();

    //zaklenemo vertex bufferje
    LoadMesh->LockIndexBuffer(D3DLOCK_READONLY, (BYTE**)&IndexPtr);
    LoadMesh->LockAttributeBuffer(D3DLOCK_READONLY, &Attributes);

    //Informacije polygona v strukturo
    for(i = 0; i  <m_NumPolygons; i++)
    {
        m_PolygonList[i].Vertex[0] = *IndexPtr++;
        m_PolygonList[i].Vertex[1] = *IndexPtr++;
        m_PolygonList[i].Vertex[2] = *IndexPtr++;

        //Shranimo texture group in stevec
        m_PolygonList[i].Group = Attributes[i];
        m_Groups[Attributes[i]].NumPolygons++;
    }

    LoadMesh->UnlockIndexBuffer();
    LoadMesh->UnlockAttributeBuffer();

    for(i = 0; i < m_NumGroups; i++)
    {
        if(m_Groups[i].NumPolygons != 0)
            m_Groups[i].VertexBuffer.Create(m_Graphics, m_Groups[i].NumPolygons * 3, m_VertexFVF, m_VertexSize);
    }

    //Velikost kocke
    MaxX = (float)max(fabs(Mesh->GetParentMesh()->m_Min.x), fabs(Mesh->GetParentMesh()->m_Max.x));
    MaxY = (float)max(fabs(Mesh->GetParentMesh()->m_Min.y), fabs(Mesh->GetParentMesh()->m_Max.y));
    MaxZ = (float)max(fabs(Mesh->GetParentMesh()->m_Min.z), fabs(Mesh->GetParentMesh()->m_Max.z));
    m_Size = max(MaxX, max(MaxY, MaxZ)) * 2.0f;
    m_MaxSize = MaxSize;

    //ustvarimo starševsko vozlišče
    m_ParentNode = new sNode();

    LoadMesh->LockVertexBuffer(D3DLOCK_READONLY, (BYTE**)&m_VertexPtr);
    SortNode(m_ParentNode, 0.0f, 0.0f, 0.0f, m_Size);
    LoadMesh->UnlockVertexBuffer();

    return TRUE;
}


//"SPROSTIMO" MODEL
BOOL cNodeTreeMesh::Free()
{
    delete m_ParentNode;
    m_ParentNode = NULL;

    m_Graphics = NULL;
    m_NumPolygons = 0;
    delete [] m_PolygonList;
    m_PolygonList = NULL;

    m_NumGroups = 0;
    delete [] m_Groups;
    m_Groups = NULL;

    return TRUE;
}

void cNodeTreeMesh::SortNode(sNode *Node, float XPos, float YPos, float ZPos, float Size)
{
    unsigned long i, Num;
    float XOff, YOff, ZOff;
    //Kakšna napaka
    if(Node == NULL || m_PolygonList == NULL)
        return;

    //Koordinate node-ov
    Node->XPos = XPos;
    Node->YPos = (m_TreeType == QUADTREE)?0.0f:YPos;
    Node->ZPos = ZPos;
    Node->Size = Size;

    //ali so plyigoni v nodu
    if(!(Num = CountPolygons(XPos, YPos, ZPos, Size)))
        return;

    //Če je preveč polygoonov v nodu razdeli
    if(Size > m_MaxSize && Num > m_MaxPolygons)
    {
        for(i=0; i<(unsigned long)((m_TreeType == QUADTREE)?4:8);i++)
        {
            XOff = ((( i % 2 ) < 1) ? -1.0f : 1.0f ) * (Size * 4.0f);
            YOff = ((( i % 4 ) < 1) ? -1.0f : 1.0f ) * (Size * 4.0f);
            ZOff = ((( i % 8 ) < 1) ? -1.0f : 1.0f ) * (Size * 4.0f);

            //ali so polygoni v zajemu noda
            if(CountPolygons(XPos+XOff, YPos+YOff, ZPos+ZOff, Size/2.0f))
            {
                Node->Nodes[i] = new sNode();

                SortNode(Node->Nodes[i], XPos+XOff, YPos+YOff, ZPos+ZOff, Size/2.0f);
            }
        }
        return;
    }

    //Allokacija prostora za kazalce na Polygon
    Node->NumPolygons = Num;
    Node->PolygonList = new sPolygon*[Num];

    //shranjuje kazalce
    Num = 0;
    for ( i=0; i<m_NumPolygons; i++)
    {
        //dodaj polygon če je zajet v 3D prostoru
        if(IsPolygonContained(&m_PolygonList[i], XPos, YPos, ZPos, Size) == TRUE)

    Node->PolygonList[Num++] = &m_PolygonList[i];
    }
}

BOOL cNodeTreeMesh::IsPolygonContained(sPolygon *Polygon, float XPos, float YPos, float ZPos, float Size)
{
    float XMin, XMax, YMin, YMax, ZMin, ZMax;
    sVertex *Vertex[3];

    //vertices(točke) polygona
    Vertex[0] =(sVertex*)&m_VertexPtr[m_VertexSize * Polygon->Vertex[0]];
    Vertex[1] =(sVertex*)&m_VertexPtr[m_VertexSize * Polygon->Vertex[1]];
    Vertex[2] =(sVertex*)&m_VertexPtr[m_VertexSize * Polygon->Vertex[2]];

    // preveri po x osi
  XMin = min(Vertex[0]->x, min(Vertex[1]->x, Vertex[2]->x));
  XMax = max(Vertex[0]->x, max(Vertex[1]->x, Vertex[2]->x));
  if(XMax < (XPos - Size / 2.0f))
  return FALSE;
  if(XMin > (XPos + Size / 2.0f))
  return FALSE;

  // preveri po y osi
  if(m_TreeType == OCTREE) {
    YMin = min(Vertex[0]->y, min(Vertex[1]->y, Vertex[2]->y));
    YMax = max(Vertex[0]->y, max(Vertex[1]->y, Vertex[2]->y));
    if(YMax < (YPos - Size / 2.0f))
    return FALSE;
    if(YMin > (YPos + Size / 2.0f))
    return FALSE;
  }

  // preveri po z osi
  ZMin = min(Vertex[0]->z, min(Vertex[1]->z, Vertex[2]->z));
  ZMax = max(Vertex[0]->z, max(Vertex[1]->z, Vertex[2]->z));
  if(ZMax < (ZPos - Size / 2.0f))
  return FALSE;
  if(ZMin > (ZPos + Size / 2.0f))
  return FALSE;

  return TRUE;
}

unsigned long cNodeTreeMesh::CountPolygons(float XPos, float YPos, float ZPos, float Size)
{
    unsigned long i, Num;

   // Ali je kakšen polygon za procesirati
  if(!m_NumPolygons)
    return 0;

  // preglej kateri polygoni so zajeti v 3D prostoru
  Num = 0;
  for( i=0; i<m_NumPolygons; i++ ) {
    if(IsPolygonContained(&m_PolygonList[i],XPos,YPos,ZPos,Size) == TRUE)
     Num++;
  }

  return Num;
}

BOOL cNodeTreeMesh::Render(cFrustum *Frustum, float ZDistance)
{
  D3DXMATRIX Matrix;  
  cFrustum ViewFrustum;  

  // ali je kje kakšna napaka
  if(m_Graphics == NULL || m_ParentNode == NULL || !m_NumPolygons)
    return FALSE;

  // ustvari pogled
  if((m_Frustum = Frustum) == NULL) {
    ViewFrustum.Construct(m_Graphics, ZDistance);
    m_Frustum = &ViewFrustum;
  }

  D3DXMatrixIdentity(&Matrix);
  m_Graphics->GetDeviceCOM()->SetTransform(D3DTS_WORLD, &Matrix);

  // zakleni vertex buffer
  for(unsigned long i=0; i<m_NumGroups; i++) {
    m_Groups[i].VertexBuffer.Lock(0,0);
    m_Groups[i].VertexPtr = (char*)m_Groups[i].VertexBuffer.GetPtr();
    m_Groups[i].NumPolygonsToDraw = 0;
  }
  m_Mesh->m_Mesh->LockVertexBuffer(D3DLOCK_READONLY, (BYTE**)&m_VertexPtr);

  // shrani trenutni čas  v render
  m_Time = timeGetTime();

  // Dodaj polygone v vertex buffer
  AddNode(m_ParentNode);

  // odkleni vertex bufferje in izriši
  m_Mesh->m_Mesh->UnlockVertexBuffer();
  for(unsigned long i=0; i<m_NumGroups; i++) {
    m_Groups[i].VertexBuffer.Unlock();

    if(m_Groups[i].NumPolygonsToDraw) {
      m_Graphics->GetDeviceCOM()->SetMaterial(&m_Mesh->m_Materials[i]);
      m_Graphics->GetDeviceCOM()->SetTexture(0, m_Mesh->m_Textures[i]);

      m_Groups[i].VertexBuffer.Render(0, m_Groups[i].NumPolygonsToDraw, D3DPT_TRIANGLELIST);
    }
  }

  return TRUE;
}

void cNodeTreeMesh::AddNode(sNode *Node)
{
  unsigned long i, Group;
  short         Num;

  // Preveri pogled glede 
  if(m_TreeType == QUADTREE) {
    if(m_Frustum->CheckRectangle(
           Node->XPos,        0.0f,          Node->ZPos, 
           Node->Size / 2.0f, m_Size / 2.0f, Node->Size / 2.0f) == FALSE)
      return;
  } else {
    if(m_Frustum->CheckRectangle(
           Node->XPos,        Node->YPos,        Node->ZPos, 
           Node->Size / 2.0f, Node->Size / 2.0f, Node->Size / 2.0f) == FALSE)
      return;
  }


  Num = 0;
  for(i=0;i<(unsigned long)((m_TreeType==QUADTREE)?4:8);i++) {
    if(Node->Nodes[i] != NULL) {
      Num++;
      AddNode(Node->Nodes[i]);
    }
  }


  if(Num)
    return;


  if(Node->NumPolygons != 0) {
    for(i=0;i<Node->NumPolygons;i++) {

      // če polygon še ni buil izrisan
      if(Node->PolygonList[i]->Time != m_Time && (Group = Node->PolygonList[i]->Group) < m_NumGroups) {

        // izriši polygone ki so vidni

        if(m_Mesh->m_Materials[Node->PolygonList[i]->Group].Diffuse.a != 0.0f) {


          memcpy(m_Groups[Group].VertexPtr, &m_VertexPtr[m_VertexSize * Node->PolygonList[i]->Vertex[0]], m_VertexSize);
          m_Groups[Group].VertexPtr += m_VertexSize;
          memcpy(m_Groups[Group].VertexPtr, &m_VertexPtr[m_VertexSize * Node->PolygonList[i]->Vertex[1]], m_VertexSize);
          m_Groups[Group].VertexPtr += m_VertexSize;
          memcpy(m_Groups[Group].VertexPtr, &m_VertexPtr[m_VertexSize * Node->PolygonList[i]->Vertex[2]], m_VertexSize);
          m_Groups[Group].VertexPtr += m_VertexSize;

          m_Groups[Group].NumPolygonsToDraw++;
        }

        // Označi polygon ki je bil sprocesiran v določenem časovnem segmentu
        Node->PolygonList[i]->Time = m_Time;
      }
    }
  }
}

float cNodeTreeMesh::GetClosestHeight(float XPos, float YPos, float ZPos)
{
  float YAbove, YBelow;

  YAbove = GetHeightAbove(XPos, YPos, ZPos);
  YBelow = GetHeightBelow(XPos, YPos, ZPos);
  if(fabs(YAbove-YPos) < fabs(YBelow-YPos))
    return YAbove;
  return YBelow;
}

float cNodeTreeMesh::GetHeightBelow(float XPos, float YPos, float ZPos)
{
  BOOL  Hit;
  float u, v, Dist;
  DWORD FaceIndex;

  D3DXIntersect(m_Mesh->m_Mesh,
&D3DXVECTOR3(XPos,YPos,ZPos), &D3DXVECTOR3(0.0f, -1.0f, 0.0f),&Hit, &FaceIndex, &u, &v, &Dist, NULL, NULL);
  if(Hit == TRUE)
    return YPos-Dist;
  return YPos;
}

float cNodeTreeMesh::GetHeightAbove(float XPos, float YPos, float ZPos)
{ 
  BOOL  Hit;
  float u, v, Dist;
  DWORD FaceIndex;

  D3DXIntersect(m_Mesh->m_Mesh,
                &D3DXVECTOR3(XPos,YPos,ZPos),
                &D3DXVECTOR3(0.0f, 1.0f, 0.0f),
                &Hit, &FaceIndex, &u, &v, &Dist , NULL, NULL);
  if(Hit == TRUE)
    return YPos+Dist;
  return YPos;
}

BOOL cNodeTreeMesh::CheckIntersect(float XStart, float YStart, float ZStart,
                                   float XEnd,   float YEnd,   float ZEnd,
                                   float *Length)
{
  BOOL  Hit;
  float u, v, Dist;
  float XDiff, YDiff, ZDiff, Size;
  DWORD FaceIndex;
  D3DXVECTOR3 vecDir;

  XDiff = XEnd - XStart;
  YDiff = YEnd - YStart;
  ZDiff = ZEnd - ZStart;

  D3DXVec3Normalize(&vecDir, &D3DXVECTOR3(XDiff, YDiff, ZDiff));
  D3DXIntersect(m_Mesh->m_Mesh, &D3DXVECTOR3(XStart,YStart,ZStart), &vecDir,&Hit, &FaceIndex, &u, &v, &Dist, NULL, NULL);

  if(Hit == TRUE) {
    Size = (float)sqrt(XDiff*XDiff+YDiff*YDiff+ZDiff*ZDiff);
    if(Dist > Size)
      Hit = FALSE;
    else {
      if(Length != NULL)
        *Length = Dist;
    }
  }

  return Hit;
}

是的,我已经在附加依赖项中链接了 lib 文件

d3d8.lib;
d3dx8d.lib;
d3dx8.lib;
winmm.lib;
odbc32.lib;
odbccp32.lib;
libcmtd.lib;
user32.lib;
gdi32.lib;
kernel32.lib;
winspool.lib;
comdlg32.lib;
advapi32.lib;
shell32.lib;
ole32.lib;
oleaut32.lib;
uuid.lib;
wsock32.lib;
d3dxof.lib;
dxguid.lib;
d3dx.lib;
dsound.lib;
dinput8.lib;
dplayx.lib;
%(AdditionalDependencies)

我得到了这些错误:

1>Build started 1.3.2013 17:45:31.
1>InitializeBuildStatus:
1>  Touching "Debug\Diavolo.unsuccessfulbuild".
1>ClCompile:
1>  ACT1.cpp
1>  c:\program files (x86)\microsoft sdks\windows\v7.0a\include\dinput.h: DIRECTINPUT_VERSION undefined. Defaulting to version 0x0800
1>ManifestResourceCompile:
1>  All outputs are up-to-date.
1>libcmtd.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
1>ACT1.obj : error LNK2019: unresolved external symbol "public: int __thiscall cVertexBuffer::Create(class cGraphics *,unsigned long,unsigned long,long)" (?Create@cVertexBuffer@@QAEHPAVcGraphics@@KKJ@Z) referenced in function "public: int __thiscall cNodeTreeMesh::Create(class cGraphics *,class cMesh *,int,float,long)" (?Create@cNodeTreeMesh@@QAEHPAVcGraphics@@PAVcMesh@@HMJ@Z)
1>ACT1.obj : error LNK2019: unresolved external symbol "public: struct sMesh * __thiscall cMesh::GetParentMesh(void)" (?GetParentMesh@cMesh@@QAEPAUsMesh@@XZ) referenced in function "public: int __thiscall cNodeTreeMesh::Create(class cGraphics *,class cMesh *,int,float,long)" (?Create@cNodeTreeMesh@@QAEHPAVcGraphics@@PAVcMesh@@HMJ@Z)
1>ACT1.obj : error LNK2019: unresolved external symbol "public: __thiscall cVertexBuffer::cVertexBuffer(void)" (??0cVertexBuffer@@QAE@XZ) referenced in function "public: __thiscall cNodeTreeMesh::sGroup::sGroup(void)" (??0sGroup@cNodeTreeMesh@@QAE@XZ)
1>ACT1.obj : error LNK2019: unresolved external symbol "public: __thiscall cVertexBuffer::~cVertexBuffer(void)" (??1cVertexBuffer@@QAE@XZ) referenced in function "public: __thiscall cNodeTreeMesh::sGroup::~sGroup(void)" (??1sGroup@cNodeTreeMesh@@QAE@XZ)
1>ACT1.obj : error LNK2019: unresolved external symbol "public: int __thiscall cVertexBuffer::Free(void)" (?Free@cVertexBuffer@@QAEHXZ) referenced in function "public: __thiscall cNodeTreeMesh::sGroup::~sGroup(void)" (??1sGroup@cNodeTreeMesh@@QAE@XZ)
1>ACT1.obj : error LNK2019: unresolved external symbol "public: int __thiscall cVertexBuffer::Render(unsigned long,unsigned long,unsigned long)" (?Render@cVertexBuffer@@QAEHKKK@Z) referenced in function "public: int __thiscall cNodeTreeMesh::Render(class cFrustum *,float)" (?Render@cNodeTreeMesh@@QAEHPAVcFrustum@@M@Z)
1>ACT1.obj : error LNK2019: unresolved external symbol "public: int __thiscall cVertexBuffer::Unlock(void)" (?Unlock@cVertexBuffer@@QAEHXZ) referenced in function "public: int __thiscall cNodeTreeMesh::Render(class cFrustum *,float)" (?Render@cNodeTreeMesh@@QAEHPAVcFrustum@@M@Z)
1>ACT1.obj : error LNK2019: unresolved external symbol "public: void * __thiscall cVertexBuffer::GetPtr(void)" (?GetPtr@cVertexBuffer@@QAEPAXXZ) referenced in function "public: int __thiscall cNodeTreeMesh::Render(class cFrustum *,float)" (?Render@cNodeTreeMesh@@QAEHPAVcFrustum@@M@Z)
1>ACT1.obj : error LNK2019: unresolved external symbol "public: int __thiscall cVertexBuffer::Lock(unsigned long,unsigned long)" (?Lock@cVertexBuffer@@QAEHKK@Z) referenced in function "public: int __thiscall cNodeTreeMesh::Render(class cFrustum *,float)" (?Render@cNodeTreeMesh@@QAEHPAVcFrustum@@M@Z)
1>ACT1.obj : error LNK2019: unresolved external symbol "public: struct IDirect3DDevice8 * __thiscall cGraphics::GetDeviceCOM(void)" (?GetDeviceCOM@cGraphics@@QAEPAUIDirect3DDevice8@@XZ) referenced in function "public: int __thiscall cNodeTreeMesh::Render(class cFrustum *,float)" (?Render@cNodeTreeMesh@@QAEHPAVcFrustum@@M@Z)
1>Frustum.obj : error LNK2001: unresolved external symbol "public: struct IDirect3DDevice8 * __thiscall cGraphics::GetDeviceCOM(void)" (?GetDeviceCOM@cGraphics@@QAEPAUIDirect3DDevice8@@XZ)
1>.\Debug\Diavolo.exe : fatal error LNK1120: 11 unresolved externals
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:01.57
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

抱歉英语不好。任何帮助都会非常感激

4

1 回答 1

0

您收到链接器错误,因为您没有链接到 d3dx9.lib、d3dx9d.lib 和 d3d9.lib。

于 2013-03-01T17:54:36.243 回答