1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
<title>Castle Game Engine: Introduction</title>
<meta name="generator" content="PasDoc 0.13.0">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<link rel="StyleSheet" type="text/css" href="pasdoc.css">
</head>
<body>
<table class="container"><tr><td class="navigation">
<h2>Castle Game Engine</h2><p><a href="introduction.html" class="navigation">Introduction</a></p><p><a href="AllUnits.html" class="navigation">Units</a></p><p><a href="ClassHierarchy.html" class="navigation">Class Hierarchy</a></p><p><a href="AllClasses.html" class="navigation">Classes, Interfaces, Objects and Records</a></p><p><a href="AllTypes.html" class="navigation">Types</a></p><p><a href="AllVariables.html" class="navigation">Variables</a></p><p><a href="AllConstants.html" class="navigation">Constants</a></p><p><a href="AllFunctions.html" class="navigation">Functions and Procedures</a></p><p><a href="AllIdentifiers.html" class="navigation">Identifiers</a></p></td><td class="content">
<h1 class="externalitem">Introduction</h1>
<p><img src="castle_game_engine_icon.png"
alt="Castle Game Engine icon"
align="right"/>
<p>Table of contents: <ol>
<li><a href="#SectionAuthor">Author</a>
</li>
<li><a href="#SectionDocumentation">About this documentation</a>
</li>
<li><a href="#SectionExamples">Examples</a>
</li>
<li><a href="#SectionCompiling">Compiling</a>
<ol>
<li><a href="#SectionCompilingFPC">Compiling these units with FPC</a>
</li>
</ol>
</li>
<li><a href="#SectionRequirements">Requirements</a>
<ol>
<li><a href="#SectionLibraries">Libraries</a>
</li>
</ol>
</li>
<li><a href="#SectionUnitsMap">Units map</a>
</li>
<li><a href="#SectionMultipleContext">Multiple OpenGL contexts</a>
</li>
</ol>
<p><h2 class=""><a name="SectionAuthor"></a>Author</h2>
<p>This is a reference for <i>Castle Game Engine</i>, see [<a href="http://castle-engine.sourceforge.net/">http://castle-engine.sourceforge.net/</a>]. Developed by Michalis Kamburelis.
<p>All comments, bug reports, questions, patches and everything are welcome. See [<a href="http://castle-engine.sourceforge.net/forum.php">http://castle-engine.sourceforge.net/forum.php</a>].
<p><h2 class=""><a name="SectionDocumentation"></a>About this documentation</h2>
<p>This reference was generated by PasDoc (see [<a href="http://pasdoc.sf.net/">http://pasdoc.sf.net/</a>]). The online version of it is available on [<a href="http://castle-engine.sourceforge.net/reference.php">http://castle-engine.sourceforge.net/reference.php</a>].
<p>Besides this reference, there is also a tutorial and other useful engine documentation on [<a href="http://castle-engine.sourceforge.net/engine.php#section_docs">http://castle-engine.sourceforge.net/engine.php#section_docs</a>].
<p><h2 class=""><a name="SectionExamples"></a>Examples</h2>
<p>As a programmer, you probably want to jump straight into the action, so take a look at the examples in <code>examples/</code> subdirectory of the engine. You can compile them from Lazarus (install castle_base and castle_components packages first, and then just open examples .lpi files), or by <code>make examples</code>.
<p>There are a lot of examples, for 3D game examples look e.g. at
<p></p>
<ul class="compact_spacing">
<li><p>examples/3d_rendering_processing/fps_game.lpr</p></li>
<li><p>examples/lazarus/model_3d_viewer/model_3d_viewer.lpr</p></li>
</ul>
<p>
<p><h2 class=""><a name="SectionCompiling"></a>Compiling</h2>
<p><h3 class=""><a name="SectionCompilingFPC"></a>Compiling these units with FPC</h3>
<p>Latest stable version of FPC is always advised. See [<a href="http://castle-engine.sourceforge.net/sources.php#section_fpc_ver">http://castle-engine.sourceforge.net/sources.php#section_fpc_ver</a>] for more comments about FPC versions allowed.
<p>Compile programs using the <code>xxx_compile.sh</code> script prepared in directory of each program. In summary, this script just calls fpc with proper command-line options. Or open the <code>xxx.lpi</code> file in Lazarus, and compile from Lazarus.
<p>To use the engine in your own programs, there are a couple of options:
<p></p>
<ol class="paragraph_spacing">
<li value="1"><p> If you use Lazarus, the most comfortable way to use engine units is to use Lazarus castle_base and castle_components packages. Just install them in Lazarus. See <code>castle_game_engine/packages/README.txt</code> in sources for more information.</p></li>
<li value="2"><p> If you don't use Lazarus, you should compile engine units using <code>castle_game_engine/Makefile</code> file. GNU make is required (under Linux this is the default `make', under Windows you have this already bundled with FPC (you can also get this from Cygwin or MinGW), under FreeBSD this is called `gmake').
<p>Currently, <code>make</code> simply uses <code>castle_game_engine/fpmake.pp</code>. If you're familiar with FPMake (see [<a href="http://wiki.lazarus.freepascal.org/FPMake">http://wiki.lazarus.freepascal.org/FPMake</a>]), you may as well just compile <code>fpmake.pp</code> and run it yourself.</p></li>
<li value="3"><p> You can also recompile the engine along with your own programs if you use our build tool, see [<a href="https://sourceforge.net/p/castle-engine/wiki/Build%20tool/">https://sourceforge.net/p/castle-engine/wiki/Build%20tool/</a>].</p></li>
<li value="4"><p> If you need more control over compilation process then you can also directly use castle-fpc.cfg file. This is my configuration file for FPC. It's used by and by all <code>xxx_compile.sh</code> scripts, <code>fpmake.pp</code> etc. All my programs and units must be compiled with FPC using this configuration.</p></li>
</ol>
<p>
<p><h2 class=""><a name="SectionRequirements"></a>Requirements</h2>
<p><h3 class=""><a name="SectionLibraries"></a>Libraries</h3>
<p></p>
<ul class="paragraph_spacing">
<li><p><code>libpng</code> and <code>zlib</code>.
<p><a class="normal" href="CastleImages.html">CastleImages</a> unit requires libpng (libpng.so under UNIXes, libpng12.dll under Windows) installed if you want to load/save PNG images. Otherwise you will get ELibPngNotAvailable exception when trying to load/save files in PNG format. Note that libpng depends on zlib.
<p>CastleZLib unit (required by <a class="normal" href="CastleZStream.html">CastleZStream</a> unit and used by <a class="normal" href="X3DNodes.html">X3DNodes</a>) requires zlib installed. This is used to open and save gzip-compressed files.</p></li>
<li><p><code>OpenAL</code>.
<p>To play 3D sound. If OpenAL is not installed, everything will stil run just fine (we will not raise any exception), you will just not get any sound.</p></li>
<li><p><code>vorbisfile</code>.
<p>To load sounds in OggVorbis format.</p></li>
<li><p><code>GtkGLExt</code> (on Unix).
<p>Used by <a class="normal" href="CastleWindow.html">CastleWindow</a> on Unix to create a window with OpenGL context. There is an alternative <a class="normal" href="CastleWindow.html">CastleWindow</a> backend that doesn't use GtkGLExt (uses directly Xlib), although it doesn't show native manu or dialog boxes.</p></li>
<li><p><code>FreeType</code>.
<p>Used by <a class="normal" href="CastleFonts.TTextureFont.html">TTextureFont</a> to read font files.</p></li>
</ul>
<p>
<p>For Windows, you can get the required DLLs easily from [<a href="http://svn.code.sf.net/p/castle-engine/code/trunk/external_libraries/">http://svn.code.sf.net/p/castle-engine/code/trunk/external_libraries/</a>]. Be sure to get DLLs matching your architecture — 32-bit (i386-win32) libraries only work with 32-bit binaries, 64-bit (x86_64-win64) libraries only work with 64-bit binaries.
<p>On Mac OS X there are some additional requirements. See [<a href="http://castle-engine.sourceforge.net/macosx_requirements.php">http://castle-engine.sourceforge.net/macosx_requirements.php</a>] for details.
<p><h2 class=""><a name="SectionUnitsMap"></a>Units map</h2>
<p>Here's a short map of the important units documented here. Units are divided into a couple of groups. Group's name (like "<code>base</code>") is also the name of subdirectory where unit's source code is placed. The "<i>Uses:</i>" notes below say which units are allowed to be used by units in specific group.
<p></p>
<dl class="paragraph_spacing">
<dt><code>base</code></dt>
<dd><p> Basic utilities and classes.
<p><i>Uses:</i> Nothing. These units do not depend on units from other groups.</p></dd>
<dt><code>audio</code></dt>
<dd><p> 3D sound support based on OpenAL, processing of sound files.
<p><i>Uses:</i> <code>base</code>.</p></dd>
<dt><code>images</code></dt>
<dd><p> Image, textures, videos processing. Not OpenGL-specific.
<p><i>Uses:</i> <code>base</code>.</p></dd>
<dt><code>fonts</code></dt>
<dd><p> Font support, including some embedded fonts in CastleOutlineFont_* and CastleBitmapFont_* units. Not OpenGL-specific.
<p><i>Uses:</i> <code>base</code>.</p></dd>
<dt><code>castlescript</code></dt>
<dd><p> Parsing and executing expressions and programs in <a class="normal" href="CastleScript.html">CastleScript</a> language [<a href="http://castle-engine.sourceforge.net/castle_script.php">http://castle-engine.sourceforge.net/castle_script.php</a>].
<p><i>Uses:</i> <code>base</code>, <code>images</code>, X3D parts also use <code>x3d</code>.</p></dd>
<dt><code>ui</code></dt>
<dd><p> 2D user interface of the engine.
<p>First of all, unit <a class="normal" href="CastleUIControls.html">CastleUIControls</a> with basic control class <a class="normal" href="CastleUIControls.TUIControl.html">TUIControl</a> and basic container interface IUIContainer.
<p>Concepts:
<p></p>
<ul class="paragraph_spacing">
<li><p>"Containers" are classes that implement IUIContainer interface. We have two containers right now:
<p></p>
<ol class="compact_spacing">
<li value="1"><p>A window, by our <a class="normal" href="CastleWindow.TCastleWindow.html">TCastleWindow</a> class (see <code>window</code> directory).</p></li>
<li value="2"><p>A Lazarus component, by our <a class="normal" href="CastleControl.TCastleControl.html">TCastleControl</a> class (see <code>components</code> directory). This descends from the base TOpenGLControl provided by Lazarus, inheriting it's functionality.</p></li>
</ol>
<p>
<p>Container is tied to a particular windowing library, like GTK or WinAPI or something higher-level like Lazarus LCL. Container is responsible for initializing and managing OpenGL context.
<p>Container handles a list of controls, that is a list of instances of the <a class="normal" href="CastleUIControls.TUIControl.html">TUIControl</a> class. For our two current containers this list is TCastleWindow.Controls and TCastleControl.Controls. Container passes to them key events, mouse events and much more.</p></li>
<li><p>"Controls" are classes that descend from <a class="normal" href="CastleUIControls.TUIControl.html">TUIControl</a> class. They may be tied to a particular rendering library, in practice — all current controls use OpenGL rendering.
<p>The controls are not concerned with how you initialized the OpenGL context, so all controls are useful with all containers. For example you can use the same <a class="normal" href="CastleOnScreenMenu.TCastleOnScreenMenu.html">TCastleOnScreenMenu</a> class inside <a class="normal" href="CastleWindow.TCastleWindow.html">TCastleWindow</a>, or inside Lazarus <a class="normal" href="CastleControl.TCastleControl.html">TCastleControl</a> component, etc.</p></li>
</ul>
<p>
<p>We have many OpenGL controls (like <a class="normal" href="CastleOnScreenMenu.TCastleOnScreenMenu.html">TCastleOnScreenMenu</a> and things like buttons inside <a class="normal" href="CastleControls.html">CastleControls</a>) in <code>ui/opengl/</code> subdirectory. We also have camera classes (<a class="normal" href="CastleCameras.html">CastleCameras</a> unit with <a class="normal" href="CastleCameras.TCamera.html">TCamera</a> descendants), they are used by scene manager.
<p><i>Uses:</i> <code>base</code>, <code>images</code>, <code>3d</code>.</p></dd>
<dt><code>3d</code></dt>
<dd><p> 3D graphics stuff, not X3D-specific.
<p>Note: <a class="normal" href="CastleVectors.html">CastleVectors</a> unit is considered by me as something more general and useful — so it's in <code>base</code> group, not here.
<p><i>Uses:</i> <code>base</code>, <code>images</code>.
<p><i>Subdirectory <code>opengl</code></i> contains OpenGL-specific stuff, that uses also <code>opengl</code> units.</p></dd>
<dt><code>opengl</code></dt>
<dd><p> OpenGL utilities.
<p><i>Uses:</i> <code>base</code>, <code>images</code>, <code>3d</code>, <code>fonts</code>.</p></dd>
<dt><code>window</code></dt>
<dd><p> <a class="normal" href="CastleWindow.html">CastleWindow</a> unit, to easily create a window with OpenGL context.
<p>This directory also contains various user-interface stuff usable only together with <a class="normal" href="CastleWindow.html">CastleWindow</a>, like progress bar display in OpenGL window (<a class="normal" href="CastleWindowProgress.html">CastleWindowProgress</a>), messages (<a class="normal" href="CastleMessages.html">CastleMessages</a>).
<p><i>Uses:</i> potentially everything. For comfort, <a class="normal" href="CastleWindow.TCastleWindow.html">TCastleWindow</a> has a ready link to SceneManager, so it depends on <a class="normal" href="CastleSceneManager.TCastleSceneManager.html">TCastleSceneManager</a> and other 3D classes.
<p>What is important is that no other engine units may depend on <a class="normal" href="CastleWindow.html">CastleWindow</a> units. So every OpenGL code outside <code>window</code> directory is usable with OpenGL context initialized in any way, like with Lazarus OpenGL control.</p></dd>
<dt><code>x3d</code></dt>
<dd><p> VRML/X3D rendering and processing. This is the core of our engine rendering, classes to handle and render 3D stuff are here.
<p>X3D file reading, writing and processing (<a class="normal" href="X3DLexer.html">X3DLexer</a>, <a class="normal" href="X3DFields.html">X3DFields</a>, <a class="normal" href="X3DNodes.html">X3DNodes</a>), building and using octree based on X3D model (<a class="normal" href="CastleShapeOctree.html">CastleShapeOctree</a>, <a class="normal" href="CastleTriangleOctree.html">CastleTriangleOctree</a>), ray-tracer based on X3D model (<a class="normal" href="CastleRayTracer.html">CastleRayTracer</a>), loading animations (<a class="normal" href="CastlePrecalculatedAnimationCore.html">CastlePrecalculatedAnimationCore</a>), load 3D model formats as X3D (<a class="normal" href="X3DLoad.html">X3DLoad</a>).
<p><a class="normal" href="CastleScene.html">CastleScene</a> unit provides the complete class for dealing with 3D models and displaying them in OpenGL. <a class="normal" href="CastlePrecalculatedAnimation.html">CastlePrecalculatedAnimation</a> also provides a special way of animating models by interpolating between a set of 3D files.
<p><i>Uses:</i> <code>base</code>, <code>images</code>, <code>3d</code>, <code>fonts</code>. As an exception, <a class="normal" href="CastleSceneManager.html">CastleSceneManager</a> also depends on <a class="normal" href="CastlePlayer.html">CastlePlayer</a> unit from the <code>game</code> group.
<p><i>Subdirectory <code>opengl</code></i> contains OpenGL-specific stuff, that uses also <code>opengl</code> units. </p></dd>
<dt><code>game</code></dt>
<dd><p> High level units implementing game mechanics for 3D games. They build on top of other units.
<p><i>Uses:</i> everything except <code>window</code>, as this must be suitable for both <a class="normal" href="CastleWindow.TCastleWindow.html">TCastleWindow</a> and Lazarus <a class="normal" href="CastleControl.TCastleControl.html">TCastleControl</a>. </p></dd>
</dl>
<p>
<p><h2 class=""><a name="SectionMultipleContext"></a>Multiple OpenGL contexts</h2>
<p>If you use more than one OpenGL context (<a class="normal" href="CastleWindow.TCastleWindow.html">TCastleWindow</a> or <a class="normal" href="CastleControl.TCastleControl.html">TCastleControl</a>) in a single program, they will share OpenGL resources (like textures). This happens automatically for <a class="normal" href="CastleControl.TCastleControl.html">TCastleControl</a> and <a class="normal" href="CastleWindow.TCastleWindow.html">TCastleWindow</a>.
<p>TODO: sharing contexts is not implemented yet for WinAPI backend of <a class="normal" href="CastleWindow.html">CastleWindow</a> (it is implemented OK for backends GLX, EGL, GTK). Please report on forum if you need it.<!-- Piwik -->
<script type="text/javascript">
var _paq = _paq || [];
_paq.push(["trackPageView"]);
_paq.push(["enableLinkTracking"]);
(function() {
var u=(("https:" == document.location.protocol) ? "https" : "http") + "://michalis.ii.uni.wroc.pl/piwik-castle-engine/";
_paq.push(["setTrackerUrl", u+"piwik.php"]);
_paq.push(["setSiteId", "1"]);
var d=document, g=d.createElement("script"), s=d.getElementsByTagName("script")[0]; g.type="text/javascript";
g.defer=true; g.async=true; g.src=u+"piwik.js"; s.parentNode.insertBefore(g,s);
})();
</script>
<!-- End Piwik Code -->
<noscript>
<!-- Piwik Image Tracker -->
<img src="http://michalis.ii.uni.wroc.pl/piwik-castle-engine/piwik.php?idsite=1&rec=1" style="border:0" alt="" />
<!-- End Piwik -->
</noscript>
<hr noshade size="1"><span class="appinfo"><em>Generated by <a href="http://pasdoc.sourceforge.net/">PasDoc 0.13.0</a> on 2015-06-15 04:43:19</em>
</span>
</td></tr></table></body></html>
|