Siêu thị PDFTải ngay đi em, trời tối mất

Thư viện tri thức trực tuyến

Kho tài liệu với 50,000+ tài liệu học thuật

© 2023 Siêu thị PDF - Kho tài liệu học thuật hàng đầu Việt Nam

Beginning direct3d game programming
PREMIUM
Số trang
428
Kích thước
6.9 MB
Định dạng
PDF
Lượt xem
1295

Beginning direct3d game programming

Nội dung xem thử

Mô tả chi tiết

Beginning

Direct3D®

Game

Programming

2nd Edition

Beginning

Direct3D®

Game

Programming

2nd Edition

Wolfgang F. Engel

© 2003 by Premier Press, a division of Course Technology. All rights reserved. No part of this book

may be reproduced or transmitted in any form or by any means, electronic or mechanical, including

photocopying, recording, or by any information storage or retrieval system without written permission

from Premier Press, except for the inclusion of brief quotations in a review.

The Premier Press logo and related trade dress are trademarks of Premier Press

and may not be used without written permission.

Publisher: Stacy L. Hiquet

Senior Marketing Manager: Martine Edwards

Marketing Manager: Heather Hurley

Associate Marketing Manager: Kristin Eisenzopf

Manager of Editorial Services: Heather Talbot

Acquisitions Editor: Mitzi Foster-Koontz

Project Editor/Copy Editor: Cathleen D. Snyder

Technical Reviewer: André LaMothe

Retail Market Coordinator: Sarah Dubois

Interior Layout: Shawn Morningstar

Cover Designer: Mike Tanamachi

CD-ROM Producer: Brandon Penticuff

Indexer: Katherine Stimson

Proofreader: Lorraine Gunter

DirectDraw, DirectMusic, DirectPlay, DirectSound, DirectX, Microsoft, Visual Basic, Visual C++,

Windows, Windows NT, Xbox, and/or other Microsoft products are registered trademarks or trade￾marks of Microsoft Corporation in the U.S. and/or other countries. All other trademarks are the

property of their respective owners.

Important: Premier Press cannot provide software support. Please contact the appropriate software

manufacturer’s technical support line or Web site for assistance.

Premier Press and the author have attempted throughout this book to distinguish proprietary trade￾marks from descriptive terms by following the capitalization style used by the manufacturer.

Information contained in this book has been obtained by Premier Press from sources believed to be

reliable. However, because of the possibility of human or mechanical error by our sources, Premier

Press, or others, the Publisher does not guarantee the accuracy, adequacy, or completeness of any

information and is not responsible for any errors or omissions or the results obtained from use of

such information. Readers should be particularly aware of the fact that the Internet is an ever-chang￾ing entity. Some facts may have changed since this book went to press.

ISBN: 1-931841-39-x

Library of Congress Catalog Card Number: 2003101212

Printed in the United States of America

03 04 05 06 07 BH 10 9 8 7 6 5 4 3 2 1

Premier Press, a division of Course Technology

25 Thomson Place

Boston, MA 02210

Für meine Frau Katja und unsere Tochter Anja

Acknowledgments

This book couldn’t have been completed without the help of many people. In

particular, I want to thank my parents, who gave me a wonderful and warm child￾hood; my wife, Katja, for being patient with a spare-time author; and our nearly two-year-old

daughter, Anna, for showing me the important things in life.

Additionally I would like to thank those people who also helped to make this book possible:

Heather Hurley, Mitzi Koontz, Emi Smith, Cathleen Snyder, Heather Talbot, and André

LaMothe. Thanks for your patience with me and for a great time at GDC 2003.

About the Author

Wolfgang F. Engel is the editor and coauthor of several programming books.

He has also written several online tutorials published on http://www.gamedev.net,

http://www.direct3d.info, and other Web sites. He held lectures at GDC 2003 and at

Vision Days in Copenhagen. Wolfgang is also a faculty advisor for the Academy of Game

