|
QSDK 1.1 Documentation |
00001 /*- 00002 * Copyright (c) 2000-2003 Qube Software, Ltd. 00003 * All rights reserved. 00004 * 00005 * $Qube: Q/server/sdk/q.h,v 1.467.2.87 2004/08/18 10:19:53 peterj Exp $ 00006 */ 00007 00008 #ifndef __q_h__ 00009 #define __q_h__ 00010 00011 #ifndef Q_BEGIN 00012 #define Q_BEGIN namespace Q { 00013 #endif 00014 00015 #ifndef Q_END 00016 #define Q_END } 00017 #endif 00018 00023 #define QServer_version 10007400 00024 00025 #include <Q/linkage.h> 00026 00027 #include <Q/maths.h> 00028 #include <Q/utils.h> 00029 00030 namespace Draw { 00031 struct WindowInfo; 00032 }; 00033 00034 namespace Image { 00035 struct Pixmap; 00036 }; 00037 00038 namespace Net { 00039 struct ReadStream; 00040 }; 00041 00042 namespace Audio { 00043 struct SoundDriverParam; 00044 }; 00045 00046 Q_BEGIN 00047 00051 #define MAX_QWEIGHTS 4 00052 00053 /* 00054 * Forward declarations. 00055 */ 00056 struct Application; 00057 struct Camera; 00058 struct Clip; 00059 struct Group; 00060 struct Instance; 00061 struct Layer; 00062 struct Portal; 00063 struct RayInfo; 00064 struct Screen; 00065 struct Shader; 00066 struct Texture; 00067 struct WedgeIterator; 00068 struct Geom; 00069 struct Mesh; 00070 struct ScopeListener; 00071 struct BoundsListener; 00072 struct KeyboardListener; 00073 struct ResidencyListener; 00074 struct ApplicationListener; 00075 struct MouseListener; 00076 struct ScopeReactor; 00077 struct BoundsReactor; 00078 struct FxSource; 00079 struct Concept; 00080 struct Database; 00081 struct ObjectIterator; 00082 struct SpeakerSet; 00083 struct Animation; 00084 struct PlaybackListener; 00085 struct SimpleSound; 00086 struct AudioEffect; 00087 struct List; 00088 00092 #define ERROR_SUBSYSTEM_QSERVER 7 00093 00238 enum ResultCodes { 00243 WObjectPresent = WARNING_CODE(ERROR_SUBSYSTEM_QSERVER, 2), 00244 00249 WClipPresent = WARNING_CODE(ERROR_SUBSYSTEM_QSERVER, 3), 00250 00256 WNameConflict = WARNING_CODE(ERROR_SUBSYSTEM_QSERVER, 4), 00257 00264 WDatabaseOpenedReadOnly = WARNING_CODE(ERROR_SUBSYSTEM_QSERVER, 5), 00265 00270 ENameConflict = ERROR_CODE(ERROR_SUBSYSTEM_QSERVER, 1), 00271 00275 ENoAnimation = ERROR_CODE(ERROR_SUBSYSTEM_QSERVER, 2), 00276 00280 EBadObject = ERROR_CODE(ERROR_SUBSYSTEM_QSERVER, 3), 00281 00288 EBadType = ERROR_CODE(ERROR_SUBSYSTEM_QSERVER, 4), 00289 00293 ENotFound = ERROR_CODE(ERROR_SUBSYSTEM_QSERVER, 5), 00294 00299 ECantCreate = ERROR_CODE(ERROR_SUBSYSTEM_QSERVER, 6), 00300 00305 ENotUnique = ERROR_CODE(ERROR_SUBSYSTEM_QSERVER, 7), 00306 00311 EAudioInvalidFormat = ERROR_CODE(ERROR_SUBSYSTEM_QSERVER, 8), 00312 00317 EAudioCacheOverflow = ERROR_CODE(ERROR_SUBSYSTEM_QSERVER, 9), 00318 00323 EDatabaseAlreadyOpened = ERROR_CODE(ERROR_SUBSYSTEM_QSERVER, 10), 00324 00330 ECannotAccess = ERROR_CODE(ERROR_SUBSYSTEM_QSERVER, 11) 00331 }; 00332 00338 struct EXPORT_QSERVER Text 00339 { 00343 Text() { text_ = 0; } 00344 00348 Text(const char* text); 00349 00353 Text(const Text& t); 00354 00358 ~Text(); 00359 00363 size_t size() const; 00364 00368 Text& add(const char* s); 00369 00373 Text& truncate(size_t size); 00374 00378 operator const char *() const { return text_; } 00379 00381 00384 Text& operator=(const char* s); 00385 Text& operator=(const Text& t); 00387 00391 int operator==(const char*) const; 00392 00396 int operator!=(const char* s) const 00397 { return !(*this == s); } 00398 00399 private: 00400 00401 char* text_; 00402 }; 00403 00413 struct EXPORT_QSERVER ObjectBase 00414 { 00418 typedef unsigned int Handle; 00419 00423 typedef unsigned int ClassType; 00424 00428 ObjectBase(); 00429 00433 ObjectBase(const ObjectBase& o); 00434 00439 ~ObjectBase(); 00440 00441 00446 ObjectBase& operator=(const ObjectBase& obj); 00447 00454 bool valid() const; 00455 00460 int operator==(const ObjectBase& obj) const; 00461 00466 int operator!=(const ObjectBase& obj) const; 00467 00476 int operator<(const ObjectBase& obj) const; 00477 00482 int operator<=(const ObjectBase& obj) const; 00483 00487 Handle handle() const; 00488 00492 void setHandle(Handle h); 00493 00498 ClassType type() const; 00499 00500 private: 00501 00502 void incRef() const; 00503 void decRef() const; 00504 00505 Handle handle_; 00506 }; 00507 00523 struct EXPORT_QSERVER Object: public ObjectBase 00524 { 00529 enum residencyAdvice { 00533 discard = 1, 00534 00539 hold, 00540 00544 acquire 00545 }; 00546 00552 enum residencyQualification { 00557 now = 1, 00558 00564 soon, 00565 00570 later 00571 }; 00572 00576 Object(); 00577 00581 Object(const Object& obj); 00582 00590 ~Object(); 00591 00608 Utils::Result destroy(); 00609 00627 Utils::Result adviseResidency(residencyAdvice, 00628 residencyQualification, 00629 ResidencyListener* = 0); 00630 00635 bool resident(bool deep = false); 00636 00644 ObjectIterator assets() const; 00645 00649 Utils::Result addAsset(const Object& obj) const; 00650 00654 Utils::Result removeAsset(const Object& obj) const; 00655 00663 ObjectIterator loadAssets() const; 00664 00668 Utils::Result addLoadAsset(const Object& obj) const; 00669 00673 Utils::Result removeLoadAsset(const Object& obj) const; 00674 00679 Utils::UID uid() const; 00680 00684 size_t diskSize() const; 00685 00691 size_t memorySize() const; 00692 00699 static Object find(const Utils::UID& uid); 00700 00706 static Object find(const char* name, const Concept& type); 00707 00713 static Object find(const char* name, const ClassType& type); 00714 00719 Text name() const; 00720 00724 bool rename(const char* newname); 00725 00730 unsigned int generation() const; 00731 00736 bool isPersistent() const; 00737 00755 Utils::Result duplicate(Database); 00756 00762 Utils::Result relocate(Database); 00763 }; 00764 00773 struct EXPORT_QSERVER Database: public ObjectBase 00774 { 00779 enum accessFlags 00780 { 00784 noAccess, 00785 00789 readOnly, 00790 00795 readModify, 00796 00801 readModifyCreate 00802 }; 00803 00807 Database() {} 00808 00835 static Database open(const char* name, 00836 accessFlags access = readModifyCreate); 00837 00874 Utils::Result connect(const char* name, 00875 accessFlags access = readModifyCreate); 00876 00882 accessFlags access() const; 00883 00889 bool retainChangedObjects() const; 00890 00894 Text name() const; 00895 00900 Utils::Result save(); 00901 00907 bool setAccess(accessFlags flags); 00908 00917 Utils::Result setRetainChangedObjects(bool); 00918 00923 bool mastered() const; 00924 00929 static Database find(const Object& obj); 00930 00935 static ObjectIterator zones(); 00936 00940 static ClassType classType(); 00941 00946 static Database cast(const ObjectBase& obj); 00947 00955 static Utils::Result revertAll(); 00956 }; 00957 00965 struct EXPORT_QSERVER ObjectIterator: public ObjectBase 00966 { 00970 ObjectIterator() {} 00971 00983 static ObjectIterator create(const Concept& type, 00984 const Database& db = Database()); 00985 00991 static ObjectIterator create(ClassType type, 00992 const Database& db = Database()); 00993 01000 bool valid() const; 01001 01007 Utils::Result next(); 01008 01012 void reset(); 01013 01018 Object current() const; 01019 01023 Object operator*() const { return current(); } 01024 01028 ObjectIterator& operator++() { next(); return *this; } 01029 01030 01034 static ClassType classType(); 01035 01040 static ObjectIterator cast(const ObjectBase& obj); 01041 }; 01042 01127 struct EXPORT_QSERVER Concept: public Object 01128 { 01132 enum ValueType 01133 { 01134 null, 01135 concept, 01136 textValue, 01137 intValue, 01138 floatValue, 01139 doubleValue 01140 }; 01141 01145 Concept() {} 01146 01150 Concept(const char* name); 01151 01156 Concept(const Object&); 01157 01162 Concept(ClassType); 01163 01174 static Concept create(const char* name, 01175 const Concept& parent, 01176 const Database& = Database()); 01177 01182 Utils::Result destroy(); 01183 01187 ValueType valueType() const; 01188 01192 Text name() const; 01193 01202 Utils::Result addParent(const Concept& parent); 01203 01208 Utils::Result let(const Concept& rel, const Concept& b); 01209 01214 Utils::Result refute(const Concept& rel, const Concept& b); 01215 01219 bool isValue() const; 01220 01225 bool isa(const Concept& con) const; 01226 01230 Object object() const; 01231 01244 Concept relocate(const Database&, bool eraseOriginal); 01245 01250 bool relocatable() const; 01251 01255 Utils::Result setRelocatable(bool); 01256 01260 int valueAsInt() const; 01261 01265 float valueAsFloat() const; 01266 01270 double valueAsDouble() const; 01271 01275 Text valueAsText() const; 01276 01280 Concept valueOf(const char* varName) const; 01281 01287 List descendants() const; 01288 01292 static Concept find(const char* name); 01293 01299 static Concept find(const Object&); 01300 01305 static Concept find(ClassType); 01306 01310 static ClassType classType(); 01311 01316 static Concept cast(const ObjectBase& obj); 01317 }; 01318 01348 struct EXPORT_QSERVER ConceptValue: public Concept 01349 { 01350 01354 ConceptValue(int); 01355 01359 ConceptValue(double); 01360 01364 ConceptValue(float); 01365 01369 ConceptValue(const char*); 01370 }; 01371 01395 struct EXPORT_QSERVER ConceptIterator: public ObjectBase 01396 { 01400 ConceptIterator() {} 01401 01407 static ConceptIterator create(const Concept& parent, unsigned int depth=1); 01408 01412 Concept current() const; 01413 01418 unsigned int currentDepth() const; 01419 01425 Utils::Result next(); 01426 01433 bool valid() const; 01434 01438 Concept operator*() const { return current(); } 01439 01443 ConceptIterator& operator++() { next(); return *this; } 01444 01448 static ClassType classType(); 01449 01454 static ConceptIterator cast(const ObjectBase& obj); 01455 }; 01456 01464 struct EXPORT_QSERVER Query: public ObjectBase 01465 { 01469 Query() {} 01470 01480 static Query create(const Concept& con, const Concept& relation); 01481 01485 static Query create(const Concept& con); 01486 01490 bool valid() const; 01491 01495 void reset(); 01496 01502 void next(); 01503 01511 Concept key() const; 01512 01522 Concept current() const; 01523 01528 bool light() const; 01529 01537 static bool affirm(const Concept& con, 01538 const Concept& rel, 01539 const Concept& value); 01540 01545 void removeCurrent(); 01546 01552 bool setCurrent(const Concept& value); 01553 01557 Concept operator*() const { return current(); } 01558 01562 Query& operator++() { next(); return *this; } 01563 01567 static ClassType classType(); 01568 01573 static Query cast(const ObjectBase& obj); 01574 }; 01575 01584 struct EXPORT_QSERVER List: public ObjectBase 01585 { 01589 List(); 01590 01594 static List create(); 01595 01599 unsigned int size() const; 01600 01604 Object at(unsigned int i) const; 01605 01610 void at(unsigned int i, const Object& obj); 01611 01615 static ClassType classType(); 01616 01621 static List cast(const ObjectBase&); 01622 }; 01623 01630 struct EXPORT_QSERVER ApplicationCounters 01631 { 01635 unsigned int instancesUpdated; 01636 01641 unsigned int instancesMoved; 01642 01646 unsigned int instancesDrawn; 01647 01651 float avRenderTime; 01652 01656 float avUpdateTime; 01657 01662 float avAppTime; 01663 }; 01664 01671 struct EXPORT_QSERVER ApplicationMemoryUsage 01672 { 01676 unsigned int totalMemoryAllocated; 01677 01681 unsigned int internalFreeMemory; 01682 01686 unsigned int totalStringMemory; 01687 01691 unsigned int totalOIDMemory; 01692 01696 unsigned int totalSystemMemoryUsed; 01697 }; 01698 01705 struct EXPORT_QSERVER ApplicationPreloadCounters 01706 { 01712 unsigned int pathCount; 01713 01717 unsigned int loadQueueSize; 01718 01722 unsigned int lodQueueSize; 01723 01727 unsigned int outscopeZonesRendered; 01728 01765 char loadChart[32]; 01766 01770 float loadRuntime; 01771 01775 size_t renderAssetSize; 01776 }; 01777 01791 struct EXPORT_QSERVER Application: public ObjectBase 01792 { 01796 enum preloadMip 01797 { 01798 mipDefault, 01799 mip64, 01800 mip128, 01801 mip256, 01802 mip512, 01803 mip1024 01804 }; 01805 01809 Application(); 01810 01814 static Application app(); 01815 01826 void init(int& argc, char** argv); 01827 01831 Screen screen() const; 01832 01837 unsigned int objectCacheSize() const; 01838 01843 unsigned int objectCacheFree() const; 01844 01849 unsigned int objectCacheOverflow() const; 01850 01854 unsigned int scopeZoneCount() const; 01855 01861 float speed() const; 01862 01867 Utils::Result setObjectCacheSize(unsigned int); 01868 01881 Utils::Result setTargetFPS(float); 01882 01888 Utils::Result setSpeed(float); 01889 01896 Utils::Result start(bool enterLoop = true); 01897 01904 bool tick(); 01905 01909 Utils::Result stop(); 01910 01917 Utils::Result activateBackgroundLoader(bool b = true); 01918 01924 Utils::Result activateBackgroundSwapper(bool b = true); 01925 01929 bool backgroundLoaderActive() const; 01930 01934 bool backgroundSwapperActive() const; 01935 01944 Utils::Result shutdown(); 01945 01950 double time() const; 01951 01956 double appTime() const; 01957 01962 Utils::Result addListener(ApplicationListener&); 01963 01967 Utils::Result removeListener(ApplicationListener&); 01968 01973 Utils::Result addListener(ResidencyListener&); 01974 01978 Utils::Result removeListener(ResidencyListener&); 01979 01983 Utils::Result addClumpLoadedListener(ResidencyListener&); 01984 01988 Utils::Result removeClumpLoadedListener(ResidencyListener&); 01989 01994 Utils::Result add(const ScopeReactor&); 01995 01999 Utils::Result remove(const ScopeReactor&); 02000 02005 Utils::Result add(const BoundsReactor&); 02006 02010 Utils::Result remove(const BoundsReactor&); 02011 02015 void lock(); 02016 02020 void unlock(); 02021 02025 Utils::Result getApplicationCounters(ApplicationCounters&); 02026 02030 Utils::Result getApplicationMemoryUsage(ApplicationMemoryUsage&); 02031 02035 Utils::Result getApplicationPreloadCounters(ApplicationPreloadCounters&); 02036 02045 Utils::Result preloadScope(unsigned int* countdown, 02046 preloadMip mip = mipDefault); 02047 02048 02052 Utils::Result activateServer(bool = true); 02053 02057 Utils::Result activateClient(const char* serverName); 02058 02062 static ClassType classType(); 02063 02068 static Application cast(const ObjectBase& obj); 02069 02074 Utils::Result createMasteringLayout(); 02075 02079 Utils::Result optimizeLayout(Database&); 02080 }; 02081 02094 struct EXPORT_QSERVER Screen: public ObjectBase 02095 { 02099 enum PerformanceCounter { 02103 triangle, 02104 02108 update, 02109 02113 shader, 02114 02118 matrix, 02119 02123 texture 02124 }; 02125 02135 enum MouseFocusChange { 02136 mouseFocusNone, 02137 mouseFocusOver, 02138 mouseFocusClick, 02139 mouseFocusOverClick 02140 }; 02141 02145 enum KeyFocusChange { 02146 keyFocusNone, 02147 keyFocusFollowMouse 02148 }; 02149 02150 02154 Screen(); 02155 02186 static Screen create(const char* screenName, 02187 const char* inputName, 02188 const char* displayName, 02189 const Maths::Vec2f& physicalExtent, 02190 const Maths::Vec2f& virtualExtent, 02191 unsigned int depth, 02192 bool fullscreen); 02225 static Screen create(Draw::WindowInfo* winInfo, 02226 const char* inputName, 02227 const char* displayName, 02228 const Maths::Vec2f& physicalExtent, 02229 const Maths::Vec2f& virtualExtent, 02230 unsigned int depth); 02231 02235 ~Screen(); 02236 02240 Maths::Vec2f virtualExtent() const; 02241 02245 Maths::Vec2f physicalExtent() const; 02246 02250 Maths::Vec2f physicalAspect() const; 02251 02255 Layer keyboardFocus() const; 02256 02261 KeyFocusChange keyboardFocusChange() const; 02262 02266 Layer mouseFocus() const; 02267 02272 MouseFocusChange mouseFocusChange() const; 02273 02280 Layer alwaysTopLayer() const; 02281 02285 SpeakerSet speakerSet() const; 02286 02291 size_t renderCacheSize() const; 02292 02297 size_t textureCacheSize() const; 02298 02302 bool textureBitDepthClamp() const; 02303 02307 Utils::Result setPhysicalExtent(const Maths::Vec2f& box); 02308 02312 Utils::Result setKeyboardFocusChange(KeyFocusChange); 02313 02317 Utils::Result setMouseFocusChange(MouseFocusChange); 02318 02323 Utils::Result setSpeakerSet(const SpeakerSet&); 02324 02330 Utils::Result setRenderCacheSize(size_t); 02331 02337 Utils::Result setTextureCacheSize(size_t size); 02338 02342 Utils::Result setTextureBitDepthClamp(bool); 02343 02347 Utils::Result moveToTop(const Layer& layer); 02348 02352 Utils::Result moveToBottom(const Layer& layer); 02353 02360 Utils::Result moveLayerOver(const Layer& layer1, 02361 const Layer& layer2); 02362 02369 Utils::Result moveLayerUnder(const Layer& layer1, 02370 const Layer& layer2); 02371 02375 bool isLayerAbove(const Layer& layer1, 02376 const Layer& layer2); 02377 02382 Layer layerAbove(const Layer& l) const; 02383 02388 Layer layerBelow(const Layer& l) const; 02389 02393 Utils::Result setKeyboardFocus(const Layer& layer); 02394 02398 Utils::Result setMouseFocus(const Layer& layer); 02399 02403 unsigned int readCounter(PerformanceCounter) const; 02404 02408 Utils::Result resetCounter(PerformanceCounter); 02409 02413 static ClassType classType(); 02414 02419 static Screen cast(const ObjectBase&); 02420 02449 Utils::Result initMouse(const Maths::Vec2f sensitivity, 02450 bool allowPositionEvents, 02451 bool allowMoveEvents); 02452 02457 Utils::Result filterMouseEvents(bool allowPositionEvents, 02458 bool allowMoveEvents); 02464 Maths::Vec2f mousePos() const; 02465 02472 Utils::Result setMousePos(const Maths::Vec2f& virtPos); 02473 02480 Maths::Vec2f mouseSensitivity() const; 02481 02488 Utils::Result setMouseSensitivity(const Maths::Vec2f sensitivity); 02489 }; 02490 02491 02500 struct EXPORT_QSERVER Sample 02501 { 02505 Sample(); 02506 02510 Sample(Clip clip); 02511 02515 ~Sample(); 02516 02521 bool valid(); 02522 02526 float duration(); 02527 02531 size_t sampleCount(); 02532 02536 unsigned int rate(); 02537 02541 unsigned int depth(); 02542 02546 unsigned int voiceCount(); 02547 02551 Text clipName() const; 02552 02553 private: 02554 void getClipInfo(); 02555 02556 Text clip_; 02557 unsigned int rate_; 02558 unsigned int depth_; 02559 unsigned int voiceCount_; 02560 size_t sampleCount_; 02561 bool valid_; 02562 }; 02563 02573 struct EXPORT_QSERVER SpeakerSet: public ObjectBase 02574 { 02578 enum SoundCounter { 02582 totalPlaying, 02587 totalFailed, 02591 totalMem, 02595 totalMemPlaying, 02596 /* Total amount of sound memory used by channels that failed to play 02597 * since counter was last reset. 02598 */ 02599 totalMemFailed 02600 }; 02601 02605 enum SpeakerType { 02606 headphones, 02607 monoSpeakers, 02608 stereoSpeakers, 02609 dolbySpeakers, 02610 fivePOne 02611 }; 02612 02616 SpeakerSet(); 02617 02623 static SpeakerSet create(const char* driverName); 02624 02628 ~SpeakerSet(); 02629 02633 static float silenceVolume(); 02634 02645 Utils::Result setParameters(Audio::SoundDriverParam* parameters); 02646 02651 size_t soundCacheMaxSize() const; 02652 02656 size_t soundCacheSize() const; 02657 02661 SpeakerType speakerType() const; 02662 02667 float volume() const; 02668 02672 float ambientVolume() const; 02673 02679 Utils::Result setSoundCacheSize(size_t); 02680 02686 Utils::Result setSpeakerType(SpeakerType); 02687 02693 Utils::Result setVolume(float); 02694 02698 Utils::Result setAmbientVolume(float); 02699 02708 void play(const Sample&, float vol); 02709 02713 unsigned int readCounter(SoundCounter) const; 02714 02718 Utils::Result resetCounter(SoundCounter); 02719 02723 static ClassType classType(); 02724 02729 static SpeakerSet cast(const ObjectBase&); 02730 }; 02731 02762 struct EXPORT_QSERVER Layer: public ObjectBase 02763 { 02767 Layer() {} 02768 02772 Utils::Result destroy(); 02773 02777 Maths::Vec2f center() const; 02778 02782 Maths::Vec2f extent() const; 02783 02787 Maths::Vec2f alignment() const; 02788 02795 float angle() const; 02796 02801 unsigned int depth() const; 02802 02806 bool visible() const; 02807 02812 bool alwaysTop() const; 02813 02817 bool rejectFocus() const; 02818 02822 Screen screen() const; 02823 02829 Maths::Vec2f layerToScreen(const Maths::Vec2f& layerRel) const; 02830 02836 Maths::Vec2f screenToLayer(const Maths::Vec2f& screenRel) const; 02837 02843 Maths::Vec2f layerToWindow(const Maths::Vec2f& layerRel) const; 02844 02850 Maths::Vec2f windowToLayer(const Maths::Vec2f& windowRel) const; 02851 02855 Utils::Result setCenter(const Maths::Vec2f& center); 02856 02860 Utils::Result setExtent(const Maths::Vec2f& extent); 02861 02865 Utils::Result setAlignment(const Maths::Vec2f& alignment); 02866 02870 Utils::Result setAngle(float angle); 02871 02876 Utils::Result setDepth(unsigned int depth); 02877 02883 Utils::Result setVisible(bool v); 02884 02890 Utils::Result setRejectFocus(bool r); 02891 02896 Utils::Result addListener(KeyboardListener&); 02897 02901 Utils::Result removeListener(KeyboardListener&); 02902 02907 Utils::Result addListener(MouseListener&); 02908 02912 Utils::Result removeListener(MouseListener&); 02913 }; 02914 02950 struct EXPORT_QSERVER ImageLayer: public Layer 02951 { 02955 ImageLayer(); 02956 02977 static ImageLayer create(const Screen&, 02978 const Shader& shader, 02979 const Maths::Vec2f& center, 02980 const Maths::Vec2f& extent, 02981 const Maths::Vec2f& alignment, 02982 const Maths::Color4b& color, 02983 bool isAlwaysTop = false); 02984 02988 ~ImageLayer(); 02989 02994 Maths::Vec2f imageCoordinate(unsigned int i) const; 02995 03000 Maths::Color4b color(unsigned int i) const; 03001 03006 Utils::Result setImageCoordinate(unsigned int i, 03007 const Maths::Vec2f& v); 03008 03013 Utils::Result setColor(unsigned int i, const Maths::Color4b& c); 03014 03018 static ClassType classType(); 03019 03024 static ImageLayer cast(const ObjectBase&); 03025 03026 }; 03027 03039 struct TextMetrics 03040 { 03041 Maths::Box2f extent; 03042 Maths::Vec2f advance; 03043 }; 03044 03065 struct EXPORT_QSERVER Font: public Object 03066 { 03071 enum textJustification { 03072 leftJustified, 03073 rightJustified, 03074 centerJustified 03075 }; 03076 03080 Font() {} 03081 03086 Font(const char* name); 03087 03093 static Font create(const char* name, 03094 const Database& db = Database()); 03095 03100 Shader shader() const; 03101 03105 const char* familyName() const; 03106 03110 const char* styleName() const; 03111 03116 float ascender() const; 03117 03122 float descender() const; 03123 03127 float height() const; 03128 03133 Utils::Result setShader(const Shader&); 03134 03138 Utils::Result setFamilyName(const char*); 03139 03143 Utils::Result setStyleName(const char*); 03144 03149 Utils::Result setAscender(float); 03150 03155 Utils::Result setDescender(float); 03156 03160 Utils::Result setHeight(float); 03161 03168 Utils::Result addGlyph(unsigned int ch, 03169 const TextMetrics& metrics, 03170 const Maths::Box2f& image); 03171 03176 bool findGlyph(unsigned int ch, 03177 TextMetrics& metrics, 03178 Maths::Box2f& image); 03179 03185 Utils::Result addKernPair(unsigned int first, 03186 unsigned int second, 03187 const Maths::Vec2f& offset); 03188 03193 bool findKernPair(unsigned int first, unsigned int second, 03194 Maths::Vec2f& offset); 03195 03199 void measureGlyph(unsigned int ch, TextMetrics& m); 03200 03204 void measureText(const char* s, TextMetrics& m); 03205 03210 static Font find(const char* name); 03211 03215 static ClassType classType(); 03216 03224 static Font cast(const ObjectBase&); 03225 }; 03226 03246 struct EXPORT_QSERVER TextLayer: public Layer 03247 { 03251 TextLayer(); 03252 03278 static TextLayer create(const Screen&, 03279 const char* s, 03280 const Font& font, 03281 unsigned int pointSize, 03282 float margin, 03283 Font::textJustification justification, 03284 const Maths::Vec2f& center, 03285 const Maths::Vec2f& alignment, 03286 const Maths::Color4b& color, 03287 bool isAlwaysTop = false); 03288 03292 ~TextLayer(); 03293 03297 Maths::Color4b color() const; 03298 03302 Text text() const; 03303 03307 Font font() const; 03308 03312 unsigned int pointSize() const; 03313 03317 Font::textJustification justification() const; 03318 03322 Utils::Result setColor(Maths::Color4b c); 03323 03327 Utils::Result setText(const char* s); 03328 03332 Utils::Result setPointSize(unsigned int pointSize); 03333 03337 Utils::Result setJustification(Font::textJustification j); 03338 03342 static ClassType classType(); 03343 03348 static TextLayer cast(const ObjectBase& obj); 03349 }; 03350 03358 struct EXPORT_QSERVER LogLayer: public Layer 03359 { 03363 LogLayer(); 03364 03391 static LogLayer create(const Screen&, 03392 const Font& font, 03393 unsigned int pointSize, 03394 float margin, 03395 Font::textJustification, 03396 const Maths::Vec2f& center, 03397 const Maths::Vec2f& extent, 03398 const Maths::Vec2f& alignment, 03399 const Maths::Color4b& color, 03400 bool isAlwaysTop = false); 03401 03405 ~LogLayer(); 03406 03410 Maths::Color4b color() const; 03411 03415 unsigned int pointSize() const; 03416 03420 Utils::Result setColor(Maths::Color4b c); 03421 03425 Utils::Result setPointSize(unsigned int pointSize); 03426 03430 Utils::Result addLog(const char* text); 03431 03435 static ClassType classType(); 03436 03441 static LogLayer cast(const ObjectBase& obj); 03442 }; 03443 03444 #ifdef __dpf_h__ 03445 03452 struct EXPORT_QSERVER LogLayerLogger: public Utils::Logger 03453 { 03454 LogLayerLogger(const LogLayer& log) 03455 : log_(log) {} 03456 03457 void print(Utils::MessageClass cls, 03458 const char *fmt, va_list args); 03459 03460 private: 03461 LogLayer log_; 03462 }; 03463 03464 #endif 03465 03477 struct EXPORT_QSERVER CameraLayer: public Layer 03478 { 03482 CameraLayer(); 03483 03498 static CameraLayer create(const Screen&, 03499 const Camera&, 03500 const Maths::Vec2f& center, 03501 const Maths::Vec2f& extent, 03502 const Maths::Vec2f& alignment); 03503 03507 ~CameraLayer(); 03508 03512 Camera camera() const; 03513 03518 float lodFactor() const; 03519 03523 Utils::Result setCamera(const Camera& camera); 03524 03531 Utils::Result setLodFactor(float factor); 03532 03538 bool pick(const Maths::Vec2f& p, 03539 RayInfo* ri); 03540 03552 Utils::Result drag(const Maths::Vec2f& p, 03553 const Maths::Vec3f& n, 03554 RayInfo* ri); 03555 03560 Utils::Result trackball(const Maths::Vec2f& p, 03561 RayInfo* ri); 03562 03567 Utils::Result angularDrag(const Maths::Vec2f& p, 03568 RayInfo* ri); 03569 03576 Maths::Vec3f dragPointInPlane(const Maths::Vec2f& p, 03577 const Maths::Vec3f& n, 03578 const Maths::Vec3f& w) const; 03579 03588 bool coordToScreen(const Maths::Vec3f& coord, 03589 Maths::Vec2f& screenRelative, 03590 Maths::Vec2f& layerRelative); 03591 03600 bool worldToLayer(const Maths::Vec3f& worldRelative, 03601 Maths::Vec2f& layerRelative) const; 03602 03610 void layerToWorld(const Maths::Vec2f& layerRelative, 03611 Maths::Vec3f& worldRelative) const; 03612 03616 static ClassType classType(); 03617 03622 static CameraLayer cast(const ObjectBase&); 03623 }; 03624 03640 struct EXPORT_QSERVER StatsLayer: public Layer 03641 { 03645 enum Category { 03646 03650 Fps = 0x0001, 03651 03657 General = 0x0002, 03658 03662 Loading = 0x0004, 03663 03669 Memory = 0x0008, 03670 03675 Objects = 0x0010, 03676 03681 Instances = 0x0020, 03682 03687 Draw = 0x0040, 03688 03693 Times = 0x0080, 03694 03699 Sounds = 0x0100, 03700 03706 Clumps = 0x0200 03707 }; 03708 03712 StatsLayer(); 03713 03735 static StatsLayer create(const Screen& screen, 03736 const Font& font, 03737 unsigned int pointSize, 03738 float margin, 03739 const Maths::Vec2f& center, 03740 const Maths::Vec2f& alignment, 03741 const Maths::Color4b& color, 03742 const Maths::Color4b& shadowColor, 03743 bool isAlwaysTop = false); 03744 03748 ~StatsLayer(); 03749 03754 unsigned int categories() const; 03755 03759 unsigned int pointSize() const; 03760 03764 Maths::Color4b color() const; 03765 03769 Maths::Color4b shadowColor() const; 03770 03777 bool compactMode() const; 03778 03785 bool historyEnabled() const; 03786 03791 Utils::Result setCategories(unsigned int); 03792 03796 Utils::Result setPointSize(unsigned int); 03797 03801 Utils::Result setColor(const Maths::Color4b& color); 03802 03806 Utils::Result setShadowColor(const Maths::Color4b& color); 03807 03814 Utils::Result setCompactMode(bool); 03815 03822 Utils::Result setHistoryEnabled(bool); 03823 03828 Utils::Result resetHistory(); 03829 03833 static ClassType classType(); 03834 03839 static StatsLayer cast(const ObjectBase& obj); 03840 }; 03841 03842 03852 struct EXPORT_QSERVER TriangleIterator: public ObjectBase 03853 { 03862 bool valid() const; 03863 03871 Utils::Result next(); 03872 03882 bool index(unsigned int index); 03883 03894 unsigned int add(unsigned int i1, unsigned int i2, unsigned int i3, 03895 const Shader& shader); 03896 03903 unsigned int add(const TriangleIterator& src); 03904 03911 Utils::Result remove(); 03912 03917 unsigned int wedge(unsigned int n) const; 03918 03922 Shader shader() const; 03923 03929 Utils::Result setShader(const Shader& s); 03930 03934 unsigned int index() const; 03935 03939 TriangleIterator& operator++() { next(); return *this; } 03940 }; 03941 03952 struct EXPORT_QSERVER VertexIterator: public ObjectBase 03953 { 03959 bool valid() const; 03960 03966 Utils::Result next(); 03967 03972 void index(unsigned int index); 03973 03977 Maths::Vec3f vertex() const; 03978 03982 Maths::Vec3f current() const { return vertex(); } 03983 03987 void setVertex(const Maths::Vec3f& v); 03988 03993 unsigned int add(const Maths::Vec3f& v); 03994 04001 unsigned int addDirect(const Maths::Vec3f& v); 04002 04006 unsigned int index() const; 04007 04011 Maths::Vec3f operator*() const { return current(); } 04012 04016 VertexIterator& operator++() { next(); return *this; } 04017 }; 04018 04032 struct EXPORT_QSERVER WedgeIterator: public ObjectBase 04033 { 04039 bool valid() const; 04040 04046 Utils::Result next(); 04047 04052 void index(unsigned int index); 04053 04057 void setWedge(unsigned int vertex, 04058 Maths::Color4b color, 04059 Maths::Vec3f normal, 04060 Maths::Vec2f texco); 04061 04065 void setVertex(unsigned int vertex); 04066 04070 void setColor(Maths::Color4b color); 04071 04075 void setNormal(Maths::Vec3f normal); 04076 04080 void setTexco(Maths::Vec2f texco); 04081 04085 unsigned int vertex() const; 04086 04090 Maths::Color4b color() const; 04091 04095 Maths::Vec3f normal() const; 04096 04100 Maths::Vec2f texco() const; 04101 04105 unsigned int index() const; 04106 04112 unsigned int add(unsigned int vertex, 04113 Maths::Color4b color, 04114 Maths::Vec3f normal, 04115 Maths::Vec2f texco); 04116 04124 unsigned int addDirect(unsigned int vertex, 04125 Maths::Color4b color, 04126 Maths::Vec3f normal, 04127 Maths::Vec2f texco); 04128 04132 WedgeIterator& operator++() { next(); return *this; } 04133 }; 04134 04142 struct EXPORT_QSERVER SampleIterator: public ObjectBase 04143 { 04149 bool valid() const; 04150 04154 unsigned int count() const; 04155 04161 Utils::Result next(); 04162 04168 bool setIndex(unsigned int index); 04169 04173 Sample sample() const; 04174 04178 Sample current() const { return sample(); } 04179 04183 void setSample(Sample& s); 04184 04189 unsigned int add(Sample& s); 04190 04194 static ClassType classType(); 04195 04199 unsigned int index() const; 04200 04204 Sample operator*() const { return current(); } 04205 04209 SampleIterator& operator++() { next(); return *this; } 04210 }; 04211 04222 struct EXPORT_QSERVER FullTriangleIterator: public ObjectBase 04223 { 04229 bool valid() const; 04230 04236 Utils::Result next(); 04237 04243 bool index(unsigned int index); 04244 04253 unsigned int add(const Maths::Vec3f& v1, 04254 const Maths::Vec3f& v2, 04255 const Maths::Vec3f& v3, 04256 const Shader& shader); 04257 04262 unsigned int add(const FullTriangleIterator& src); 04263 04268 Shader shader() const; 04269 04273 Utils::Result getCoordinates(Maths::Vec3f& v1, 04274 Maths::Vec3f& v2, 04275 Maths::Vec3f& v3) const; 04276 04280 Utils::Result setShader(const Shader& s); 04281 04285 unsigned int index() const; 04286 04290 FullTriangleIterator& operator++() { next(); return *this; } 04291 }; 04292 04308 struct EXPORT_QSERVER FxClass: public Object 04309 { 04322 enum loopInterpType { 04323 sawtooth, 04324 triangle, 04325 random 04326 }; 04327 04340 enum loopCountType { 04341 count, 04342 frequency 04343 }; 04344 04352 enum distribution { 04353 uniform, 04354 gaussian 04355 }; 04356 04362 template<class T> struct Dimension { 04363 Dimension() 04364 : init_(0), 04365 initRange_(0), 04366 initDist_(uniform), 04367 delta_(0), 04368 deltaRange_(0), 04369 deltaDist_(uniform) {} 04370 04374 Dimension(T init) 04375 : init_(init), 04376 initRange_(0), 04377 initDist_(uniform), 04378 delta_(0), 04379 deltaRange_(0), 04380 deltaDist_(uniform) {} 04381 04388 Dimension(T init, T initRange, distribution initDist, 04389 T delta, T deltaRange, distribution deltaDist) 04390 : init_(init), 04391 initRange_(initRange), 04392 initDist_(initDist), 04393 delta_(delta), 04394 deltaRange_(deltaRange), 04395 deltaDist_(deltaDist) {} 04396 04400 T init_; 04401 04405 T initRange_; 04406 04410 distribution initDist_; 04411 04415 T delta_; 04416 04420 T deltaRange_; 04421 04425 distribution deltaDist_; 04426 }; 04427 04431 typedef Dimension<float> Dimensionf; 04432 04436 Maths::Vec4f startColor() const; 04437 04441 Maths::Vec4f endColor() const; 04442 04446 loopInterpType colorInterpType() const; 04447 04451 loopCountType colorCountType() const; 04452 04456 float colorLoop() const; 04457 04465 Texture texture() const; 04466 04471 Maths::Vec2f origin() const; 04472 04477 Maths::Vec2f extent() const; 04478 04482 unsigned int rows() const; 04483 04487 unsigned int columns() const; 04488 04493 unsigned int startFrame() const; 04494 04499 unsigned int endFrame() const; 04500 04504 loopInterpType frameInterpType() const; 04505 04509 loopCountType frameCountType() const; 04510 04514 float frameLoop() const; 04515 04522 float restitution() const; 04523 04527 float mass() const; 04528 04538 float resist1() const; 04539 float resist2() const; 04541 04547 float springStiffness() const; 04548 04553 bool collide() const; 04554 04559 bool blend() const; 04560 04564 Utils::Result setStartColor(const Maths::Vec4f&); 04565 04569 Utils::Result setEndColor(const Maths::Vec4f&); 04570 04574 Utils::Result setColorInterpType(loopInterpType); 04575 04579 Utils::Result setColorCountType(loopCountType); 04580 04584 Utils::Result setColorLoop(float); 04585 04589 Utils::Result setTexture(Texture); 04590 04595 Utils::Result setOrigin(const Maths::Vec2f &); 04596 04601 Utils::Result setExtent(const Maths::Vec2f &); 04602 04606 Utils::Result setRows(unsigned int); 04607 04611 Utils::Result setColumns(unsigned int); 04612 04617 Utils::Result setStartFrame(unsigned int); 04618 04623 Utils::Result setEndFrame(unsigned int); 04624 04628 Utils::Result setFrameInterpType(loopInterpType); 04629 04633 Utils::Result setFrameCountType(loopCountType); 04634 04638 Utils::Result setFrameLoop(float); 04639 04646 Utils::Result setRestitution(float r); 04647 04651 Utils::Result setMass(float m); 04652 04658 Utils::Result setResist1(float); 04659 Utils::Result setResist2(float); 04661 04666 Utils::Result setSpringStiffness(float); 04667 04672 Utils::Result setCollide(bool c); 04673 04678 Utils::Result setBlend(bool b); 04679 04683 static ClassType classType(); 04684 04692 static FxClass cast(const ObjectBase&); 04693 }; 04694 04706 struct EXPORT_QSERVER FxClassUse { 04707 04708 // Constructors 04709 FxClassUse() {} 04710 04715 FxClassUse(const FxClass& fxclass, float life); 04716 04722 FxClassUse(const FxClass& fxclass, 04723 float life, 04724 float lifeRange, 04725 FxClass::distribution lifeDist); 04726 04727 bool operator==(const FxClassUse& fxcu) const; 04728 04732 FxClass fxClass_; 04733 04737 float life_; 04738 04742 float lifeRange_; 04743 04747 FxClass::distribution lifeDist_; 04748 }; 04749 04767 struct EXPORT_QSERVER FxClassSequence: public Object 04768 { 04772 FxClassSequence() {} 04773 04778 FxClassSequence(const char* name); 04779 04785 static FxClassSequence create(const char* name, 04786 const Database& db = Database()); 04787 04794 static FxClassSequence create(const char* name, const FxClassUse& fxcu, 04795 const Database& db = Database()); 04796 04800 FxClassUse at(unsigned int i) const; 04801 04805 unsigned int size() const; 04806 04810 Utils::Result set(unsigned int i, const FxClassUse& fxcu); 04811 04815 Utils::Result add(const FxClassUse& fxcu); 04816 04820 Utils::Result clear(); 04821 04826 static FxClassSequence find(const char* name); 04827 04831 static ClassType classType(); 04832 04840 static FxClassSequence cast(const ObjectBase&); 04841 }; 04842 04843 /* 04844 * The subclasses of the FxClass must define an individual atom. The following 04845 * features are defined: 04846 * 04847 * - the inital physical dimensions of the atom. 04848 * - the way in which the dimensions change over time. 04849 * - the way in which the atoms are initially oriented. 04850 * - the way in which the atom orientation changes over time. 04851 */ 04852 04864 struct EXPORT_QSERVER FxClassParticle: public FxClass 04865 { 04869 FxClassParticle() {} 04870 04875 FxClassParticle(const char* name); 04876 04882 static FxClassParticle create(const char* name, 04883 const Database& db = Database()); 04884 04890 Dimensionf radius() const; 04891 04898 Dimensionf orientation() const; 04899 04903 float aspectRatio() const; 04904 04909 Utils::Result setRadius(const Dimensionf& radius); 04910 04915 Utils::Result setOrientation(const Dimensionf& orientation); 04916 04920 Utils::Result setAspectRatio(float); 04921 04926 static FxClassParticle find(const char* name); 04927 04931 static ClassType classType(); 04932 04940 static FxClassParticle cast(const ObjectBase&); 04941 }; 04942 04954 struct EXPORT_QSERVER Clip: public Object 04955 { 04959 Clip() {} 04960 04969 Clip(const char* name, const char* mimeType); 04970 04974 ~Clip(); 04975 04983 static Clip create(const char* name, const char* mimeType, 04984 void* data, 04985 unsigned int size, 04986 const Database& db = Database()); 04987 04993 static Clip create(const char* name, const char* mimeType, 04994 const Database& db = Database()); 04995 05002 static Clip create(const char* name, Net::ReadStream* rs, 05003 const Database& db = Database()); 05004 05008 Utils::Result destroy(); 05009 05013 double createTime() const; 05014 05018 double modifyTime() const; 05019 05023 unsigned int size() const; 05024 05028 Text mimeType() const; 05029 05034 Text majorType() const; 05035 05040 Text minorType() const; 05041 05042 // Features 05043 05049 Utils::Result read(size_t offset, 05050 void* buf, 05051 size_t bytes, 05052 size_t& bytesRead) const; 05053 05059 Utils::Result write(size_t offset, 05060 const void* buf, 05061 size_t bytes, 05062 size_t& bytesWritten); 05063 05067 Utils::Result truncate(size_t); 05068 05074 Utils::Result setData(Net::ReadStream* rs); 05075 05079 Utils::Result data(Net::ReadStream** rs) const; 05080 05088 static Clip find(const char* name, const char* mimeType); 05089 05093 static ClassType classType(); 05094 05102 static Clip cast(const ObjectBase&); 05103 }; 05104 05114 struct EXPORT_QSERVER Bitmap: public Object 05115 { 05119 Bitmap(); 05120 05128 Bitmap(Clip clip); 05129 05133 ~Bitmap(); 05134 05142 static Bitmap create(const char* name, Image::Pixmap*, 05143 const Database& db = Database()); 05144 05151 static Bitmap create(const char* name, const Clip&, 05152 const Database& db = Database()); 05153 05157 unsigned int width() const; 05158 05162 unsigned int height() const; 05163 05167 unsigned int depth() const; 05168 05176 bool isMip(unsigned int& mipLevel) const; 05177 05181 Text clipName() const; 05182 05187 static Bitmap find(const char* name); 05188 05192 static ClassType classType(); 05193 05201 static Bitmap cast(const ObjectBase&); 05202 }; 05203 05215 struct EXPORT_QSERVER Environment: public Object 05216 { 05220 Environment(); 05221 05226 Environment(const char*); 05227 05233 static Environment create(const char* name, 05234 const Database& db = Database()); 05235 05241 float fogEnd() const; 05242 05249 float fogStart() const; 05250 05257 Maths::Color4b fogColor() const; 05258 05262 bool fogging() const; 05263 05268 Group skyBox() const; 05269 05276 bool skyBoxLighting() const; 05277 05284 Maths::Vec3f sceneAmbient() const; 05285 05289 unsigned int lightCount() const; 05290 05295 Maths::Vec3f lightDirection(unsigned int idx) const; 05296 05301 Maths::Vec3f lightColor(unsigned int idx) const; 05302 05306 SimpleSound ambientSound() const; 05307 05313 AudioEffect audioEffect() const; 05314 05318 Utils::Result setFogEnd(float fogEnd); 05319 05323 Utils::Result setFogStart(float fogStart); 05324 05328 Utils::Result setFogColor(const Maths::Color4b& fogColor); 05329 05334 Utils::Result setFogging(bool fogEnable); 05335 05340 Utils::Result setSkyBox(Group skybox); 05341 05348 Utils::Result setSkyBoxLighting(bool light); 05349 05356 Utils::Result setSceneAmbient(const Maths::Vec3f&); 05357 05363 Utils::Result setLightCount(unsigned int); 05364 05370 Utils::Result setLight(unsigned int idx, 05371 const Maths::Vec3f& direction, 05372 const Maths::Vec3f& color); 05373 05378 Utils::Result setAmbientSound(const SimpleSound&); 05379 05388 Utils::Result setAudioEffect(const AudioEffect&); 05389 05394 static Environment find(const char* name); 05395 05399 static ClassType classType(); 05400 05408 static Environment cast(const ObjectBase&); 05409 }; 05410 05429 struct EXPORT_QSERVER Zone: public Object 05430 { 05435 enum rayTestFlags { 05440 throughPortals = 1, 05441 05446 instanceValid = 2, 05447 05453 normalValid = 4, 05454 05459 faceNormalValid = 8 05460 }; 05461 05465 Zone() {} 05466 05471 Zone(const char* name); 05472 05478 static Zone create(const char *name, 05479 const Database& db = Database()); 05480 05485 Group root() const; 05486 05491 Maths::Box3f box() const; 05492 05498 Environment environment() const; 05499 05505 Utils::Result setEnvironment(const Environment& e); 05506 05526 RayInfo rayTestClosest(const Maths::Vec3f& position, 05527 const Maths::Vec3f& direction, 05528 float distance, 05529 unsigned int flags, 05530 const Group& exclude); 05531 05546 bool rayTestClosest(const Maths::Vec3f& position, 05547 const Maths::Vec3f& direction, 05548 float distance, 05549 unsigned int flags, 05550 const Group& exclude, 05551 RayInfo* ri) const; 05552 05567 RayInfo rayTestAny(const Maths::Vec3f& position, 05568 const Maths::Vec3f& direction, 05569 float distance, 05570 unsigned int flags, 05571 const Group& exclude); 05572 05584 bool rayTestAny(const Maths::Vec3f& position, 05585 const Maths::Vec3f& direction, 05586 float distance, 05587 unsigned int flags, 05588 const Group& exclude, 05589 RayInfo* ri) const; 05590 05604 List rangeQuery(const Maths::Box3f& box, 05605 unsigned int flags, 05606 const Concept& filter) const; 05607 05621 List rangeQuery(const Maths::Sphere3f& s, 05622 unsigned int flags, 05623 const Concept& filter) const; 05624 05638 List rangeQuery(const Maths::Cylinder3f& s, 05639 unsigned int flags, 05640 const Concept& filter) const; 05641 05646 static Zone find(const char* name); 05647 05651 static ClassType classType(); 05652 05660 static Zone cast(const ObjectBase&); 05661 }; 05662 05671 struct EXPORT_QSERVER Playback: public ObjectBase 05672 { 05678 enum Mode { 05682 replace, 05686 queue, 05687 }; 05688 05692 static Playback create(); 05693 05716 Utils::Result playAnimation(Mode mode, 05717 const Animation& anim, 05718 float speed, 05719 float tweenDelay, 05720 float start, 05721 float end); 05722 05728 Utils::Result playAnimation(Mode mode, 05729 const Animation& anim, 05730 float speed, 05731 float tweenDelay); 05732 05747 Utils::Result seek(const Animation&, float time); 05748 05761 Utils::Result getAnimation(Mode mode, 05762 Animation& anim, 05763 float& speed, 05764 float& tweenDelay, 05765 float& start, 05766 float& end); 05767 05771 float speed() const; 05772 05781 Utils::Result setSpeed(float speed); 05782 05786 Utils::Result addListener(PlaybackListener& listener); 05787 05791 Utils::Result removeListener(PlaybackListener& listener); 05792 05797 static Playback cast(const ObjectBase&); 05798 05802 static ClassType classType(); 05803 }; 05804 05817 struct EXPORT_QSERVER Geom: public Object 05818 { 05822 Geom() {} 05823 05828 bool visible() const; 05829 05834 bool intersectable() const; 05835 05840 bool collidee() const; 05841 05846 bool collider() const; 05847 05851 bool boundsEvent() const; 05852 05856 bool lightable() const; 05857 05866 bool disabled() const; 05867 05871 Maths::Box3f box() const; 05872 05877 Utils::Result setVisible(bool b); 05878 05883 Utils::Result setIntersectable(bool b); 05884 05890 Utils::Result setCollidee(bool b); 05891 05897 Utils::Result setCollider(bool b); 05898 05903 Utils::Result setBoundsEvent(bool b); 05904 05908 Utils::Result setLightable(bool b); 05909 05914 Utils::Result setDisabled(bool b); 05915 05923 static Geom cast(const ObjectBase&); 05924 }; 05925 05935 struct EXPORT_QSERVER LodHolder: public Geom 05936 { 05940 LodHolder() {} 05941 05946 LodHolder(const char* name); 05947 05953 static LodHolder create(const char* name, 05954 const Database& db = Database()); 05955 05959 unsigned int lodCount() const; 05960 05965 Geom lod(unsigned int pos) const; 05966 05973 float lodRange() const; 05974 05979 float lodTransitionTime() const; 05980 05985 Utils::Result addLod(unsigned int pos, Geom lod); 05986 05990 Utils::Result setLodRange(float zonerange); 05991 05995 Utils::Result setLodTransitionTime(float time); 05996 06001 static LodHolder find(const char* name); 06002 06006 static ClassType classType(); 06007 06015 static LodHolder cast(const ObjectBase&); 06016 }; 06017 06029 struct EXPORT_QSERVER Transition: public Geom 06030 { 06034 Transition() {} 06035 06040 Transition(const char* name); 06041 06049 static Transition create(const char* name, 06050 const Database& db = Database()); 06051 06055 unsigned int geomCount() const; 06056 06060 Geom geom(unsigned int pos) const; 06061 06066 float transitionTime() const; 06067 06071 Utils::Result addGeom(unsigned int pos, const Geom& lod); 06072 06076 Utils::Result setTransitionTime(float time); 06077 06082 static Transition find(const char* name); 06083 06087 static ClassType classType(); 06088 06096 static Transition cast(const ObjectBase&); 06097 }; 06098 06110 struct EXPORT_QSERVER Mesh: public Geom 06111 { 06115 Mesh() {} 06116 06121 Mesh(const char* name); 06122 06130 static Mesh create(const char* name, 06131 const Database& db = Database()); 06132 06136 unsigned int vertexCount() const; 06137 06141 unsigned int triangleCount() const; 06142 06146 unsigned int wedgeCount() const; 06147 06154 bool collideable() const; 06155 06161 Utils::Result setCollideable(bool b); 06162 06167 TriangleIterator triangles(); 06168 06173 VertexIterator vertices(); 06174 06179 WedgeIterator wedges(); 06180 06184 Utils::Result addBox(Maths::Box3f box, const Shader& s) const; 06185 06191 Utils::Result addRod(const Maths::Vec3f& start, 06192 const Maths::Vec3f& end, 06193 float radius, 06194 const Shader& s) const; 06195 06200 static Mesh find(const char* name); 06201 06205 static ClassType classType(); 06206 06214 static Mesh cast(const ObjectBase&); 06215 }; 06216 06234 struct EXPORT_QSERVER Skin: public Geom 06235 { 06239 Skin() {} 06240 06245 Skin(const char* name); 06246 06254 static Skin create(const char* name, 06255 const Database& db = Database()); 06256 06260 unsigned int jointCount() const; 06261 06266 float weight(unsigned int wi, unsigned int ji) const; 06267 06271 unsigned int vertexCount() const; 06272 06276 unsigned int triangleCount() const; 06277 06281 unsigned int wedgeCount() const; 06282 06287 Utils::Result setWeight(unsigned int wi, unsigned int ji, float w); 06288 06293 TriangleIterator triangles(); 06294 06299 VertexIterator vertices(); 06300 06305 WedgeIterator wedges(); 06306 06311 Utils::Result setCollideable(bool b); 06312 06317 static Skin find(const char* name); 06318 06322 static ClassType classType(); 06323 06331 static Skin cast(const ObjectBase&); 06332 }; 06333 06343 struct EXPORT_QSERVER IntersectionMesh: public Geom 06344 { 06348 IntersectionMesh() {} 06349 06354 IntersectionMesh(const char* name); 06355 06362 static IntersectionMesh create(const char* name, 06363 const Database& db = Database()); 06364 06368 unsigned int triangleCount() const; 06369 06374 FullTriangleIterator triangles(); 06375 06380 static IntersectionMesh find(const char* name); 06381 06385 static ClassType classType(); 06386 06394 static IntersectionMesh cast(const ObjectBase&); 06395 }; 06396 06420 struct EXPORT_QSERVER AudioEffect: public Object 06421 { 06427 enum effectType { 06428 06432 noEffect = 0, 06433 06439 pitchShift = 1, 06440 06448 reverb = 3 06449 }; 06450 06457 enum effectParameterType { 06458 06464 pitch = 0, 06465 06474 preset = 1 06475 }; 06476 06484 enum reverbType { 06486 06487 reverbGeneric = 0, 06488 reverbPaddedCell = 1, 06489 reverbRoom = 2, 06490 reverbBathroom = 3, 06491 reverbLivingRoom = 4, 06492 reverbStoneRoom = 5, 06493 reverbAuditorium = 6, 06494 reverbConcertHall = 7, 06495 reverbCave = 8, 06496 reverbArena = 9, 06497 reverbHangar = 10, 06498 reverbCarpetedHallway = 11, 06499 reverbHallway = 12, 06500 reverbStoneCorridor = 13, 06501 reverbAlley = 14, 06502 reverbForest = 15, 06503 reverbCity = 16, 06504 reverbMountains = 17, 06505 reverbQuarry = 18, 06506 reverbPlain = 19, 06507 reverbParkingLot = 20, 06508 reverbSewerPipe = 21, 06509 reverbUnderwater = 22 06511 }; 06512 06516 AudioEffect() {} 06517 06522 AudioEffect(const char* name); 06523 06528 static AudioEffect create(const char* name, 06529 const Database& db = Database()); 06530 06536 unsigned int effect() const; 06537 06546 float floatEffectParameter(unsigned int param, 06547 unsigned int index) const; 06556 int intEffectParameter(unsigned int param, 06557 unsigned int index) const; 06558 06563 Utils::Result setEffect(unsigned int); 06564 06578 Utils::Result setFloatEffectParameter(unsigned int param, 06579 unsigned int index, 06580 float value); 06594 Utils::Result setIntEffectParameter(unsigned int param, 06595 unsigned int index, 06596 int value); 06597 06602 static AudioEffect find(const char* name); 06603 06607 static ClassType classType(); 06608 06616 static AudioEffect cast(const ObjectBase& obj); 06617 }; 06618 06632 struct EXPORT_QSERVER SimpleSound: public Object 06633 { 06637 SimpleSound() {} 06638 06643 SimpleSound(const char* name); 06644 06650 static SimpleSound create(const char* name, 06651 const Database& db = Database()); 06652 06657 static SimpleSound createFromFile(const char* filename); 06658 06665 Sample sample() const; 06666 06670 float volume() const; 06671 06678 float fadeIn() const; 06679 06686 float fadeOut() const; 06687 06691 bool playing() const; 06692 06696 AudioEffect audioEffect() const; 06697 06704 Utils::Result setVolume(float); 06705 06717 Utils::Result setFade(float in, float out); 06718 06722 Utils::Result setSample(const Sample&); 06723 06727 Utils::Result setAudioEffect(const AudioEffect&); 06728 06735 Utils::Result play(bool looping, bool remove = false); 06736 06740 Utils::Result stop(); 06741 06748 Utils::Result getFilename(Q::Text*) const; 06749 06754 static SimpleSound find(const char* name); 06755 06759 static ClassType classType(); 06760 06768 static SimpleSound cast(const ObjectBase&); 06769 }; 06770 06786 struct EXPORT_QSERVER Sound: public Geom 06787 { 06791 Sound() {} 06792 06797 Sound(const char* name); 06798 06806 static Sound create(const char* name, 06807 const Database& db = Database()); 06808 06813 float falloff() const; 06814 06819 float range() const; 06820 06828 float fadeIn() const; 06829 06837 float fadeOut() const; 06838 06844 AudioEffect effectOverride() const; 06845 06850 Utils::Result setFalloff(float); 06851 06856 Utils::Result setRange(float); 06857 06869 Utils::Result setFade(float in, float out); 06870 06876 Utils::Result setEffectOverride(const AudioEffect&); 06877 06882 static Sound find(const char* name); 06883 06888 SampleIterator samples(); 06889 06893 static ClassType classType(); 06894 06902 static Sound cast(const ObjectBase&); 06903 }; 06904 06914 struct EXPORT_QSERVER TransformIterator: public ObjectBase 06915 { 06921 bool valid() const; 06922 06928 Utils::Result next(); 06929 06935 bool index(unsigned int index); 06936 06943 unsigned int add(const Maths::Vec3f& position, 06944 const Maths::Vec3f& scale, 06945 const Maths::Quat4f& orientation, 06946 unsigned int parent); 06947 06953 unsigned int add(const Maths::Vec3f& position, 06954 const Maths::Vec3f& scale, 06955 const Maths::Quat4f& orientation); 06956 06964 Utils::Result add(const Geom& g); 06965 06974 Utils::Result remove(const Geom& g); 06975 06979 Maths::Vec3f position() const; 06980 06984 Maths::Vec3f scale() const; 06985 06989 Maths::Quat4f orientation() const; 06990 06995 bool getParent(unsigned int&) const; 06996 07000 List geoms() const; 07001 07005 TransformIterator& operator++() { next(); return *this; } 07006 }; 07007 07029 struct EXPORT_QSERVER Cluster: public Geom 07030 { 07034 Cluster() {} 07035 07040 Cluster(const char* name); 07041 07049 static Cluster create(const char* name, 07050 const Database& db = Database()); 07051 07055 unsigned int transformCount() const; 07056 07061 TransformIterator transforms(); 07062 07067 static Cluster find(const char* name); 07068 07072 static ClassType classType(); 07073 07081 static Cluster cast(const ObjectBase&); 07082 }; 07083 07092 struct EXPORT_QSERVER TextureEffect: public Object 07093 { 07101 static TextureEffect cast(const ObjectBase&); 07102 }; 07103 07136 struct EXPORT_QSERVER Texture: public TextureEffect 07137 { 07141 enum { 07142 positionTrack = 0, 07143 rotationTrack = 1, 07144 scaleTrack = 2 07145 }; 07146 07150 Texture() {} 07151 07156 Texture(const char* name); 07157 07163 static Texture create(const char* name, 07164 unsigned int levels, 07165 const Database& db = Database()); 07166 07173 Utils::Result setLevel(unsigned int level, 07174 const Bitmap& data); 07175 07180 Utils::Result setLowestLoadLevel(unsigned int level); 07181 07186 unsigned int lowestLoadLevel() const; 07187 07193 Utils::Result fillFromLevel(unsigned int level, 07194 Image::Pixmap* data); 07195 07199 unsigned int levels() const; 07200 07204 Bitmap level(unsigned int level) const; 07205 07219 Utils::Result setPlayback(const Instance& i, const Shader& s, 07220 const Playback& pb); 07221 07226 Playback playback(const Instance& i, const Shader& s) const; 07227 07231 Utils::Ref<Image::Pixmap> readTopLevel(const Screen& screen) const; 07232 07237 static Texture find(const char* name); 07238 07243 static Texture defaultTexture(); 07244 07248 static ClassType classType(); 07249 07257 static Texture cast(const ObjectBase&); 07258 }; 07259 07271 struct EXPORT_QSERVER FrameTexture: public TextureEffect 07272 { 07276 FrameTexture() {} 07277 07282 FrameTexture(const char* name); 07283 07291 static FrameTexture create(const char* name, const Texture& texture, 07292 unsigned int rows, unsigned int columns, 07293 const Database& db = Database()); 07294 07298 Utils::Result setFrame(unsigned int frameNo, 07299 const Instance& i); 07300 07304 unsigned int frame(const Instance& i) const; 07305 07309 Texture texture() const; 07310 07314 unsigned int rows() const; 07315 07319 unsigned int columns() const; 07320 07324 Utils::Result setTexture(Texture t); 07325 07329 Utils::Result setRows(unsigned int); 07330 07334 Utils::Result setColumns(unsigned int); 07335 07340 static FrameTexture find(const char* name); 07341 07345 static ClassType classType(); 07346 07354 static FrameTexture cast(const ObjectBase&); 07355 }; 07356 07357 07367 struct EXPORT_QSERVER CameraTexture: public TextureEffect 07368 { 07372 CameraTexture() {} 07373 07378 CameraTexture(const char* name); 07379 07385 static CameraTexture create(const char* name, const Camera& camera, 07386 unsigned int maxMip, 07387 const Database& db = Database()); 07388 07392 Utils::Result camera(const Camera& camera); 07393 07397 Camera camera() const; 07398 07402 Utils::Ref<Image::Pixmap> readTopLevel(const Screen& screen) const; 07403 07408 static CameraTexture find(const char* name); 07409 07413 static ClassType classType(); 07414 07422 static CameraTexture cast(const ObjectBase&); 07423 }; 07424 07435 struct EXPORT_QSERVER Shader: public Object 07436 { 07440 Shader() {} 07441 07446 Shader(const char* name); 07447 07454 static Shader create(const char* name, 07455 const TextureEffect& diffuseMap, 07456 const Database& db = Database()); 07457 07461 Utils::Result setDiffuseColor(const Maths::Vec4f& v); 07462 07466 Utils::Result setAmbientColor(const Maths::Vec4f& v); 07467 07471 Utils::Result setSpecularColor(const Maths::Vec4f& v); 07472 07476 Utils::Result setEmissiveColor(const Maths::Vec4f& v); 07477 07481 Utils::Result setShininess(float s); 07482 07486 Utils::Result setDiffuseMap(const TextureEffect& t); 07487 07491 Utils::Result setSpecularMap(const TextureEffect& t); 07492 07498 Utils::Result setUseMaterialAmbient(bool b); 07499 07505 Utils::Result setUseMaterialDiffuse(bool b); 07506 07512 Utils::Result setAdditiveBlend(bool b); 07513 07518 Utils::Result setDepthWriteDisable(bool b); 07519 07526 Utils::Result setAlphaMask(bool b); 07527 07533 Utils::Result setClampedTextureAddressing(bool b); 07534 07541 Utils::Result optimize(); 07542 07546 Maths::Vec4f diffuseColor() const; 07547 07551 Maths::Vec4f ambientColor() const; 07552 07556 Maths::Vec4f specularColor() const; 07557 07561 Maths::Vec4f emissiveColor() const; 07562 07566 float shininess() const; 07567 07571 TextureEffect diffuseMap() const; 07572 07576 TextureEffect specularMap() const; 07577 07583 bool useMaterialAmbient() const; 07584 07590 bool useMaterialDiffuse() const; 07591 07596 bool additiveBlend() const; 07597 07602 bool depthWriteDisable() const; 07603 07608 bool alphaMask() const; 07609 07614 bool clampedTextureAddressing() const; 07615 07620 static Shader find(const char* name); 07621 07625 static Shader defaultShader(); 07626 07630 static ClassType classType(); 07631 07639 static Shader cast(const ObjectBase&); 07640 }; 07641 07654 struct EXPORT_QSERVER Instance: public Object 07655 { 07659 Instance() {} 07660 07665 Instance(const char* name); 07666 07675 static Instance create(const char* name, 07676 const Geom& geom, const Group& group, 07677 const Database& db = Database()); 07678 07682 Maths::Box3f box() const; 07683 07687 Group group() const; 07688 07692 Geom geom() const; 07693 07698 bool visible() const; 07699 07704 bool intersectable() const; 07705 07709 bool collidee() const; 07710 07714 bool collider() const; 07715 07719 bool boundsEvent() const; 07720 07724 bool lightable() const; 07725 07733 bool disabled() const; 07734 07743 Utils::Result setGroup(const Group&); 07744 07749 Utils::Result setVisible(bool b); 07750 07755 Utils::Result setIntersectable(bool b); 07756 07761 Utils::Result setCollidee(bool b); 07762 07767 Utils::Result setCollider(bool b); 07768 07773 Utils::Result setBoundsEvent(bool b); 07774 07778 Utils::Result setLightable(bool b); 07779 07784 Utils::Result setDisabled(bool b); 07785 07789 bool inScope() const; 07790 07799 void resetBox(); 07800 07805 static Instance find(const char* name); 07806 07817 List overlaps(const Concept& filter) const; 07818 07822 List litBy() const; 07823 07833 Utils::Result setOverride(Shader orig, Shader repl); 07834 07838 Utils::Result removeOverride(Shader orig); 07839 07843 Utils::Result clearOverrides(); 07844 07848 static ClassType classType(); 07849 07857 static Instance cast(const ObjectBase& obj); 07858 }; 07859 07869 struct EXPORT_QSERVER Group: public Object 07870 { 07874 enum { 07875 positionTrack = 0, 07876 orientationTrack = 1, 07877 scaleTrack = 2 07878 }; 07879 07883 Group() {} 07884 07889 Group(const char* name); 07890 07911 static Group create(const char* name, const Group& parent, 07912 const Database& db = Database()); 07913 07932 Group createCopy(const char* name); 07933 07939 Utils::Result destroy(); 07940 07948 List children(int depth = 0) const; 07949 07953 List instances() const; 07954 07959 Group parent() const; 07960 07965 Zone zone() const; 07966 07972 Maths::Vec3f position(const Group& ref) const; 07973 07978 Maths::Vec3f position() const; 07979 07987 Maths::Vec3f velocity(const Group& ref) const; 07988 07995 Maths::Vec3f velocity() const; 07996 08002 Maths::Quat4f orientation(const Group& ref) const; 08003 08008 Maths::Quat4f orientation() const; 08009 08017 Maths::Vec3f rotationAxis(const Group& ref) const; 08018 08025 Maths::Vec3f rotationAxis() const; 08026 08032 float rotation() const; 08033 08038 float scale() const; 08039 08044 Maths::Vec3f scaleVec() const; 08045 08061 Utils::Result setParent(const Group&); 08062 08068 Utils::Result setPosition(const Group& ref, const Maths::Vec3f&); 08069 08074 Utils::Result setPosition(const Maths::Vec3f&); 08075 08081 Utils::Result setVelocity(const Group& ref, const Maths::Vec3f&); 08082 08087 Utils::Result setVelocity(const Maths::Vec3f&); 08088 08095 Utils::Result setOrientation(const Group& ref, const Maths::Quat4f&); 08096 08101 Utils::Result setOrientation(const Maths::Quat4f&); 08102 08108 Utils::Result setRotation(float); 08109 08117 Utils::Result setRotationAxis(const Group& ref, const Maths::Vec3f&); 08118 08125 Utils::Result setRotationAxis(const Maths::Vec3f&); 08126 08130 Utils::Result setScale(float scalef); 08131 08135 Utils::Result setScale(const Maths::Vec3f& scalev); 08136 08141 bool ancestor(const Group& group) const; 08142 08156 Utils::Result setPlayback(const Playback& playback, 08157 unsigned int trackOffset); 08158 08162 Playback playback() const; 08163 08167 unsigned int playbackTrackOffset() const; 08168 08176 Utils::Result seek(const Animation&, 08177 unsigned int trackOffset, 08178 float time); 08179 08184 static Group find(const char* name); 08185 08189 static ClassType classType(); 08190 08198 static Group cast(const ObjectBase&); 08199 }; 08200 08222 struct EXPORT_QSERVER FxSource: public Geom 08223 { 08230 Maths::Vec3f gravity() const; 08231 08235 Utils::Result setGravity(const Maths::Vec3f &); 08236 08243 float generationRate() const; 08244 08248 Utils::Result setGenerationRate(float); 08249 08254 FxClassSequence fxClassSequence() const; 08255 08259 Utils::Result setFxClassSequence(const FxClassSequence& fxcs); 08260 08264 static ClassType classType(); 08265 08273 static FxSource cast(const ObjectBase&); 08274 }; 08275 08290 struct EXPORT_QSERVER FxSourceCuboid: public FxSource 08291 { 08295 FxSourceCuboid(); 08296 08301 FxSourceCuboid(const char* name); 08302 08311 static FxSourceCuboid create(const char* name, 08312 const FxClassSequence& fxcs, 08313 const Database& db = Database()); 08314 08321 static FxSourceCuboid create(const char* name, 08322 const Database& db = Database()); 08323 08328 Maths::Vec3f locationRange() const; 08329 08334 FxClass::distribution locationDist(unsigned int i) const; 08335 08341 Maths::Vec3f velocity() const; 08342 08347 Maths::Vec3f velocityRange() const; 08348 08353 FxClass::distribution velocityDist(unsigned int i) const; 08354 08358 bool worldVelocity() const; 08359 08364 bool addEmitterVelocity() const; 08365 08369 Utils::Result setLocationRange(const Maths::Vec3f&); 08370 08374 Utils::Result setLocationDist(unsigned int, 08375 FxClass::distribution); 08376 08380 Utils::Result setVelocity(const Maths::Vec3f&); 08381 08385 Utils::Result setVelocityRange(const Maths::Vec3f&); 08386 08391 Utils::Result setVelocityDist(unsigned int, 08392 FxClass::distribution); 08393 08399 Utils::Result setWorldVelocity(bool); 08400 08406 Utils::Result setAddEmitterVelocity(bool); 08407 08412 static FxSourceCuboid find(const char* name); 08413 08417 static ClassType classType(); 08418 08426 static FxSourceCuboid cast(const ObjectBase&); 08427 }; 08428 08446 struct EXPORT_QSERVER FxInstance: public Instance 08447 { 08451 FxInstance() {} 08452 08457 FxInstance(const char* name); 08458 08465 static FxInstance create(const char* name, 08466 const FxSource& vs, 08467 const Group& group, 08468 const Database& db = Database()); 08469 08473 FxSource fxSource() const; 08474 08479 float generationRate() const; 08480 08485 bool overrideGenRate() const; 08486 08492 Utils::Result setGenerationRate(float); 08493 08500 Utils::Result setOverrideGenRate(bool b); 08501 08506 static FxInstance find(const char* name); 08507 08511 static ClassType classType(); 08512 08520 static FxInstance cast(const ObjectBase&); 08521 }; 08522 08535 struct EXPORT_QSERVER Camera: public Instance 08536 { 08540 Camera() {} 08541 08546 Camera(const char* name); 08547 08554 static Camera create(const char* name, 08555 const Group& parent, 08556 const Database& db = Database()); 08557 08562 Maths::Box2f frustumScreen() const; 08563 08568 float frontClip() const; 08569 08574 float farClip() const; 08575 08580 Utils::Result setFrustumScreen(const Maths::Box2f&); 08581 08586 Utils::Result setFrontClip(float); 08587 08592 Utils::Result setFarClip(float); 08593 08598 static Camera find(const char* name); 08599 08603 static ClassType classType(); 08604 08612 static Camera cast(const ObjectBase&); 08613 }; 08614 08624 struct EXPORT_QSERVER Microphone: public Instance 08625 { 08631 enum InputType { 08632 simple, 08633 head 08634 }; 08635 08639 Microphone() {} 08640 08645 Microphone(const char* name); 08646 08653 static Microphone create(const char* name, 08654 const Group& parent, 08655 const Database& db = Database()); 08656 08660 InputType inputType() const; 08661 08667 float volume() const; 08668 08676 AudioEffect effectOverride() const; 08677 08681 Utils::Result setInputType(InputType); 08682 08690 void setVolume(float); 08691 08699 Utils::Result setEffectOverride(const AudioEffect&); 08700 08705 static Microphone find(const char* name); 08706 08710 static ClassType classType(); 08711 08719 static Microphone cast(const ObjectBase&); 08720 }; 08721 08733 struct EXPORT_QSERVER Light: public Geom 08734 { 08738 Light() {} 08739 08744 Light(const char* name); 08745 08753 static Light create(const char* name, 08754 const Database& db = Database()); 08755 08759 Maths::Vec3f color() const; 08760 08764 float radius() const; 08765 08770 float intensityR() const; 08771 08776 float intensityO() const; 08777 08782 float minAngle() const; 08783 08787 float maxAngle() const; 08788 08792 Utils::Result setColor(const Maths::Vec3f&); 08793 08800 Utils::Result setRadius(float); 08801 08805 Utils::Result setIntensityR(float); 08806 08810 Utils::Result setIntensityO(float); 08811 08815 Utils::Result setMinAngle(float); 08816 08820 Utils::Result setMaxAngle(float); 08821 08826 static Light find(const char* name); 08827 08831 static ClassType classType(); 08832 08840 static Light cast(const ObjectBase&); 08841 }; 08842 08854 struct EXPORT_QSERVER ClusterInstance: public Instance 08855 { 08859 enum Track { 08860 positionTrack = 0, 08861 orientationTrack = 1, 08862 scaleTrack = 2 08863 }; 08864 08868 ClusterInstance() {} 08869 08874 ClusterInstance(const char* name); 08875 08882 static ClusterInstance create(const char* name, 08883 const Cluster&, 08884 const Group&, 08885 const Database& = Database()); 08886 08907 Utils::Result getTransform(const Group& ref, 08908 unsigned int i, 08909 Maths::Vec3f& position, 08910 Maths::Vec3f& scale, 08911 Maths::Quat4f& orientation, 08912 bool& overridden) const; 08913 08929 Utils::Result getTransform(const Group& ref, 08930 unsigned int i, 08931 Maths::Matrix4f& matrix, 08932 bool& overridden) const; 08933 08937 unsigned int transformCount() const; 08938 08954 Utils::Result setTransform(const Group& ref, 08955 unsigned int i, 08956 const Maths::Vec3f& position, 08957 const Maths::Vec3f& scale, 08958 const Maths::Quat4f& orientation); 08959 08963 Utils::Result removeTransform(unsigned int i); 08964 08969 List geoms(unsigned int i) const; 08970 08974 Utils::Result add(unsigned int i, const Geom&); 08975 08981 Utils::Result remove(unsigned int i, const Geom&); 08982 08995 Utils::Result setPlayback(const Playback& playback); 08996 09004 Utils::Result setPlayback(unsigned int i, 09005 const Playback& playback); 09006 09011 Playback playback(unsigned int transformIndex) const; 09012 09018 Utils::Result seek(unsigned int transformIndex, 09019 const Animation&, 09020 float time); 09021 09027 Utils::Result seek(const Animation&, 09028 float time); 09029 09030 09035 static ClusterInstance find(const char* name); 09036 09040 static ClassType classType(); 09041 09049 static ClusterInstance cast(const ObjectBase&); 09050 }; 09051 09063 struct EXPORT_QSERVER TransitionInstance: public Instance 09064 { 09068 TransitionInstance() {} 09069 09074 TransitionInstance(const char*); 09075 09082 static TransitionInstance create(const char* name, 09083 const Transition& trans, 09084 const Group& group, 09085 const Database& db = Database()); 09086 09090 unsigned int level() const; 09091 09096 Utils::Result setLevel(unsigned int l); 09097 09103 static TransitionInstance find(const char* name); 09104 09108 static ClassType classType(); 09109 09118 static TransitionInstance cast(const ObjectBase&); 09119 }; 09120 09133 struct EXPORT_QSERVER SoundInstance: public Instance 09134 { 09139 enum ReplayMode { 09143 normal = 0, 09147 looping = 1, 09155 hit = 2 09156 }; 09157 09163 enum LifetimeMode { 09167 removeNone = 0, 09171 removeInstance = 1, 09176 removeGroup = 2 09177 }; 09178 09182 SoundInstance() {} 09183 09188 SoundInstance(const char* name); 09189 09196 static SoundInstance create(const char* name, 09197 const Sound& sound, 09198 const Group& group, 09199 const Database& db = Database()); 09200 09204 Sound sound() const; 09205 09215 bool multiChannel() const; 09216 09230 bool playing() const; 09231 09238 float volume() const; 09239 09245 AudioEffect effectOverride() const; 09246 09250 Utils::Result setMultiChannel(bool); 09251 09258 Utils::Result setVolume(float); 09259 09265 Utils::Result setEffectOverride(const AudioEffect&); 09266 09289 Utils::Result play(unsigned int sampleIndex = 0, 09290 ReplayMode replay = normal, 09291 LifetimeMode life = removeNone); 09292 09297 Utils::Result stop(); 09298 09303 static SoundInstance find(const char* name); 09304 09308 static ClassType classType(); 09309 09317 static SoundInstance cast(const ObjectBase&); 09318 }; 09319 09328 struct EXPORT_QSERVER Portal: public Geom 09329 { 09333 Portal() {} 09334 09339 Portal(const char* name); 09340 09348 static Portal create(const char* name, 09349 const Database& db = Database()); 09350 09354 Maths::Vec3f normal() const; 09355 09359 unsigned int vertexCount() const; 09360 09365 Utils::Result getVertices(Maths::Vec3f* v) const; 09366 09370 Utils::Result setPolygon(unsigned int count, 09371 const Maths::Vec3f* v, 09372 const Maths::Vec3f& normal); 09373 09378 static Portal find(const char* name); 09379 09383 static ClassType classType(); 09384 09392 static Portal cast(const ObjectBase&); 09393 }; 09394 09411 struct EXPORT_QSERVER PortalInstance: public Instance 09412 { 09416 PortalInstance() {} 09417 09422 PortalInstance(const char* name); 09423 09430 static PortalInstance 09431 create(const char* name, 09432 const Portal& p, 09433 const Group& group, 09434 const Database& db = Database()); 09435 09439 PortalInstance neighbour() const; 09440 09444 Text neighbourName() const; 09445 09451 bool active() const; 09452 09460 bool loadThrough() const; 09461 09467 Utils::Result setLoadThrough(bool); 09468 09472 Utils::Result setNeighbour(const PortalInstance&); 09473 09477 Utils::Result setNeighbourName(const char* name); 09478 09484 Utils::Result setActive(bool b); 09485 09490 static PortalInstance 09491 find(const char* name); 09492 09496 static ClassType classType(); 09497 09505 static PortalInstance cast(const ObjectBase&); 09506 }; 09507 09516 struct EXPORT_QSERVER Region: public Geom 09517 { 09521 Region() {} 09522 09527 Region(const char* name); 09528 09537 static Region create(const char* name, 09538 const Maths::Box3f& box, 09539 const Database& db = Database()); 09540 09546 static Region create(const char* name, 09547 const Maths::Sphere3f& s, 09548 const Database& db = Database()); 09549 09556 static Region create(const char* name, 09557 const Maths::Cylinder3f& c, 09558 const Database& db = Database()); 09559 09566 Utils::Result setBox(const Maths::Box3f& box); 09567 09572 Utils::Result setCollideable(bool b); 09573 09578 static Region find(const char* name); 09579 09583 static ClassType classType(); 09584 09592 static Region cast(const ObjectBase&); 09593 }; 09594 09619 struct EXPORT_QSERVER Scope: public ObjectBase 09620 { 09624 Scope() {} 09625 09630 static Scope create(const Group& group, unsigned int radius = 1); 09631 09635 Group group() const; 09636 09640 unsigned int radius() const; 09641 09645 List zones() const; 09646 09652 Utils::Result adviseResidency(ResidencyListener* = 0); 09653 09657 static ClassType classType(); 09658 09663 static Scope cast(const ObjectBase&); 09664 }; 09665 09680 struct EXPORT_QSERVER Animation: public Object 09681 { 09690 enum KeyType { 09691 stepKey, 09692 linearKey, 09693 smoothKey 09694 }; 09695 09699 Animation() {} 09700 09705 Animation(const char* name); 09706 09712 static Animation create(const char* name, 09713 const Database& db = Database()); 09714 09719 Utils::Result open(); 09720 09725 Utils::Result close(); 09726 09733 size_t addKey(unsigned int track, 09734 KeyType type, 09735 float time, 09736 const Maths::Vec4f& value); 09737 09743 unsigned int trackCount() const; 09744 09749 size_t trackSize(unsigned int track) const; 09750 09756 bool quaternionTrack(unsigned int track) const; 09757 09763 Utils::Result setQuaternionTrack(unsigned int track, bool v); 09764 09771 bool getKey(unsigned int track, 09772 size_t index, 09773 KeyType& type, 09774 float& time, 09775 Maths::Vec4f& value) const; 09776 09781 bool removeKey(unsigned int track, size_t index); 09782 09786 Utils::Result value(unsigned int track, 09787 float time, 09788 Maths::Vec4f& value) const; 09789 09794 float startTime() const; 09795 09800 float endTime() const; 09801 09811 size_t addSegment(const char* name, float start, 09812 float end); 09813 09817 size_t segmentCount() const; 09818 09824 Utils::Result getSegment(size_t index, Text& name, 09825 float& start, float& end) const; 09826 09832 Utils::Result getSegment(const char* name, 09833 float& start, float& end) const; 09834 09839 static Animation find(const char* name); 09840 09844 static ClassType classType(); 09845 09853 static Animation cast(const ObjectBase&); 09854 }; 09855 09867 struct EXPORT_QSERVER AnimationBundle: public Object 09868 { 09872 AnimationBundle(); 09873 09878 AnimationBundle(const char* name); 09879 09885 static AnimationBundle create(const char* name, 09886 const Database& db = Database()); 09887 09894 size_t addEntry(const Group& group, 09895 unsigned int trackOffset); 09896 09900 size_t entryCount() const; 09901 09907 Utils::Result getEntry(size_t index, Group& group, 09908 unsigned int& trackOffset) const; 09909 09914 Utils::Result setPlayback(const Playback& playback); 09915 09920 Utils::Result setPlayback(size_t index, const Playback& playback); 09921 09926 Playback playback(size_t index) const; 09927 09933 Utils::Result seek(unsigned int index, 09934 const Animation&, 09935 float time); 09936 09942 Utils::Result seek(const Animation&, 09943 float time); 09944 09954 AnimationBundle copy() const; 09955 09970 AnimationBundle copy(bool parent) const; 09971 09976 static AnimationBundle find(const char* name); 09977 09981 static ClassType classType(); 09982 09990 static AnimationBundle cast(const ObjectBase&); 09991 }; 09992 10002 struct EXPORT_QSERVER RayInfo 10003 { 10007 RayInfo() : valid_(false) {} 10008 10013 bool valid() const { return valid_; } 10014 10018 const Instance& instance() const { return instance_; } 10019 10023 Instance& instance() { return instance_; } 10024 10029 Maths::Vec3f coord() const { return coord_; } 10030 10035 Maths::Vec3f normal() const { return normal_; } 10036 10040 float distance() const { return distance_; } 10041 10045 const Shader& shader() const { return shader_; } 10046 10050 Shader& shader() { return shader_; } 10051 10057 unsigned int index() const { return index_; } 10058 10062 void setValid(bool v) { valid_ = v; } 10063 10067 void setInstance(const Instance& i) { instance_ = i; } 10068 10072 void setCoord(const Maths::Vec3f& v) { coord_ = v; } 10073 10077 void setDistance(float dist) { distance_ = dist; } 10078 10082 void setNormal(const Maths::Vec3f& v) { normal_ = v; } 10083 10087 void setShader(const Shader& s) { shader_ = s; } 10088 10093 void setIndex(unsigned int i) { index_ = i; } 10094 10095 private: 10096 bool valid_; 10097 Instance instance_; 10098 Maths::Vec3f coord_; 10099 Maths::Vec3f normal_; 10100 float distance_; 10101 Shader shader_; 10102 unsigned int index_; 10103 }; 10104 10115 struct EXPORT_QSERVER ScopeReactor: public ObjectBase 10116 { 10120 ScopeReactor() {} 10121 10126 static ScopeReactor create(const Instance& instance); 10127 10132 Utils::Result addListener(ScopeListener& l); 10133 10138 Utils::Result removeListener(ScopeListener& l); 10139 10143 static ClassType classType(); 10144 10149 static ScopeReactor cast(const ObjectBase&); 10150 }; 10151 10163 struct EXPORT_QSERVER BoundsReactor: public ObjectBase 10164 { 10168 BoundsReactor() {} 10169 10174 static BoundsReactor create(); 10175 10180 static BoundsReactor create(const Instance& source); 10181 10186 static BoundsReactor create(const Instance& source, 10187 const Instance& target); 10188 10193 Utils::Result addListener(BoundsListener& l); 10194 10199 Utils::Result removeListener(BoundsListener& l); 10200 10204 static ClassType classType(); 10205 10210 static BoundsReactor cast(const ObjectBase&); 10211 }; 10212 10223 struct ScopeListener 10224 { 10229 virtual ~ScopeListener() {} 10230 10234 virtual void onInScope(ScopeReactor& r, 10235 Instance& instance) = 0; 10236 10240 virtual void onOutScope(ScopeReactor& r, 10241 Instance& instance) = 0; 10242 }; 10243 10254 struct BoundsListener 10255 { 10260 virtual ~BoundsListener() {} 10261 10266 virtual void onEnter(BoundsReactor& r, 10267 Instance& source, 10268 Instance& target) = 0; 10269 10274 virtual void onExit(BoundsReactor& r, 10275 Instance& source, 10276 Instance& target) = 0; 10277 }; 10278 10289 struct ResidencyListener 10290 { 10295 virtual ~ResidencyListener() {} 10296 10300 virtual void onLoaded(Object& object) = 0; 10301 }; 10302 10314 struct KeyboardListener 10315 { 10320 virtual ~KeyboardListener() {} 10321 10328 virtual void onKeyPress(Layer& l, unsigned int code) = 0; 10329 10336 virtual void onKeyRelease(Layer& l, unsigned int code) = 0; 10337 10343 virtual void onKeyFocus(Layer& l, bool gainedFocus) = 0; 10344 10350 virtual void onKeyValue(Layer& l, char character) = 0; 10351 }; 10352 10364 struct MouseListener 10365 { 10370 virtual ~MouseListener() {} 10371 10384 virtual void onButtonPress(Layer& l, 10385 const Maths::Vec2f& layerRelative, 10386 const Maths::Vec2f& screenRelative, 10387 unsigned int buttons) = 0; 10388 10401 virtual void onButtonRelease(Layer& l, 10402 const Maths::Vec2f& layerRelative, 10403 const Maths::Vec2f& screenRelative, 10404 unsigned int buttons) = 0; 10405 10414 virtual void onPosition(Layer& l, 10415 const Maths::Vec2f& layerRelative, 10416 const Maths::Vec2f& screenRelative) = 0; 10417 10424 virtual void onMove(Layer& l, const Maths::Vec2f& delta) = 0; 10425 10429 virtual void onWheel(Layer& l, float delta) = 0; 10430 10436 virtual void onMouseFocus(Layer&, bool gainedFocus) = 0; 10437 }; 10438 10449 struct ApplicationListener 10450 { 10455 virtual ~ApplicationListener() {} 10456 10461 virtual void onTick(double time) = 0; 10462 10466 virtual void onWindowClose() = 0; 10467 }; 10468 10480 struct PlaybackListener 10481 { 10486 virtual ~PlaybackListener() {} 10487 10492 virtual void onStart(Playback& pb, Animation& anim, 10493 float start, float end) = 0; 10494 10499 virtual void onEnd(Playback& pb, Animation& anim, 10500 float start, float end) = 0; 10501 }; 10502 10512 struct EXPORT_QSERVER KnowledgeSlice: public Object 10513 { 10517 KnowledgeSlice() {} 10518 10523 unsigned int nameCount() const; 10524 10528 unsigned int factCount() const; 10529 10533 Text name(unsigned int n) const; 10534 10542 Utils::Result getFact(unsigned int n, 10543 unsigned int& ci, 10544 unsigned int& ri, 10545 unsigned int& vi, 10546 unsigned int& flags) const; 10550 static ClassType classType(); 10551 10556 static KnowledgeSlice cast(const ObjectBase&); 10557 }; 10558 10571 struct EXPORT_QSERVER Clump: public Object 10572 { 10577 enum StreamCounter { 10581 totalSize, 10585 totalTime, 10589 readTime, 10593 restoreTime, 10594 }; 10595 10599 Clump() {} 10600 10604 List assets() const; 10605 10609 KnowledgeSlice knowledge() const; 10610 10615 Zone fromZone() const; 10616 10620 Zone toZone() const; 10621 10625 static ClassType classType(); 10626 10631 static Clump cast(const ObjectBase&); 10632 10638 static Clump find(const Zone& fromZone, 10639 const Zone& toZone); 10640 10645 static List buildClumps(const Scope&); 10646 10651 float readCounter(StreamCounter) const; 10652 }; 10653 10654 Q_END 10655 10656 #endif // __q_h__ 10657 10658 // Local Variables: 10659 // mode: c++ 10660 // outline-regexp: "[ \t]*/\*\*" 10661 // End:
|
|
|
Qube Software Limited © 2000-2004
|
|