• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.

Honas

Members
  • Content count

    18
  • Joined

  • Last visited

Community Reputation

101 Neutral

About Honas

  • Rank
    Member
  1. First of all: Thank you for replying! [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img] I changed my BoneMesh in SkinnedMesh.h like this: [code]struct BoneMesh: public D3DXMESHCONTAINER { ID3DXMesh* OriginalMesh; vector<D3DMATERIAL9> materials; vector<IDirect3DTexture9*> textures; DWORD NumAttributeGroups; D3DXATTRIBUTERANGE* attributeTable; D3DXMATRIX** boneMatrixPtrs; D3DXMATRIX* boneOffsetMatrices; D3DXMATRIX* currentBoneMatrices; BoneMesh(){} ~BoneMesh() { delete [] attributeTable; delete [] boneOffsetMatrices; delete [] currentBoneMatrices; delete [] boneMatrixPtrs; attributeTable = 0; boneOffsetMatrices = 0; currentBoneMatrices = 0; boneMatrixPtrs = 0; } };[/code] [code]MEMORY : Memory leaks detected! 27 active allocations totalling 652 bytes: + ID 00000045, tag ID 0x00000000: 0x01053E44 160 bytes [thegame.cpp:250 (InitTerrain)] + ID 00000393, tag ID 0x00000000: 0x0105427C 44 bytes [gameobject.cpp:459 (createCube)] + ID 00000394, tag ID 0x00000000: 0x01057D44 20 bytes [gameobject.cpp:459 (createCube)] + ID 00000404, tag ID 0x00000000: 0x01054564 8 bytes [skinnedmesh.h:36 (BoneMesh::BoneMesh)] + ID 00000405, tag ID 0x00000000: 0x0105464C 8 bytes [skinnedmesh.h:36 (BoneMesh::BoneMesh)] + ID 00000414, tag ID 0x00000000: 0x01054DDC 8 bytes [skinnedmesh.h:36 (BoneMesh::BoneMesh)] + ID 00000415, tag ID 0x00000000: 0x08E10244 8 bytes [skinnedmesh.h:36 (BoneMesh::BoneMesh)] + ID 00000424, tag ID 0x00000000: 0x08E10BF4 8 bytes [skinnedmesh.h:36 (BoneMesh::BoneMesh)] + ID 00000425, tag ID 0x00000000: 0x08E10CDC 8 bytes [skinnedmesh.h:36 (BoneMesh::BoneMesh)] + ID 00000434, tag ID 0x00000000: 0x08E1168C 8 bytes [skinnedmesh.h:36 (BoneMesh::BoneMesh)] + ID 00000435, tag ID 0x00000000: 0x08E11774 8 bytes [skinnedmesh.h:36 (BoneMesh::BoneMesh)] + ID 00000444, tag ID 0x00000000: 0x08E12124 8 bytes [skinnedmesh.h:36 (BoneMesh::BoneMesh)] + ID 00000445, tag ID 0x00000000: 0x08E1220C 8 bytes [skinnedmesh.h:36 (BoneMesh::BoneMesh)] + ID 00000456, tag ID 0x00000000: 0x08E12C84 4 bytes [gameobject.cpp:459 (createCube)] + ID 00000457, tag ID 0x00000000: 0x08E12D64 32 bytes [gameobject.cpp:459 (createCube)] + ID 00000459, tag ID 0x00000000: 0x08E12F44 44 bytes [gameobject.cpp:479 (createBase)] + ID 00000460, tag ID 0x00000000: 0x08E1304C 12 bytes [gameobject.cpp:479 (createBase)] + ID 00000461, tag ID 0x00000000: 0x08E13134 44 bytes [gameobject.cpp:363 (BaseGraphicsComponent::BaseGraphicsComponent)] + ID 00000462, tag ID 0x00000000: 0x08E1323C 44 bytes [gameobject.cpp:372 (BaseGraphicsComponent::BaseGraphicsComponent)] + ID 00000463, tag ID 0x00000000: 0x08E13344 4 bytes [gameobject.cpp:479 (createBase)] + ID 00000464, tag ID 0x00000000: 0x08E13424 8 bytes [gameobject.cpp:479 (createBase)] + ID 00000466, tag ID 0x00000000: 0x08E135F4 44 bytes [gameobject.cpp:479 (createBase)] + ID 00000467, tag ID 0x00000000: 0x08E136FC 12 bytes [gameobject.cpp:479 (createBase)] + ID 00000468, tag ID 0x00000000: 0x08E137E4 44 bytes [gameobject.cpp:363 (BaseGraphicsComponent::BaseGraphicsComponent)] + ID 00000469, tag ID 0x00000000: 0x08E138EC 44 bytes [gameobject.cpp:372 (BaseGraphicsComponent::BaseGraphicsComponent)] + ID 00000470, tag ID 0x00000000: 0x08E12E64 4 bytes [gameobject.cpp:479 (createBase)] + ID 00000471, tag ID 0x00000000: 0x08E139F4 8 bytes [gameobject.cpp:479 (createBase)] End of allocations Memory leaks were foundTheGame (Debug) .exe has triggered a breakpoint The thread 'Win32 Thread' (0xdf8) has exited with code 0 (0x0). The thread 'Win32 Thread' (0xe74) has exited with code 0 (0x0). The thread 'Win32 Thread' (0x112c) has exited with code 0 (0x0). The thread 'Win32 Thread' (0xc94) has exited with code 0 (0x0). The thread 'Win32 Thread' (0x118c) has exited with code 0 (0x0). The thread 'Win32 Thread' (0x1330) has exited with code 0 (0x0). The thread 'Win32 Thread' (0xa30) has exited with code 0 (0x0). The thread 'Win32 Thread' (0x12ac) has exited with code 0 (0x0). The thread 'Win32 Thread' (0x2b8) has exited with code 0 (0x0). The thread 'Win32 Thread' (0x13cc) has exited with code 0 (0x0). The thread 'Win32 Thread' (0x124c) has exited with code 0 (0x0). The thread 'Win32 Thread' (0x828) has exited with code 0 (0x0). Direct3D9: (ERROR) :Memory still allocated! Alloc count = 189 Direct3D9: (ERROR) :Current Process (pid) = 000013d4 Direct3D9: (ERROR) :Memory Address: 058e07fc lAllocID=1 dwSize=00004bc4, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 058e53f4 lAllocID=2 dwSize=00000350, ReturnAddr=6bbf02fa (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 058e577c lAllocID=3 dwSize=00000ef0, ReturnAddr=6bbf6401 (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0591434c lAllocID=5 dwSize=000242b4, ReturnAddr=6bbfe508 (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 05938634 lAllocID=6 dwSize=00001bd8, ReturnAddr=6bbeec04 (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 058e66a4 lAllocID=7 dwSize=000005e0, ReturnAddr=6bbeecd5 (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 058e6cbc lAllocID=8 dwSize=00000014, ReturnAddr=6bbeed27 (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 058f0064 lAllocID=12 dwSize=00001950, ReturnAddr=6bbe3cab (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0593a244 lAllocID=13 dwSize=000005e0, ReturnAddr=6bbe3cf1 (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 058e6dc4 lAllocID=14 dwSize=00000014, ReturnAddr=6bbe3d3e (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0593a85c lAllocID=15 dwSize=00000350, ReturnAddr=6bbf02fa (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 058f19ec lAllocID=16 dwSize=00000ef0, ReturnAddr=6bbf6401 (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0593abe4 lAllocID=18 dwSize=0001bd28, ReturnAddr=6bbfe508 (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 058f2914 lAllocID=19 dwSize=00001bd8, ReturnAddr=6bbeec04 (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 05956944 lAllocID=20 dwSize=000005c0, ReturnAddr=6bbeecd5 (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 05956f3c lAllocID=21 dwSize=00000014, ReturnAddr=6bbeed27 (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 058f4524 lAllocID=23 dwSize=00001950, ReturnAddr=6bbe3cab (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 058f5eac lAllocID=24 dwSize=000005c0, ReturnAddr=6bbe3cf1 (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 05956f84 lAllocID=25 dwSize=00000014, ReturnAddr=6bbe3d3e (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 058e6e0c lAllocID=26 dwSize=00000044, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 058e6e84 lAllocID=27 dwSize=00000050, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 058f682c lAllocID=35 dwSize=00000ef0, ReturnAddr=6bbf6401 (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 058e6f0c lAllocID=36 dwSize=00000030, ReturnAddr=6bc00881 (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 058f7754 lAllocID=37 dwSize=00001bd8, ReturnAddr=6bbeec04 (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 058f9364 lAllocID=38 dwSize=000005e0, ReturnAddr=6bbeecd5 (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 058e6f74 lAllocID=39 dwSize=00000014, ReturnAddr=6bbeed27 (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 058f997c lAllocID=41 dwSize=00004138, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 058fdaec lAllocID=42 dwSize=00000198, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 058f64a4 lAllocID=43 dwSize=00000030, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 058fdcbc lAllocID=44 dwSize=00001020, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 058fed14 lAllocID=45 dwSize=00000a48, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 058f650c lAllocID=46 dwSize=00000098, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 058f65dc lAllocID=47 dwSize=0000007c, ReturnAddr=6bc0a22b (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 058f668c lAllocID=48 dwSize=00000024, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 058f66e4 lAllocID=49 dwSize=00000098, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 058ff794 lAllocID=50 dwSize=0000007c, ReturnAddr=6bc0a22b (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 058f67b4 lAllocID=51 dwSize=00000044, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 058ff844 lAllocID=52 dwSize=00000024, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 058ff89c lAllocID=53 dwSize=000000a8, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 058ff97c lAllocID=54 dwSize=00000098, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 058ffa4c lAllocID=55 dwSize=0000007c, ReturnAddr=6bc0a22b (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 05956fcc lAllocID=56 dwSize=0002b330, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 05982334 lAllocID=57 dwSize=0000002c, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 05982394 lAllocID=58 dwSize=00000028, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 059823f4 lAllocID=59 dwSize=00000420, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0598284c lAllocID=60 dwSize=00000030, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 059828b4 lAllocID=61 dwSize=00000030, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 058ffafc lAllocID=62 dwSize=00001020, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0598291c lAllocID=63 dwSize=00000120, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 05982a74 lAllocID=64 dwSize=00000060, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 05900b54 lAllocID=65 dwSize=00000e20, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 05982b0c lAllocID=66 dwSize=00000120, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 05982c64 lAllocID=67 dwSize=00000060, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 059019ac lAllocID=68 dwSize=000003ec, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 05982cfc lAllocID=69 dwSize=00000050, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 05982d84 lAllocID=70 dwSize=00000050, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 05982e0c lAllocID=71 dwSize=00000050, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 05982e94 lAllocID=72 dwSize=00000050, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 05982f1c lAllocID=73 dwSize=00000048, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 05901dcc lAllocID=74 dwSize=00000054, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 05901e54 lAllocID=75 dwSize=00000048, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 05901ed4 lAllocID=78 dwSize=000000b8, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 05901fc4 lAllocID=79 dwSize=00010020, ReturnAddr=6bbed65a (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0591201c lAllocID=80 dwSize=0000007c, ReturnAddr=6bc0a22b (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 059120cc lAllocID=81 dwSize=000000c0, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 059121c4 lAllocID=82 dwSize=0000007c, ReturnAddr=6bc0a22b (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 05912274 lAllocID=83 dwSize=000000c0, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0591236c lAllocID=84 dwSize=0000007c, ReturnAddr=6bc0a22b (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0591241c lAllocID=85 dwSize=000000b0, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 05912504 lAllocID=86 dwSize=0000007c, ReturnAddr=6bc0a22b (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 059125b4 lAllocID=87 dwSize=00000050, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 05982f9c lAllocID=88 dwSize=0000002c, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0591263c lAllocID=89 dwSize=00000028, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0591269c lAllocID=90 dwSize=0000002c, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 058e6fbc lAllocID=91 dwSize=0000517c, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 059126fc lAllocID=92 dwSize=00001020, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 05913754 lAllocID=93 dwSize=0000003c, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 05983004 lAllocID=94 dwSize=00004020, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 059137c4 lAllocID=95 dwSize=0000003c, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 058ec16c lAllocID=96 dwSize=0000183c, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0598705c lAllocID=97 dwSize=0000fab8, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 05913834 lAllocID=98 dwSize=00000068, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 059138d4 lAllocID=99 dwSize=00000140, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 05913a4c lAllocID=100 dwSize=0000003c, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 05996b4c lAllocID=101 dwSize=00004020, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 05913abc lAllocID=102 dwSize=0000003c, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0599aba4 lAllocID=103 dwSize=0000183c, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 05913b2c lAllocID=104 dwSize=0000021c, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 05913d7c lAllocID=105 dwSize=00000224, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 05913fd4 lAllocID=106 dwSize=0000003c, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 05914044 lAllocID=107 dwSize=00000060, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 059141ac lAllocID=109 dwSize=00000050, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 05914234 lAllocID=110 dwSize=00000038, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0599c414 lAllocID=111 dwSize=00000080, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 059142a4 lAllocID=112 dwSize=0000002c, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0599c4cc lAllocID=113 dwSize=00000040, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0599c544 lAllocID=114 dwSize=00000040, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0599c5bc lAllocID=115 dwSize=00000040, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0599c634 lAllocID=116 dwSize=00000060, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0599c6cc lAllocID=117 dwSize=00000030, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 058ed9dc lAllocID=118 dwSize=00000b38, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 058ee54c lAllocID=119 dwSize=00001020, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0599c734 lAllocID=120 dwSize=00000120, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0599c88c lAllocID=121 dwSize=00000060, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0599c924 lAllocID=122 dwSize=00001020, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 058ef5a4 lAllocID=123 dwSize=00000120, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 058ef6fc lAllocID=124 dwSize=00000060, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 058ef794 lAllocID=125 dwSize=00000420, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 058efbec lAllocID=126 dwSize=000000e4, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 058efd04 lAllocID=127 dwSize=00000028, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0599d97c lAllocID=128 dwSize=000053c0, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 059a2d74 lAllocID=129 dwSize=00000420, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 059a31cc lAllocID=130 dwSize=00000420, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 058efd64 lAllocID=131 dwSize=000001a0, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 058eff3c lAllocID=133 dwSize=00000040, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 059a8d24 lAllocID=549 dwSize=00000420, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 059a917c lAllocID=550 dwSize=00000420, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 059a9f04 lAllocID=557 dwSize=00000420, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 059aa35c lAllocID=558 dwSize=00000420, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 059ab06c lAllocID=592 dwSize=00000054, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 059ab5f4 lAllocID=593 dwSize=00000080, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 059ed46c lAllocID=659 dwSize=00000054, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 059ed4f4 lAllocID=660 dwSize=00000080, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0ad2cb34 lAllocID=2383 dwSize=00000420, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0ad2cf8c lAllocID=2384 dwSize=00000420, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0ad2e96c lAllocID=2462 dwSize=00000420, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0ad2edc4 lAllocID=2463 dwSize=00000420, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0adb345c lAllocID=3182 dwSize=000000b8, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0adb354c lAllocID=3183 dwSize=000000a0, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0adb3624 lAllocID=3184 dwSize=0000007c, ReturnAddr=6bc0a22b (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0adb36d4 lAllocID=3185 dwSize=0000005c, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0adb3764 lAllocID=3186 dwSize=00000044, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0adb37dc lAllocID=3187 dwSize=00000024, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0adb3834 lAllocID=3188 dwSize=00000112, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0adb397c lAllocID=3191 dwSize=000000a8, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0adb3a5c lAllocID=3192 dwSize=00000068, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0adb3afc lAllocID=3193 dwSize=0000007c, ReturnAddr=6bc0a22b (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0adb3bac lAllocID=3194 dwSize=00000060, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0adb3c44 lAllocID=3195 dwSize=00000044, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0adb3cbc lAllocID=3196 dwSize=00000024, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0adb3d14 lAllocID=3197 dwSize=00000112, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0adb3e5c lAllocID=3200 dwSize=000000b8, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0adb3f4c lAllocID=3201 dwSize=000000a0, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0adb4024 lAllocID=3202 dwSize=0000007c, ReturnAddr=6bc0a22b (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0adb40d4 lAllocID=3203 dwSize=0000005c, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0adb4164 lAllocID=3204 dwSize=00000044, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0adb41dc lAllocID=3205 dwSize=00000024, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0adb4234 lAllocID=3206 dwSize=00000112, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0adb437c lAllocID=3209 dwSize=000000a8, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0adb445c lAllocID=3210 dwSize=00000068, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0adb44fc lAllocID=3211 dwSize=0000007c, ReturnAddr=6bc0a22b (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0adb45ac lAllocID=3212 dwSize=00000060, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0adb4644 lAllocID=3213 dwSize=00000044, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0adb46bc lAllocID=3214 dwSize=00000024, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0adb4714 lAllocID=3215 dwSize=00000112, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0ad2e3dc lAllocID=3216 dwSize=00000010, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0adb485c lAllocID=3217 dwSize=000001a0, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0adb4a34 lAllocID=3219 dwSize=00000038, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0adb9144 lAllocID=3343 dwSize=00000054, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0adb91cc lAllocID=3344 dwSize=00000080, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0adc2ee4 lAllocID=3600 dwSize=0000018c, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0adc30a4 lAllocID=3601 dwSize=000005c4, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0adb967c lAllocID=3602 dwSize=0000003c, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 059ec8fc lAllocID=3603 dwSize=00000048, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0adbcf14 lAllocID=3604 dwSize=00000028, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 059ec97c lAllocID=3605 dwSize=00000028, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0adc369c lAllocID=3606 dwSize=0000003c, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0adc370c lAllocID=3607 dwSize=000000a0, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 059ec9dc lAllocID=3608 dwSize=00000028, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0adc37e4 lAllocID=3609 dwSize=00000028, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0adc3844 lAllocID=3610 dwSize=00000090, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0adc390c lAllocID=3611 dwSize=00000044, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0adc3984 lAllocID=3612 dwSize=000001e0, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0adc3b9c lAllocID=3613 dwSize=00000028, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0adc3c5c lAllocID=3615 dwSize=00000084, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 059aa964 lAllocID=3623 dwSize=00000028, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0adc2e64 lAllocID=3633 dwSize=00000038, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0adc49a4 lAllocID=3638 dwSize=000009d4, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0adc5f7c lAllocID=3644 dwSize=000009d4, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0adc2c34 lAllocID=3648 dwSize=00000090, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0adc2d7c lAllocID=3652 dwSize=00000090, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0adc5884 lAllocID=3701 dwSize=000001a0, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0ad6d314 lAllocID=3703 dwSize=00000038, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0adc5a5c lAllocID=3704 dwSize=00000054, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0adc5ae4 lAllocID=3705 dwSize=00000080, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0adc5b9c lAllocID=3706 dwSize=000001a0, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0adc5d74 lAllocID=3708 dwSize=00000040, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0adc7124 lAllocID=3713 dwSize=00000080, ReturnAddr=6bbed5ea (pid=000013d4) Direct3D9: (ERROR) :Memory Address: 0adc71dc lAllocID=3714 dwSize=0000007c, ReturnAddr=6bc0b592 (pid=000013d4) Direct3D9: (ERROR) :Total Memory Unfreed From Current Process = 814560 bytes D3DX: MEMORY LEAKS DETECTED: 2 allocations unfreed (182 bytes) D3DX: Set HKLM\Software\Microsoft\Direct3D\D3DXBreakOnAllocId=0x10b4 to debug The program '[5076] TheGame (Debug) .exe: Native' has exited with code 0 (0x0).[/code] Allocations from the checker are down by 20! I am not sure, if I delete [b]boneMatrixPtrs [/b]the right way... Also, [b]+ ID 00000404, tag ID 0x00000000: 0x02824564 8 bytes [skinnedmesh.h:36 (BoneMesh::BoneMesh)][/b] points to BoneMesh(){}. [b]Why?[/b] I can provide you a stripped down program, if that would be helpful.
  2. Hey everyone, I recently adapted code for skinning meshes into my current project, which I took from a book on character animation. But I ran into memory leaks as soon as I tried to import my own character in my own project. The demo code from the book runs fine with my character without ever calling DestroyFrame or DestroyMeshContainer for the BoneHierarchyLoader, to my surprise. I ran into 212 unfreed allocations and tried to clean it up, which, for example included creating a new function that actually traverses the hierarchy and deletes every bone. I got it down to two unfreed locations and I cannot pinpoint them. I even used Evil Steve's memory leak checker. [url="http://www.gamedev.net/topic/482850-free-memory-leak-checker-c/"]http://www.gamedev.n...leak-checker-c/[/url] My output (includes the checker output and D3DX output): (Please notice that only BoneMesh and SkinnedMesh stuff is relevant.) [source]MEMORY : High watermark was 2699428 bytes (2636KB, 2MB) MEMORY : Memory leaks detected! 47 active allocations totalling 1408 bytes: + ID 00000045, tag ID 0x00000000: 0x008A3E44 160 bytes [thegame.cpp:250 (InitTerrain)] + ID 00000393, tag ID 0x00000000: 0x008A427C 44 bytes [gameobject.cpp:459 (createCube)] + ID 00000394, tag ID 0x00000000: 0x008A7D44 16 bytes [gameobject.cpp:459 (createCube)] + ID 00000404, tag ID 0x00000000: 0x008A4564 8 bytes [??:0 (BoneMesh::BoneMesh)] + ID 00000405, tag ID 0x00000000: 0x008A464C 8 bytes [??:0 (BoneMesh::BoneMesh)] + ID 00000408, tag ID 0x00000000: 0x008A4854 20 bytes [skinnedmesh.cpp:111 (BoneHierarchyLoader::CreateMeshContainer)] + ID 00000409, tag ID 0x00000000: 0x008A4944 64 bytes [skinnedmesh.cpp:116 (BoneHierarchyLoader::CreateMeshContainer)] + ID 00000410, tag ID 0x00000000: 0x008A4A64 64 bytes [skinnedmesh.cpp:117 (BoneHierarchyLoader::CreateMeshContainer)] + ID 00000414, tag ID 0x00000000: 0x008A4DDC 8 bytes [??:0 (BoneMesh::BoneMesh)] + ID 00000415, tag ID 0x00000000: 0x09040244 8 bytes [??:0 (BoneMesh::BoneMesh)] + ID 00000418, tag ID 0x00000000: 0x0904052C 20 bytes [skinnedmesh.cpp:111 (BoneHierarchyLoader::CreateMeshContainer)] + ID 00000419, tag ID 0x00000000: 0x0904061C 64 bytes [skinnedmesh.cpp:116 (BoneHierarchyLoader::CreateMeshContainer)] + ID 00000420, tag ID 0x00000000: 0x0904073C 64 bytes [skinnedmesh.cpp:117 (BoneHierarchyLoader::CreateMeshContainer)] + ID 00000424, tag ID 0x00000000: 0x09040BF4 8 bytes [??:0 (BoneMesh::BoneMesh)] + ID 00000425, tag ID 0x00000000: 0x09040CDC 8 bytes [??:0 (BoneMesh::BoneMesh)] + ID 00000428, tag ID 0x00000000: 0x09040FC4 20 bytes [skinnedmesh.cpp:111 (BoneHierarchyLoader::CreateMeshContainer)] + ID 00000429, tag ID 0x00000000: 0x090410B4 64 bytes [skinnedmesh.cpp:116 (BoneHierarchyLoader::CreateMeshContainer)] + ID 00000430, tag ID 0x00000000: 0x090411D4 64 bytes [skinnedmesh.cpp:117 (BoneHierarchyLoader::CreateMeshContainer)] + ID 00000434, tag ID 0x00000000: 0x0904168C 8 bytes [??:0 (BoneMesh::BoneMesh)] + ID 00000435, tag ID 0x00000000: 0x09041774 8 bytes [??:0 (BoneMesh::BoneMesh)] + ID 00000438, tag ID 0x00000000: 0x09041A5C 20 bytes [skinnedmesh.cpp:111 (BoneHierarchyLoader::CreateMeshContainer)] + ID 00000439, tag ID 0x00000000: 0x09041B4C 64 bytes [skinnedmesh.cpp:116 (BoneHierarchyLoader::CreateMeshContainer)] + ID 00000440, tag ID 0x00000000: 0x09041C6C 64 bytes [skinnedmesh.cpp:117 (BoneHierarchyLoader::CreateMeshContainer)] + ID 00000444, tag ID 0x00000000: 0x09042124 8 bytes [??:0 (BoneMesh::BoneMesh)] + ID 00000445, tag ID 0x00000000: 0x0904220C 8 bytes [??:0 (BoneMesh::BoneMesh)] + ID 00000448, tag ID 0x00000000: 0x090424F4 20 bytes [skinnedmesh.cpp:111 (BoneHierarchyLoader::CreateMeshContainer)] + ID 00000449, tag ID 0x00000000: 0x090425E4 64 bytes [skinnedmesh.cpp:116 (BoneHierarchyLoader::CreateMeshContainer)] + ID 00000450, tag ID 0x00000000: 0x09042704 64 bytes [skinnedmesh.cpp:117 (BoneHierarchyLoader::CreateMeshContainer)] + ID 00000451, tag ID 0x00000000: 0x09042824 4 bytes [skinnedmesh.cpp:331 (SkinnedMesh::SetupBoneMatrixPointers)] + ID 00000452, tag ID 0x00000000: 0x09042904 4 bytes [skinnedmesh.cpp:331 (SkinnedMesh::SetupBoneMatrixPointers)] + ID 00000453, tag ID 0x00000000: 0x090429E4 4 bytes [skinnedmesh.cpp:331 (SkinnedMesh::SetupBoneMatrixPointers)] + ID 00000454, tag ID 0x00000000: 0x09042AC4 4 bytes [skinnedmesh.cpp:331 (SkinnedMesh::SetupBoneMatrixPointers)] + ID 00000455, tag ID 0x00000000: 0x09042BA4 4 bytes [skinnedmesh.cpp:331 (SkinnedMesh::SetupBoneMatrixPointers)] + ID 00000456, tag ID 0x00000000: 0x09042C84 4 bytes [gameobject.cpp:459 (createCube)] + ID 00000457, tag ID 0x00000000: 0x09042D64 32 bytes [gameobject.cpp:459 (createCube)] + ID 00000459, tag ID 0x00000000: 0x09042F44 44 bytes [gameobject.cpp:479 (createBase)] + ID 00000460, tag ID 0x00000000: 0x0904304C 12 bytes [gameobject.cpp:479 (createBase)] + ID 00000461, tag ID 0x00000000: 0x09043134 44 bytes [gameobject.cpp:363 (BaseGraphicsComponent::BaseGraphicsComponent)] + ID 00000462, tag ID 0x00000000: 0x0904323C 44 bytes [gameobject.cpp:372 (BaseGraphicsComponent::BaseGraphicsComponent)] + ID 00000463, tag ID 0x00000000: 0x09043344 4 bytes [gameobject.cpp:479 (createBase)] + ID 00000464, tag ID 0x00000000: 0x09043424 8 bytes [gameobject.cpp:479 (createBase)] + ID 00000466, tag ID 0x00000000: 0x090435F4 44 bytes [gameobject.cpp:479 (createBase)] + ID 00000467, tag ID 0x00000000: 0x090436FC 12 bytes [gameobject.cpp:479 (createBase)] + ID 00000468, tag ID 0x00000000: 0x090437E4 44 bytes [gameobject.cpp:363 (BaseGraphicsComponent::BaseGraphicsComponent)] + ID 00000469, tag ID 0x00000000: 0x090438EC 44 bytes [gameobject.cpp:372 (BaseGraphicsComponent::BaseGraphicsComponent)] + ID 00000470, tag ID 0x00000000: 0x09042E64 4 bytes [gameobject.cpp:479 (createBase)] + ID 00000471, tag ID 0x00000000: 0x090439F4 8 bytes [gameobject.cpp:479 (createBase)] End of allocations Memory leaks were foundTheGame (Debug) .exe has triggered a breakpoint The thread 'Win32 Thread' (0x1140) has exited with code 0 (0x0). The thread 'Win32 Thread' (0x418) has exited with code 0 (0x0). The thread 'Win32 Thread' (0x16c8) has exited with code 0 (0x0). The thread 'Win32 Thread' (0xb8c) has exited with code 0 (0x0). The thread 'Win32 Thread' (0x1028) has exited with code 0 (0x0). The thread 'Win32 Thread' (0x148c) has exited with code 0 (0x0). The thread 'Win32 Thread' (0x13f0) has exited with code 0 (0x0). The thread 'Win32 Thread' (0x1144) has exited with code 0 (0x0). The thread 'Win32 Thread' (0x1280) has exited with code 0 (0x0). The thread 'Win32 Thread' (0x1500) has exited with code 0 (0x0). The thread 'Win32 Thread' (0x1080) has exited with code 0 (0x0). The thread 'Win32 Thread' (0x172c) has exited with code 0 (0x0). Direct3D9: (ERROR) :Memory still allocated! Alloc count = 185 Direct3D9: (ERROR) :Current Process (pid) = 0000155c Direct3D9: (ERROR) :Memory Address: 056707fc lAllocID=1 dwSize=00004bc4, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 056753f4 lAllocID=2 dwSize=00000350, ReturnAddr=6b6f02fa (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 0567577c lAllocID=3 dwSize=00000ef0, ReturnAddr=6b6f6401 (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05b3434c lAllocID=5 dwSize=000242b4, ReturnAddr=6b6fe508 (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05b58634 lAllocID=6 dwSize=00001bd8, ReturnAddr=6b6eec04 (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 056766a4 lAllocID=7 dwSize=000005e0, ReturnAddr=6b6eecd5 (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05676cbc lAllocID=8 dwSize=00000014, ReturnAddr=6b6eed27 (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05b10064 lAllocID=12 dwSize=00001950, ReturnAddr=6b6e3cab (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05b5a244 lAllocID=13 dwSize=000005e0, ReturnAddr=6b6e3cf1 (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05676dc4 lAllocID=14 dwSize=00000014, ReturnAddr=6b6e3d3e (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05b5a85c lAllocID=15 dwSize=00000350, ReturnAddr=6b6f02fa (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05b119ec lAllocID=16 dwSize=00000ef0, ReturnAddr=6b6f6401 (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05b5abe4 lAllocID=18 dwSize=0001bd28, ReturnAddr=6b6fe508 (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05b12914 lAllocID=19 dwSize=00001bd8, ReturnAddr=6b6eec04 (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05b76944 lAllocID=20 dwSize=000005c0, ReturnAddr=6b6eecd5 (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05b76f3c lAllocID=21 dwSize=00000014, ReturnAddr=6b6eed27 (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05b14524 lAllocID=23 dwSize=00001950, ReturnAddr=6b6e3cab (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05b15eac lAllocID=24 dwSize=000005c0, ReturnAddr=6b6e3cf1 (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05b76f84 lAllocID=25 dwSize=00000014, ReturnAddr=6b6e3d3e (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05676e0c lAllocID=26 dwSize=00000044, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05676e84 lAllocID=27 dwSize=00000050, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05b1682c lAllocID=35 dwSize=00000ef0, ReturnAddr=6b6f6401 (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05676f0c lAllocID=36 dwSize=00000030, ReturnAddr=6b700881 (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05b17754 lAllocID=37 dwSize=00001bd8, ReturnAddr=6b6eec04 (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05b19364 lAllocID=38 dwSize=000005e0, ReturnAddr=6b6eecd5 (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05676f74 lAllocID=39 dwSize=00000014, ReturnAddr=6b6eed27 (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05b1997c lAllocID=41 dwSize=00004138, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05b1daec lAllocID=42 dwSize=00000198, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05b164a4 lAllocID=43 dwSize=00000030, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05b1dcbc lAllocID=44 dwSize=00001020, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05b1ed14 lAllocID=45 dwSize=00000a48, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05b1650c lAllocID=46 dwSize=00000098, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05b165dc lAllocID=47 dwSize=0000007c, ReturnAddr=6b70a22b (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05b1668c lAllocID=48 dwSize=00000024, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05b166e4 lAllocID=49 dwSize=00000098, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05b1f794 lAllocID=50 dwSize=0000007c, ReturnAddr=6b70a22b (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05b167b4 lAllocID=51 dwSize=00000044, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05b1f844 lAllocID=52 dwSize=00000024, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05b1f89c lAllocID=53 dwSize=000000a8, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05b1f97c lAllocID=54 dwSize=00000098, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05b1fa4c lAllocID=55 dwSize=0000007c, ReturnAddr=6b70a22b (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05b76fcc lAllocID=56 dwSize=0002b330, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05ba2334 lAllocID=57 dwSize=0000002c, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05ba2394 lAllocID=58 dwSize=00000028, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05ba23f4 lAllocID=59 dwSize=00000420, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05ba284c lAllocID=60 dwSize=00000030, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05ba28b4 lAllocID=61 dwSize=00000030, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05b1fafc lAllocID=62 dwSize=00001020, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05ba291c lAllocID=63 dwSize=00000120, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05ba2a74 lAllocID=64 dwSize=00000060, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05b20b54 lAllocID=65 dwSize=00000e20, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05ba2b0c lAllocID=66 dwSize=00000120, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05ba2c64 lAllocID=67 dwSize=00000060, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05b219ac lAllocID=68 dwSize=000003ec, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05ba2cfc lAllocID=69 dwSize=00000050, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05ba2d84 lAllocID=70 dwSize=00000050, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05ba2e0c lAllocID=71 dwSize=00000050, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05ba2e94 lAllocID=72 dwSize=00000050, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05ba2f1c lAllocID=73 dwSize=00000048, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05b21dcc lAllocID=74 dwSize=00000054, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05b21e54 lAllocID=75 dwSize=00000048, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05b21ed4 lAllocID=78 dwSize=000000b8, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05b21fc4 lAllocID=79 dwSize=00010020, ReturnAddr=6b6ed65a (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05b3201c lAllocID=80 dwSize=0000007c, ReturnAddr=6b70a22b (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05b320cc lAllocID=81 dwSize=000000c0, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05b321c4 lAllocID=82 dwSize=0000007c, ReturnAddr=6b70a22b (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05b32274 lAllocID=83 dwSize=000000c0, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05b3236c lAllocID=84 dwSize=0000007c, ReturnAddr=6b70a22b (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05b3241c lAllocID=85 dwSize=000000b0, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05b32504 lAllocID=86 dwSize=0000007c, ReturnAddr=6b70a22b (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05b325b4 lAllocID=87 dwSize=00000050, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05ba2f9c lAllocID=88 dwSize=0000002c, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05b3263c lAllocID=89 dwSize=00000028, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05b3269c lAllocID=90 dwSize=0000002c, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05676fbc lAllocID=91 dwSize=0000517c, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05b326fc lAllocID=92 dwSize=00001020, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05b33754 lAllocID=93 dwSize=0000003c, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05ba3004 lAllocID=94 dwSize=00004020, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05b337c4 lAllocID=95 dwSize=0000003c, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 0567c16c lAllocID=96 dwSize=0000183c, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05ba705c lAllocID=97 dwSize=0000fab8, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05b33834 lAllocID=98 dwSize=00000068, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05b338d4 lAllocID=99 dwSize=00000140, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05b33a4c lAllocID=100 dwSize=0000003c, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05bb6b4c lAllocID=101 dwSize=00004020, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05b33abc lAllocID=102 dwSize=0000003c, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05bbaba4 lAllocID=103 dwSize=0000183c, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05b33b2c lAllocID=104 dwSize=0000021c, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05b33d7c lAllocID=105 dwSize=00000224, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05b33fd4 lAllocID=106 dwSize=0000003c, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05b34044 lAllocID=107 dwSize=00000060, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05b341ac lAllocID=109 dwSize=00000050, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05b34234 lAllocID=110 dwSize=00000038, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05bbc414 lAllocID=111 dwSize=00000080, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05b342a4 lAllocID=112 dwSize=0000002c, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05bbc4cc lAllocID=113 dwSize=00000040, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05bbc544 lAllocID=114 dwSize=00000040, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05bbc5bc lAllocID=115 dwSize=00000040, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05bbc634 lAllocID=116 dwSize=00000060, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05bbc6cc lAllocID=117 dwSize=00000030, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 0567d9dc lAllocID=118 dwSize=00000b38, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 0567e54c lAllocID=119 dwSize=00001020, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05bbc734 lAllocID=120 dwSize=00000120, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05bbc88c lAllocID=121 dwSize=00000060, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05bbc924 lAllocID=122 dwSize=00001020, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 0567f5a4 lAllocID=123 dwSize=00000120, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 0567f6fc lAllocID=124 dwSize=00000060, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 0567f794 lAllocID=125 dwSize=00000420, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 0567fbec lAllocID=126 dwSize=000000e4, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 0567fd04 lAllocID=127 dwSize=00000028, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05bbd97c lAllocID=128 dwSize=000053c0, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05bc2d74 lAllocID=129 dwSize=00000420, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05bc31cc lAllocID=130 dwSize=00000420, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 0567fd64 lAllocID=131 dwSize=000001a0, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 0567ff3c lAllocID=133 dwSize=00000040, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05bc8d24 lAllocID=549 dwSize=00000420, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05bc917c lAllocID=550 dwSize=00000420, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05bc9954 lAllocID=553 dwSize=00000420, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05bc9f04 lAllocID=557 dwSize=00000420, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05bca35c lAllocID=558 dwSize=00000420, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05bcb06c lAllocID=592 dwSize=00000054, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05bcb5f4 lAllocID=593 dwSize=00000080, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05c0c8fc lAllocID=628 dwSize=00000114, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05c0ca44 lAllocID=629 dwSize=000003e4, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05b340dc lAllocID=630 dwSize=0000003c, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05c0ce5c lAllocID=631 dwSize=00000048, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05b3414c lAllocID=632 dwSize=00000028, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05c0c60c lAllocID=633 dwSize=00000028, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05c0cedc lAllocID=634 dwSize=0000003c, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05c0cf4c lAllocID=635 dwSize=00000028, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05bca964 lAllocID=643 dwSize=00000028, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05c0c45c lAllocID=651 dwSize=00000090, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05bc9864 lAllocID=655 dwSize=000000a0, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05c0d46c lAllocID=659 dwSize=00000054, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 05c0d4f4 lAllocID=660 dwSize=00000080, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 0addcb34 lAllocID=2383 dwSize=00000420, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 0addcf8c lAllocID=2384 dwSize=00000420, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 0adde96c lAllocID=2462 dwSize=00000420, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 0addedc4 lAllocID=2463 dwSize=00000420, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 0ae6345c lAllocID=3182 dwSize=000000b8, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 0ae6354c lAllocID=3183 dwSize=000000a0, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 0ae63624 lAllocID=3184 dwSize=0000007c, ReturnAddr=6b70a22b (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 0ae636d4 lAllocID=3185 dwSize=0000005c, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 0ae63764 lAllocID=3186 dwSize=00000044, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 0ae637dc lAllocID=3187 dwSize=00000024, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 0ae63834 lAllocID=3188 dwSize=00000112, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 0ae6397c lAllocID=3191 dwSize=000000a8, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 0ae63a5c lAllocID=3192 dwSize=00000068, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 0ae63afc lAllocID=3193 dwSize=0000007c, ReturnAddr=6b70a22b (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 0ae63bac lAllocID=3194 dwSize=00000060, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 0ae63c44 lAllocID=3195 dwSize=00000044, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 0ae63cbc lAllocID=3196 dwSize=00000024, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 0ae63d14 lAllocID=3197 dwSize=00000112, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 0ae63e5c lAllocID=3200 dwSize=000000b8, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 0ae63f4c lAllocID=3201 dwSize=000000a0, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 0ae64024 lAllocID=3202 dwSize=0000007c, ReturnAddr=6b70a22b (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 0ae640d4 lAllocID=3203 dwSize=0000005c, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 0ae64164 lAllocID=3204 dwSize=00000044, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 0ae641dc lAllocID=3205 dwSize=00000024, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 0ae64234 lAllocID=3206 dwSize=00000112, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 0ae6437c lAllocID=3209 dwSize=000000a8, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 0ae6445c lAllocID=3210 dwSize=00000068, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 0ae644fc lAllocID=3211 dwSize=0000007c, ReturnAddr=6b70a22b (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 0ae645ac lAllocID=3212 dwSize=00000060, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 0ae64644 lAllocID=3213 dwSize=00000044, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 0ae646bc lAllocID=3214 dwSize=00000024, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 0ae64714 lAllocID=3215 dwSize=00000112, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 0adde3dc lAllocID=3216 dwSize=00000010, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 0ae6485c lAllocID=3217 dwSize=000001a0, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 0ae64a34 lAllocID=3219 dwSize=00000038, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 0ae69144 lAllocID=3343 dwSize=00000054, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 0ae691cc lAllocID=3344 dwSize=00000080, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 0ae699d4 lAllocID=3363 dwSize=00000028, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 0ae69284 lAllocID=3373 dwSize=00000044, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 0ae6a1a4 lAllocID=3383 dwSize=00000084, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 0ae69574 lAllocID=3387 dwSize=000001e0, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 0ae6a48c lAllocID=3391 dwSize=000001e0, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 0ae6e4b4 lAllocID=3501 dwSize=000001a0, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 0ae6e68c lAllocID=3503 dwSize=00000038, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 0ae6e6fc lAllocID=3504 dwSize=00000054, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 0ae6e784 lAllocID=3505 dwSize=00000080, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 0ae6e83c lAllocID=3506 dwSize=000001a0, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 0ae6ea14 lAllocID=3508 dwSize=00000040, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 0ae6ed04 lAllocID=3513 dwSize=00000080, ReturnAddr=6b6ed5ea (pid=0000155c) Direct3D9: (ERROR) :Memory Address: 0ae6edbc lAllocID=3514 dwSize=0000007c, ReturnAddr=6b70b592 (pid=0000155c) Direct3D9: (ERROR) :Total Memory Unfreed From Current Process = 810080 bytes D3DX: MEMORY LEAKS DETECTED: 2 allocations unfreed (182 bytes) D3DX: Set HKLM\Software\Microsoft\Direct3D\D3DXBreakOnAllocId=0x10b4 to debug The program '[5468] TheGame (Debug) .exe: Native' has exited with code 0 (0x0).[/source] SkinnedMesh.h [source] #ifndef SKINNED_MESH_H #define SKINNED_MESH_H #include <windows.h> #include <d3dx9.h> #include <string> #include <vector> #include "TriBase.h" class Camera; class BoneHierarchyLoader; using namespace std; struct Bone: public D3DXFRAME { D3DXMATRIX CombinedTransformationMatrix; }; struct BoneMesh: public D3DXMESHCONTAINER { ID3DXMesh* OriginalMesh; vector<D3DMATERIAL9> materials; vector<IDirect3DTexture9*> textures; DWORD NumAttributeGroups; D3DXATTRIBUTERANGE* attributeTable; D3DXMATRIX** boneMatrixPtrs; D3DXMATRIX* boneOffsetMatrices; D3DXMATRIX* currentBoneMatrices; }; class SkinnedMesh { public: SkinnedMesh(); ~SkinnedMesh(); void Load(char fileName[]); void Render(Bone *bone); void RenderStart(Bone *bone, Camera & cam, D3DXMATRIX world); void SetPose(D3DXMATRIX world, float time); void SetAnimation(string name); void GetAnimations(vector<string> &animations); ID3DXAnimationController* GetController(); private: void UpdateMatrices(Bone* bone, D3DXMATRIX *parentMatrix); void SetupBoneMatrixPointers(Bone *bone); void Destroy(LPD3DXFRAME bone, BoneHierarchyLoader& bh); D3DXFRAME *m_pRootBone; ID3DXAnimationController *m_pAnimControl; ID3DXEffect* m_pEffect; }; #endif SKINNED_MESH_H[/source] SkinnedMesh.cpp [source]#include "skinnedMesh.h" #include <fstream> #include "Camera.h" #pragma warning(disable:4996) //extern IDirect3DDevice9* g_pDevice; //extern ID3DXEffect *g_pEffect; //extern ofstream g_debug; class BoneHierarchyLoader: public ID3DXAllocateHierarchy { public: STDMETHOD(CreateFrame)(THIS_ LPCSTR Name, LPD3DXFRAME *ppNewFrame); STDMETHOD(CreateMeshContainer)(THIS_ LPCTSTR Name, CONST D3DXMESHDATA * pMeshData, CONST D3DXMATERIAL * pMaterials, CONST D3DXEFFECTINSTANCE * pEffectInstances, DWORD NumMaterials, CONST DWORD * pAdjacency, LPD3DXSKININFO pSkinInfo, LPD3DXMESHCONTAINER * ppNewMeshContainer); STDMETHOD(DestroyFrame)(THIS_ LPD3DXFRAME pFrameToFree); STDMETHOD(DestroyMeshContainer)(THIS_ LPD3DXMESHCONTAINER pMeshContainerBase); }; HRESULT BoneHierarchyLoader::CreateFrame(LPCSTR Name, LPD3DXFRAME *ppNewFrame) { Bone *newBone = new Bone; memset(newBone, 0, sizeof(Bone)); //Copy name if(Name != NULL) { newBone->Name = new char[strlen(Name)+1]; strcpy(newBone->Name, Name); } //Set the transformation matrices D3DXMatrixIdentity(&newBone->TransformationMatrix); D3DXMatrixIdentity(&newBone->CombinedTransformationMatrix); //Return the new bone... *ppNewFrame = (D3DXFRAME*)newBone; return S_OK; } HRESULT BoneHierarchyLoader::CreateMeshContainer(LPCSTR Name, CONST D3DXMESHDATA *pMeshData, CONST D3DXMATERIAL *pMaterials, CONST D3DXEFFECTINSTANCE *pEffectInstances, DWORD NumMaterials, CONST DWORD *pAdjacency, LPD3DXSKININFO pSkinInfo, LPD3DXMESHCONTAINER *ppNewMeshContainer) { //Create new Bone Mesh BoneMesh *boneMesh = new BoneMesh; memset(boneMesh, 0, sizeof(BoneMesh)); //Get mesh data boneMesh->OriginalMesh = pMeshData->pMesh; boneMesh->MeshData.pMesh = pMeshData->pMesh; boneMesh->MeshData.Type = pMeshData->Type; pMeshData->pMesh->AddRef(); //Add Reference so that the mesh isnt deallocated IDirect3DDevice9 *g_pDevice = NULL; pMeshData->pMesh->GetDevice(&g_pDevice); //Get g_pDevice ptr from mesh //Copy materials and load textures (just like with a static mesh) for(int i=0;i<(int)NumMaterials;i++) { D3DXMATERIAL mtrl; memcpy(&mtrl, &pMaterials[i], sizeof(D3DXMATERIAL)); boneMesh->materials.push_back(mtrl.MatD3D); IDirect3DTexture9* newTexture = NULL; if(mtrl.pTextureFilename != NULL) { char textureFname[200]; strcpy(textureFname, "_GRAPHICS/"); strcat(textureFname, mtrl.pTextureFilename); //Load texture D3DXCreateTextureFromFile(g_pDevice, textureFname, &newTexture); } boneMesh->textures.push_back(newTexture); } if(pSkinInfo != NULL) { //Get Skin Info boneMesh->pSkinInfo = pSkinInfo; pSkinInfo->AddRef(); //Add reference so that the SkinInfo isnt deallocated DWORD maxVertInfluences = 0; DWORD numBoneComboEntries = 0; ID3DXBuffer* boneComboTable = 0; pSkinInfo->ConvertToIndexedBlendedMesh(pMeshData->pMesh, D3DXMESH_MANAGED | D3DXMESH_WRITEONLY, 30, 0, // ignore adjacency in 0, // ignore adjacency out 0, // ignore face remap 0, // ignore vertex remap &maxVertInfluences, &numBoneComboEntries, &boneComboTable, &boneMesh->MeshData.pMesh); if(boneComboTable != NULL) boneComboTable->Release(); //Get Attribute Table boneMesh->MeshData.pMesh->GetAttributeTable(NULL, &boneMesh->NumAttributeGroups); ################actual line 111######### boneMesh->attributeTable = new D3DXATTRIBUTERANGE[boneMesh->NumAttributeGroups]; boneMesh->MeshData.pMesh->GetAttributeTable(boneMesh->attributeTable, NULL); //Create bone offset and current matrices int NumBones = pSkinInfo->GetNumBones(); boneMesh->boneOffsetMatrices = new D3DXMATRIX[NumBones]; ###########116########### boneMesh->currentBoneMatrices = new D3DXMATRIX[NumBones]; #########117############ //Get bone offset matrices for(int i=0;i < NumBones;i++) boneMesh->boneOffsetMatrices[i] = *(boneMesh->pSkinInfo->GetBoneOffsetMatrix(i)); } //Set ppNewMeshContainer to the newly created boneMesh container *ppNewMeshContainer = boneMesh; return S_OK; } HRESULT BoneHierarchyLoader::DestroyFrame(LPD3DXFRAME pFrameToFree) { if(pFrameToFree) { //Free name if(pFrameToFree->Name != NULL) delete [] pFrameToFree->Name; //Free bone delete pFrameToFree; } pFrameToFree = NULL; return S_OK; } HRESULT BoneHierarchyLoader::DestroyMeshContainer(LPD3DXMESHCONTAINER pMeshContainerBase) { BoneMesh *boneMesh = (BoneMesh*)pMeshContainerBase; //Release textures int numTextures = (int)boneMesh->textures.size(); for(int i=0;i < numTextures;i++) if(boneMesh->textures[i] != NULL) boneMesh->textures[i]->Release(); //Release mesh data if(boneMesh->MeshData.pMesh) boneMesh->MeshData.pMesh->Release(); if(boneMesh->pSkinInfo) boneMesh->pSkinInfo->Release(); if(boneMesh->OriginalMesh) boneMesh->OriginalMesh->Release(); delete boneMesh; return S_OK; } ////////////////////////////////////////////////////////////////////////////////////////////////// // SKINNED MESH // ////////////////////////////////////////////////////////////////////////////////////////////////// struct VERTEX{ VERTEX(); VERTEX(D3DXVECTOR3 pos, D3DCOLOR col){position = pos; color = col;} D3DXVECTOR3 position; D3DCOLOR color; static const DWORD FVF; }; const DWORD VERTEX::FVF = D3DFVF_XYZ | D3DFVF_DIFFUSE; SkinnedMesh::SkinnedMesh() { m_pRootBone = NULL; m_pAnimControl = NULL; m_pEffect = NULL; } SkinnedMesh::~SkinnedMesh() { BoneHierarchyLoader boneHierarchy; Destroy(m_pRootBone, boneHierarchy); if(m_pAnimControl) m_pAnimControl->Release(); m_pEffect->Release(); } void SkinnedMesh::Load(char fileName[]) { BoneHierarchyLoader boneHierarchy; D3DXLoadMeshHierarchyFromX(fileName, D3DXMESH_MANAGED, tbDirect3D::Instance().GetDevice(), &boneHierarchy, NULL, &m_pRootBone, &m_pAnimControl); SetupBoneMatrixPointers((Bone*)m_pRootBone); //Update all the bones D3DXMATRIX i; D3DXMatrixIdentity(&i); UpdateMatrices((Bone*)m_pRootBone, &i); //Set up the effect ID3DXBuffer *pErrorMsgs = NULL; HRESULT hRes = D3DXCreateEffectFromFile(tbDirect3D::Instance().GetDevice(), "_GRAPHICS/lighting.fx", NULL, NULL, D3DXSHADER_DEBUG, NULL, &m_pEffect, &pErrorMsgs); if(FAILED(hRes) && (pErrorMsgs != NULL)) //Failed to create Effect { tbWriteToLog( (char*)pErrorMsgs->GetBufferPointer()); MessageBox(tbDirect3D::Instance().GetWindow(), "Fehler beim Erstellen eines .fx!", "Fehler", MB_OK | MB_ICONEXCLAMATION); } } void SkinnedMesh::UpdateMatrices(Bone* bone, D3DXMATRIX *parentMatrix) { if(bone == NULL)return; D3DXMatrixMultiply(&bone->CombinedTransformationMatrix, &bone->TransformationMatrix, parentMatrix); if(bone->pFrameSibling)UpdateMatrices((Bone*)bone->pFrameSibling, parentMatrix); if(bone->pFrameFirstChild)UpdateMatrices((Bone*)bone->pFrameFirstChild, &bone->CombinedTransformationMatrix); } void SkinnedMesh::Render(Bone *bone) { if(bone == NULL)bone = (Bone*)m_pRootBone; //If there is a mesh to render... if(bone->pMeshContainer != NULL) { BoneMesh *boneMesh = (BoneMesh*)bone->pMeshContainer; if (boneMesh->pSkinInfo != NULL) { // set up bone transforms int numBones = boneMesh->pSkinInfo->GetNumBones(); for(int i=0;i < numBones;i++) { D3DXMatrixMultiply(&boneMesh->currentBoneMatrices[i], &boneMesh->boneOffsetMatrices[i], boneMesh->boneMatrixPtrs[i]); } D3DXMATRIX view, proj, identity; m_pEffect->SetMatrixArray("FinalTransforms", boneMesh->currentBoneMatrices, boneMesh->pSkinInfo->GetNumBones()); D3DXMatrixIdentity(&identity); //Render the mesh for(int i=0;i < (int)boneMesh->NumAttributeGroups;i++) { int mtrlIndex = boneMesh->attributeTable[i].AttribId; tbDirect3D::Instance().GetDevice()->SetMaterial(&(boneMesh->materials[mtrlIndex])); tbDirect3D::Instance().GetDevice()->SetTexture(0, boneMesh->textures[mtrlIndex]); //m_pEffect->SetMatrix("matW", &identity); m_pEffect->SetTexture("texDiffuse", boneMesh->textures[mtrlIndex]); D3DXHANDLE hTech = m_pEffect->GetTechniqueByName("Skinning"); m_pEffect->SetTechnique(hTech); m_pEffect->Begin(NULL, NULL); m_pEffect->BeginPass(0); boneMesh->MeshData.pMesh->DrawSubset(mtrlIndex); m_pEffect->EndPass(); m_pEffect->End(); } } else { //Normal Static Mesh m_pEffect->SetMatrix("matW", &bone->CombinedTransformationMatrix); D3DXHANDLE hTech = m_pEffect->GetTechniqueByName("Lighting"); m_pEffect->SetTechnique(hTech); //Render the mesh int numMaterials = (int)boneMesh->materials.size(); for(int i=0;i < numMaterials;i++) { tbDirect3D::Instance().GetDevice()->SetMaterial(&boneMesh->materials[i]); m_pEffect->SetTexture("texDiffuse", boneMesh->textures[i]); m_pEffect->Begin(NULL, NULL); m_pEffect->BeginPass(0); boneMesh->OriginalMesh->DrawSubset(i); m_pEffect->EndPass(); m_pEffect->End(); } } } if(bone->pFrameSibling != NULL)Render((Bone*)bone->pFrameSibling); if(bone->pFrameFirstChild != NULL)Render((Bone*)bone->pFrameFirstChild); } void SkinnedMesh::RenderStart(Bone *bone, Camera & cam, D3DXMATRIX world) { tbDirect3D& D3D = tbDirect3D::Instance(); D3DXVECTOR4 lightPos(10.0f, 120.0f, 0.0f, 0.0f); m_pEffect->SetMatrix("matW", &world); m_pEffect->SetMatrix("matVP", &(cam.view()*cam.proj())); m_pEffect->SetVector("lightPos", &lightPos); Render(bone); } void SkinnedMesh::SetupBoneMatrixPointers(Bone *bone) { if(bone->pMeshContainer != NULL) { BoneMesh *boneMesh = (BoneMesh*)bone->pMeshContainer; if(boneMesh->pSkinInfo != NULL) { int NumBones = boneMesh->pSkinInfo->GetNumBones(); boneMesh->boneMatrixPtrs = new D3DXMATRIX*[NumBones]; ############actual line 331############## for(int i=0;i < NumBones;i++) { Bone *b = (Bone*)D3DXFrameFind(m_pRootBone, boneMesh->pSkinInfo->GetBoneName(i)); if(b != NULL)boneMesh->boneMatrixPtrs[i] = &b->CombinedTransformationMatrix; else boneMesh->boneMatrixPtrs[i] = NULL; } } } if(bone->pFrameSibling != NULL)SetupBoneMatrixPointers((Bone*)bone->pFrameSibling); if(bone->pFrameFirstChild != NULL)SetupBoneMatrixPointers((Bone*)bone->pFrameFirstChild); } void SkinnedMesh::SetPose(D3DXMATRIX world, float time) { m_pAnimControl->AdvanceTime(time, NULL); UpdateMatrices((Bone*)m_pRootBone, &world); } void SkinnedMesh::SetAnimation(string name) { ID3DXAnimationSet *anim = NULL; int numAnims = (int)m_pAnimControl->GetMaxNumAnimationSets(); for(int i=0;i<numAnims;i++) { anim = NULL; m_pAnimControl->GetAnimationSet(i, &anim); if(anim != NULL) { if(strcmp(name.c_str(), anim->GetName()) == 0) m_pAnimControl->SetTrackAnimationSet(0, anim); anim->Release(); } } } void SkinnedMesh::GetAnimations(vector<string> &animations) { ID3DXAnimationSet *anim = NULL; for(int i=0;i<(int)m_pAnimControl->GetMaxNumAnimationSets();i++) { anim = NULL; m_pAnimControl->GetAnimationSet(i, &anim); if(anim != NULL) { animations.push_back(anim->GetName()); anim->Release(); } } } ID3DXAnimationController* SkinnedMesh::GetController() { ID3DXAnimationController* newAnimController = NULL; if(m_pAnimControl != NULL) { m_pAnimControl->CloneAnimationController(m_pAnimControl->GetMaxNumAnimationOutputs(), m_pAnimControl->GetMaxNumAnimationSets(), m_pAnimControl->GetMaxNumTracks(), m_pAnimControl->GetMaxNumEvents(), &newAnimController); } return newAnimController; } void SkinnedMesh::Destroy(LPD3DXFRAME bone, BoneHierarchyLoader& bh) { if((BoneMesh *) bone->pMeshContainer != NULL) { bh.DestroyMeshContainer(bone->pMeshContainer); } if(bone->pFrameSibling != NULL) Destroy(bone->pFrameSibling, bh); if(bone->pFrameFirstChild != NULL) Destroy(bone->pFrameFirstChild, bh); bh.DestroyFrame(bone); }[/source] I've marked some of the code lines from the checker output. Any ideas what I forgot?
  3. You guys nailed it, thank you so much! I was unaware of the fact, that I still have to include the header in my cpp file.
  4. [b][size=8][font=verdana,geneva,sans-serif]---------SOLVED-----------[/font][/size][/b] [b]Include the headers in your .cpp when you forward declare! [/b][img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img] Hello gamdev, I am working on a 3D game and I want to give my camera object now a reference to my player (a [b]GameObject[/b]) instead of only a 3D vector [i]- which I used to direct my camera at the player's position-[/i] so that it can change the orientation of the player. All my headers have inclusion guards and the according source files only include the header. But now I get weird errors when I include [b]"Camera.h"[/b]: [code]1>------ Build started: Project: TheGame, Configuration: Debug Win32 ------ 1> Camera.cpp 1>c:\users\jonas\desktop\thegame\terrain.h(19): error C2143: syntax error : missing ';' before '*' 1>c:\users\jonas\desktop\thegame\terrain.h(19): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>c:\users\jonas\desktop\thegame\terrain.h(19): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>c:\users\jonas\desktop\thegame\terrain.h(32): error C2061: syntax error : identifier 'Camera' 1>c:\users\jonas\desktop\thegame\terrain.h(52): error C2061: syntax error : identifier 'Camera' 1>c:\users\jonas\desktop\thegame\terrain.h(55): error C2061: syntax error : identifier 'Camera' 1>c:\users\jonas\desktop\thegame\terrain.h(56): error C2061: syntax error : identifier 'Camera' 1> Terrain.cpp 1>c:\users\jonas\desktop\thegame\gameobject.h(22): error C2061: syntax error : identifier 'Terrain' 1>c:\users\jonas\desktop\thegame\gameobject.h(63): error C2061: syntax error : identifier 'Terrain' 1>c:\users\jonas\desktop\thegame\gameobject.h(65): error C2065: 'terrain' : undeclared identifier 1> TheGame.cpp 1>c:\users\jonas\desktop\thegame\terrain.h(19): error C2143: syntax error : missing ';' before '*' 1>c:\users\jonas\desktop\thegame\terrain.h(19): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>c:\users\jonas\desktop\thegame\terrain.h(19): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>c:\users\jonas\desktop\thegame\terrain.h(32): error C2061: syntax error : identifier 'Camera' 1>c:\users\jonas\desktop\thegame\terrain.h(52): error C2061: syntax error : identifier 'Camera' 1>c:\users\jonas\desktop\thegame\terrain.h(55): error C2061: syntax error : identifier 'Camera' 1>c:\users\jonas\desktop\thegame\terrain.h(56): error C2061: syntax error : identifier 'Camera' 1>c:\users\jonas\desktop\thegame\thegame.cpp(111): error C2660: 'Terrain::draw' : function does not take 3 arguments 1>c:\users\jonas\desktop\thegame\thegame.cpp(249): error C2661: 'Terrain::Terrain' : no overloaded function takes 12 arguments 1> Generating Code... ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== [/code] According to this link: [url="http://www.cplusplus.com/forum/articles/10627/"]http://www.cplusplus...articles/10627/[/url] I don't really need to be that drastic so I tried a forward declaration: [code]1>------ Build started: Project: TheGame, Configuration: Debug Win32 ------ 1> Camera.cpp 1>c:\users\jonas\desktop\thegame\camera.cpp(217): error C2027: use of undefined type 'GameObject' 1> c:\users\jonas\desktop\thegame\camera.h(4) : see declaration of 'GameObject' 1>c:\users\jonas\desktop\thegame\camera.cpp(217): error C2228: left of '.Position' must have class/struct/union 1>c:\users\jonas\desktop\thegame\camera.cpp(217): error C2228: left of '.x' must have class/struct/union 1>c:\users\jonas\desktop\thegame\camera.cpp(217): error C2027: use of undefined type 'GameObject' 1> c:\users\jonas\desktop\thegame\camera.h(4) : see declaration of 'GameObject' 1>c:\users\jonas\desktop\thegame\camera.cpp(217): error C2228: left of '.Position' must have class/struct/union 1>c:\users\jonas\desktop\thegame\camera.cpp(217): error C2228: left of '.y' must have class/struct/union 1>c:\users\jonas\desktop\thegame\camera.cpp(217): error C2027: use of undefined type 'GameObject' 1> c:\users\jonas\desktop\thegame\camera.h(4) : see declaration of 'GameObject' 1>c:\users\jonas\desktop\thegame\camera.cpp(217): error C2228: left of '.Position' must have class/struct/union 1>c:\users\jonas\desktop\thegame\camera.cpp(217): error C2228: left of '.z' must have class/struct/union 1>c:\users\jonas\desktop\thegame\camera.cpp(218): error C2027: use of undefined type 'GameObject' 1> c:\users\jonas\desktop\thegame\camera.h(4) : see declaration of 'GameObject' 1>c:\users\jonas\desktop\thegame\camera.cpp(218): error C2228: left of '.Position' must have class/struct/union 1> GameObject.cpp 1> Terrain.cpp 1> TheGame.cpp 1> Generating Code... ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== [/code] Why is it undefined? So in my first approach my [b]Camera.h[/b] includes [b]GameObject.h[/b] because of a reference to a GameObject object as a function parameter ([i]too drastic[/i]). In [b]GameObject.h[/b] I include [b]Terrain.h[/b] because of pointer to a Terrain object as a function parameter ([i]so my GameObjects stay on the terrain, also too drastic[/i]). In [b]Terrain.h[/b] I pass a camera reference as a function parameter and save a camera pointer in a class contained in the terrain class, so I include [b]Camera.h[/b]. ([i]for some culling, and again too drastic![/i]) So I basically have a cyclic dependency. I tried to forward declare in those files: [code]1>------ Build started: Project: TheGame, Configuration: Debug Win32 ------ 1> Camera.cpp 1>c:\users\jonas\desktop\thegame\camera.cpp(217): error C2027: use of undefined type 'GameObject' 1> c:\users\jonas\desktop\thegame\camera.h(4) : see declaration of 'GameObject' 1>c:\users\jonas\desktop\thegame\camera.cpp(217): error C2228: left of '.Position' must have class/struct/union 1>c:\users\jonas\desktop\thegame\camera.cpp(217): error C2228: left of '.x' must have class/struct/union 1>c:\users\jonas\desktop\thegame\camera.cpp(217): error C2027: use of undefined type 'GameObject' 1> c:\users\jonas\desktop\thegame\camera.h(4) : see declaration of 'GameObject' 1>c:\users\jonas\desktop\thegame\camera.cpp(217): error C2228: left of '.Position' must have class/struct/union 1>c:\users\jonas\desktop\thegame\camera.cpp(217): error C2228: left of '.y' must have class/struct/union 1>c:\users\jonas\desktop\thegame\camera.cpp(217): error C2027: use of undefined type 'GameObject' 1> c:\users\jonas\desktop\thegame\camera.h(4) : see declaration of 'GameObject' 1>c:\users\jonas\desktop\thegame\camera.cpp(217): error C2228: left of '.Position' must have class/struct/union 1>c:\users\jonas\desktop\thegame\camera.cpp(217): error C2228: left of '.z' must have class/struct/union 1>c:\users\jonas\desktop\thegame\camera.cpp(218): error C2027: use of undefined type 'GameObject' 1> c:\users\jonas\desktop\thegame\camera.h(4) : see declaration of 'GameObject' 1>c:\users\jonas\desktop\thegame\camera.cpp(218): error C2228: left of '.Position' must have class/struct/union 1> GameObject.cpp 1>c:\users\jonas\desktop\thegame\gameobject.cpp(64): error C2027: use of undefined type 'Terrain' 1> c:\users\jonas\desktop\thegame\gameobject.h(5) : see declaration of 'Terrain' 1>c:\users\jonas\desktop\thegame\gameobject.cpp(64): error C2227: left of '->getWidth' must point to class/struct/union/generic type 1>c:\users\jonas\desktop\thegame\gameobject.cpp(65): error C2027: use of undefined type 'Terrain' 1> c:\users\jonas\desktop\thegame\gameobject.h(5) : see declaration of 'Terrain' 1>c:\users\jonas\desktop\thegame\gameobject.cpp(65): error C2227: left of '->getDepth' must point to class/struct/union/generic type 1>c:\users\jonas\desktop\thegame\gameobject.cpp(78): error C2027: use of undefined type 'Terrain' 1> c:\users\jonas\desktop\thegame\gameobject.h(5) : see declaration of 'Terrain' 1>c:\users\jonas\desktop\thegame\gameobject.cpp(78): error C2227: left of '->getHeight' must point to class/struct/union/generic type 1>c:\users\jonas\desktop\thegame\gameobject.cpp(320): error C2027: use of undefined type 'Terrain' 1> c:\users\jonas\desktop\thegame\gameobject.h(5) : see declaration of 'Terrain' 1>c:\users\jonas\desktop\thegame\gameobject.cpp(320): error C2227: left of '->getHeight' must point to class/struct/union/generic type 1> Terrain.cpp 1>c:\users\jonas\desktop\thegame\terrain.cpp(117): error C2027: use of undefined type 'Camera' 1> c:\users\jonas\desktop\thegame\terrain.h(4) : see declaration of 'Camera' 1>c:\users\jonas\desktop\thegame\terrain.cpp(117): error C2227: left of '->pos' must point to class/struct/union/generic type 1>c:\users\jonas\desktop\thegame\terrain.cpp(118): error C2027: use of undefined type 'Camera' 1> c:\users\jonas\desktop\thegame\terrain.h(4) : see declaration of 'Camera' 1>c:\users\jonas\desktop\thegame\terrain.cpp(118): error C2227: left of '->pos' must point to class/struct/union/generic type 1>c:\users\jonas\desktop\thegame\terrain.cpp(128): error C2027: use of undefined type 'Camera' 1> c:\users\jonas\desktop\thegame\terrain.h(4) : see declaration of 'Camera' 1>c:\users\jonas\desktop\thegame\terrain.cpp(128): error C2228: left of '.isVisible' must have class/struct/union 1> TheGame.cpp 1> Generating Code... ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== [/code] My main still includes the according headers, and I use these objects like this: [code]Camera g_Camera; Terrain* g_Terrain; std::vector<GameObject*> g_GameObjectList;[/code] Do I have to forward declare Terrain and GameObject, too? Well, at the moment it gives me more of the same errors when I do. Any advice?
  5. [quote name='rip-off' timestamp='1330645783' post='4918420'] Your SubGrid type is an inner class of Terrain. However, it has no relationship with the parent class. That is, a SubGrid isn't associated with any [i]particular[/i] Terrain instance. One solution is to put a pointer to Terrain in the SubGrid (intiialised in the constructor). The operator<() can use this pointer to access the camera. As Washu correctly points out - this is a basic language issue. [quote] Well I took out everything that is not part of the problem. [/quote] No, there is still a huge amount of code in that that is nothing to do with the problem. This is what the code would look like if you had taken everything out: [code] #ifndef CAMERA_H #define CAMERA_H class Camera { bool example; }; #endif #ifndef TERRAIN_H #define TERRAIN_H class Terrain { public: Terrain(Camera &camera); class SubGrid { bool operator<(const SubGrid &other) const; }; private: Camera &camera; }; #endif #include "terrain.h" Terrain::Terrain(Camera &camera) : camera(camera) { } bool Terrain::SubGrid::operator<(const SubGrid &other) const { return camera.example; } int main() { } [/code] This code distils the essence of your problem - it should generate exactly the error you were looking at. Also note that the code dump you gave is not properly indented, which makes it very difficult to decipher. Once again, having less code would make this less of an issue. As an aside, it is usually a good idea to not use references as members. References have strange semantics as members because they are not reseatable. Instead, convert the reference to a pointer. The constructor can still take a reference, which neatly documents the intent of the class. [/quote] Thank you!
  6. The reason my problem [b]actually exists[/b] is because I do not want to use my camera class globally, like in Luna's initial code example.
  7. [quote name='Washu' timestamp='1330638427' post='4918376'] Look up the error code, it tells you [url="http://msdn.microsoft.com/en-us/library/ac27ea0d%28v=vs.71%29.aspx"]EXACTLY [/url]what's wrong. [/quote] I've looked into it before and I am still clueless. SubGrid does not know mCamera. Using Terrain::mCamera does not work. Making mCamera static also. :/ Thanks for your help, though. It says: "Camera & Terrain::mCamera Error: a nonstatic member reference must be relative to a specific object" But this gets called after the constructor where I pass the specific object (the reference) to mCamera. I'm clueless.
  8. Thanks, but these errors remain: [code]1>------ Build started: Project: TheGame, Configuration: Debug Win32 ------ 1> Terrain.cpp 1>c:\-\thegame\terrain.cpp(121): error C2327: 'Terrain::mCamera' : is not a type name, static, or enumerator 1>c:-\\thegame\terrain.cpp(121): error C2065: 'mCamera' : undeclared identifier 1>c:\-\thegame\terrain.cpp(121): error C2228: left of '.getPos' must have class/struct/union 1> type is ''unknown-type'' 1>c:\-\thegame\terrain.cpp(121): error C2228: left of '.vD3DVector' must have class/struct/union 1>c:\-\thegame\terrain.cpp(122): error C2327: 'Terrain::mCamera' : is not a type name, static, or enumerator 1>c:\-\thegame\terrain.cpp(122): error C2065: 'mCamera' : undeclared identifier 1>c:\-\thegame\terrain.cpp(122): error C2228: left of '.getPos' must have class/struct/union 1> type is ''unknown-type'' 1>c:\-\thegame\terrain.cpp(122): error C2228: left of '.vD3DVector' must have class/struct/union[/code]
  9. Well I took out everything that is not part of the problem. Here's the complete source code of terrain: [code]#ifndef TERRAIN_H #define TERRAIN_H #include "Heightmap.h" #include "d3dUtil.h" #include "Vertex.h" #include "Camera.h" class Terrain { public: Terrain(UINT vertRows, UINT vertCols, float dx, float dz, char * heightmap, char * tex0, char *tex1, char * tex2, char * blendMap, float heightScale, float yOffset, Camera & cam); ~Terrain(); DWORD getNumTriangles(); DWORD getNumVertices(); float getWidth(); float getDepth(); void onLostDevice(); void onResetDevice(); // (x, z) relative to terrain's local space. float getHeight(float x, float z); void setDirToSunW(const D3DXVECTOR3& d); void draw(D3DXMATRIX& view, D3DXMATRIX& proj); private: void buildGeometry(); void buildSubGridMesh(RECT& R, VertexPNT* gridVerts); void buildEffect(); Camera & mCamera; struct SubGrid { ID3DXMesh* mesh; AABB box; // For sorting. bool operator<(const SubGrid& rhs)const; const static int NUM_ROWS = 33; const static int NUM_COLS = 33; const static int NUM_TRIS = (NUM_ROWS-1)*(NUM_COLS-1)*2; const static int NUM_VERTS = NUM_ROWS*NUM_COLS; }; private: Heightmap mHeightmap; std::vector<SubGrid> mSubGrids; DWORD mVertRows; DWORD mVertCols; float mWidth; float mDepth; float mDX; float mDZ; IDirect3DTexture9* mTex0; IDirect3DTexture9* mTex1; IDirect3DTexture9* mTex2; IDirect3DTexture9* mBlendMap; ID3DXEffect* mFX; D3DXHANDLE mhTech; D3DXHANDLE mhViewProj; D3DXHANDLE mhDirToSunW; D3DXHANDLE mhTex0; D3DXHANDLE mhTex1; D3DXHANDLE mhTex2; D3DXHANDLE mhBlendMap; }; #endif // TERRAIN_H[/code] I marked the errors down below. [code]#include "Terrain.h" #include <list> Terrain::Terrain(UINT vertRows, UINT vertCols, float dx, float dz, char * heightmap, char *tex0, char *tex1, char * tex2, char *blendMap, float heightScale, float yOffset, Camera & cam):mCamera(cam) // <--- Like this? { mVertRows = vertRows; mVertCols = vertCols; mDX = dx; mDZ = dz; mWidth = (mVertCols-1)*mDX; mDepth = (mVertRows-1)*mDZ; mHeightmap.loadRAW(vertRows, vertCols, heightmap, heightScale, yOffset); tbTextureManager& tm = tbTextureManager::Instance(); mBlendMap = tm.GetTexture(blendMap); mTex0 = tm.GetTexture(tex0); mTex1 = tm.GetTexture(tex1); mTex2 = tm.GetTexture(tex2); buildGeometry(); buildEffect(); } Terrain::~Terrain() { for(UINT i = 0; i < mSubGrids.size(); ++i) ReleaseCOM(mSubGrids[i].mesh); ReleaseCOM(mFX); ReleaseCOM(mTex0); ReleaseCOM(mTex1); ReleaseCOM(mTex2); ReleaseCOM(mBlendMap); } DWORD Terrain::getNumTriangles() { return (DWORD)mSubGrids.size()*mSubGrids[0].mesh->GetNumFaces(); } DWORD Terrain::getNumVertices() { return (DWORD)mSubGrids.size()*mSubGrids[0].mesh->GetNumVertices(); } float Terrain::getWidth() { return mWidth; } float Terrain::getDepth() { return mDepth; } void Terrain::onLostDevice() { HR(mFX->OnLostDevice()); } void Terrain::onResetDevice() { HR(mFX->OnResetDevice()); } float Terrain::getHeight(float x, float z) { // Transform from terrain local space to "cell" space. float c = (x + 0.5f*mWidth) / mDX; float d = (z - 0.5f*mDepth) / -mDZ; // Get the row and column we are in. int row = (int)floorf(d); int col = (int)floorf(c); // Grab the heights of the cell we are in. // A*--*B // | /| // |/ | // C*--*D float A = mHeightmap(row, col); float B = mHeightmap(row, col+1); float C = mHeightmap(row+1, col); float D = mHeightmap(row+1, col+1); // Where we are relative to the cell. float s = c - (float)col; float t = d - (float)row; // If upper triangle ABC. if(t < 1.0f - s) { float uy = B - A; float vy = C - A; return A + s*uy + t*vy; } else // lower triangle DCB. { float uy = C - D; float vy = B - D; return D + (1.0f-s)*uy + (1.0f-t)*vy; } } void Terrain::setDirToSunW(const D3DXVECTOR3& d) { HR(mFX->SetValue(mhDirToSunW, &d, sizeof(D3DXVECTOR3))); } bool Terrain::SubGrid::operator<(const SubGrid& rhs) const { D3DXVECTOR3 d1 = box.center() - mCamera->getPos().vD3DVector; // ERROR D3DXVECTOR3 d2 = rhs.box.center() - mCamera->getPos().vD3DVector; // ERROR return D3DXVec3LengthSq(&d1) < D3DXVec3LengthSq(&d2); } void Terrain::draw(D3DXMATRIX& view, D3DXMATRIX& proj) { // Frustum cull sub-grids. std::list<SubGrid> visibleSubGrids; for(UINT i = 0; i < mSubGrids.size(); ++i) { if( mCamera->isVisible(mSubGrids[i].box) ) // ERROR visibleSubGrids.push_back(mSubGrids[i]); } // Sort front-to-back from camera. visibleSubGrids.sort(); HR(mFX->SetMatrix(mhViewProj, &(view*proj))); HR(mFX->SetTechnique(mhTech)); UINT numPasses = 0; HR(mFX->Begin(&numPasses, 0)); HR(mFX->BeginPass(0)); for(std::list<SubGrid>::iterator iter = visibleSubGrids.begin(); iter != visibleSubGrids.end(); ++iter) HR(iter->mesh->DrawSubset(0)); HR(mFX->EndPass()); HR(mFX->End()); } void Terrain::buildGeometry() { //=============================================================== // Create one large mesh for the grid in system memory. DWORD numTris = (mVertRows-1)*(mVertCols-1)*2; DWORD numVerts = mVertRows*mVertCols; ID3DXMesh* mesh = 0; D3DVERTEXELEMENT9 elems[MAX_FVF_DECL_SIZE]; UINT numElems = 0; HR(VertexPNT::Decl->GetDeclaration(elems, &numElems)); // Use Scratch pool since we are using this mesh purely for some CPU work, // which will be used to create the sub-grids that the graphics card // will actually draw. HR(D3DXCreateMesh(numTris, numVerts, D3DPOOL_SCRATCH|D3DXMESH_32BIT, elems, tbDirect3D::Instance().GetDevice(), &mesh)); //=============================================================== // Write the grid vertices and triangles to the mesh. VertexPNT* v = 0; HR(mesh->LockVertexBuffer(0, (void**)&v)); std::vector<D3DXVECTOR3> verts; std::vector<DWORD> indices; GenTriGrid(mVertRows, mVertCols, mDX, mDZ, D3DXVECTOR3(0.0f, 0.0f, 0.0f), verts, indices); float w = mWidth; float d = mDepth; for(UINT i = 0; i < mesh->GetNumVertices(); ++i) { // We store the grid vertices in a linear array, but we can // convert the linear array index to an (r, c) matrix index. int r = i / mVertCols; int c = i % mVertCols; v[i].pos = verts[i]; v[i].pos.y = mHeightmap(r, c); v[i].tex0.x = (v[i].pos.x + (0.5f*w)) / w; v[i].tex0.y = (v[i].pos.z - (0.5f*d)) / -d; } // Write triangle data so we can compute normals. DWORD* indexBuffPtr = 0; HR(mesh->LockIndexBuffer(0, (void**)&indexBuffPtr)); for(UINT i = 0; i < mesh->GetNumFaces(); ++i) { indexBuffPtr[i*3+0] = indices[i*3+0]; indexBuffPtr[i*3+1] = indices[i*3+1]; indexBuffPtr[i*3+2] = indices[i*3+2]; } HR(mesh->UnlockIndexBuffer()); // Compute Vertex Normals. HR(D3DXComputeNormals(mesh, 0)); //=============================================================== // Now break the grid up into subgrid meshes. // Find out the number of subgrids we'll have. For example, if // m = 513, n = 257, SUBGRID_VERT_ROWS = SUBGRID_VERT_COLS = 33, // then subGridRows = 512/32 = 16 and sibGridCols = 256/32 = 8. int subGridRows = (mVertRows-1) / (SubGrid::NUM_ROWS-1); int subGridCols = (mVertCols-1) / (SubGrid::NUM_COLS-1); for(int r = 0; r < subGridRows; ++r) { for(int c = 0; c < subGridCols; ++c) { // Rectangle that indicates (via matrix indices ij) the // portion of grid vertices to use for this subgrid. RECT R = { c * (SubGrid::NUM_COLS-1), r * (SubGrid::NUM_ROWS-1), (c+1) * (SubGrid::NUM_COLS-1), (r+1) * (SubGrid::NUM_ROWS-1) }; buildSubGridMesh(R, v); } } HR(mesh->UnlockVertexBuffer()); ReleaseCOM(mesh); // Done with global mesh. } void Terrain::buildSubGridMesh(RECT& R, VertexPNT* gridVerts) { //=============================================================== // Get indices for subgrid (we don't use the verts here--the verts // are given by the parameter gridVerts). std::vector<D3DXVECTOR3> tempVerts; std::vector<DWORD> tempIndices; GenTriGrid(SubGrid::NUM_ROWS, SubGrid::NUM_COLS, mDX, mDZ, D3DXVECTOR3(0.0f, 0.0f, 0.0f), tempVerts, tempIndices); ID3DXMesh* subMesh = 0; D3DVERTEXELEMENT9 elems[MAX_FVF_DECL_SIZE]; UINT numElems = 0; HR(VertexPNT::Decl->GetDeclaration(elems, &numElems)); HR(D3DXCreateMesh(SubGrid::NUM_TRIS, SubGrid::NUM_VERTS, D3DXMESH_MANAGED, elems, tbDirect3D::Instance().GetDevice(), &subMesh)); //=============================================================== // Build Vertex Buffer. Copy rectangle of vertices from the // grid into the subgrid structure. VertexPNT* v = 0; HR(subMesh->LockVertexBuffer(0, (void**)&v)); int k = 0; for(int i = R.top; i <= R.bottom; ++i) { for(int j = R.left; j <= R.right; ++j) { v[k++] = gridVerts[i*mVertCols+j]; } } //=============================================================== // Compute the bounding box before unlocking the vertex buffer. AABB bndBox; HR(D3DXComputeBoundingBox((D3DXVECTOR3*)v, subMesh->GetNumVertices(), sizeof(VertexPNT), &bndBox.minPt, &bndBox.maxPt)); HR(subMesh->UnlockVertexBuffer()); //=============================================================== // Build Index and Attribute Buffer. WORD* indices = 0; DWORD* attBuff = 0; HR(subMesh->LockIndexBuffer(0, (void**)&indices)); HR(subMesh->LockAttributeBuffer(0, &attBuff)); for(int i = 0; i < SubGrid::NUM_TRIS; ++i) { indices[i*3+0] = (WORD)tempIndices[i*3+0]; indices[i*3+1] = (WORD)tempIndices[i*3+1]; indices[i*3+2] = (WORD)tempIndices[i*3+2]; attBuff[i] = 0; // All in subset 0. } HR(subMesh->UnlockIndexBuffer()); HR(subMesh->UnlockAttributeBuffer()); //=============================================================== // Optimize for the vertex cache and build attribute table. DWORD* adj = new DWORD[subMesh->GetNumFaces()*3]; HR(subMesh->GenerateAdjacency(EPSILON, adj)); HR(subMesh->OptimizeInplace(D3DXMESHOPT_VERTEXCACHE|D3DXMESHOPT_ATTRSORT, adj, 0, 0, 0)); delete[] adj; //=============================================================== // Save the mesh and bounding box. SubGrid g; g.mesh = subMesh; g.box = bndBox; mSubGrids.push_back(g); } void Terrain::buildEffect() { ID3DXBuffer* errors = 0; HR(D3DXCreateEffectFromFile(tbDirect3D::Instance().GetDevice(), "Terrain.fx", 0, 0, D3DXSHADER_DEBUG, 0, &mFX, &errors)); if( errors ) MessageBox(0, (char*)errors->GetBufferPointer(), 0, 0); mhTech = mFX->GetTechniqueByName("TerrainTech"); mhViewProj = mFX->GetParameterByName(0, "gViewProj"); mhDirToSunW = mFX->GetParameterByName(0, "gDirToSunW"); mhTex0 = mFX->GetParameterByName(0, "gTex0"); mhTex1 = mFX->GetParameterByName(0, "gTex1"); mhTex2 = mFX->GetParameterByName(0, "gTex2"); mhBlendMap = mFX->GetParameterByName(0, "gBlendMap"); HR(mFX->SetTexture(mhTex0, mTex0)); HR(mFX->SetTexture(mhTex1, mTex1)); HR(mFX->SetTexture(mhTex2, mTex2)); HR(mFX->SetTexture(mhBlendMap, mBlendMap)); }[/code] Main (beware of German commentary! InitTerrain plays a key role here.) [code] // =================== // Hier werden die Direct3D-Klassen der TriBase-Engine angewandt. #include <TriBase.h> #include "Resource.h" #include "Config.h" #include "Vertex.h" #include "Camera.h" #include "GameObject.h" #include "Terrain.h" // ****************************************************************** // Globale Variablen tbConfig g_Config; // Konfigurationsstruktur PDIRECT3DCUBETEXTURE9 g_pEnvMap = NULL; // Umgebungstextur tbEffect* g_pSkyBoxEffect = NULL; // Sky-Box-Effekt tbVertexBuffer* g_pSkyBoxVB = NULL; // Sky-Box-Vertex-Buffer tbIndexBuffer* g_pSkyBoxIB = NULL; // Sky-Box-Index-Buffer tbFont* g_pFont1 = NULL; // Erste Schriftart float g_fTime = 0.0f; // Globaler Zeitzähler Camera g_Camera; /// Kamera GameObject* g_Cube; /// Würfel Terrain* g_Terrain; /// Landschaft tbModel* g_pDuckModel; /// Platzhaltermodell // ****************************************************************** // Die Move-Funktion tbResult MoveProc(float fNumSecsPassed) { tbVector3 vCameraDir; // Den Zeitzähler aktualisieren g_fTime += fNumSecsPassed; // Input //--------------------------------------------------------------- g_Cube->UpdateInput(fNumSecsPassed); g_Camera.moveCamera(g_Cube->Position, fNumSecsPassed); // Physics // -------------------------------------------------------------- //g_Terrain->setDirToSunW(D3DXVECTOR3(cos(fNumSecsPassed), sin(fNumSecsPassed) , 0.0f)); // looks nice g_Cube->UpdatePhysics(g_Terrain, fNumSecsPassed); return TB_OK; } // ****************************************************************** // Die Render-Funktion tbResult RenderProc(float fNumSecsPassed) { tbMatrix mWorld; int iNumPasses; tbDirect3D& D3D = tbDirect3D::Instance(); //Z-Buffer clearen, Skybox überschreibt das Bild D3D->Clear(0,NULL, D3DCLEAR_ZBUFFER,D3DCOLOR_XRGB(0, 0,0), 1.0f, 0); // Die Szene beginnen D3D->BeginScene(); // ------------------------------------------------------------------ g_Camera.setUpCamera(); // ------------------------------------------------------------------ // Z-Buffer deaktivieren, Dithering aktivieren D3D.SetRS(D3DRS_ZENABLE, FALSE); D3D.SetRS(D3DRS_DITHERENABLE, TRUE); // Die Umgebungstextur setzen D3D.SetTexture(0, g_pEnvMap); D3D.SetTSS(1, D3DTSS_COLOROP, D3DTOP_DISABLE); // Weltmatrix erstellen, die die Sky-Box zur Kamera hin schiebt mWorld = tbMatrixTranslation(g_Camera.getPos()); D3D.SetTransform(D3DTS_WORLD, mWorld); // Vertex- und Index-Buffer aktivieren und das Vertexformat setzen D3D->SetStreamSource(0, g_pSkyBoxVB->GetVB(), 0, sizeof(SSkyBoxVertex)); D3D->SetIndices(g_pSkyBoxIB->GetIB()); D3D.SetFVF(SSkyBoxVertex::dwFVF); // Zeichnen! iNumPasses = g_pSkyBoxEffect->Begin(); for(int iPass = 0; iPass < iNumPasses; iPass++) { g_pSkyBoxEffect->Pass(iPass); D3D->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, 0, 8, 0, 12); } g_pSkyBoxEffect->End(); //------------------------------------------------------------------- D3D.SetRS(D3DRS_ZENABLE, TRUE); g_Terrain->draw((D3DXMATRIX&) g_Camera.getViewMatrix(), (D3DXMATRIX&) g_Camera.getProjMatrix() ); //------------------------------------------------------------------- g_Cube->UpdateGraphics(g_fTime); //------------------------------------------------------------------- ///ENTE D3DLIGHT9 Light; // Ein Richtungslicht erstellen mit der Richtung der Kamera ZeroMemory(&Light, sizeof(D3DLIGHT9)); Light.Type = D3DLIGHT_DIRECTIONAL; Light.Diffuse = tbColor(0.5f, 0.5f, 0.5f); Light.Ambient = tbColor(0.5f, 0.5f, 0.5f); Light.Specular = tbColor(0.5f, 0.5f, 0.5f); Light.Direction = g_Camera.getTarget(); D3D->SetLight(0, &Light); D3D->LightEnable(0, TRUE); // Weltmatrix zurücksetzen D3D.SetTransform(D3DTS_WORLD, tbMatrixIdentity()); D3D.SetRS(D3DRS_LIGHTING, TRUE); g_pDuckModel->Render(-1, -1, TRUE, FALSE); //------------------------------------------------------------------- // Debug-Hilfen char acText[256]; // Speichert die Nachricht tbVector3 camPos = g_Camera.getPos(); g_pFont1->Begin(); sprintf(acText, "Camera: %.2f | %.2f | %.2f", camPos.x, camPos.y, camPos.z); g_pFont1->DrawTextA(tbVector2(10.0f,10.0f), acText); sprintf(acText, "Player: %.2f | %.2f | %.2f", g_Cube->Position.x, g_Cube->Position.y, g_Cube->Position.z); g_pFont1->DrawTextA(tbVector2(10.0f,30.0f), acText); switch(g_Camera.getMode()) { case FREE_FLYING: {sprintf(acText, "Camera mode: Free flying"); break;} case BIRDS_EYE_PLAYER: {sprintf(acText, "Camera mode: Bird's eye on player"); break;} case FOLLOW_PLAYER: {sprintf(acText, "Camera mode: Follow player"); break;} case FOLLOW_PLAYER_LEFT: {sprintf(acText, "Camera mode: Follow left of player"); break;} case FOLLOW_PLAYER_RIGHT: {sprintf(acText, "Camera mode: Follow Right of player"); break;} } g_pFont1->DrawTextA(tbVector2(10.0f,50.0f), acText); g_pFont1->End(); // ------------------------------------------------------------------ // Szene beenden D3D->EndScene(); return TB_OK; } // ****************************************************************** // Initialisierung der Sky-Box tbResult InitSkyBox() { SSkyBoxVertex aVertex[8]; // Vertex- und Index-Buffer erstellen. 8 Vertizes, 36 Indizes. g_pSkyBoxVB = new tbVertexBuffer; if(g_pSkyBoxVB->Init(8 * sizeof(SSkyBoxVertex), sizeof(SSkyBoxVertex), SSkyBoxVertex::dwFVF, D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY, D3DPOOL_DEFAULT)) { // Fehler! return TB_ERROR; } // Nun der Index-Buffer (16 Bits pro Index) g_pSkyBoxIB = new tbIndexBuffer; if(g_pSkyBoxIB->Init(36 * sizeof(WORD), sizeof(WORD), D3DFMT_INDEX16)) { // Fehler! return TB_ERROR; } // ------------------------------------------------------------------ // Die Vertizes erstellen aVertex[0].vPosition = tbVector3(-1.0f, 1.0f, 1.0f); aVertex[1].vPosition = tbVector3( 1.0f, 1.0f, 1.0f); aVertex[2].vPosition = tbVector3( 1.0f, 1.0f, -1.0f); aVertex[3].vPosition = tbVector3(-1.0f, 1.0f, -1.0f); aVertex[4].vPosition = tbVector3(-1.0f, -1.0f, 1.0f); aVertex[5].vPosition = tbVector3( 1.0f, -1.0f, 1.0f); aVertex[6].vPosition = tbVector3( 1.0f, -1.0f, -1.0f); aVertex[7].vPosition = tbVector3(-1.0f, -1.0f, -1.0f); // Die Texturkoordinaten entsprechen den Vertexpositionen for(int iVertex = 0; iVertex < 8; iVertex++) { // Texturkoordinate eintragen aVertex[iVertex].vTexture = aVertex[iVertex].vPosition; } // Alle Vertizes eintragen und den Vertex-Buffer aktualisieren g_pSkyBoxVB->AddVertices(8, aVertex); if(g_pSkyBoxVB->Update()) return TB_ERROR; // ------------------------------------------------------------------ // Den Index-Buffer ausfüllen WORD awIndex[36] = {7, 3, 0, 4, 7, 0, // Vorderseite 5, 1, 2, 6, 5, 2, // Hinterseite 4, 0, 1, 5, 4, 1, // Linke Seite 6, 2, 3, 7, 6, 3, // Rechte Seite 2, 1, 0, 3, 2, 0, // Oberseite 4, 5, 6, 7, 4, 6}; // Unterseite g_pSkyBoxIB->AddIndices(36, awIndex); if(g_pSkyBoxIB->Update()) return TB_ERROR; // ------------------------------------------------------------------ // Die Textur der Sky-Box laden g_pEnvMap = tbTextureManager::Instance().GetCubeTexture("_GRAPHICS/EnvMap.dds"); if(g_pEnvMap == NULL) return TB_ERROR; // Effekt laden g_pSkyBoxEffect = new tbEffect; if(g_pSkyBoxEffect == NULL) return TB_ERROR; if(g_pSkyBoxEffect->Init("_GRAPHICS/SkyBox.fx")) return TB_ERROR; return TB_OK; } // ****************************************************************** // Initialisierung der Schriftarten tbResult InitFonts() { // Erste Schriftart... g_pFont1 = new tbFont; if(g_pFont1->Init("_GRAPHICS/Futura_8_22.tga", "_GRAPHICS/Futura_8_22.tbf")) { // Fehler... return TB_ERROR; } return TB_OK; } // ****************************************************************** // Initialisierung des Terrains tbResult InitTerrain() { InitVertexDeclaration(); g_Terrain = new Terrain(257, 257, 0.5f, 0.5f, "heightmap17_257.raw", "_GRAPHICS/grass.dds", "_GRAPHICS/dirt.dds", "_GRAPHICS/stone.dds", "_GRAPHICS/blend_hm17.dds", 0.2f, 0.0f, g_Camera); g_Terrain->setDirToSunW(D3DXVECTOR3(0.0f, 1.0f, 0.0f)); if (g_Terrain == NULL) return TB_ERROR; else return TB_OK; } // ****************************************************************** // Aufräumen tbResult CleanUp() { /// tbDirect3D& D3D = tbDirect3D::Instance(); // Textur deaktivieren und löschen D3D->SetTexture(0, NULL); // Vertex- und Index-Buffer deaktivieren und löschen D3D->SetStreamSource(0, NULL, 0, 0); D3D->SetIndices(NULL); // Terrain benutzt Declaration anstatt FVF DestroyVertexDeclaration(); g_Terrain->~Terrain(); // Alles löschen tbDirect3D::Instance().Exit(); tbTextureManager::Instance().Exit(); tbDirectInput::Instance().Exit(); TB_SAFE_DELETE(g_pDuckModel); TB_SAFE_DELETE(g_pSkyBoxEffect); TB_SAFE_DELETE(g_pSkyBoxVB); TB_SAFE_DELETE(g_pSkyBoxIB); TB_SAFE_DELETE(g_pFont1); delete g_Cube; // Die TriBase-Engine herunterfahren tbExit(); return TB_OK; } // ****************************************************************** // Windows-Hauptfunktion int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, char* pcCommandLine, int iShowCommand) { // TriBase-Engine initialisieren tbInit(); tbResult r; // Konfiguration abfragen if (tbFileExists("Config.txt")) { if (r = loadConfig(&g_Config, "Config.txt")) { // Fehler! MessageBox(NULL, "Fehler beim Laden der Konfiguration!", "Fehler", MB_OK | MB_ICONEXCLAMATION); return 1; } } else { if(r = tbDoConfigDialog(&g_Config)) // Hier wird der Dialog gestartet. { if(r == TB_CANCELED) return 0; else { // Fehler! MessageBox(NULL, "Fehler im Konfigurationsdialog!", "Fehler", MB_OK | MB_ICONEXCLAMATION); return 1; } } if (r = saveConfig(&g_Config, "Config.txt")) // ausgewählte Config wird automatisch gespeichert. { // Fehler! MessageBox(NULL, "Fehler beim Speichern der Konfiguration!", "Fehler", MB_OK | MB_ICONEXCLAMATION); return 1; } } // Direct3D initialisieren if(tbDirect3D::Instance().Init(&g_Config, // Hier wird die Konfiguration weitergegeben. "Game. Work in progress.", NULL, LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON1)))) { // Fehler! MessageBox(NULL, "Fehler bei der Direct3D-Initialisierung!", "Fehler", MB_OK | MB_ICONEXCLAMATION); CleanUp(); return 1; } // Den Texturmanager initialisieren if(tbDirectInput::Instance().Init()) { MessageBox(tbDirect3D::Instance().GetWindow(), "Fehler beim Initialisieren von tbDirectInput!", "Fehler", MB_OK | MB_ICONEXCLAMATION); CleanUp(); return 1; } // Den Texturmanager initialisieren if(tbTextureManager::Instance().Init()) { MessageBox(tbDirect3D::Instance().GetWindow(), "Fehler beim Initialisieren des Texturmanagers!", "Fehler", MB_OK | MB_ICONEXCLAMATION); CleanUp(); return 1; } // Die Sky-Box initialisieren if(InitSkyBox()) { MessageBox(tbDirect3D::Instance().GetWindow(), "Fehler beim Initialisieren der Sky-Box!", "Fehler", MB_OK | MB_ICONEXCLAMATION); CleanUp(); return 1; } // Die Schriftarten initialisieren if (InitFonts()) { MessageBox(tbDirect3D::Instance().GetWindow(), "Fehler beim Initialisieren der Schriftarten!", "Fehler", MB_OK | MB_ICONEXCLAMATION); CleanUp(); return 1; } g_Camera = Camera(tbVector3(0.0f,30.0f,0.0f)); // Das Terrain initialisieren if (InitTerrain()) { MessageBox(tbDirect3D::Instance().GetWindow(), "Fehler beim Initialisieren des Terrains!", "Fehler", MB_OK | MB_ICONEXCLAMATION); CleanUp(); return 1; } // Das Stadtmodell laden g_pDuckModel = new tbModel; if(g_pDuckModel->Init("_GRAPHICS/Ente.tbm")) { MessageBox(tbDirect3D::Instance().GetWindow(), "Fehler beim Laden der Entenmodelldatei!", "Fehler", MB_OK | MB_ICONEXCLAMATION); CleanUp(); return 1; } /// GameObjects initialisieren g_Cube = createCube(tbVector3(10.0f, 24.0f,0.0f)); if(tbDoMessageLoop(MoveProc, RenderProc)) { MessageBox(tbDirect3D::Instance().GetWindow(), "Fehler beim Zeichnen!", "Fehler", MB_OK | MB_ICONEXCLAMATION); CleanUp(); return 1; } // Aufräumen CleanUp(); return 0; } [/code] [code]#ifndef CAMERA_H #define CAMERA_H #include "TriBase.h" #include "d3dUtil.h" enum CameraMode {FREE_FLYING, FOLLOW_PLAYER, FOLLOW_PLAYER_LEFT, FOLLOW_PLAYER_RIGHT, BIRDS_EYE_PLAYER}; class Camera { private: tbVector3 m_vCameraPos; // Kameraposition float m_fCameraRot; // Rotation der Kamera float m_fCameraUpDown; // Schaut die Kamera hoch oder runter? tbVector3 m_vCameraDir; // Wohin schaut die Kamera? int m_iCameraMode; // Modus der Kamera tbMatrix mProjection; // Für die Projektions-Matrix tbMatrix mView; // Für die View-Matrix // Frustum Planes D3DXPLANE mFrustumPlanes[6]; // [0] = near // [1] = far // [2] = left // [3] = right // [4] = top // [5] = bottom public: Camera() { m_vCameraPos = (0.0f, 30.0f, 0.0f); m_iCameraMode = FOLLOW_PLAYER; m_fCameraUpDown = 0.0f; m_fCameraRot = 0.0f; m_vCameraDir = tbVector3(sinf(m_fCameraRot) * cosf(m_fCameraUpDown), sinf(m_fCameraUpDown), cosf(m_fCameraRot) * cosf(m_fCameraUpDown)); } Camera(tbVector3 pos) { m_vCameraPos = pos; m_iCameraMode = FOLLOW_PLAYER; m_fCameraUpDown = 0.0f; m_fCameraRot = 0.0f; m_vCameraDir = tbVector3(sinf(m_fCameraRot) * cosf(m_fCameraUpDown), sinf(m_fCameraUpDown), cosf(m_fCameraRot) * cosf(m_fCameraUpDown)); } tbVector3 getPos(){ return m_vCameraPos; } tbVector3 getTarget() { return m_vCameraDir; } int getMode(){ return m_iCameraMode; } tbMatrix getProjMatrix() { return mProjection; } tbMatrix getViewMatrix() { return mView; } void moveCamera(tbVector3 vTarget, float fTime); void setUpCamera(); void buildWorldFrustumPlanes(); // Box coordinates should be relative to world space. bool isVisible(const AABB& box) const; }; #endif CAMERA_H[/code] [code]#include "Camera.h" void Camera::moveCamera(tbVector3 vTarget, float fTime) { switch (m_iCameraMode) { case FREE_FLYING: { // Tastatursteuerung... m_vCameraDir = tbVector3(sinf(m_fCameraRot) * cosf(m_fCameraUpDown), sinf(m_fCameraUpDown), cosf(m_fCameraRot) * cosf(m_fCameraUpDown)); if(GetAsyncKeyState(VK_A)) m_fCameraRot -= 1.0f * fTime; if(GetAsyncKeyState(VK_D)) m_fCameraRot += 1.0f * fTime; if(GetAsyncKeyState(VK_UP)) m_fCameraUpDown -= 1.0f * fTime; if(GetAsyncKeyState(VK_DOWN)) m_fCameraUpDown += 1.0f * fTime; if(GetAsyncKeyState(VK_W)) m_vCameraPos += m_vCameraDir * 25.0f * fTime; if(GetAsyncKeyState(VK_S)) m_vCameraPos -= m_vCameraDir * 25.0f * fTime; break; } case BIRDS_EYE_PLAYER: { m_vCameraPos = vTarget + tbVector3(0.0f, 40.0f, 0.0f); m_fCameraRot = 0.0f; m_fCameraUpDown = -1.55f; // ~90° da PI / 2 break; } case FOLLOW_PLAYER: { m_vCameraPos = vTarget + tbVector3(0.0f, 20.0f, -20.0f); m_fCameraRot = 0.0f; m_fCameraUpDown = -0.78f; // ~45° da PI / 4 break; } case FOLLOW_PLAYER_LEFT: { m_vCameraPos = vTarget + tbVector3(20.0f, 20.0f, 0.0f); m_fCameraRot = -1.55f; m_fCameraUpDown = -0.78f; // ~45° da PI / 4 break; } case FOLLOW_PLAYER_RIGHT: { m_vCameraPos = vTarget + tbVector3(-20.0f, 20.0f, 0.0f); m_fCameraRot = 1.55f; m_fCameraUpDown = -0.78f; // ~45° da PI / 4 break; } } // Kamera-Modus via NumPad if(GetAsyncKeyState(VK_NUMPAD2)) m_iCameraMode = FOLLOW_PLAYER; if(GetAsyncKeyState(VK_NUMPAD4)) m_iCameraMode = FOLLOW_PLAYER_LEFT; if(GetAsyncKeyState(VK_NUMPAD6)) m_iCameraMode = FOLLOW_PLAYER_RIGHT; if(GetAsyncKeyState(VK_NUMPAD5)) m_iCameraMode = FREE_FLYING; if(GetAsyncKeyState(VK_NUMPAD8)) m_iCameraMode = BIRDS_EYE_PLAYER; } void Camera::setUpCamera() { tbDirect3D& D3D = tbDirect3D::Instance(); // Projektionsmatrix erstellen und einsetzen mProjection = tbMatrixProjection(TB_DEG_TO_RAD(90.0f), D3D.GetAspect(), 0.1f, 100.0f); D3D.SetTransform(D3DTS_PROJECTION, mProjection); //switch (m_iCameraMode) //{ // case FREE_FLYING: // { // Kameramatrix erstellen und einsetzen m_vCameraDir = tbVector3(sinf(m_fCameraRot) * cosf(m_fCameraUpDown), sinf(m_fCameraUpDown), cosf(m_fCameraRot) * cosf(m_fCameraUpDown)); // break; // } //} mView = tbMatrixCamera(m_vCameraPos, m_vCameraPos + m_vCameraDir); buildWorldFrustumPlanes(); D3D.SetTransform(D3DTS_VIEW, mView); } void Camera::buildWorldFrustumPlanes() { // Note: Extract the frustum planes in world space. tbMatrix VP = mView * mProjection; D3DXVECTOR4 col0(VP(0,0), VP(1,0), VP(2,0), VP(3,0)); D3DXVECTOR4 col1(VP(0,1), VP(1,1), VP(2,1), VP(3,1)); D3DXVECTOR4 col2(VP(0,2), VP(1,2), VP(2,2), VP(3,2)); D3DXVECTOR4 col3(VP(0,3), VP(1,3), VP(2,3), VP(3,3)); // Planes face inward. mFrustumPlanes[0] = (D3DXPLANE)(col2); // near mFrustumPlanes[1] = (D3DXPLANE)(col3 - col2); // far mFrustumPlanes[2] = (D3DXPLANE)(col3 + col0); // left mFrustumPlanes[3] = (D3DXPLANE)(col3 - col0); // right mFrustumPlanes[4] = (D3DXPLANE)(col3 - col1); // top mFrustumPlanes[5] = (D3DXPLANE)(col3 + col1); // bottom for(int i = 0; i < 6; i++) D3DXPlaneNormalize(&mFrustumPlanes[i], &mFrustumPlanes[i]); } bool Camera::isVisible(const AABB& box)const { // Test assumes frustum planes face inward. D3DXVECTOR3 P; D3DXVECTOR3 Q; // N *Q *P // | / / // |/ / // -----/----- Plane -----/----- Plane // / / | // / / | // *P *Q N // // PQ forms diagonal most closely aligned with plane normal. // For each frustum plane, find the box diagonal (there are four main // diagonals that intersect the box center point) that points in the // same direction as the normal along each axis (i.e., the diagonal // that is most aligned with the plane normal). Then test if the box // is in front of the plane or not. for(int i = 0; i < 6; ++i) { // For each coordinate axis x, y, z... for(int j = 0; j < 3; ++j) { // Make PQ point in the same direction as the plane normal on this axis. if( mFrustumPlanes[i][j] >= 0.0f ) { P[j] = box.minPt[j]; Q[j] = box.maxPt[j]; } else { P[j] = box.maxPt[j]; Q[j] = box.minPt[j]; } } // If box is in negative half space, it is behind the plane, and thus, completely // outside the frustum. Note that because PQ points roughly in the direction of the // plane normal, we can deduce that if Q is outside then P is also outside--thus we // only need to test Q. if( D3DXPlaneDotCoord(&mFrustumPlanes[i], &Q) < 0.0f ) // outside return false; } return true; } [/code] Code is originally (partly) from Frank D. Luna and David Scherfing.
  10. [quote name='Washu' timestamp='1330633187' post='4918342'] You didn't include camera in your terain.cpp. The definition of the incomplete type of Camera is required by then. [/quote] I don't need to include the camera because of the forward declaration: terrain is not a parent of camera and it does not contain a camera object, but a reference. Nevertheless, I switched to '#include "Camera.h"' and I get the exact same error.
  11. [code]// main.cpp #include "Camera.h" #include "Terrain.h" //declarations Camera g_Camera; Terrain* g_Terrain; // before the game loop in the main function... g_Camera = Camera(tbVector3(0.0f,30.0f,0.0f)); g_Terrain = new Terrain(/*uninteresting stuff*/ g_Camera); [/code] [code]// camera.h // contains uninteresting stuff..[/code] [code]// terrain.h #ifndef TERRAIN_H #define TERRAIN_H #include "Heightmap.h" #include "d3dUtil.h" #include "Vertex.h" class Camera; class Terrain { public: Terrain(/*uninteresting*/ Camera & cam); ~Terrain(); private: Camera & g_Camera; }; #endif // TERRAIN_H[/code] [code]//terrain.cpp #include "Terrain.h" #include "d3dUtil.h" #include <list> Terrain::Terrain(*/uninteresting*/ Camera & cam) { g_Camera = cam; }[/code]
  12. [quote name='Washu' timestamp='1330630590' post='4918316'] References must be initialized when defined, however this doesn't work for non-static members, thus you must initialize the reference in the class initializer list. [/quote] Let's say I have : [code]Terrain::Terrain(****, Camera & cam) //terrain.cpp[/code] and I call it this way: [code]g_Terrain = new Terrain(****, &g_Camera); //main.cpp[/code] Changing it to: [code]Terrain::Terrain(****, Camera & cam):m_Camera(cam) // terrain.cpp[/code] does not help, where m_Camera is declared like this [code]Camera & m_Camera; // terrain.h[/code]
  13. Hey gamedev, I am extremely rusty with my C++ skills. I want to pass my camera object to the terrain class, so I can cull some subgrids from my view frustrum. So, my initial idea was to pass the camera in the terrain constructor. I have my camera declared like this: [code]Camera g_Camera; [/code] and after I initialize the camera I call the constructor for my terrain. I am really unsure how I should accomplish this, but I would save a "Camera &" in my terrain class and just pass over the reference in the constructor. But I get these errors: [code]1>c:\***\thegame\terrain.cpp(13): error C2758: 'Terrain::mCamera' : must be initialized in constructor base/member initializer list 1> c:\***\thegame\terrain.h(72) : see declaration of 'Terrain::mCamera' 1>c:\***\thegame\terrain.cpp(128): error C2327: 'Terrain::mCamera' : is not a type name, static, or enumerator 1>c:\***\thegame\terrain.cpp(128): error C2065: 'mCamera' : undeclared identifier 1>c:\***\thegame\terrain.cpp(128): error C2228: left of '.getPos' must have class/struct/union 1> type is ''unknown-type''[/code] Can anyone outline the correct way to do this? [Full code below]
  14. [quote name='__Homer__' timestamp='1314194069' post='4853200'] Hi I assume this is DX9 stuff (fixed function pipeline). Where did you enable texturing? Other than that, I can't see how you are making your view matrix. Suggest to comment it out and use D3DXMatrixLookAt to prove your code, then switch back. [/quote] Yes, I am using DX9. I do not enable texturing...My vertex only uses a position and a color. [code] mCamera = tbMatrixCamera(g_vCameraPos, g_vCameraPos + vCameraDir); D3D.SetTransform(D3DTS_VIEW, mCamera);[/code] (taken from above) I am creating the view matrix with the the position of the camera and I look at "vCameraDir". I think the camera code is fine. What dou you mean with D3DXMatrixLookAt? So I always look at the cube? Edit: Tried enabling/disabling D3DRS_LIGHTING, no luck.
  15. Oh, I am sorry. The cube is simply not visible. I can move the camera, but I still cannot see the cube at position (0.0f, 0.0f, 0.0f).