Entertainment Technology (http://www.academyofget.com/html/advisors.html).

Contents at a Glance

Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xx

Part One

DirectX Graphics: Don’t Hurt Me . . . . . 1

Chapter 1 The History of Direct3D/DirectX Graphics. . . . . . . . . . . 3

Chapter 2 Overview of HAL and COM . . . . . . . . . . . . . . . . . . . . . . . 9

Chapter 3 Programming Conventions. . . . . . . . . . . . . . . . . . . . . . . . 19

Chapter 4 3D Fundamentals, Gouraud Shading,

and Texture-Mapping Basics . . . . . . . . . . . . . . . . . . . . . . . 27

Chapter 5 The Basics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

Chapter 6 First Steps to Animation. . . . . . . . . . . . . . . . . . . . . . . . . . 77

Part Two

Knee-Deep in DirectX

Graphics Programming . . . . . . . . . . . 123

Chapter 7 Texture-Mapping Fundamentals . . . . . . . . . . . . . . . . . . . 125

Chapter 8 Using Multiple Textures . . . . . . . . . . . . . . . . . . . . . . . . . 149

Part Three

Hard-Core DirectX

Graphics Programming . . . . . . . . . . . 175

Chapter 9 Shader Programming with the

High-Level Shader Language. . . . . . . . . . . . . . . . . . . . . . 177

Chapter 10 More Advanced Shader Effects. . . . . . . . . . . . . . . . . . . . 197

Chapter 11 Working with Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227

Chapter 12 Using *.md3 Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253

Part Four

Appendixes . . . . . . . . . . . . . . . . . . . 299

Appendix A Windows Game Programming Foundation . . . . . . . . . . 301

Appendix B C++ Primer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327

Appendix C Mathematics Primer . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353

Appendix D Creating a Texture with

D3DXCreateTextureFromFileEx(). . . . . . . . . . . . . . . . . 371

Appendix E Game Programming Resources . . . . . . . . . . . . . . . . . . . 375

Appendix F What’s on the CD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377

Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 381

Contents at a Glance ix

Contents

Letter from the Series Editor . . . . . . . . . . . . . . . . . . . . . . . . . . xix

Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xx

Part One

DirectX Graphics: Don’t Hurt Me . . . . . 1

Chapter 1

The History of Direct3D/DirectX Graphics. . . . . . . 3

DirectX 2.0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

DirectX 6/7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

DirectX 8. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

Point Sprites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

3D Textures. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

Direct3DX Utility Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

Vertex and Pixel Shaders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

DirectX 9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

Chapter 2

Overview of HAL and COM . . . . . . . . . . . . . . . . . . . 9

Hardware Abstraction Layer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

Pluggable Software Devices. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

Reference Rasterizer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

Controlling Devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

COM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

Chapter 3

Programming Conventions . . . . . . . . . . . . . . . . . . . 19

Accessing COM Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

Naming Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

Debugging DirectX. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24

Return Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

Chapter 4

3D Fundamentals, Gouraud Shading,

and Texture-Mapping Basics . . . . . . . . . . . . . . . . . . 27

3D Fundamentals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28

Understanding Vertices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

Working with Orientation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

Understanding Faces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

Understanding Polygons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

Understanding Normals. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

Understanding Normals and Gouraud Shading . . . . . . . . . . . . . . . . . . . . . . . 33

Texture-Mapping Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36

Chapter 5

The Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

Compiling the Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38

The DirectX Graphics Common Architecture . . . . . . . . . . . . . . . . . . . . . . . . 40

The Basic Example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41

The ConfirmDevice(), OneTimeSceneInit(), and InitDeviceObjects() Functions . . . 44

The RestoreDeviceObjects() Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45

The FrameMove() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53

The Render() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53

Contents xi

The InvalidateDeviceObjects() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57

The DeleteDeviceObjects() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58

The FinalCleanup() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58

The Basic2 Example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58

The InitDeviceObjects() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62

The RestoreDeviceObjects() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62

The Render() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64

The InvalidateDeviceObjects() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66

The DeleteDeviceObjects() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67

The FinalCleanup() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67

The Basic3 Example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67

The Basic4 Example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69

The Basic5 Example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75

Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76

Chapter 6

First Steps to Animation . . . . . . . . . . . . . . . . . . . . . 77

Understanding Transformations and Viewports. . . . . . . . . . . . . . . . . . . . . . . . 78

The World Transformation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79

The View Transformation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103

The Projection Transformation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110

Working with the Viewport . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112

Depth Buffering. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116

Additional Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119

Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119

Part One Quiz. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120

xii Contents

Part Two

Knee-Deep in DirectX

Graphics Programming . . . . . . . . . . . 123

Chapter 7

Texture-Mapping Fundamentals . . . . . . . . . . . . . . 125

What Is the Point of Textures? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126

Working with Texture Coordinates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129

Using Texture-Addressing Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131

Wrap Texture-Addressing Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132

Mirror Texture-Addressing Mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133

Clamp Texture-Addressing Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134

Border Color Texture-Addressing Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135

Mirroronce Texture-Addressing Mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136

Texture Wrapping. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136

Texture Filtering and Anti-Aliasing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138

Mipmaps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139

Nearest-Point Sampling. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140

Linear Texture Filtering. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141

Anisotropic Filtering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142

Anti-Aliasing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143

Alpha Blending. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145

Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147

Chapter 8

Using Multiple Textures . . . . . . . . . . . . . . . . . . . . . 149

Multipass Rendering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150

Color Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153

Dark Mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154

Animating the Dark Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157

Blending a Texture with Material Diffuse Color . . . . . . . . . . . . . . . . . . . . . . . . . . . 158

A Dark Map Blended with Material Diffuse Color . . . . . . . . . . . . . . . . . . . . . . . . . 160

Contents xiii

Glow Mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161

Detail Mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163

Alpha Modulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167

Alpha Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166

Multitexturing Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168

Texture Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169

Additional Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169

Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170

Part Two Quiz . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170

Part Three

Hard-Core DirectX

Graphics Programming . . . . . . . . . . . 175

Chapter 9

Shader Programming with the High-Level Shader

Language . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177

What You Need to Jump into HLSL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179

Vertex and Pixel Shader Tasks. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180

Common Lighting Formulas Implemented with HLSL . . . . . . . . . . . . . . . . 181

Ambient Lighting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181

Diffuse Lighting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183

Specular Lighting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186

Self-Shadowing Term . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191

Bump Mapping. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192

Point Lights . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194

Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196

Chapter 10

More Advanced Shader Effects . . . . . . . . . . . . . . . 197

Working with Cube Maps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198

Generating Cube Maps. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198

Accessing Cube Maps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199

xiv Contents

Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200

Refractive and Reflective Environment Mapping. . . . . . . . . . . . . . . . . . . . . . 202

Dynamic Refractive and Reflective Environment Mapping . . . . . . . . . . . . . . . . . . . 204

Bumped Dynamic Refractive and Reflective Environment Mapping . . . . . . . . . . . . 208

Working with Shadows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211

Shadow Volumes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212

Things to Consider When Using Shadow Volumes . . . . . . . . . . . . . . . . . . . . . . . . . 226

Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226

Chapter 11

Working with Files . . . . . . . . . . . . . . . . . . . . . . . . . 227

3D File Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228

The X File Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229

Header. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230

Mesh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231

MeshMaterialList . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232

Normals. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235

Textures. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236

Transformation Matrices. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242

Animation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246

Using X Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249

Extending X Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251

Additional Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252

X File Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252

Skinned Meshes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252

Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252

Chapter 12

Using *.md3 Files . . . . . . . . . . . . . . . . . . . . . . . . . . 253

Files of the Trade . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254

Animation.cfg. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258

The .skin File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260

Textures and the Shader File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261

Contents xv

Tải ngay đi em, còn do dự, trời tối mất!