blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 5
146
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
7
| license_type
stringclasses 2
values | repo_name
stringlengths 6
79
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringclasses 4
values | visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.07k
426M
⌀ | star_events_count
int64 0
27
| fork_events_count
int64 0
12
| gha_license_id
stringclasses 3
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 6
values | src_encoding
stringclasses 26
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 1
class | length_bytes
int64 20
6.28M
| extension
stringclasses 20
values | content
stringlengths 20
6.28M
| authors
listlengths 1
16
| author_lines
listlengths 1
16
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0543d157fc4c3dce2d5fb5d180a7e64021652b86 | 49340251ce63c14e953a82fd7d7f06de458f25b3 | /vm2/clnt/main.cpp | d90d765dee5a5bfade421853170a06035c1e9a6b | []
| no_license | umegaya/pfm | aa104fc9ec04a60d5096fdafd9f20d4e4f735343 | 40d40bd6346dc9dccb20558e69b64a90f591bae4 | refs/heads/master | 2021-01-25T12:09:25.296418 | 2010-09-06T21:25:33 | 2010-09-06T21:25:33 | 86,939 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,059 | cpp | #include "clnt.h"
#include "nbr.h"
#include "common.h"
#include "serializer.h"
#include "cp.h"
const char *
find_config_path(int argc, char *argv[]) {
for (int i = 0; i < argc; i++) {
if (nbr_str_cmp_tail(argv[i], ".conf", 5, 256) == 0) {
return argv[i];
}
}
return NULL;
}
static int g_client = 1;
static int g_require_callnum_per_cli = 1;
static int g_callnum = 0;
NBR_STLS pfm::clnt::args g_args = NULL;
static bool g_finish() { return (g_callnum >= ((g_require_callnum_per_cli * g_client) + g_client)); }
int callback(pfm::clnt::watcher w, pfm::clnt::client c,
pfm::clnt::errobj e, char *p, int l) {
if (!g_args) { g_args = pfm::clnt::init_args(65536); }
if (e) {
char b[256];
TRACE("RPC error: <%s>\n", pfm::clnt::error_to_s(b, sizeof(b), e));
return NBR_OK;
}
pfm::clnt::obj o = pfm::clnt::get_from(c);
pfm::clnt::setup_args(g_args, o, "test", true, 0);
pfm::clnt::watcher w2 = pfm::clnt::call(c, g_args, callback);
if (w2) {
__sync_add_and_fetch(&g_callnum, 1);
if (g_finish()) { return NBR_OK; }
return NBR_OK;
}
return NBR_EEXPIRE;
}
int main(int argc, char *argv[])
{
int r;
if ((r = pfm::clnt::init(find_config_path(argc, argv)) < 0)) {
return r;
}
pfm::clnt::watcher wlist[1024];
char acc[256];
if (argc > 2) {
SAFETY_ATOI(argv[2], g_client, int);
if (g_client > 1024) { return NBR_ESHORT; }
}
for (int i = 0; i < g_client; i++) {
U32 hash = (g_client << 16) + i;
snprintf(acc, sizeof(acc) - 1, "rtko%08x", hash);
if (!(wlist[i] = pfm::clnt::login(NULL,
"test", acc, (char *)&hash, sizeof(hash),
callback))) {
return NBR_EEXPIRE;
}
usleep(50 * 1000);
}
UTIME g_start = nbr_time();
while (1) {
pfm::clnt::poll(nbr_time());
if (g_finish()) { break; }
}
UTIME g_tot = (nbr_time() - g_start);
fprintf(stdout, "%lluus for %uquery (%lfqps)\n",
g_tot, g_client * g_require_callnum_per_cli,
(float)(((float)1000 * 1000) * (float)g_callnum / (float)g_tot));
pfm::clnt::fin();
return NBR_OK;
}
| [
"[email protected]"
]
| [
[
[
1,
74
]
]
]
|
dbd13f9a1f8d33a91d7dc5a7e8ea3e33d91fb669 | 1cc5720e245ca0d8083b0f12806a5c8b13b5cf98 | /v103/10374/d.cpp | 6250d67c491affa664ec4f6e2e3a159366413494 | []
| no_license | Emerson21/uva-problems | 399d82d93b563e3018921eaff12ca545415fd782 | 3079bdd1cd17087cf54b08c60e2d52dbd0118556 | refs/heads/master | 2021-01-18T09:12:23.069387 | 2010-12-15T00:38:34 | 2010-12-15T00:38:34 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,137 | cpp | #include <stdio.h>
#include <string.h>
int main() {
int i,j,k,l,m,n,o,p;
char part[30][100];
char cand[30][100];
bool val[30];
int capa[30];
int voto[30];
int cand_c;
char s[100];
scanf("%d\n",&p);
while(p--) {
scanf("%d\n",&cand_c);
for(i=0;i!=cand_c;i++) {
gets(cand[i]);
gets(part[i]);
}
// candidates
for(i=0;i!=cand_c;i++) val[i]=0;
for(i=0;i!=cand_c;i++) {
for(j=0;j!=cand_c;j++) {
if(strcmp(part[j],part[i])==0) {
capa[i]=j;
val[j]=1;
break;
}
}
}
scanf("%d\n",&o);
for(i=0;i!=cand_c;i++) voto[i]=0;
// votes, please
while(o--) {
gets(s);
for(i=0;i!=cand_c;i++) {
if(strcmp(cand[i],s)==0) {
voto[capa[i]]++;
break;
}
}
}
j=0;
// finds the maximum voted
for(i=1;i<cand_c;i++) if(val[i] && voto[i]>voto[j]) j = i;
// is it a tie?
for(i=0;i<cand_c;i++) {
if(val[i] && i!=j && voto[i]==voto[j]) {
printf("tie\n");
goto nex;
}
}
// not a tie, go ahead
printf("%s\n",part[j]);
nex:
if(p) printf("\n");
}
return 0;
}
| [
"[email protected]"
]
| [
[
[
1,
71
]
]
]
|
27b19aa01233f269ce260b61a1b48ade2a651e94 | cf8b742c4d6401386db95ddbe2e81a5c4c35f1ee | /src/dialogkernel3.h | fa4b3d6d50917b6bd098efa68802b7fe224d65fe | []
| no_license | jandernascimento/imageprocessing-umanipulator | 3467f30b671bfa6701e050c88d19e0fd6642e095 | 20364c69b2d532c1309e9e0d136a2476f2b2f82a | refs/heads/master | 2021-01-02T08:52:10.734338 | 2011-01-27T21:52:40 | 2011-01-27T21:52:40 | 32,868,567 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 664 | h | #ifndef DIALOGKERNEL3_H
#define DIALOGKERNEL3_H
#include <QDialog>
namespace Ui {
class dialogkernel3;
}
class dialogkernel3 : public QDialog
{
Q_OBJECT
public:
explicit dialogkernel3(QWidget *parent = 0);
~dialogkernel3();
public slots:
void okpressed(void);
signals:
void kernel3(double d1,
double d2,
double d3,
double d4,
double d5,
double d6,
double d7,
double d8,
double d9
);
private:
Ui::dialogkernel3 *ui;
};
#endif // DIALOGKERNEL3_H
| [
"hamid.mirisaee@04d00976-414e-c661-e2ab-a3a293d51e39"
]
| [
[
[
1,
34
]
]
]
|
a680b0f5344364b28ad9a494ad0b70a9d1bdd2d4 | 317f62189c63646f81198d1692bed708d8f18497 | /contrib/orion/Util.h | 1cc83996d1cacd7cc055ad5d84123269c7c040bd | [
"MIT"
]
| permissive | mit-carbon/Graphite-Cycle-Level | 8fb41d5968e0a373fd4adbf0ad400a9aa5c10c90 | db3f1e986ddc10f3e5f3a5d4b68bd6a9885969b3 | refs/heads/master | 2021-01-25T07:08:46.628355 | 2011-11-23T08:53:18 | 2011-11-23T08:53:18 | 1,930,686 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 222 | h | #ifndef __UTIL_H__
#define __UTIL_H__
#include <cmath>
using namespace std;
#ifdef _WIN32
inline double log2(double x)
{
static const double xxx = 1.0/log(2.0);
return log(x)*xxx;
}
#endif
#endif
| [
"[email protected]"
]
| [
[
[
1,
17
]
]
]
|
4293c8574864022077b6109f3518d9823c10022e | c95a83e1a741b8c0eb810dd018d91060e5872dd8 | /Game/ClientShellDLL/ClientShellShared/CMoveMgr.h | 3f2e1f4585e7a838c0f157633f5264b96d2c994f | []
| no_license | rickyharis39/nolf2 | ba0b56e2abb076e60d97fc7a2a8ee7be4394266c | 0da0603dc961e73ac734ff365bfbfb8abb9b9b04 | refs/heads/master | 2021-01-01T17:21:00.678517 | 2011-07-23T12:11:19 | 2011-07-23T12:11:19 | 38,495,312 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 7,684 | h | // ----------------------------------------------------------------------- //
//
// MODULE : CMoveMgr.cpp
//
// PURPOSE : Client side player movement mgr - Definition
//
// CREATED : 10/2/98
//
// (c) 1998-2002 Monolith Productions, Inc. All Rights Reserved
//
// ----------------------------------------------------------------------- //
#ifndef __CMOVEMGR_H__
#define __CMOVEMGR_H__
#include "iltclient.h"
#include "ContainerCodes.h"
#include "SharedMovement.h"
#include "SurfaceMgr.h"
#include "VarTrack.h"
#include "CameraOffsetMgr.h"
#include "timer.h"
class CGameClientShell;
class CCharacterFX;
class CVehicleMgr;
class CContainerInfo
{
public:
float m_fGravity;
float m_fViscosity;
LTVector m_Current;
ContainerCode m_ContainerCode;
LTBOOL m_bHidden;
HOBJECT m_hObject;
PlayerPhysicsModel m_ePPhysicsModel;
};
class CMoveMgr
{
public:
CMoveMgr();
~CMoveMgr();
LTBOOL Init();
void Update();
void UpdateModels();
LTVector GetVelocity() const;
void SetVelocity(const LTVector &vVel);
LTFLOAT GetMaxVelMag() const;
void SetGravity(LTFLOAT fGravity) { m_fGravity = fGravity; }
LTFLOAT GetMovementPercent() const;
LTFLOAT GetVelMagnitude();
LTBOOL IsPlayerModel();
CCharacterFX* GetCharacterFX() const { return m_pCharFX; }
void SetCharacterFX(CCharacterFX* pFX) { m_pCharFX = pFX; }
void OnPhysicsUpdate(uint16 changeFlags, ILTMessage_Read *pMsg);
void UpdateMouseStrafeFlags(float *pAxisOffsets);
void OnEnterWorld();
void OnExitWorld();
void Save(ILTMessage_Write *pMsg, SaveDataState eSaveDataState);
void Load(ILTMessage_Read *pMsg, SaveDataState eLoadDataState);
LTRESULT OnObjectMove(HOBJECT hObj, bool bTeleport, LTVector *pPos);
LTRESULT OnObjectRotate(HOBJECT hObj, bool bTeleport, LTRotation *pNewRot);
void OnTouchNotify(CollisionInfo *pInfo, float forceMag);
uint32 GetControlFlags() const { return m_dwControlFlags; }
LTBOOL Jumped() const { return m_bJumped; }
// CMoveMgr keeps a list of spheres that repel the player object.
// These are created from explosions.
LTRESULT AddPusher(const LTVector &pos, float radius,
float startDelay, float duration, float strength);
HOBJECT GetObject() {return m_hObject;}
HOBJECT GetServerObject();
void SetSpectatorMode(LTBOOL bSet);
void OnServerForcePos(ILTMessage_Read *pMsg);
void WritePositionInfo(ILTMessage_Write *pMsg);
SurfaceType GetStandingOnSurface() const { return m_eStandingOnSurface; }
LTBOOL CanDoFootstep();
LTBOOL IsHeadInLiquid() const { return IsLiquid(m_eCurContainerCode); }
LTBOOL IsFreeMovement() const { return ::IsFreeMovement(m_eCurContainerCode); }
LTBOOL IsBodyInLiquid() const { return m_bBodyInLiquid; }
LTBOOL IsOnGround() const { return m_bOnGround; }
LTBOOL IsBodyOnLadder() const { return m_bBodyOnLadder; }
LTBOOL IsOnLift() const { return m_bOnLift; }
LTBOOL IsFalling() const { return m_bFalling; }
LTBOOL IsMovingQuietly() const;
LTBOOL IsDucking() const { return (m_dwControlFlags & BC_CFLG_DUCK); }
void SetDucking(bool bDuck) { if (bDuck) m_dwControlFlags |= BC_CFLG_DUCK; else m_dwControlFlags &= ~BC_CFLG_DUCK; }
LTBOOL RunLock() const { return m_bRunLock; }
LTBOOL DuckLock() const { return m_bDuckLock; }
void SetRunLock(LTBOOL bRunLock) { m_bRunLock = bRunLock; }
void SetDuckLock(LTBOOL bDuckLock) { m_bDuckLock = bDuckLock; }
LTVector GetGroundNormal() const { return m_vGroundNormal; }
void UpdateOnGround();
LTFLOAT GetMoveMultiplier() const { return m_fMoveMultiplier; }
LTFLOAT GetMoveAccelMultiplier() const { return m_fMoveAccelMultiplier; }
LTVector GetTotalCurrent() const { return m_vTotalCurrent; }
LTFLOAT GetTotalViscosity() const { return m_fTotalViscosity; }
void AllowMovement(LTBOOL b=LTTRUE) { m_bAllowMovement = b; }
LTBOOL GetAllowMovement( ) { return m_bAllowMovement; }
void UpdateStartMotion(LTBOOL bForce=LTFALSE);
CVehicleMgr* GetVehicleMgr() const { return m_pVehicleMgr; }
void AddDamagePenalty(LTFLOAT fDuration);
HOBJECT GetLadderObject() const { return m_hLadderObject; }
uint32 GetNumContainers() const { return m_nContainers; }
CContainerInfo* GetContainerInfo( uint32 nContainer );
void UpdateContainerList();
void UpdateContainerViscosity(CContainerInfo *pInfo);
void UpdateContainerGravity(CContainerInfo *pInfo);
// Is it safe to save right now?
bool CanSave() const;
bool IsInWorld() const { return m_hObject != LTNULL; }
float GetCrouchHeightDifference() const;
float GetCurrentHeightDifference() const;
protected:
void InitWorldData();
void ShowPos(char *pBlah);
void UpdatePushers();
void UpdatePlayerAnimation();
LTBOOL AreDimsCorrect();
void ResetDims(LTVector *pOffset=NULL);
bool CanStandUp();
void UpdateControlFlags();
void UpdateMotion();
void UpdateFriction();
void UpdateSound();
void UpdateNormalControlFlags();
void UpdateNormalMotion();
void UpdateNormalFriction();
void UpdateContainerMotion();
void UpdateOnLadder(CContainerInfo *pInfo);
void UpdateInLiquid(CContainerInfo *pInfo);
void HandleFallLand(LTFLOAT fDistFell);
void MoveLocalSolidObject();
void UpdateVelMagnitude();
void SetClientObjNonsolid();
void TermLevel();
LTFLOAT CalculateMovementPenalty() const;
protected :
uint8 m_ClientMoveCode;
// The object representing our movement.
HOBJECT m_hObject;
LTLink m_Pushers;
LTVector m_vWantedDims;
// Movement state.
uint32 m_dwControlFlags;
uint32 m_dwLastControlFlags;
LTBOOL m_bBodyInLiquid;
LTBOOL m_bSwimmingOnSurface;
LTBOOL m_bCanSwimJump;
ContainerCode m_eBodyContainerCode; // Body container code
LTBOOL m_bBodyOnLadder;
HOBJECT m_hLadderObject;
LTBOOL m_bLoading;
LTVector m_vSavedVel;
HPOLY m_hStandingOnPoly;
SurfaceType m_eStandingOnSurface;
LTVector m_vGroundNormal;
LTBOOL m_bOnGround;
LTBOOL m_bOnLift;
LTBOOL m_bFalling;
LTBOOL m_bRunLock;
LTBOOL m_bDuckLock;
LTBOOL m_bUsingPlayerModel;
LTBOOL m_bForceToServerPos;
float m_fBaseMoveAccel;
float m_fMoveAccelMultiplier;
float m_fLastOnGroundY;
LTBOOL m_bJumped;
LTVector m_vTotalCurrent;
float m_fTotalViscosity;
bool m_bGravityOverride;
float m_fTotalContainerGravity;
// Movement speeds.
float m_fJumpVel;
float m_fSuperJumpVel;
float m_fJumpMultiplier;
float m_fSwimVel;
float m_fWalkVel;
float m_fRunVel;
float m_fLadderVel;
float m_fMoveMultiplier;
float m_fGravity;
LTBOOL m_bSwimmingJump;
LTBOOL m_bFirstAniUpdate;
LTBOOL m_bAllowMovement;
ContainerCode m_eLastContainerCode;
ContainerCode m_eCurContainerCode;
CContainerInfo m_Containers[MAX_TRACKED_CONTAINERS];
uint32 m_nContainers;
// Spectator speed multiplier.
VarTrack m_CV_SpectatorSpeedMul;
CCharacterFX* m_pCharFX;
CVehicleMgr* m_pVehicleMgr;
CTimer m_DamageTimer;
// Player dims semi-constants
LTVector m_vCrouchDims;
LTVector m_vStandDims;
};
extern CMoveMgr* g_pMoveMgr;
#endif // __CMOVEMGR_H__
| [
"[email protected]"
]
| [
[
[
1,
280
]
]
]
|
c7f582cc41dc452e07f8a72584031f0b1f905d71 | 3aafc3c40c1464fc2a32d1b6bba23818903a4ec9 | /TagControlTest/TagControlTest/TagControlTest.cpp | 333dbc6ae56902e788c0af5a5c9991361bef1eb2 | []
| no_license | robintw/rlibrary | 13930416649ec38196bfd38e0980616e9f5454c8 | 3e55d49acba665940828e26c8bff60863a86246f | refs/heads/master | 2020-09-22T10:31:55.561804 | 2009-01-24T19:05:19 | 2009-01-24T19:05:19 | 34,583,564 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 448 | cpp | // TagControlTest.cpp : main project file.
#include "stdafx.h"
#include "Form1.h"
using namespace TagControlTest;
[STAThreadAttribute]
int main(array<System::String ^> ^args)
{
// Enabling Windows XP visual effects before any controls are created
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false);
// Create the main window and run it
Application::Run(gcnew Form1());
return 0;
}
| [
"[email protected]@02cab514-f24f-0410-a9ea-a7698ff47c65"
]
| [
[
[
1,
18
]
]
]
|
cde38fde0d80446b28398137724a08e26d8df4d5 | 138a353006eb1376668037fcdfbafc05450aa413 | /source/ogre/OgreNewt/boost/mpl/aux_/test/assert.hpp | b76479205651c99cc00e8f375933e58502252f27 | []
| no_license | sonicma7/choreopower | 107ed0a5f2eb5fa9e47378702469b77554e44746 | 1480a8f9512531665695b46dcfdde3f689888053 | refs/heads/master | 2020-05-16T20:53:11.590126 | 2009-11-18T03:10:12 | 2009-11-18T03:10:12 | 32,246,184 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,058 | hpp |
#ifndef BOOST_MPL_AUX_TEST_ASSERT_HPP_INCLUDED
#define BOOST_MPL_AUX_TEST_ASSERT_HPP_INCLUDED
// Copyright Aleksey Gurtovoy 2002-2004
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/mpl for documentation.
// $Source: /cvsroot/ogre/ogreaddons/ogrenewt/OgreNewt_Main/inc/boost/mpl/aux_/test/assert.hpp,v $
// $Date: 2006/04/17 23:48:05 $
// $Revision: 1.1 $
#include <boost/mpl/assert.hpp>
#include <boost/preprocessor/cat.hpp>
#define MPL_ASSERT(pred) BOOST_MPL_ASSERT(pred)
#define MPL_ASSERT_NOT(pred) BOOST_MPL_ASSERT_NOT(pred)
#define MPL_ASSERT_MSG(c, msg, types) BOOST_MPL_ASSERT_MSG(c, msg, types)
#define MPL_ASSERT_RELATION(x, rel, y) BOOST_MPL_ASSERT_RELATION(x, rel, y)
#define MPL_ASSERT_INSTANTIATION(x) \
enum { BOOST_PP_CAT(instantiation_test, __LINE__) = sizeof( x ) } \
/**/
#endif // BOOST_MPL_AUX_TEST_ASSERT_HPP_INCLUDED
| [
"Sonicma7@0822fb10-d3c0-11de-a505-35228575a32e"
]
| [
[
[
1,
29
]
]
]
|
03fdfea3f6eae0b2af1a0da7ec636462d8c7c69b | 38763b01d06c87ff1164877f57fc22d0da2927e4 | /src/imageb/module/modulePushButton.cpp | 3b562f510f7101c2ec095fda3e10b01d7160a32b | []
| no_license | JPSGoncalves/ImageB | 48b31b83bb1c032394c14e1df5ed90e2a285a521 | 135ccb9847f9e3394f2391417885d753a5b3a930 | refs/heads/master | 2023-03-17T03:57:10.299812 | 2011-07-20T16:59:41 | 2011-07-20T16:59:41 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 282 | cpp | #include "modulePushButton.h"
modulePushButton::modulePushButton()
{
}
modulePushButton::~modulePushButton()
{
delete(mod);
}
void modulePushButton::setModuleBase(moduleBase *m)
{
mod = m;
}
moduleBase *modulePushButton::getModuleBase()
{
return mod;
}
| [
"[email protected]"
]
| [
[
[
1,
23
]
]
]
|
c5202d223d4afbca29fad89544e8ccd6bb917040 | ce105c9e4ac9b1b77a160793e0c336826b936670 | /c++/classworkx/classworkx/employee.h | 0825e079bc2a02cc0856e6e1b9d073a68acff141 | []
| no_license | jmcgranahan/jusall-programinghw | a32909655cec085d459c2c567c2f1bed2b947612 | d6c5b54d0300a784dee0257364cd049f741cee81 | refs/heads/master | 2020-08-27T03:27:24.013332 | 2011-04-25T06:30:27 | 2011-04-25T06:30:27 | 40,640,139 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,370 | h | namespace Employees //new namespace
{
int string_length(char* str)
{
int i = 0;
while (i < 9999)
{
if(str[i] == '\0') return i;
++i;
}
return -1;
}
class Employee // new class
{
private://private sections
char* name;
char* jobTitle;
float wage;
float hoursWorked;
public: //public sections and prototypes
void setName(char* name);
const char* getName();
void setJobTitle(char* jobTitle);
const char* getJobTitle();
void setWage(float wage);
float getWage();
void setHoursWorked(float hoursWorked);
float getHoursWorked();
float getPay();
//constructors and deconstructors
Employee();
Employee(char* name, char* jobTitle, float wage, float hoursWorked);
~Employee();
};
// initialization of prototypes
void Employee::setName(char* name)
{
delete [] this->name; //delete current name
int size = string_length(name); // get length of new name
this->name = new char [size +1]; // set length + 1
for (int i = 0; i <= size; i++)
{
this->name [i] = name[i]; //copy selected char
}
}
const char* Employee::getName()
{
return name;
}
void Employee::setJobTitle(char* jobTitle)
{
delete [] this->jobTitle;
int size = string_length(jobTitle);
this->jobTitle = new char [size +1];
for (int i = 0; i <= size; i++)
{
this->jobTitle [i] = jobTitle[i];
}
}
const char* Employee::getJobTitle()
{
return jobTitle;
}
void Employee::setWage(float wage)
{
this->wage = wage;
}
float Employee::getWage()
{
return wage;
}
void Employee::setHoursWorked(float hoursWorked)
{
this->hoursWorked = hoursWorked;
}
float Employee::getHoursWorked()
{
return hoursWorked;
}
float Employee::getPay()
{
return wage * hoursWorked;
}
Employee::Employee() //init employee
{
name = new char [1];
jobTitle = new char [1];
wage = 0.0f;
hoursWorked = 0.0f;
}
Employee::Employee(char* name, char* jobTitle, float wage, float hoursWorked)
{
this->name = new char [1];
setName(name);
this->jobTitle = new char [1];
setJobTitle(jobTitle);
this->wage = 0.0f;
setWage(wage);
this->hoursWorked = 0.0f;
setHoursWorked(hoursWorked);
}
Employee::~Employee()
{
delete [] name;
delete [] jobTitle;
}
} | [
"biga05@c0f360ae-aefd-11de-b8dd-ab4b6ce6d521"
]
| [
[
[
1,
131
]
]
]
|
55ddfa3de21bae0c32a5072f243d2421ccd57ac4 | 535d66763ae4d6957b7ca38f1c940720ed34fcfe | /ExecProcess.h | ca3d3d8f3c97e1592a1d47b7d527f5de4be840ce | []
| no_license | beru/pngquant_gui | b038ed2d47417beb9b310274b236d96f7585d922 | f883848b1fd14c5c30fdc0683739f3cbfa412499 | refs/heads/master | 2021-01-01T18:07:45.246457 | 2011-10-16T14:06:38 | 2011-10-16T14:06:38 | 2,585,340 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 152 | h | #pragma once
#include <vector>
bool ExecProcess(
LPCTSTR cmdLine,
const std::vector<uint8_t>& inData,
std::vector<uint8_t>& outData
);
| [
"[email protected]"
]
| [
[
[
1,
10
]
]
]
|
eeeaa760b407345e3e580e07460bad14cdc70e24 | 011359e589f99ae5fe8271962d447165e9ff7768 | /src/burner/win32/miscpaths.cpp | 0a10b64173e5a2191d319d83f288114a7551f30a | []
| no_license | PS3emulators/fba-next-slim | 4c753375fd68863c53830bb367c61737393f9777 | d082dea48c378bddd5e2a686fe8c19beb06db8e1 | refs/heads/master | 2021-01-17T23:05:29.479865 | 2011-12-01T18:16:02 | 2011-12-01T18:16:02 | 2,899,840 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,033 | cpp | // custom misc paths, by regret
#include "burner.h"
#include <shlobj.h>
TCHAR szMiscPaths[PATH_SUM][MAX_PATH] = {
_T("previews\\"), _T("cheats\\"), _T("screenshots\\"), _T("savestates\\"), _T("recordings\\"),
_T("skins\\"), _T("ips\\"), _T("titles\\"), _T("flyers\\"),
_T("scores\\"), _T("selects\\"), _T("gameovers\\"), _T("bosses\\"), _T("icons\\"),
};
TCHAR szAppRomPaths[DIRS_MAX][MAX_PATH] = {
{ _T("") }
};
// Function for directory options
static int CALLBACK browseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData)
{
if (uMsg == BFFM_INITIALIZED && lpData) {
SendMessage(hwnd, BFFM_SETSELECTION, (WPARAM)1, (LPARAM)lpData);
}
return 0;
}
// ROM paths
static INT_PTR CALLBACK ROMDirProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
{
switch (Msg) {
case WM_INITDIALOG: {
for (int i = 0; i < DIRS_MAX; i++) {
SetDlgItemText(hDlg, IDC_DIR_EDIT1 + i, szAppRomPaths[i]);
}
wndInMid(hDlg, hSelDlg ? hSelDlg : hScrnWnd);
SetFocus(hDlg);
break;
}
case WM_COMMAND: {
int var;
TCHAR buffer[MAX_PATH] = _T("");
if (LOWORD(wParam) == IDOK) {
SendMessage(hDlg, WM_CLOSE, 0, 0);
break;
} else {
if (LOWORD(wParam) >= IDC_DIR_BR1 && LOWORD(wParam) <= IDC_DIR_BR14) {
var = IDC_DIR_EDIT1 + LOWORD(wParam) - IDC_DIR_BR1;
GetDlgItemText(hDlg, var, buffer, sizearray(buffer));
} else {
if (HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDCANCEL) {
SendMessage(hDlg, WM_CLOSE, 0, 0);
}
break;
}
}
BROWSEINFO bInfo;
memset(&bInfo, 0, sizeof(bInfo));
bInfo.hwndOwner = hDlg;
bInfo.lpszTitle = FBALoadStringEx(IDS_ROMS_SELECT_DIR);
bInfo.ulFlags = BIF_EDITBOX | BIF_RETURNONLYFSDIRS;
bInfo.lpfn = browseCallbackProc;
if (buffer) {
bInfo.lParam = (LPARAM)buffer;
}
LPITEMIDLIST pItemIDList = SHBrowseForFolder(&bInfo);
if (pItemIDList) {
if (SHGetPathFromIDList(pItemIDList, buffer)) {
pathCheck(buffer);
SetDlgItemText(hDlg, var, buffer);
}
LPMALLOC pMalloc = NULL;
SHGetMalloc(&pMalloc);
if (pMalloc) {
pMalloc->Free(pItemIDList);
pMalloc->Release();
}
}
break;
}
case WM_NOTIFY: {
switch (((NMHDR *)lParam)->code) {
case PSN_APPLY:
TCHAR buffer[MAX_PATH] = _T("");
for (int i = 0; i < DIRS_MAX; i++) {
if (GetDlgItemText(hDlg, IDC_DIR_EDIT1 + i, buffer, sizearray(buffer))) {
pathCheck(buffer);
}
_tcscpy(szAppRomPaths[i], buffer);
}
}
}
break;
case WM_CLOSE: {
EndDialog(hDlg, 0);
// if (chOk) {
// bRescanRoms = true;
// CreateROMInfo();
// }
}
}
return 0;
}
int RomsDirCreate(HWND parent)
{
FBADialogBox(IDD_ROMSDIR, parent, (DLGPROC)ROMDirProc);
return 0;
}
// Misc paths
static INT_PTR CALLBACK miscPathProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
{
int var;
switch (Msg) {
case WM_INITDIALOG: {
for (int i = 0; i < PATH_SUM; i++) {
SetDlgItemText(hDlg, IDC_DIR_EDIT1 + i, szMiscPaths[PATH_PREVIEW + i]);
}
wndInMid(hDlg, hSelDlg ? hSelDlg : hScrnWnd);
SetFocus(hDlg);
return TRUE;
}
case WM_COMMAND: {
TCHAR buffer[MAX_PATH] = _T("");
if (LOWORD(wParam) == IDOK) {
SendMessage(hDlg, WM_CLOSE, 0, 0);
break;
}
else if (HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == ID_DEFAULT) {
// set default path
SetDlgItemText(hDlg, IDC_DIR_EDIT1, _T("previews\\"));
SetDlgItemText(hDlg, IDC_DIR_EDIT2, _T("cheats\\"));
SetDlgItemText(hDlg, IDC_DIR_EDIT3, _T("screenshots\\"));
SetDlgItemText(hDlg, IDC_DIR_EDIT4, _T("savestates\\"));
SetDlgItemText(hDlg, IDC_DIR_EDIT5, _T("recordings\\"));
SetDlgItemText(hDlg, IDC_DIR_EDIT6, _T("skins\\"));
SetDlgItemText(hDlg, IDC_DIR_EDIT7, _T("ips\\"));
SetDlgItemText(hDlg, IDC_DIR_EDIT8, _T("titles\\"));
SetDlgItemText(hDlg, IDC_DIR_EDIT9, _T("flyers\\"));
SetDlgItemText(hDlg, IDC_DIR_EDIT10, _T("scores\\"));
SetDlgItemText(hDlg, IDC_DIR_EDIT11, _T("selects\\"));
SetDlgItemText(hDlg, IDC_DIR_EDIT12, _T("gameovers\\"));
SetDlgItemText(hDlg, IDC_DIR_EDIT13, _T("bosses\\"));
SetDlgItemText(hDlg, IDC_DIR_EDIT14, _T("icons\\"));
break;
} else {
if (LOWORD(wParam) >= IDC_DIR_BR1 && LOWORD(wParam) <= IDC_DIR_BR14) {
var = IDC_DIR_EDIT1 + LOWORD(wParam) - IDC_DIR_BR1;
GetDlgItemText(hDlg, var, buffer, sizearray(buffer));
} else {
if (HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDCANCEL) {
SendMessage(hDlg, WM_CLOSE, 0, 0);
}
break;
}
}
BROWSEINFO bInfo;
memset(&bInfo, 0, sizeof(bInfo));
bInfo.hwndOwner = hDlg;
bInfo.lpszTitle = FBALoadStringEx(IDS_ROMS_SELECT_DIR);
bInfo.ulFlags = BIF_EDITBOX | BIF_RETURNONLYFSDIRS;
bInfo.lpfn = browseCallbackProc;
if (buffer) {
bInfo.lParam = (LPARAM)buffer;
}
LPITEMIDLIST pItemIDList = SHBrowseForFolder(&bInfo);
if (pItemIDList) {
if (SHGetPathFromIDList(pItemIDList, buffer)) {
pathCheck(buffer);
SetDlgItemText(hDlg, var, buffer);
}
LPMALLOC pMalloc = NULL;
SHGetMalloc(&pMalloc);
if (pMalloc) {
pMalloc->Free(pItemIDList);
pMalloc->Release();
}
}
break;
}
case WM_NOTIFY: {
switch (((NMHDR *)lParam)->code) {
case PSN_APPLY:
TCHAR buffer[MAX_PATH] = _T("");
for (int i = 0; i < PATH_SUM; i++) {
if (GetDlgItemText(hDlg, IDC_DIR_EDIT1 + i, buffer, sizearray(buffer)) && _tcscmp(szMiscPaths[i], buffer)) {
pathCheck(buffer);
_tcscpy(szMiscPaths[i], buffer);
}
}
break;
}
}
break;
case WM_CLOSE: {
EndDialog(hDlg, 0);
}
}
return 0;
}
int miscDirCreate(HWND parent)
{
FBADialogBox(IDD_MISCDIR, parent, (DLGPROC)miscPathProc);
return 0;
}
const TCHAR* getMiscPath(unsigned int dirType)
{
if (dirType < PATH_PREVIEW || dirType >= PATH_SUM) {
return NULL;
}
return szMiscPaths[dirType];
}
const TCHAR* getMiscArchiveName(unsigned int dirType)
{
if (dirType < PATH_PREVIEW || dirType >= PATH_SUM) {
return NULL;
}
static TCHAR szArchiveName[64] = _T("");
switch (dirType) {
case PATH_PREVIEW:
_tcscpy(szArchiveName, _T("snap"));
break;
case PATH_TITLE:
_tcscpy(szArchiveName, _T("titles"));
break;
case PATH_FLYER:
_tcscpy(szArchiveName, _T("flyers"));
break;
case PATH_SCORE:
_tcscpy(szArchiveName, _T("score"));
break;
case PATH_SELECT:
_tcscpy(szArchiveName, _T("select"));
break;
case PATH_GAMEOVER:
_tcscpy(szArchiveName, _T("gameover"));
break;
case PATH_BOSS:
_tcscpy(szArchiveName, _T("boss"));
break;
case PATH_CHEAT:
_tcscpy(szArchiveName, _T("cheat"));
break;
case PATH_SKIN:
_tcscpy(szArchiveName, _T("skin"));
break;
case PATH_ICON:
_tcscpy(szArchiveName, _T("icons"));
break;
}
return szArchiveName;
}
// Property sheet
void pathSheetCreate(HWND parent)
{
HINSTANCE instance = FBALocaliseInstance();
PROPSHEETPAGE psp[2];
PROPSHEETHEADER psh;
for (int i = 0; i < sizearray(psp); i++) {
psp[i].dwSize = sizeof(PROPSHEETPAGE);
psp[i].dwFlags = PSP_DEFAULT;
psp[i].hInstance = instance;
psp[i].lParam = 0;
psp[i].pfnCallback = NULL;
}
psp[1].pszTemplate = MAKEINTRESOURCE(IDD_MISCDIR);
psp[1].pfnDlgProc = (DLGPROC)miscPathProc;
psp[0].pszTemplate = MAKEINTRESOURCE(IDD_ROMSDIR);
psp[0].pfnDlgProc = (DLGPROC)ROMDirProc;
psh.dwSize = sizeof(PROPSHEETHEADER);
psh.dwFlags = PSH_PROPSHEETPAGE | PSH_NOAPPLYNOW | PSH_NOCONTEXTHELP;
psh.hwndParent = parent;
psh.hInstance = instance;
psh.pszCaption = FBALoadStringEx(IDS_PREF_PATHSETTING);
psh.nPages = sizearray(psp);
psh.nStartPage = 0;
psh.ppsp = (LPCPROPSHEETPAGE)&psp;
psh.pfnCallback = NULL;
PropertySheet(&psh);
}
| [
"[email protected]"
]
| [
[
[
1,
306
]
]
]
|
fd2ad45f9e551ba7bf278337037f9d9fc366c7cc | b5ad65ebe6a1148716115e1faab31b5f0de1b493 | /maxsdk2008/include/ifnpub.h | 51a7b602589e16b605a6fa73896f35acded2551a | []
| no_license | gasbank/aran | 4360e3536185dcc0b364d8de84b34ae3a5f0855c | 01908cd36612379ade220cc09783bc7366c80961 | refs/heads/master | 2021-05-01T01:16:19.815088 | 2011-03-01T05:21:38 | 2011-03-01T05:21:38 | 1,051,010 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 135,139 | h | //**************************************************************************/
// Copyright (c) 1998-2006 Autodesk, Inc.
// All rights reserved.
//
// These coded instructions, statements, and computer programs contain
// unpublished proprietary information written by Autodesk, Inc., and are
// protected by Federal copyright law. They may not be disclosed to third
// parties or copied or duplicated in any form, in whole or in part, without
// the prior written consent of Autodesk, Inc.
//**************************************************************************/
// FILE: iFnPub.h
// DESCRIPTION: Interface to Plugin Function Publishing system
// AUTHOR: John Wainwright
// HISTORY: created 2/15/00
//**************************************************************************/
#ifndef __IFNPUB__
#define __IFNPUB__
#include "maxheap.h"
#include "baseInterface.h"
#include "strbasic.h"
// classes defined in this header
class FPInterface;
class FPInterfaceDesc;
class FPStaticInterface;
class FPMixinInterface;
class FPFunctionDef;
class FPActionDef;
class FPParamDef;
class FPPropDef;
typedef int FPStatus;
class FPParams;
class FPParamOptions;
class FPValidator;
class FPEnum;
class FPValue;
class IObject;
class MAXException;
class FPMacroEmitter;
typedef short FunctionID; // ID for individual functions within an interface (local)
#define FP_NO_FUNCTION ((FunctionID)-1) // special ID indicating no function bound
typedef short EnumID;
#define FP_NO_ENUM ((EnumID)-1)
// built-in interface IDs
#define NULLINTERFACE_ID Interface_ID(0, 0) // null interface
// BASEINTERFACE_ID (1,1) in baseInterface.h
#define FPINTERFACE_ID Interface_ID(0, 2) // root FPInterface
#define FPMIXININTERFACE_ID Interface_ID(0, 3) // root FPMixinInterface
#define FPINTERFACEDESC_ID Interface_ID(0, 4) // root FPInterfaceDesc
// standard interface accessors
inline FPInterface* GetFPInterface(BaseInterface* bi) { return reinterpret_cast<FPInterface*>(bi->GetInterface(FPINTERFACE_ID)); }
inline FPInterfaceDesc* GetFPInterfaceDesc(BaseInterface* bi) { return reinterpret_cast<FPInterfaceDesc*>(bi->GetInterface(FPINTERFACEDESC_ID)); }
inline FPMixinInterface* GetFPMixinInterface(BaseInterface* bi){ return reinterpret_cast<FPMixinInterface*>(bi->GetInterface(FPMIXININTERFACE_ID)); }
// external classes
class ClassDesc;
class MSPluginClass;
class Rollout;
class MaxIcon;
class ActionTable;
class Point3;
class TSTR;
class PBBitmap;
class Mtl;
class Texmap;
class INode;
class ReferenceTarget;
class Matrix3;
class AngAxis;
class Quat;
class Ray;
class Point2;
class BitArray;
class ClassDesc;
class Mesh;
class Object;
class Control;
class Interval;
class Color;
class Value;
typedef INT_PTR StringResID;
typedef int ResID;
typedef short MapID;
// FPStatus values
#define FPS_FAIL 0
#define FPS_NO_SUCH_FUNCTION -1
#define FPS_ACTION_DISABLED -2
#define FPS_OK 1
// FPInterface class, the base class for FnPub interfaces.
// contains the basic dispatching code & virtual base methods
// The prime subclass is FPInterfaceDesc, which contains the
// interface metadata in a singleton instance. There are two
// typedefs, FPStaticInterface used as the base class for static and core
// interfaces, and FPMixinInterface used as the
// base class for mixin (object-based) interfaces
/*! \sa Class BaseInterface, Class ClassDesc, Class FPInterfaceDesc, Class Interface_ID, Class ActionTable, <a href="ms-its:listsandfunctions.chm::/idx_R_list_of_fpstatus_values.html">List of FPStatus Values</a>,
<a href="ms-its:3dsmaxsdk.chm::/function_root.html">Function Publishing System</a>.\n\n
\par Description:
This class is available in release 4.0 and later only.\n\n
The Function Publishing system makes use of this class. Functions are published
in one or more Interfaces by a plug-in. Each interface is represented by an
instance of a class derived from this base class.\n\n
Note that the Function Publishing class hierarchy is as follows:\n\n
<b>FPInterface</b>: This is the base class for all interfaces, the prime client
type for using interfaces.\n\n
<b>FPInterfaceDesc</b>: This is the class which contains interface
metadata.\n\n
<b>FPStaticInterface</b>: This is the class to use as the base class for
defining static or core virtual interface classes.\n\n
<b>FPMixinInterface</b>: This is for use as the base class for defining
object-based mixin interface classes, in this case you also use FPInterfaceDesc
for mixin interface descriptors. */
class FPInterface : public BaseInterface
{
protected:
virtual FPStatus _dispatch_fn(FunctionID fid, TimeValue t, FPValue& result, FPParams* p) { return FPS_NO_SUCH_FUNCTION; }
public:
static CoreExport FPInterfaceDesc nullInterface; // null interface descriptor, can be returned by interfaces not publishing metadata
// from BaseInterface
virtual BaseInterface* GetInterface(Interface_ID id)
{
if (id == FPINTERFACE_ID) return this;
else if (id == FPINTERFACEDESC_ID) return (BaseInterface*)GetDesc();
else return BaseInterface::GetInterface(id);
}
// metadata access
/*! \remarks Returns a pointer to the class which contains the interface
metadata. */
virtual FPInterfaceDesc* GetDesc() = 0;
// Fn calling
/*! \remarks
\par Parameters:
<b>FunctionID fid</b>\n\n
The function ID of the function to invoke.\n\n
<b>TimeValue t=0</b>\n\n
The timevalue at which to invoke the function.\n\n
<b>FPParams* params=NULL</b>\n\n
The FPParams to pass.
\return The FPStatus. See the
<a href="ms-its:listsandfunctions.chm::/idx_R_list_of_fpstatus_values.html">List of FPStatus Values</a>
for details */
CoreExport virtual FPStatus Invoke(FunctionID fid, TimeValue t=0, FPParams* params=NULL);
/*! \remarks This method will invoke the specified function.
\par Parameters:
<b>FunctionID fid</b>\n\n
The function ID of the function to invoke.\n\n
<b>FPParams* params</b>\n\n
The FPParams to pass.
\return The FPStatus. See the
<a href="ms-its:listsandfunctions.chm::/idx_R_list_of_fpstatus_values.html">List of FPStatus Values</a>
for details */
virtual inline FPStatus Invoke(FunctionID fid, FPParams* params) { return Invoke(fid, 0, params); }
/*! \remarks This method will invoke the specified function.
\par Parameters:
<b>FunctionID fid</b>\n\n
The function ID of the function to invoke.\n\n
<b>TimeValue t</b>\n\n
The timevalue at which to invoke the function.\n\n
<b>FPValue\& result</b>\n\n
A reference to the resulting FPValue.\n\n
<b>FPParams* params=NULL</b>\n\n
The FPParams to pass.
\return The FPStatus. See the
<a href="ms-its:listsandfunctions.chm::/idx_R_list_of_fpstatus_values.html">List of FPStatus Values</a>
for details */
CoreExport virtual FPStatus Invoke(FunctionID fid, TimeValue t, FPValue& result, FPParams* params=NULL);
/*! \remarks This method will invoke the specified function.
\par Parameters:
<b>FunctionID fid</b>\n\n
The function ID of the function to invoke.\n\n
<b>FPValue\& result</b>\n\n
A reference to the resulting FPValue.\n\n
<b>FPParams* params=NULL</b>\n\n
The FPParams to pass.
\return The FPStatus. See the
<a href="ms-its:listsandfunctions.chm::/idx_R_list_of_fpstatus_values.html">List of FPStatus Values</a>
for details */
virtual inline FPStatus Invoke(FunctionID fid, FPValue& result, FPParams* params=NULL) { return Invoke(fid, 0, result, params); }
/*! \remarks This method returns a function ID based on the name of the
function specified.
\par Parameters:
<b>MCHAR* name</b>\n\n
The name of the function to retrieve the Function ID for. */
CoreExport virtual FunctionID FindFn(MCHAR* name);
// predicate access
/*! \remarks This method allows you to check whether a specific action
function is enabled, in which case the method will return TRUE. If the
action function is not enabled FALSE will be returned.
\par Parameters:
<b>FunctionID actionID</b>\n\n
The function ID of the action you wish to check the enabled state for. */
CoreExport virtual BOOL IsEnabled(FunctionID actionID);
/*! \remarks This method allows you to check whether a specific action
function is checked, in which case the method will return TRUE. If the
action function is not checked FALSE will be returned.
\par Parameters:
<b>FunctionID actionID</b>\n\n
The function ID of the action you wish to check the checked state for. */
CoreExport virtual BOOL IsChecked(FunctionID actionID);
/*! \remarks This method allows you to check whether a specific action
function is visible, in which case the method will return TRUE. If the
action function is not visible FALSE will be returned.
\par Parameters:
<b>FunctionID actionID</b>\n\n
The function ID of the action you wish to check the visibility state for.
*/
CoreExport virtual BOOL IsVisible(FunctionID actionID);
/*! \remarks This method will return the isEnabled ID for the specified
action function.
\par Parameters:
<b>FunctionID actionID</b>\n\n
The function ID of the action you wish to get the isEnabled ID for. */
CoreExport virtual FunctionID GetIsEnabled(FunctionID actionID);
/*! \remarks This method will return the isChecked ID for the specified
action function.
\par Parameters:
<b>FunctionID actionID</b>\n\n
The function ID of the action you wish to get the isChecked ID for. */
CoreExport virtual FunctionID GetIsChecked(FunctionID actionID);
/*! \remarks This method will return the isVisible ID for the specified
action function.
\par Parameters:
<b>FunctionID actionID</b>\n\n
The function ID of the action you wish to get the isVisible ID for. */
CoreExport virtual FunctionID GetIsVisible(FunctionID actionID);
// Action interface access & control
/*! \remarks This method returns a pointer to the ActionTable.
\par Default Implementation:
<b>{ return NULL; }</b> */
virtual ActionTable* GetActionTable() { return NULL; }
// global Actions enable/disable
/*! \remarks This method allows you to enable or disable the entire set of
actions in the interface You might want to use this method if the actions
are only to be active during certain periods in the running of 3ds Max.
Usually, this control is achieved via ActionTable contexts.
\par Parameters:
<b>BOOL onOff</b>\n\n
TRUE to enable actions, FALSE to disable them.
\par Default Implementation:
<b>{ }</b> */
virtual void EnableActions(BOOL onOff) { }
};
#include <paramtype.h>
// FPInterfaceDesc class, an FPInterface that contains the metadata for an interface, a distinhished
// singleton instance per interface kept in a Tab<> in ClassDesc
// This class is subclassed typically by static and core inerfaces and instantiated
// by mixins to provide their metadata
/*! \sa Class FPInterface, Class ClassDesc, Class Interface_ID, Class FPEnum, Class FPFunctionDef, Class FPPropDef, Class ActionTable, Template Class Tab, <a href="ms-its:3dsmaxsdk.chm::/function_root.html">Function Publishing System</a>.\n\n
\par Description:
This class is available in release 4.0 and later only.\n\n
This is the Function Publishing interface descriptor. This is usually a static
instance of the implementation interface. The constructor for this class uses
the same var-args technique used by the ParamBlockDesc2 constructor, enabling
descriptive information for all the functions in the interface to be supplied
in one constructor call.\n\n
The FPInterfaceDesc class, an FPInterface that contains the metadata for an
interface, is a distinguished singleton instance per interface kept in a
Tab\<\> in ClassDesc. This class is subclassed typically by static and core
interfaces and instantiated by mixins to provide their metadata.\n\n
Note the following typedef: <b>typedef FPInterfaceDesc FPStaticInterface</b>
\par Data Members:
<b>Interface_ID ID;</b>\n\n
The unique ID of the interface.\n\n
<b>TSTR internal_name;</b>\n\n
The fixed internal name for the interface.\n\n
<b>StringResID description;</b>\n\n
The description string resource ID.\n\n
<b>ClassDesc* cd;</b>\n\n
Points to the publishing plug-in's ClassDesc.\n\n
<b>USHORT flags;</b>\n\n
The flag bits. One or more of the following values:\n\n
<b>FP_ACTIONS</b>\n\n
Marks this as an Action Interface, holding only UI modal, zero parameter action
functions.\n\n
<b>FP_MIXIN</b>\n\n
Marks this as a Mixin Interface, it is implemented directly by the plug-in
class, so the methods in it are virtual on the plugin's objects.\n\n
<b>FP_CORE</b>\n\n
Marks this as a 3ds Max Core Interface, available through
<b>GetCOREInterface(Interface_ID)</b>.\n\n
<b>FP_STATIC_METHODS</b>\n\n
This interface is used as a static method interface in MAXScript, properties
are not directly callable\n\n
<b>FP_SCRIPTED_CLASS</b>\n\n
Internal use only: Belongs to a scripted plug-in class.\n\n
<b>FP_TEMPORARY</b>\n\n
Internal use only: Temporary descriptor built during scene load.\n\n
<b>Tab\<FPFunctionDef*\> functions;</b>\n\n
A table of descriptors for individual functions in this interface.\n\n
<b>Tab\<FPPropDef*\> props;</b>\n\n
A Table of descriptors for individual properties in this interface.\n\n
<b>Tab\<FPEnum*\> enumerations;</b>\n\n
A table of any symbolic enums for the interface. This is a Tab\<\> of pointers
to <b>FPEnum</b> class instances which themselves contain a Tab\<\> of name,
code pairs.\n\n
The following data members are for scripted plug-ins if this interface belongs
to a scripted plug-in class.\n\n
<b>MSPluginClass* pc;</b>\n\n
The scripted class if non-NULL (gc-protected by the scripted plugin class).\n\n
<b>Rollout* rollout;</b>\n\n
The rollout if specified (gc-protected by the scripted plugin class).\n\n
<b>ActionTable* action_table;</b>\n\n
The table published for this action interface.\n\n
For more information, see Class ActionTable. */
class FPInterfaceDesc : public FPInterface
{
protected:
CoreExport void load_descriptor(Interface_ID id, MCHAR* int_name, StringResID descr, ClassDesc* cd, USHORT flag, va_list ap);
public:
// interface metadata
Interface_ID ID; // my unique ID
MSTR internal_name; // fixed, internal name
StringResID description; // description string resource
ClassDesc* cd; // publishing plugin's ClassDesc
USHORT flags; // flag bits
Tab<FPFunctionDef*> functions; // descriptors for individual functions in this interface
Tab<FPPropDef*> props; // " " " properties in this interface
Tab<FPEnum*> enumerations; // any symbolic enums for the interface
// scripted plug-in stuff if this belongs to a scripted plug-in class
MSPluginClass* pc; // the scripted class if non-NULL (gc-protected by the scripted plugin class)
Rollout* rollout; // rollout if specified (gc-protected by the scripted plugin class)
// Action-interface stuff
ActionTable* action_table; // the table published for this action interface
// constructors
/*! \remarks Constructor. No initialization is performed. */
CoreExport FPInterfaceDesc() { }
/*! \remarks Constructor.
\par Parameters:
<b>Interface_ID id</b>\n\n
The unique ID of the interface.\n\n
<b>MCHAR* int_name</b>\n\n
The fixed internal name for the interface.\n\n
<b>StringResID descr</b>\n\n
A string resource ID containing the description for this interface
class.\n\n
<b>ClassDesc* cd</b>\n\n
A pointer to a ClassDesc class descriptor of the publishing plug-in.\n\n
<b>ULONG flag</b>\n\n
The flag bits. One or more of the following values: <b>FP_ACTIONS,
FP_MIXIN, FP_CORE, FP_STATIC_METHODS, FP_SCRIPTED_CLASS, FP_TEMPORARY</b>.
For a description see the data members descriptions.\n\n
<b>...</b>\n\n
This constructor takes a variable number of arguments representing the
'properties' sections and function definitions. For more information see
the advanced topics on
<a href="ms-its:3dsmaxsdk.chm::/function_root.html">Function
Publishing</a>. */
CoreExport FPInterfaceDesc(Interface_ID id, MCHAR* int_name, StringResID descr, ClassDesc* cd, ULONG flag, ...);
CoreExport ~FPInterfaceDesc();
/*! \remarks This is a virtual method called by the varargs-based
constructors for interface descriptors and static interfaces, so that they
have an opportunity to do runtime initialization of any extra state data
you add to these interfaces (usually to static interfaces). Since such
interfaces are usually constructed with the built-in varargs constructor,
there is no way to do custom initialization without a hook like the Init()
call. Your static interface would provide an implementation of Init() to do
any special initialization.
\par Default Implementation:
<b>{ }</b> */
virtual void Init() { }
// from GenericInterface, default lifetime is noRelease
LifetimeType LifetimeControl() { return noRelease; }
// from BaseInterface
virtual BaseInterface* GetInterface(Interface_ID id) { if (id == FPINTERFACEDESC_ID) return this; else return FPInterface::GetInterface(id); }
// construction utilities
/*! \remarks This method relates to <b>Init()</b>. In some cases, you
really do need to provide your own constructor or set of constructors for a
static interface or descriptor, but you still want to be able to load it
with all the interface metadata that the built-in varargs constructor does.
You can do this by calling the <b>LoadDescriptor()</b> method at any point
in your own constructors and it takes the same arguments as the built-in
varargs constructor.
\par Parameters:
<b>Interface_ID id</b>\n\n
The unique ID of the interface.\n\n
<b>MCHAR* int_name</b>\n\n
The fixed internal name for the interface.\n\n
<b>StringResID descr</b>\n\n
A string resource ID containing the description for this interface
class.\n\n
<b>ClassDesc* cd</b>\n\n
A pointer to a ClassDesc class descriptor of the publishing plug-in.\n\n
<b>ULONG flag</b>\n\n
The flag bits. One or more of the following values: <b>FP_ACTIONS,
FP_MIXIN, FP_CORE, FP_STATIC_METHODS, FP_SCRIPTED_CLASS, FP_TEMPORARY</b>.
For a description see the data members descriptions.\n\n
<b>...</b>\n\n
This method takes a variable number of arguments representing the
'properties' sections and function definitions. For more information see
the advanced topics on
<a href="ms-its:3dsmaxsdk.chm::/function_root.html">Function
Publishing</a>. */
CoreExport void LoadDescriptor(Interface_ID id, MCHAR* int_name, StringResID descr, ClassDesc* cd, ULONG flag, ...);
/*! \remarks This method sets the ClassDesc pointer associated
FPInterfaceDesc class. You can only call this method once on a descriptor
and then only if it has been constructed initially with a NULL cd. See the
notes in the constructor.\n\n
\par Parameters:
<b>ClassDesc* i_cd</b>\n\n
This points to the ClassDesc class descriptor to set. */
CoreExport void SetClassDesc(ClassDesc* i_cd);
/*! \remarks This is used internally. */
CoreExport va_list check_fn(va_list ap, int id);
/*! \remarks This is used internally. */
CoreExport va_list scan_fn(va_list ap, int id, int index);
/*! \remarks This is used internally. */
CoreExport va_list check_prop(va_list ap, int id);
/*! \remarks This is used internally. */
CoreExport va_list scan_prop(va_list ap, int id, int index);
/*! \remarks This is used internally. */
CoreExport va_list check_enum(va_list ap, EnumID id);
/*! \remarks This is used internally. */
CoreExport va_list scan_enum(va_list ap, EnumID id, int index);
// metadata access
/*! \remarks This method returns a pointer to the descriptor for this
Function Publishing interface descriptor.
\par Default Implementation:
<b>{ return this; }</b> */
FPInterfaceDesc* GetDesc() { return this; }
Interface_ID GetID() { return ID; }
/*! \remarks This method returns a pointer to the function definition of a
specific function identified by its ID. Calls to this method, given an
<b>FPInterface*</b>, can be made indirectly through
<b>FPInterface::GetDesc()</b>. For example; <b>FPFunctionDef* fd =
fpi-\>GetDesc()-\>GetFnDef(foo_move);</b>
\par Parameters:
<b>FunctionID fid</b>\n\n
The unique function ID used to identify the function. */
CoreExport FPFunctionDef* GetFnDef(FunctionID fid);
/*! \remarks This method returns a pointer to the action table.
\par Default Implementation:
<b>{ return action_table; }</b> */
ActionTable* GetActionTable() { return action_table; }
// global Actions enable/disable
/*! \remarks This method allows you to enable or disable the entire set of
actions in the interface You might want to use this method if the actions
are only to be active during certain periods in the running of 3ds Max.
Usually, this control is achieved via ActionTable contexts.
\par Parameters:
<b>BOOL onOff;</b>\n\n
TRUE to enable actions, FALSE to disable actions. */
CoreExport void EnableActions(BOOL onOff);
// overridable HInstance and resource access from owning module
/*! \remarks This method will return a handle to the owning instance. */
CoreExport virtual HINSTANCE HInstance();
/*! \remarks This method returns the string associated with a specified
String Resource ID
\par Parameters:
<b>StringResD id</b>\n\n
The string resource ID for which you want to obtain the string. */
CoreExport virtual MCHAR* GetRsrcString(StringResID id);
};
// FPInterfaceDesc flag bits
// per interface flags
#define FP_ACTIONS 0x0001 // marks this as an Action Interface, holding only UI modal, zero param action fns
#define FP_MIXIN 0x0002 // marks this as a Mixin Interface, it is implemented directly by the plugin class, so the
// methods in it are virtual on the plugin's objects
#define FP_CORE 0x0004 // marks this as a MAX Core Interface, available through GetCOREInterface(Interface_ID)
#define FP_STATIC_METHODS 0x0008 // this interface is used as a static method interface in MAXScript, properties are not directly callable
#define FP_TEST_INTERFACE 0x0010 // a non-public test interface, Discreet internal use only
// per descriptor internal flags
#define FP_SCRIPTED_CLASS 0x1000 // belongs to a scripted plug-in class
#define FP_TEMPORARY 0x2000 // temporary descripter built during scene load to support schema migration
// static interface
/*! \sa Class FPInterfaceDesc.\n\n
\par Description:
This class is currently the same as <b>FPInterfaceDesc</b> as per the following
typedef:\n\n
<b>typedef FPInterfaceDesc FPStaticInterface</b>\n\n
See Class FPInterfaceDesc for
details. */
class FPStaticInterface : public FPInterfaceDesc
{
};
// The MAXScript FPMixinInterface wrapper class
class FPMixinInterfaceValue;
// mixin interface
/*! \sa Class FPInterface, Class FPInterfaceDesc, <a href="ms-its:3dsmaxsdk.chm::/function_root.html">Function publishing</a>.\n\n
\par Description:
This class is available in release 4.0 and later only.\n\n
A "Mixin" interface provides a way for a plug-in to expose some of its
functionality for use by other plug-ins or MAXScript. The notion of "Mixin"
refers to the idea that the interface is a sub-class of the plug-in class and
thus "mixed in" with it. Many classes in the SDK now inherit from
FPMixinInterface in order to expose some of their functionality.\n\n
Developers should see the documentation for
Class FPInterface for reference on this
class as well.\n\n
For an overview of the function publishing system as a whole, see
<a href="ms-its:3dsmaxsdk.chm::/function_root.html">Function
publishing</a>. */
class FPMixinInterface : public FPInterface
{
friend class FPMixinInterfaceValue;
private:
FPMixinInterfaceValue* MXS_fpi;
protected:
Tab<InterfaceNotifyCallback*> *interfaceNotifyCBs;
// copy constructor and copy assignment operator are defined to prevent MXS_fpi and
// interfaceNotifyCBs pointers from being copied from right-hand side.
// These pointers are instance specific.
FPMixinInterface(const FPMixinInterface &rhs) : MXS_fpi(NULL), interfaceNotifyCBs(NULL) {}
FPMixinInterface& operator=(const FPMixinInterface& rhs) {return *this;}
public:
FPMixinInterface() : MXS_fpi(NULL), interfaceNotifyCBs(NULL) {}
// from GenericInterface, default lifetime is serverControlled
virtual LifetimeType LifetimeControl() { return serverControlled; }
CoreExport virtual bool RegisterNotifyCallback(InterfaceNotifyCallback* incb);
virtual void UnRegisterNotifyCallback(InterfaceNotifyCallback* incb)
{
if (interfaceNotifyCBs)
for (int i=0; i < interfaceNotifyCBs->Count(); i++)
{ if (incb == (*interfaceNotifyCBs)[i])
interfaceNotifyCBs->Delete(i,1);
}
}
CoreExport ~FPMixinInterface();
// from BaseInterface
virtual BaseInterface* GetInterface(Interface_ID id) { if (id == FPMIXININTERFACE_ID) return this; else return FPInterface::GetInterface(id); }
// utility metadata accessors...
// use GetDescByID() to directly implement FPInterface::GetDesc() in your public virtual base mixin class,
// like this: FPInterfacedesc* GetDesc() { return GetDescByID(THIS_INTERFACE_ID); }
// then implement a GetDescByID() in the implementing class to avoid link export issues
/*! \remarks This method is used to directly implement
<b>FPInterface::GetDesc()</b> in your public virtual base mixin class, like
this;\n\n
<b>FPInterfaceDesc* GetDesc() { return GetDescByID(THIS_INTERFACE_ID);
}</b>\n\n
Then implement a GetDescByID() in the implementing class to avoid link
export issues.
\par Parameters:
<b>Interface_ID id</b>\n\n
The unique interface ID by which to get the FPInterfaceDesc.
\par Default Implementation:
<b>{ return \&nullInterface; }</b> */
virtual FPInterfaceDesc* GetDescByID(Interface_ID id) { return &nullInterface; }
// override GetID() in those interfaces that don't publish metadata but have a unique Interface_ID for quick internal identification
// in implementation code that might be shared by a bunch of mixin interfaces
/*! \remarks This method overrides GetID() in those interfaces that do not
publish metadata but instead have a unique Interface_ID for quick internal
identification in implementation code that might be shared by a bunch of
mixin interfaces.
\return The Interface_ID.
\par Default Implementation:
<b>{ return GetDesc()-\>ID; }</b> */
virtual Interface_ID GetID() { return GetDesc()->ID; }
};
// FPFunctionDef, contains descriptor for each published function
// live in Tab<> in FPInterface
/*! \sa Class FPInterface, Class FPInterfaceDesc, Class FPActionDef, Class FPParamDef, Template Class Tab, <a href="ms-its:3dsmaxsdk.chm::/function_root.html">Function Publishing System</a>,
<a href="ms-its:listsandfunctions.chm::/idx_R_list_of_parameter_types.html">List of Param Type Choices</a>,
<a href="ms-its:listsandfunctions.chm::/idx_R_list_of_parameter_types.html">List of ParamType2 Choices</a>.\n\n
\par Description:
This class is available in release 4.0 and later only.\n\n
This class stores data about a single function of an FPInterface. A table of
pointers to these objects is a data member of Class <b>FPInterfaceDesc</b>.
\par Data Members:
<b>FunctionID ID;</b>\n\n
The interface-local ID (unique to the interface only) used to identify the
function in calls.\n\n
<b>TSTR internal_name;</b>\n\n
The fixed internal name for the function.\n\n
<b>StringResID description;</b>\n\n
The description string resource.\n\n
<b>USHORT flags;</b>\n\n
The internal flag bits. One of more of the following values:\n\n
<b>FP_ACTION</b>\n\n
Indicates this is an action function.\n\n
<b>FP_HAS_UI</b>\n\n
Indicates the action has UI specified.\n\n
<b>FP_ICONRES</b>\n\n
Indicates icon via resource ID.\n\n
<b>FP_ICONFILE</b>\n\n
Indicates icon via bmp file + index.\n\n
<b>FP_HAS_SHORTCUT</b>\n\n
Indicates has default keyboard shortcut.\n\n
<b>FP_HAS_KEYARGS</b>\n\n
Indicates function has some optional keyword args defined.\n\n
<b>FP_VAR_ARGS</b>\n\n
Indicates a variable number of args, pass args directly in a FPParams
instance.\n\n
<b>FP_NO_REDRAW</b>\n\n
Do not flag need for viewport redraw when function is invoked, MAXScript
defaults to flag redraw.\n\n
<b>ParamType2 result_type;</b>\n\n
The type of value returned by the function.\n\n
<b>EnumID enumID;</b>\n\n
The ID of symbolic enumeration in owning interface if any.\n\n
<b>FPActionDef* action_def;</b>\n\n
The extra metadata if function in an Action interface.\n\n
<b>Tab\<FPParamDef*\> params;</b>\n\n
The descriptors for parameters to this function. */
class FPFunctionDef: public MaxHeapOperators
{
public:
DWORD cbStruct; // size of the struct
FunctionID ID; // interface-local ID, used to identify fn in calls
MSTR internal_name; // fixed, internal name
StringResID description; // description string resource
USHORT flags; // flag bits
ParamType2 result_type; // type of value returned by fn
EnumID enumID; // ID of symbolic enumeration in owning interface if any
FPActionDef* action_def; // extra metadata if function in an Action interface
Tab<FPParamDef*> params; // descriptors for parameters to this fn
SHORT keyparam_count; // count of keyword-parameters (with f_keyArgDefault's)
/*! \remarks Constructor. The data members are initialized as
follows:\n\n
<b>flags = 0; description = 0; action_def = NULL; enumID = FP_NO_ENUM;</b>
*/
FPFunctionDef() {cbStruct = sizeof(FPFunctionDef); flags = 0; description = 0; action_def = NULL; enumID = FP_NO_ENUM; keyparam_count = 0; }
CoreExport ~FPFunctionDef();
};
/*! \sa Class FPParamOptions, <a href="ms-its:listsandfunctions.chm::/idx_R_list_of_parameter_types.html">List of Param Type Choices</a>\n\n
\par Description:
This class is available in release 4.0 and later only.\n\n
The 'properties' section follows the function definitions. Each propery has a
single entry defining the function IDs for the getter and setter functions, a
fixed internal property name, a descriptor string resource ID and the property
type. If the property is read-only and there is no setter function, specify
<b>FP_NO_FUNCTION</b> for the setter ID.
\par Data Members:
<b>FunctionID getter_ID;</b>\n\n
The interface-local ID for getter method.\n\n
<b>FunctionID setter_ID;</b>\n\n
The interface-local ID for setter method.\n\n
<b>TSTR internal_name;</b>\n\n
The fixed, internal name.\n\n
<b>StringResID description;</b>\n\n
The description string resource ID.\n\n
<b>USHORT flags;</b>\n\n
The flag bits.\n\n
<b>ParamType2 prop_type;</b>\n\n
The property type.\n\n
<b>EnumID enumID;</b>\n\n
The ID of symbolic enumeration in owning interface if any.\n\n
<b>FPParamOptions* options;</b>\n\n
Present if non-NULL, used for setter param. */
class FPPropDef: public MaxHeapOperators
{
public:
DWORD cbStruct; // size of the struct
FunctionID getter_ID; // interface-local ID for getter method
FunctionID setter_ID; // interface-local ID for setter method
MSTR internal_name; // fixed, internal name
StringResID description; // description string resource
USHORT flags; // flag bits
ParamType2 prop_type; // property type
EnumID enumID; // ID of symbolic enumeration in owning interface if any
FPParamDef* setter_param; // present if non-NULL, used for setter param options
/*! \remarks Constructor. The data members are initialized as follows:\n\n
<b>flags = 0; description = 0; getter_ID = setter_ID =
FPS_NO_SUCH_FUNCTION; enumID = FP_NO_ENUM; options = NULL;</b> */
FPPropDef() { cbStruct = sizeof(FPPropDef); flags = 0; description = 0; getter_ID = setter_ID = FPS_NO_SUCH_FUNCTION; enumID = FP_NO_ENUM; setter_param = NULL; }
CoreExport ~FPPropDef();
};
// function def flag bits
#define FP_NO_REDRAW 0x0001 // do not flag need for viewport redraw when function is invoked, MAXScript defaults to flag redraw
#define FP_VAR_ARGS 0x0002 // variable number of args, pass args directly in a FPParams instance
#define FP_CLIENT_OWNS_RESULT 0x0004 // client owns lifetime of pointer-based results, should delete when finished using
// internal function bits
#define FP_ACTION 0x0100 // indicates an action function
#define FP_HAS_UI 0x0200 // action has UI specifiec
#define FP_ICONRES 0x0400 // icon via res ID
#define FP_ICONFILE 0x0800 // icon via bmp file + index
#define FP_HAS_SHORTCUT 0x1000 // has default KB shortct
#define FP_HAS_KEYARGS 0x2000 // fn has some optional keyword args defined
// FPActionDef, contains extra descriptor info for function if fn is in an Action interface
/*! \sa Class FPInterface, Class FPInterfaceDesc, Class FPActionDef, Class FPParamDef, Template Class Tab, Class MaxIcon, <a href="ms-its:3dsmaxsdk.chm::/function_root.html">Function Publishing System</a>,
<a href="ms-its:listsandfunctions.chm::/idx_R_list_of_controltype2_choices.html">List of ControlType2 Choices</a>,
<a href="ms-its:listsandfunctions.chm::/idx_R_list_of_parameter_types.html">List of ParamType2 Choices</a>.\n\n
\par Description:
This class is available in release 4.0 and later only.\n\n
FPActionDef, contains extra descriptor info for Action interface functions.
\par Data Members:
<b>TSTR internal_cat;</b>\n\n
The fixed, internal category name.\n\n
<b>StringResID category;</b>\n\n
The localizable category string resource ID.\n\n
<b>FunctionID isEnabled_id;</b>\n\n
The interface function IDs for the isEnabled predicate for this action.\n\n
<b>FunctionID isChecked_id;</b>\n\n
The interface function IDs for the isChecked predicate for this action.\n\n
<b>FunctionID isVisible_id;</b>\n\n
The interface function IDs for the isVisible predicate for this action.\n\n
<b>ResID icon_resID;</b>\n\n
The icon as resource ID.\n\n
<b>TSTR icon_file;</b>\n\n
The icon as UI .bmp filename, index pair, as per CUI icon specifications.\n\n
<b>short icon_index;</b>\n\n
The index of the icon associated with the action.\n\n
<b>MaxIcon* icon;</b>\n\n
The MaxIcon class data associated with this action.\n\n
<b>StringResID button_text;</b>\n\n
The button text string resource ID, defaults to function description.\n\n
<b>StringResID tool_tip;</b>\n\n
The tooltip string resource ID, defaults to function description.\n\n
<b>StringResID menu_text;</b>\n\n
The menu item text string resource ID, defaults to buttonText or function
description.\n\n
<b>ControlType2 ctrl_type;</b>\n\n
The type of UI control, if f_ui specified.\n\n
<b>ResID ctrl_pbID;</b>\n\n
The control's host parammap pblock ID.\n\n
<b>MapID ctrl_mapID;</b>\n\n
The control's host parammap map ID within the block.\n\n
<b>int ctrl_id;</b>\n\n
The control dialog item ID.\n\n
<b>COLORREF ctrl_hiCol;</b>\n\n
The highlight color if check button.\n\n
<b>ACCEL shortcut;</b>\n\n
The default keyboard shortcut. */
class FPActionDef: public MaxHeapOperators
{
public:
DWORD cbStruct; // size of the struct
MSTR internal_cat; // fixed, internal category name
StringResID category; // localizable category resID
FunctionID isEnabled_id; // interface function IDs for the isEnabled predicate for this action
FunctionID isChecked_id; // " " for isChecked predicate
FunctionID isVisible_id; // " " for isVisible predicate
ResID icon_resID; // icon as resource ID
MSTR icon_file; // icon as UI .bmp filename, index pair, as per CUI icon specifications...
short icon_index;
MaxIcon* icon;
StringResID button_text; // button text string resID, defaults to function description
StringResID tool_tip; // tooltip string resID, defaults to function description
StringResID menu_text; // menu item text string resID, defaults to buttonText or function description
ControlType2 ctrl_type; // type of UI control, if f_ui specified
ResID ctrl_pbID; // control's host parammap pblock ID
MapID ctrl_mapID; // control's host parammap map ID within the block
int ctrl_id; // control dialog item ID
COLORREF ctrl_hiCol; // highlight colorif check button
ACCEL shortcut; // default keyboard shortcut
FPMacroEmitter* macro_emitter; // if non-NULL, callback object to emit macros to macroRecorder
/*! \remarks Constructor.\n\n
This will initialize the members to their empty default values. */
CoreExport FPActionDef();
/*! \remarks Destructor. */
CoreExport ~FPActionDef();
};
// fn def option tags for Action functions & parameters
enum {
// Action options
f_category = -(1<<30), // category name, as internal MCHAR* and localizable string resID, defaults to interface name
f_predicates, // supply 3 functionIDs for isEnabled, isChecked, isVisible predicates
f_isEnabled, // isEnabled predicate functionID
f_isChecked, // isChecked predicate functionID
f_isVisible, // isVisible predicate functionID
f_iconRes, // icon as resource ID
f_icon, // icon as UI .bmp filename, index pair, as per CUI icon specifications
f_buttonText, // button text string resID, defaults to function description
f_toolTip, // tooltip string resID, defaults to function description
f_menuText, // menu item text string resID, defaults to buttonText or function description
f_ui, // UI spec if paramMap2-implemented UI (pmap blockID, mapID, control type, button or checkbutton resID, hilight col if chkbtn)
f_shortCut, // default keyboard short cut, as pair: virt ACCEL flags word, keycode (first two items in Win32 ACCEL struct)
f_macroEmitter, // provide callback object to handle macro emmission
// param options
f_range, // valid range, two type-specific vals
f_validator, // validator object, FPValidator*
f_inOut, // in, out flags FPP_IN_PARM, FPP_OUT_PARAM or both, defaults to both
f_keyArgDefault, // marks this as an optional keyArg param and gives default value which must me of type to match param type
f_index, // no args, of present indicates values used as indexes, client can map own origin to always 0-origin internally
};
// FPParamDef, contains descriptor for each published function
// live in Tab<> in FPInterface
// per-param flags
#define FPP_HAS_RANGE 0x0001
#define FPP_HAS_VALIDATOR 0x0002
#define FPP_IN_PARAM 0x0004 // in-out flags used by _BR ref types to decide when to pass in source values or hand back returns
#define FPP_OUT_PARAM 0x0008 // " "
#define FPP_IN_OUT_PARAM 0x000C // " " both
#define FPP_KEYARG 0x0010 // if p_keyArgDefault supplied, client canuse keyword args if supported for this param
#define FPP_INDEX 0x0020 // parameter values used as indexes, always 0-origin internally, allows client to map to other origins
/*! \sa <a href="ms-its:listsandfunctions.chm::/idx_R_list_of_type_2_params.html">List of ParamType2 Choices</a>,
Class FPParamOptions, Template Class Tab.\n\n
\par Description:
This class is available in release 4.0 and later only.\n\n
This class contains a descriptor for each published function, found in Tab\<\>
in <b>FPInterface</b>.
\par Data Members:
<b>TSTR internal_name;</b>\n\n
The internal name.\n\n
<b>StringResID description;</b>\n\n
The string resource ID of the description.\n\n
<b>ParamType2 type;</b>\n\n
The parameter type. See the <a href="ms-its:listsandfunctions.chm::/idx_R_list_of_parameter_types.html">List
of ParamType2 Choices</a> for details.\n\n
<b>EnumID enumID;</b>\n\n
ID of symbolic enumeration in owning interface if any.\n\n
<b>USHORT flags;</b>\n\n
The parameter definition flags;\n\n
<b>FPP_HAS_RANGE</b>\n\n
Indicates that the parameter definition contains a range.\n\n
<b>FPP_HAS_VALIDATOR</b>\n\n
Indicates that the parameter has a validator.\n\n
<b>FPP_IN_PARAM</b>\n\n
In flag used by _BR ref types to decide when to pass in source values or hand
back returns.\n\n
<b>FPP_OUT_PARAM</b>\n\n
Out flag used by _BR ref types to decide when to pass in source values or hand
back returns.\n\n
<b>FPP_IN_OUT_PARAM</b>\n\n
In-Out flag used by _BR ref types to decide when to pass in source values or
hand back returns.\n\n
<b>FPP_KEYARG</b>\n\n
If p_keyArgDefault supplied, the client can use keyword args if supported for
this param.\n\n
<b>FPP_INDEX</b>\n\n
Parameter values used as indexes, always 0-origin internally, allows client to
map to other origins.\n\n
<b>FPParamOptions* options;</b>\n\n
Present if non-NULL, a pointer to the parameter options object. */
class FPParamDef: public MaxHeapOperators
{
public:
DWORD cbStruct; // size of the struct
MSTR internal_name;
StringResID description;
ParamType2 type;
EnumID enumID; // ID of symbolic enumeration in owning interface if any
USHORT flags;
FPParamOptions* options; // present if non-NULL
/*! \remarks Constructor.
\par Default Implementation:
<b>{ description = 0; options = NULL; flags = FPP_IN_OUT_PARAM; enumID =
FP_NO_ENUM; }</b> */
FPParamDef() : cbStruct(sizeof(FPParamDef)), description(0), options(NULL), enumID(FP_NO_ENUM), flags(FPP_IN_OUT_PARAM) { }
CoreExport ~FPParamDef() ;
};
// FPParams, contains a Tab<> of FPValue's being the actual parameters for an FP Fn call
// at present, FP Fn arguments are positional. We could expand this to allow
// optional, order-independent keyword params
/*! \sa Class FPValue\n\n
\par Description:
This class is available in release 4.0 and later only.\n\n
This parameters class contains a <b>Tab\<\></b> of <b>FPValue's</b>, being the
actual parameters for an FP Function call.
\par Data Members:
<b>Tab\<FPValue\> params;</b>\n\n
The table of FPValue's contained in this class. */
class FPParams: public MaxHeapOperators
{
public:
Tab<FPValue> params;
/*! \remarks Constructor.
\par Default Implementation:
<b>{ }</b> */
FPParams() { }
/*! \remarks Constructor.
\par Parameters:
<b>int count</b>\n\n
The number of parameter values to add.\n\n
<b>...</b>\n\n
This method takes a variable number of arguments representing the parameter
values that will be stored in the <b>params</b> table. */
CoreExport FPParams(int count, ...);
/*! \remarks Destructor. */
CoreExport ~FPParams();
/*! \remarks This method loads a number of parameter values.
\par Parameters:
<b>int count</b>\n\n
The number of parameter values to add.\n\n
<b>...</b>\n\n
This method takes a variable number of arguments representing the parameter
values that will be stored in the <b>params</b> table. */
CoreExport void Load(int count, ...);
};
// symbolic enums for an interface,
// used by metadata clients to support symbolic value for TYPE_ENUM types (ints)
/*! \sa Class FPInterface, <a href="ms-its:3dsmaxsdk.chm::/function_root.html">Function Publishing System</a>\n\n
\par Description:
This class is available in release 4.0 and later only.\n\n
This class contains an ID for the enumeration and a table of structures which
contains a name and an integer code for each item. This is used by metadata
clients to support symbolic values for <b>TYPE_ENUM</b> types (ints).\n\n
One or more symbolic enums, similar to C++ enums, can now be added to an
FPInterface's metadata, and individual int parameters and/or results for
functions in that interface can be defined as <b>TYPE_ENUM</b> and associated
with one of the enum lists. Working in a similar manner as MAXScript, this
allows metadata clients to support symbolic encodings for these parameters and
results.\n\n
Enums are defined in the FPInterface descriptor following the function and
property definitions as sets of string/code pairs. Each enum list is identified
by a unique integer, similar to function IDs, which is used to associated a
<b>TYPE_ENUM</b> parameter or result with its enum. IDs for these would
normally be defined somewhere near the function IDs for an interface. For
example:\n\n
<b>// function IDs</b>\n\n
<b>enum { bmm_getWidth, bmm_getHeight, bmm_getType, bmm_copyImage,
...};</b>\n\n
<b>// enum IDs</b>\n\n
<b>enum { bmm_type, bmm_copy_quality, ...};</b>\n\n
might be some of the IDs for a possible bitmap manager interface. The two enums
provide symbolic codes for the bitmap type and copyImage quality defines in the
"bitmap.h" SDK header, such as <b>BMM_PALETTED, BMM_TRUE_32,
COPY_IMAGE_RESIZE_LO_QUALITY</b>, etc. In the descriptor for the interface, any
enum lists follow the function and property definitions. They are introduced by
the special tag, 'enums', as in the following example:\n\n
<b>static FPInterfaceDesc bmmfpi (</b>\n\n
<b>BMM_INTERFACE, _T("bmm"), IDS_BMMI, NULL, FP_CORE,</b>\n\n
<b>...</b>\n\n
<b>bmm_copyImage, _T("copyImage"), ...</b>\n\n
<b>_T("copyType"), IDS_COPYTYPE, TYPE_ENUM, bmm_copy_quality,</b>\n\n
<b>...</b>\n\n
<b>properties,</b>\n\n
<b>geo_getType, geo_setType, _T("type"), 0, TYPE_ENUM, bmm_type,</b>\n\n
<b>enums,</b>\n\n
<b>bmm_type, 7,</b>\n\n
<b>"lineArt", BMM_LINE_ART,</b>\n\n
<b>"paletted", BMM_PALETTED,</b>\n\n
<b>"gray8", BMM_GRAY_8,</b>\n\n
<b>"gray16", BMM_GRAY_16 ,</b>\n\n
<b>"true16", BMM_TRUE_16,</b>\n\n
<b>"true32", BMM_TRUE_32,</b>\n\n
<b>"true24", BMM_TRUE_64,</b>\n\n
<b>bmm_copy_quality, 4,</b>\n\n
<b>"crop", COPY_IMAGE_CROP,</b>\n\n
<b>"resizeLo", COPY_IMAGE_RESIZE_LO_QUALITY,</b>\n\n
<b>"resizeHi", COPY_IMAGE_RESIZE_HI_QUALITY,</b>\n\n
<b>"useCustom", COPY_IMAGE_USE_CUSTOM,</b>\n\n
<b>end</b>\n\n
<b>);</b>\n\n
In the above example, the enums are listed following the function \& property
definitions. They are introduced by the 'enums' tag and consist of an enum ID
followed by a count of items, followed by that many string and code pairs. By
attaching them to the interface like this, any number of functions and
properties in the interface can use them.\n\n
The above example also has function and property definitions showing the use of
<b>TYPE_ENUM</b>. The <b>copyImage</b> function takes a <b>copyType</b>
parameter which uses the <b>bmm_copy_quality enum</b> and the type property
uses the <b>bmm_type enum</b>. In all situations where TYPE_xxx types can be
supplied in a descriptor, including the new property definitions,
<b>TYPE_ENUM</b> can be used to indicate an int by-value type.
<b>TYPE_ENUM's</b> must always be followed by an enum ID. This is the only case
in which the type is specified as a pair of values. <b>TYPE_ENUM</b> parameters
and results show up in MAXScript as # names. For example, if a bmm interface
was in the variable 'bm1' and the bitmap type was <b>BMM_GRAY_16</b>,\n\n
<b>bm1.type</b>\n\n
<b>-\> #gray16</b>\n\n
<b>bm1.type = #true32 -- set it to #true24 (code is BMM_TRUE_24)</b>\n\n
<b>bm2 = bm1.copyImage #resizeHi</b>\n\n
the integer <b>TYPE_ENUM</b> codes are translated back-and-forth to symbolic #
names by MAXScript using the definitions in the FPInterface descriptor's enums.
If you need to access the enum metadata in an <b>FPInterfaceDesc</b>, it is
available in the 'enumerations' data member. This is a <b>Tab\<\></b> of
pointers to <b>FPEnum</b> class instances which themselves contain a Tab\<\> of
name, code pairs. See class <b>FPEnum</b> in <b>/MAXSDK/INCLUDE/FnPub.h</b> for
details.\n\n
\par Data Members:
<b>EnumID ID;</b>\n\n
ID for this enumeration\n\n
<b>typedef struct {</b>\n\n
<b>TCHAR*name;</b>\n\n
This is the symbolic name for the enum.\n\n
<b>int code;</b>\n\n
This is the equivalent integer code.\n\n
<b>} enum_code;</b>\n\n
<b>Tab\<enum_code\> enumeration;</b>\n\n
The table of enumeration codes. */
class FPEnum: public MaxHeapOperators
{
public:
EnumID ID; // ID for this enumeration
struct enum_code: public MaxHeapOperators {
MCHAR* name; // enum symbolic name
int code; // equivalent int code
};
Tab<enum_code> enumeration;
};
// FPValue, a variant structure containing a single value, passable as a FP Fn parameter or result
class PBBitmap;
class Texmap;
class Value;
/*! \sa <a href="ms-its:listsandfunctions.chm::/idx_R_list_of_type_2_params.html">List of ParamType2 Choices</a>,
Template Class Tab.\n\n
\par Description:
This class is available in release 4.0 and later only.\n\n
This class contains a single value used as part of the Function Publishing
system. It's capable of holding any of the FnPub supported types. This value is
used as a parameter and as a return value.
\par Data Members:
<b>ParamType2 type;</b>\n\n
This data member identifies which type of value is stored in the union
below.\n\n
The following union contains a single value, pointer to a single value, or a
pointer to a single table (Tab\<\>) of values.\n\n
\code
union
{
int i;
float f;
int* iptr;
float* fptr;
Point3* p;
TimeValue t;
TCHAR* s;
TSTR* tstr;
PBBitmap* bm;
Mtl* mtl;
Texmap* tex;
INode* n;
ReferenceTarget* r;
Matrix3* m;
AngAxis* aa;
Quat* q;
Ray* ray;
Point2* p2;
BitArray* bits;
ClassDesc* cd;
Mesh* msh;
Object* obj;
Control* ctrl;
Interval* intvl;
POINT* pt;
HWND hwnd;
IObject* iobj;
FPInterface* fpi;
void* ptr;
Color* clr;
FPValue* fpv;
Value* v;
// Tab<>s of above
Tab<int>* i_tab;
Tab<float>* f_tab;
Tab<Point3*>* p_tab;
Tab<TimeValue>* t_tab;
Tab<TCHAR*>* s_tab;
Tab<TSTR*>* tstr_tab;
Tab<PBBitmap*>* bm_tab;
Tab<Mtl*>* mtl_tab;
Tab<Texmap*>* tex_tab;
Tab<INode*>* n_tab;
Tab<ReferenceTarget*>* r_tab;
Tab<Matrix3*>* m3_tab;
Tab<AngAxis*>* aa_tab;
Tab<Quat*>* q_tab;
Tab<Ray*>* ray_tab;
Tab<Point2*>* p2_tab;
Tab<BitArray*>* bits_tab;
Tab<ClassDesc*>* cd_tab;
Tab<Mesh*>* msh_tab;
Tab<Object*>* obj_tab;
Tab<Control*>* ctrl_tab;
Tab<Interval*>* intvl_tab;
Tab<POINT*>* pt_tab;
Tab<HWND>* hwnd_tab;
Tab<IObject*>* iobj_tab;
Tab<FPInterface*>* fpi_tab;
Tab<void*>* ptr_tab;
Tab<Color*>* clr_tab;
Tab<FPValue*>* fpv_tab;
Tab<Value*>* v_tab;
};
\endcode */
class FPValue: public MaxHeapOperators
{
public:
ParamType2 type;
union
{
int i;
float f;
DWORD d;
bool b;
INT_PTR intptr;
// SR NOTE64: Bumps union to 64 bits in Win32, this assumes that FPValue are
// temporaries so this should not cause too much memory bloat.
INT64 i64;
double dbl;
int* iptr;
float* fptr;
Point3* p;
Point4* p4;
TimeValue t;
MCHAR* s;
MSTR* tstr;
PBBitmap* bm;
Mtl* mtl;
Texmap* tex;
INode* n;
ReferenceTarget* r;
Matrix3* m;
AngAxis* aa;
Quat* q;
Ray* ray;
Point2* p2;
BitArray* bits;
ClassDesc* cd;
Mesh* msh;
Object* obj;
Control* ctrl;
Interval* intvl;
POINT* pt;
HWND hwnd;
IObject* iobj;
FPInterface* fpi;
void* ptr;
Color* clr;
AColor* aclr;
FPValue* fpv;
Value* v;
DWORD* dptr;
bool* bptr;
INT_PTR* intptrptr;
INT64* i64ptr;
double* dblptr;
// Tab<>s of above
Tab<int>* i_tab;
Tab<float>* f_tab;
Tab<Point3*>* p_tab;
Tab<Point4*>* p4_tab;
Tab<TimeValue>* t_tab;
Tab<MCHAR*>* s_tab;
Tab<MSTR*>* tstr_tab;
Tab<PBBitmap*>* bm_tab;
Tab<Mtl*>* mtl_tab;
Tab<Texmap*>* tex_tab;
Tab<INode*>* n_tab;
Tab<ReferenceTarget*>* r_tab;
Tab<Matrix3*>* m3_tab;
Tab<AngAxis*>* aa_tab;
Tab<Quat*>* q_tab;
Tab<Ray*>* ray_tab;
Tab<Point2*>* p2_tab;
Tab<BitArray*>* bits_tab;
Tab<ClassDesc*>* cd_tab;
Tab<Mesh*>* msh_tab;
Tab<Object*>* obj_tab;
Tab<Control*>* ctrl_tab;
Tab<Interval*>* intvl_tab;
Tab<POINT*>* pt_tab;
Tab<HWND>* hwnd_tab;
Tab<IObject*>* iobj_tab;
Tab<FPInterface*>* fpi_tab;
Tab<void*>* ptr_tab;
Tab<Color*>* clr_tab;
Tab<AColor*>* aclr_tab;
Tab<FPValue*>* fpv_tab;
Tab<Value*>* v_tab;
Tab<DWORD>* d_tab;
Tab<bool>* b_tab;
Tab<INT_PTR>* intptr_tab;
Tab<INT64>* i64_tab;
Tab<double>* dbl_tab;
};
/*! \remarks Constructor
\par Default Implementation:
<b>{ Init(); }</b> */
FPValue() { Init(); }
/*! \remarks Copy Constructor.
\par Parameters:
<b>FPValue\& from</b>\n\n
A reference to a FPValue to copy from.
\par Default Implementation:
<b>{ Init(); *this = from; }</b> */
FPValue(const FPValue& from) { Init(); *this = from; }
/*! \remarks Constructor
\par Default Implementation:
<b>{va_list ap; va_start(ap, type); ap = Loadva(type, ap);
va_end(ap);}</b> */
FPValue(int type, ...) { va_list ap; va_start(ap, type); ap = Loadva(type, ap); va_end(ap); }
/*! \remarks Destructor.
\par Default Implementation:
<b>{ Free(); }</b> */
CoreExport ~FPValue() { Free(); }
/*! \remarks This method will free up all memory used by the class.\n\n
*/
CoreExport void Free();
/*! \remarks This method will Initialize FPValue class.
\par Default Implementation:
<b>{ type = (ParamType2)TYPE_INT; s = NULL; }</b> */
CoreExport void Init();
//! \brief Allocates and initializes the Tab in the FPValue for TAB types.
/*! \param [in] type - The ParamType2 type to set the FPValue to.
\param [in] size - The size of the tab
*/
CoreExport void InitTab(ParamType2 type, int size);
/*! \remarks Assignment operator. */
CoreExport FPValue& operator=(const FPValue& sv);
CoreExport va_list Loadva(int type, va_list ap, bool ptr=false);
/*! \remarks This method will load the FPValue class with the provided
data.
\par Parameters:
<b>int type</b>\n\n
The FPValue parameter type to load.\n\n
<b>...</b>\n\n
This method takes a variable number of arguments.
\par Default Implementation:
<b>{va_list ap; va_start(ap, type); ap = Loadva(type, ap); va_end(ap);}</b>
*/
inline void Load(int type, ...) { va_list ap; va_start(ap, type); ap = Loadva(type, ap); va_end(ap); }
/*! \remarks This method will load the FPValue class with the provided
data.
\par Parameters:
<b>int type</b>\n\n
The FPValue parameter type to load.\n\n
<b>...</b>\n\n
This method takes a variable number of arguments.
\return <b>{ va_list ap; va_start(ap, type);</b>\n\n
<b>ap = Loadva(type, ap, true); va_end(ap); }</b>\n\n
*/
inline void LoadPtr(int type, ...) { va_list ap; va_start(ap, type); ap = Loadva(type, ap, true); va_end(ap); }
//! \brief Saves the FPValue.
/*! Note that raw pointers are not saved. FPValues that contain a raw pointer (TYPE_IOBJECT, TYPE_INTERFACE,
TYPE_VOID, TYPE_HWND) will store a pointer value of NULL.
For TYPE_VALUE values, only the following singleton values are saved and loaded: undefined, unsupplied, emptyVal, ok.
All other value types are saved as undefined.
\param [in] isave - This class provides methods to save data to disk.
\return IOResult - One of the following values:
IO_OK - The result was acceptable - no errors.
IO_ERROR - This is returned if an error occurred.
*/
/*! \remarks Saves the FPValue. Note that raw pointers are not saved.
FPValues that contain a raw pointer (TYPE_IOBJECT, TYPE_INTERFACE,
TYPE_VOID, TYPE_HWND) will store a pointer value of NULL. For TYPE_VALUE
values, only the following singleton values are saved and loaded:
undefined, unsupplied, emptyVal, ok. All other value types are saved as
undefined.
\par Parameters:
<b>isave</b>\n\n
This class provides methods to save data to disk. \see ISave
\return IOResult - One of the following values:\n\n
IO_OK - The result was acceptable - no errors.\n\n
IO_ERROR - This is returned if an error occurred.\n\n
*/
CoreExport IOResult Save(ISave *isave);
//! \brief Loads the FPValue.
/*! \param [in] iload - This class provides methods to load data from disk.
\return IOResult - One of the following values:
IO_OK - The result was acceptable - no errors.
IO_ERROR - This is returned if an error occurred.
*/
CoreExport IOResult Load(ILoad *iload);
//! \brief Returns true if the data associated with the type is represented by a pointer. If the type is a TAB type, whether the data in the Tab is represented by a pointer.
/*! \param [in] type - The ParamType2 type to test.
\return bool - True if the FPValue's data, or the Tab's data if a TAB type, is a pointer
*/
CoreExport static bool IsPointerBasedType(ParamType2 type);
};
// optional param-specific descriptor info
/*! \sa Class FPValue, <a href="ms-its:listsandfunctions.chm::/idx_R_list_of_type_2_params.html">List of ParamType2 Choices</a>,
Template Class Tab.\n\n
\par Description:
This class is available in release 4.0 and later only.\n\n
This class contains the optional parameters holding specific descriptor
information.
\par Data Members:
<b>FPValue range_low;</b>\n\n
The low range if specified.\n\n
<b>FPValue range_high;</b>\n\n
The high range if specified.\n\n
<b>FPValidator* validator;</b>\n\n
The validator if specified.\n\n
<b>FPValue keyarg_default;</b>\n\n
The default if value is optional keyword arg\n\n
<b>BYTE pos_param_count;</b>\n\n
The count of positional params in event of keyword arg presence */
class FPParamOptions: public MaxHeapOperators
{
public:
DWORD cbStruct; // size of the struct
FPValue range_low; // range values if specified
FPValue range_high;
FPValidator* validator; // validator if specified
FPValue keyarg_default; // default if value is optional keyword arg
/*! \remarks Constructor. */
FPParamOptions() : cbStruct(sizeof(FPParamOptions)), validator(NULL) { }
};
// virtual base class for parameter validation objects
/*! \sa Class InterfaceServer, Class FPInterfaceDesc, Class FPValue, Class Interface_ID, <a href="ms-its:3dsmaxsdk.chm::/function_root.html">Function Publishing System</a>.\n\n
\par Description:
This class is available in release 4.0 and later only.\n\n
An interface descriptor may contain validation information for individual
parameters, so that clients (such as MAXScript) can validate values given as
parameters to FPInterface calls, prior to making the call. The validation
information can be in the form of a range of values for int and float types, or
more generally, a validator object that is called to the validate a parameter
value.\n\n
The validation info is specified in the FPInterface descriptor in optional
tagged entries following the parameters to be validated. The two possible tags
are <b>f_range</b> and <b>f_validator</b>. An instance of this class is used
when <b>f_validator</b> is specified.\n\n
Here's an example from a possible mixin interface to Cylinder:\n\n
<b>static FPInterfaceDesc cylfpi (</b>\n\n
<b>CYL_INTERFACE, _T("cylMixin"), 0, \&cylinderDesc, FP_MIXIN,</b>\n\n
<b>...</b>\n\n
<b>cyl_setRadius, _T("setRadius"), 0, TYPE_VOID, 0, 1,</b>\n\n
<b>_T("radius"), 0, TYPE_FLOAT,</b>\n\n
<b>f_range, 0.0, 10000.0,</b>\n\n
<b>cyl_setDirection, _T("setDirection"), 0, TYPE_VOID, 0, 1,</b>\n\n
<b>_T("vector"), 0, TYPE_POINT3,</b>\n\n
<b>f_validator, \&cylValidator,</b>\n\n
<b>...</b>\n\n
<b>end</b>\n\n
<b>);</b>\n\n
The "vector" parameter in the above example has a validator object specified.
This must be a pointer to an instance of a class derived from the new class,
<b>FPValidator</b>, defined in <b>I/MAXSDK/INCLUDE/iFnPub.h</b>. This is a
virtual base class, containing a single method, <b>Validate()</b>, that is
called to validate a prospective value for a parameter. You would typically
subclass <b>FPValidator</b> in your code and provide an implementation of
<b>Validate()</b> to do the validation. */
class FPValidator : public InterfaceServer
{
public:
// validate val for the given param in function in interface
/*! \remarks This method is called to validate the value <b>val</b> passed
for the given parameter in the function whose ID is passed in the specified
interface passed. If there are many parameters to validate this way,
developers can choose to provide a separate subclass for each parameter or
a single subclass and switch on the parameter identification supplied.
\par Parameters:
<b>FPInterface* fpi</b>\n\n
Points to the interface the function is a part of.\n\n
<b>FunctionID fid</b>\n\n
The ID of the function within the interface above.\n\n
<b>int paramNum</b>\n\n
Identifies which parameter within the function above to validate.\n\n
<b>FPValue\& val</b>\n\n
The value to validate.\n\n
<b>MSTR\& msg</b>\n\n
Update this string with an error message if needed. The user of the
Validator can then display this string.
\return Returns true if the value was valid; false if invalid. */
virtual bool Validate(FPInterface* fpi, FunctionID fid, int paramNum, FPValue& val, MSTR& msg)=0;
};
// virtual base class for action function macroRecorder emitter objects
class FPMacroEmitter: public MaxHeapOperators
{
public:
// gen macro for a call to given action fn
virtual void EmitMacro(FPInterface* fpi, FPFunctionDef* fd)=0;
};
// IObject class, virtual base class for random classes that want to
// implement GetInterface(). Similar to IUnknown in COM.
// would be used to pass interface-based objects not
// otherwise supported by the FPValue base types.
// MAXScript handles these and will use GetInterface() to
// publish interface & methods as properties of the IObjects
/*! \sa Class BaseInterfaceServer, Class FPInterface, Class FPInterfaceDesc, <a href="ms-its:3dsmaxsdk.chm::/function_root.html">Function Publishing</a>, Class InterfaceServer,\n\n
\par Description:
This class is available in release 4.0 and later only.\n\n
This is the base class used to publish functions from those objects not derived
from Animatable. A developer inherits from this class and implements the
methods of this class to provide information about the interfaces published by
the class.\n\n
There is a corresponding <b>ParamType2</b> type code, <b>TYPE_IOBJECT</b>, that
allows instances of these classes to be passed and returned in FPInterface
methods. This provides a simple form of user-defined type, in the sense that
these instance collections are passed as interfaces rather than pointers.
MAXScript has wrapper value classes for IObjects and so this mechanism provides
a light-weight alternative to the MAXScript SDK facilities for adding new
wrapper value classes to the scripter.\n\n
MAXScript also calls the <b>AcquireInterface()</b> and
<b>ReleaseInterface()</b> methods on IObjects as it creates and collects these
wrappers, so that IObject objects can keep track of MAXScript's extant
references to them. <br> \n\n
*/
class IObject : public BaseInterfaceServer
{
public:
// inherits interface access and iteration from BaseInterfaceServer
//
// virtual BaseInterface* GetInterface(Interface_ID id);
// virtual int NumInterfaces();
// virtual BaseInterface* GetInterfaceAt(int i)
// object/class name
/*! \remarks Returns the object/class name.
\par Default Implementation:
<b>{ return _T(""); }</b> */
virtual MCHAR* GetIObjectName() { return _M(""); }
// interface enumeration...
// IObject ref management (can be implemented by dynamically-allocated IObjects for
// ref-count based lifetime control)
/*! \remarks This method is called when MAXScript makes a reference to
this object. This is part of the IObject reference management and can be
implemented by dynamically allocated IObjects for ref-count based lifetime
control.
\par Default Implementation:
<b>{ }</b> */
virtual void AcquireIObject() { }
/*! \remarks This method is called when MAXScript deletes a reference to
this object. This is part of the IObject reference management and can be
implemented by dynamically allocated IObjects for ref-count based lifetime
control.
\par Default Implementation:
<b>{ }</b> */
virtual void ReleaseIObject() { }
// virtual destructor
/*! \remarks This method is the virtual destructor for the IObject.
\par Default Implementation:
<b>{ }</b> */
virtual void DeleteIObject() { }
};
// base exception class for FP-based exceptions. FnPub functions can throw this
// instances of this class or subclasses to signal error conditions.
/*! \sa Class FPInterfaceDesc, <a href="ms-its:3dsmaxsdk.chm::/function_root.html">Function Publishing System</a>.\n\n
\par Description:
This class is available in release 4.0 and later only.\n\n
Function Publishing interface functions can now report fatal error conditions
to callers by using C++ exception-handling. This base class, MAXException, can
be thrown directly, or subclassed as needed for error grouping. The class
contains a message buffer and an optional error code. You would signal an error
using the <b>MAXException()</b> constructor and the C++ throw statement, as in
the following example:\n\n
<b>...</b>\n\n
<b>if (discrim \< 0.0) // oh-oh, not good</b>\n\n
<b>throw MAXException ("Unable to find root.", -23);</b>\n\n
<b>...</b>\n\n
This signals a fatal error with the message and code shown. If the error occurs
during a call to the function by MAXScript code, it will be trapped by
MAXScript and the error message will be displayed and the running script will
be terminated (but 3ds Max will continue running). If the error occurs during a
C++-level call, typically the outer 3ds Max error catcher will catch and report
the error and then exit 3ds Max, or clients of the interface can install their
own catch code.
\par Data Members:
<b>TSTR message;</b>\n\n
The exception message.\n\n
<b>int error_code;</b>\n\n
The exception error code. */
class MAXException: public MaxHeapOperators
{
public:
MSTR message;
int error_code;
/*! \remarks Constructor. The data members are initialized to the values
passed.
\par Parameters:
<b>TCHAR* msg</b>\n\n
The exception message.\n\n
<b>int code=0</b>\n\n
The exception error code.
\par Default Implementation:
<b>{}</b> */
MAXException(MCHAR* msg, int code=0) : message(msg), error_code(code) { }
};
// publishing DESCRIPTOR & FUNCTION_MAP macros
#define DECLARE_DESCRIPTOR(_interface) \
public: \
_interface() { } \
_interface(Interface_ID id, MCHAR* name, \
StringResID descr, ClassDesc* cd, \
USHORT flags, ...) \
{ \
va_list ap; \
va_start(ap, flags); \
load_descriptor(id, name, descr, cd, flags, ap); \
va_end(ap); \
}
#define DECLARE_DESCRIPTOR_INIT(_interface) \
public: \
_interface() { init(); } \
void init(); \
_interface(Interface_ID id, MCHAR* name, \
StringResID descr, ClassDesc* cd, \
USHORT flags, ...) \
{ \
init(); \
va_list ap; \
va_start(ap, flags); \
load_descriptor(id, name, descr, cd, flags, ap); \
va_end(ap); \
}
// NOTE: the default ctor is NOT called! If any
// initialization is required use DECLARE_DESCRIPTOR_INIT_NDC
#define DECLARE_DESCRIPTOR_NDC(_interface) \
public: \
_interface(Interface_ID id, MCHAR* name, \
StringResID descr, ClassDesc* cd, \
USHORT flags, ...) \
{ \
va_list ap; \
va_start(ap, flags); \
load_descriptor(id, name, descr, cd, flags, ap); \
va_end(ap); \
}
#define DECLARE_DESCRIPTOR_INIT_NDC(_interface) \
public: \
void init(); \
_interface(Interface_ID id, MCHAR* name, \
StringResID descr, ClassDesc* cd, \
USHORT flags, ...) \
{ \
init(); \
va_list ap; \
va_start(ap, flags); \
load_descriptor(id, name, descr, cd, flags, ap); \
va_end(ap); \
}
#define BEGIN_FUNCTION_MAP \
public: \
FPStatus _dispatch_fn(FunctionID fid, TimeValue t, \
FPValue& result, FPParams* p) \
{ \
FPStatus status = FPS_OK; \
switch (fid) \
{
#define BEGIN_FUNCTION_MAP_PARENT(Parent) \
public: \
FPStatus _dispatch_fn(FunctionID fid, TimeValue t, \
FPValue& result, FPParams* p) \
{ \
FPStatus status \
= Parent::_dispatch_fn(fid, t, result, p); \
if (status == FPS_OK) return status; \
status = FPS_OK; \
switch (fid) \
{
#define END_FUNCTION_MAP \
default: status = FPS_NO_SUCH_FUNCTION; \
} \
return status; \
}
#define NO_FUNCTION_MAP \
public: \
FPStatus _dispatch_fn(FunctionID fid, TimeValue t, \
FPValue& result, FPParams* p) \
{ \
return FPS_NO_SUCH_FUNCTION; \
}
// ----------- indivudal MAP entry macros ----------
#define FP_FIELD(_type, _v) (_type##_FIELD(_v))
// Action function
#define FN_ACTION(_fid, _fn) \
case _fid: \
status = _fn(); \
break;
// predicates
#define FN_PRED(_fid, _fn) \
case _fid: \
result.Load(TYPE_BOOL, _fn()); \
break;
#define FN_PREDS(_fid1, _fn1, _fid2, _fn2, _fid3, _fn3) \
case _fid1: \
result.Load(TYPE_BOOL, _fn1()); \
break; \
case _fid2: \
result.Load(TYPE_BOOL, _fn2()); \
break; \
case _fid3: \
result.Load(TYPE_BOOL, _fn3()); \
break;
// property FN_MAP macros
#define PROP_FNS(_getID, _getFn, _setID, _setFn, _ptype) \
case _getID: \
result.LoadPtr(_ptype, _ptype##_RSLT( \
_getFn())); \
break; \
case _setID: \
_setFn(FP_FIELD(_ptype, p->params[0])); \
break;
#define RO_PROP_FN(_getID, _getFn, _ptype) \
case _getID: \
result.LoadPtr(_ptype, _ptype##_RSLT( \
_getFn())); \
break;
#define PROP_TFNS(_getID, _getFn, _setID, _setFn, _ptype) \
case _getID: \
result.LoadPtr(_ptype, _ptype##_RSLT( \
_getFn(t))); \
break; \
case _setID: \
_setFn(FP_FIELD(_ptype, p->params[0]), t); \
break;
#define RO_PROP_TFN(_getID, _getFn, _ptype) \
case _getID: \
result.LoadPtr(_ptype, _ptype##_RSLT( \
_getFn(t))); \
break;
// property FN_MAP macros for the Static Method Interfaces used in MAXScript
#define SM_PROP_FNS(_getID, _getFn, _setID, _setFn, _ptype) \
case _getID: \
result.LoadPtr(_ptype, _ptype##_RSLT( \
_getFn(FP_FIELD(TYPE_FPVALUE_BR, p->params[0])))); \
break; \
case _setID: \
_setFn(FP_FIELD(TYPE_FPVALUE_BR, p->params[0]), FP_FIELD(_ptype, p->params[1])); \
break;
#define SM_RO_PROP_FN(_getID, _getFn, _ptype) \
case _getID: \
result.LoadPtr(_ptype, _ptype##_RSLT( \
_getFn(FP_FIELD(TYPE_FPVALUE_BR, p->params[0]))));\
break;
#define SM_PROP_TFNS(_getID, _getFn, _setID, _setFn, _ptype) \
case _getID: \
result.LoadPtr(_ptype, _ptype##_RSLT( \
_getFn(FP_FIELD(TYPE_FPVALUE_BR, p->params[0]), t)));\
break; \
case _setID: \
_setFn(FP_FIELD(TYPE_FPVALUE_BR, p->params[0]), FP_FIELD(_ptype, p->params[1]), t); \
break;
#define SM_RO_PROP_TFN(_getID, _getFn, _ptype) \
case _getID: \
result.LoadPtr(_ptype, _ptype##_RSLT( \
_getFn(FP_FIELD(TYPE_FPVALUE_BR, p->params[0]), t))); \
break;
// functions with return value, no time
#define FN_VA(_fid, _rtype, _f) \
case _fid: \
result.LoadPtr(_rtype, _rtype##_RSLT( \
_f(p))); \
break;
#define FN_0(_fid, _rtype, _f) \
case _fid: \
result.LoadPtr(_rtype, _rtype##_RSLT( \
_f())); \
break;
#define FN_1(_fid, _rtype, _f, _p1) \
case _fid: \
result.LoadPtr(_rtype, _rtype##_RSLT( \
_f(FP_FIELD(_p1, p->params[0])))); \
break;
#define FN_2(_fid, _rtype, _f, _p1, _p2) \
case _fid: \
result.LoadPtr(_rtype, _rtype##_RSLT( \
_f(FP_FIELD(_p1, p->params[0]), \
FP_FIELD(_p2, p->params[1])))); \
break;
#define FN_3(_fid, _rtype, _f, _p1, _p2, _p3) \
case _fid: \
result.LoadPtr(_rtype, _rtype##_RSLT( \
_f(FP_FIELD(_p1, p->params[0]), \
FP_FIELD(_p2, p->params[1]), \
FP_FIELD(_p3, p->params[2])))); \
break;
#define FN_4(_fid, _rtype, _f, _p1, _p2, _p3, _p4) \
case _fid: \
result.LoadPtr(_rtype, _rtype##_RSLT( \
_f(FP_FIELD(_p1, p->params[0]), \
FP_FIELD(_p2, p->params[1]), \
FP_FIELD(_p3, p->params[2]), \
FP_FIELD(_p4, p->params[3])))); \
break;
#define FN_5(_fid, _rtype, _f, _p1, _p2, _p3, _p4, _p5) \
case _fid: \
result.LoadPtr(_rtype, _rtype##_RSLT( \
_f(FP_FIELD(_p1, p->params[0]), \
FP_FIELD(_p2, p->params[1]), \
FP_FIELD(_p3, p->params[2]), \
FP_FIELD(_p4, p->params[3]), \
FP_FIELD(_p5, p->params[4])))); \
break;
#define FN_6(_fid, _rtype, _f, _p1, _p2, _p3, _p4, _p5, _p6) \
case _fid: \
result.LoadPtr(_rtype, _rtype##_RSLT( \
_f(FP_FIELD(_p1, p->params[0]), \
FP_FIELD(_p2, p->params[1]), \
FP_FIELD(_p3, p->params[2]), \
FP_FIELD(_p4, p->params[3]), \
FP_FIELD(_p5, p->params[4]), \
FP_FIELD(_p6, p->params[5])))); \
break;
#define FN_7(_fid, _rtype, _f, _p1, _p2, _p3, _p4, _p5, _p6, _p7) \
case _fid: \
result.LoadPtr(_rtype, _rtype##_RSLT( \
_f(FP_FIELD(_p1, p->params[0]), \
FP_FIELD(_p2, p->params[1]), \
FP_FIELD(_p3, p->params[2]), \
FP_FIELD(_p4, p->params[3]), \
FP_FIELD(_p5, p->params[4]), \
FP_FIELD(_p6, p->params[5]), \
FP_FIELD(_p7, p->params[6])))); \
break;
#define FN_8(_fid, _rtype, _f, _p1, _p2, _p3, _p4, _p5, _p6, _p7, _p8) \
case _fid: \
result.LoadPtr(_rtype, _rtype##_RSLT( \
_f(FP_FIELD(_p1, p->params[0]), \
FP_FIELD(_p2, p->params[1]), \
FP_FIELD(_p3, p->params[2]), \
FP_FIELD(_p4, p->params[3]), \
FP_FIELD(_p5, p->params[4]), \
FP_FIELD(_p6, p->params[5]), \
FP_FIELD(_p7, p->params[6]), \
FP_FIELD(_p8, p->params[7])))); \
break;
#define FN_9(_fid, _rtype, _f, _p1, _p2, _p3, _p4, _p5, _p6, _p7, _p8, _p9) \
case _fid: \
result.LoadPtr(_rtype, _rtype##_RSLT( \
_f(FP_FIELD(_p1, p->params[0]), \
FP_FIELD(_p2, p->params[1]), \
FP_FIELD(_p3, p->params[2]), \
FP_FIELD(_p4, p->params[3]), \
FP_FIELD(_p5, p->params[4]), \
FP_FIELD(_p6, p->params[5]), \
FP_FIELD(_p7, p->params[6]), \
FP_FIELD(_p8, p->params[7]), \
FP_FIELD(_p9, p->params[8])))); \
break;
#define FN_10(_fid, _rtype, _f, _p1, _p2, _p3, _p4, _p5, _p6, _p7, _p8, _p9, _p10) \
case _fid: \
result.LoadPtr(_rtype, _rtype##_RSLT( \
_f(FP_FIELD(_p1, p->params[0]), \
FP_FIELD(_p2, p->params[1]), \
FP_FIELD(_p3, p->params[2]), \
FP_FIELD(_p4, p->params[3]), \
FP_FIELD(_p5, p->params[4]), \
FP_FIELD(_p6, p->params[5]), \
FP_FIELD(_p7, p->params[6]), \
FP_FIELD(_p8, p->params[7]), \
FP_FIELD(_p9, p->params[8]), \
FP_FIELD(_p10, p->params[9])))); \
break;
#define FN_11(_fid, _rtype, _f, _p1, _p2, _p3, _p4, _p5, _p6, _p7, _p8, _p9, _p10,_p11) \
case _fid: \
result.LoadPtr(_rtype, _rtype##_RSLT( \
_f(FP_FIELD(_p1, p->params[0]), \
FP_FIELD(_p2, p->params[1]), \
FP_FIELD(_p3, p->params[2]), \
FP_FIELD(_p4, p->params[3]), \
FP_FIELD(_p5, p->params[4]), \
FP_FIELD(_p6, p->params[5]), \
FP_FIELD(_p7, p->params[6]), \
FP_FIELD(_p8, p->params[7]), \
FP_FIELD(_p9, p->params[8]), \
FP_FIELD(_p10, p->params[9]), \
FP_FIELD(_p11, p->params[10])))); \
break;
// void functions, no time
#define VFN_VA(_fid, _f) \
case _fid: \
_f(p); \
break;
#define VFN_0(_fid, _f) \
case _fid: \
_f(); \
break;
#define VFN_1(_fid, _f, _p1) \
case _fid: \
_f(FP_FIELD(_p1, p->params[0])); \
break;
#define VFN_2(_fid, _f, _p1, _p2) \
case _fid: \
_f(FP_FIELD(_p1, p->params[0]), \
FP_FIELD(_p2, p->params[1])); \
break;
#define VFN_3(_fid, _f, _p1, _p2, _p3) \
case _fid: \
_f(FP_FIELD(_p1, p->params[0]), \
FP_FIELD(_p2, p->params[1]), \
FP_FIELD(_p3, p->params[2])); \
break;
#define VFN_4(_fid, _f, _p1, _p2, _p3, _p4) \
case _fid: \
_f(FP_FIELD(_p1, p->params[0]), \
FP_FIELD(_p2, p->params[1]), \
FP_FIELD(_p3, p->params[2]), \
FP_FIELD(_p4, p->params[3])); \
break;
#define VFN_5(_fid, _f, _p1, _p2, _p3, _p4, _p5) \
case _fid: \
_f(FP_FIELD(_p1, p->params[0]), \
FP_FIELD(_p2, p->params[1]), \
FP_FIELD(_p3, p->params[2]), \
FP_FIELD(_p4, p->params[3]), \
FP_FIELD(_p5, p->params[4])); \
break;
#define VFN_6(_fid, _f, _p1, _p2, _p3, _p4, _p5, _p6) \
case _fid: \
_f(FP_FIELD(_p1, p->params[0]), \
FP_FIELD(_p2, p->params[1]), \
FP_FIELD(_p3, p->params[2]), \
FP_FIELD(_p4, p->params[3]), \
FP_FIELD(_p5, p->params[4]), \
FP_FIELD(_p6, p->params[5])); \
break;
#define VFN_7(_fid, _f, _p1, _p2, _p3, _p4, _p5, _p6, _p7) \
case _fid: \
_f(FP_FIELD(_p1, p->params[0]), \
FP_FIELD(_p2, p->params[1]), \
FP_FIELD(_p3, p->params[2]), \
FP_FIELD(_p4, p->params[3]), \
FP_FIELD(_p5, p->params[4]), \
FP_FIELD(_p6, p->params[5]), \
FP_FIELD(_p7, p->params[6])); \
break;
// functions with const return value, no time
#define CFN_VA(_fid, _rtype, _f) \
case _fid: \
result.LoadPtr(_rtype, _rtype##_RSLT(const_cast<_rtype##_TYPE>( \
_f(p)))); \
break;
#define CFN_0(_fid, _rtype, _f) \
case _fid: \
result.LoadPtr(_rtype, _rtype##_RSLT(const_cast<_rtype##_TYPE>( \
_f()))); \
break;
#define CFN_1(_fid, _rtype, _f, _p1) \
case _fid: \
result.LoadPtr(_rtype, _rtype##_RSLT(const_cast<_rtype##_TYPE>( \
_f(FP_FIELD(_p1, p->params[0]))))); \
break;
#define CFN_2(_fid, _rtype, _f, _p1, _p2) \
case _fid: \
result.LoadPtr(_rtype, _rtype##_RSLT(const_cast<_rtype##_TYPE>( \
_f(FP_FIELD(_p1, p->params[0]), \
FP_FIELD(_p2, p->params[1]))))); \
break;
#define CFN_3(_fid, _rtype, _f, _p1, _p2, _p3) \
case _fid: \
result.LoadPtr(_rtype, _rtype##_RSLT(const_cast<_rtype##_TYPE>( \
_f(FP_FIELD(_p1, p->params[0]), \
FP_FIELD(_p2, p->params[1]), \
FP_FIELD(_p3, p->params[2]))))); \
break;
#define CFN_4(_fid, _rtype, _f, _p1, _p2, _p3, _p4) \
case _fid: \
result.LoadPtr(_rtype, _rtype##_RSLT(const_cast<_rtype##_TYPE>( \
_f(FP_FIELD(_p1, p->params[0]), \
FP_FIELD(_p2, p->params[1]), \
FP_FIELD(_p3, p->params[2]), \
FP_FIELD(_p4, p->params[3]))))); \
break;
#define CFN_5(_fid, _rtype, _f, _p1, _p2, _p3, _p4, _p5) \
case _fid: \
result.LoadPtr(_rtype, _rtype##_RSLT(const_cast<_rtype##_TYPE>( \
_f(FP_FIELD(_p1, p->params[0]), \
FP_FIELD(_p2, p->params[1]), \
FP_FIELD(_p3, p->params[2]), \
FP_FIELD(_p4, p->params[3]), \
FP_FIELD(_p5, p->params[4]))))); \
break;
// value returning functions, with time
#define FNT_VA(_fid, _rtype, _f) \
case _fid: \
result.LoadPtr(_rtype, _rtype##_RSLT( \
_f(p, t))); \
break;
#define FNT_0(_fid, _rtype, _f) \
case _fid: \
result.LoadPtr(_rtype, _rtype##_RSLT( \
_f(t))); \
break;
#define FNT_1(_fid, _rtype, _f, _p1) \
case _fid: \
result.LoadPtr(_rtype, _rtype##_RSLT( \
_f(FP_FIELD(_p1, p->params[0]), \
t))); \
break;
#define FNT_2(_fid, _rtype, _f, _p1, _p2) \
case _fid: \
result.LoadPtr(_rtype, _rtype##_RSLT( \
_f(FP_FIELD(_p1, p->params[0]), \
FP_FIELD(_p2, p->params[1]), \
t))); \
break;
#define FNT_3(_fid, _rtype, _f, _p1, _p2, _p3) \
case _fid: \
result.LoadPtr(_rtype, _rtype##_RSLT( \
_f(FP_FIELD(_p1, p->params[0]), \
FP_FIELD(_p2, p->params[1]), \
FP_FIELD(_p3, p->params[2]), \
t))); \
break;
#define FNT_4(_fid, _rtype, _f, _p1, _p2, _p3, _p4) \
case _fid: \
result.LoadPtr(_rtype, _rtype##_RSLT( \
_f(FP_FIELD(_p1, p->params[0]), \
FP_FIELD(_p2, p->params[1]), \
FP_FIELD(_p3, p->params[2]), \
FP_FIELD(_p4, p->params[3]), \
t))); \
break;
#define FNT_5(_fid, _rtype, _f, _p1, _p2, _p3, _p4, _p5) \
case _fid: \
result.LoadPtr(_rtype, _rtype##_RSLT( \
_f(FP_FIELD(_p1, p->params[0]), \
FP_FIELD(_p2, p->params[1]), \
FP_FIELD(_p3, p->params[2]), \
FP_FIELD(_p4, p->params[3]), \
FP_FIELD(_p5, p->params[4]), \
t))); \
break;
#define FNT_6(_fid, _rtype, _f, _p1, _p2, _p3, _p4, _p5, _p6) \
case _fid: \
result.LoadPtr(_rtype, _rtype##_RSLT( \
_f(FP_FIELD(_p1, p->params[0]), \
FP_FIELD(_p2, p->params[1]), \
FP_FIELD(_p3, p->params[2]), \
FP_FIELD(_p4, p->params[3]), \
FP_FIELD(_p5, p->params[4]), \
FP_FIELD(_p6, p->params[5]), \
t))); \
break;
#define FNT_7(_fid, _rtype, _f, _p1, _p2, _p3, _p4, _p5, _p6, _p7) \
case _fid: \
result.LoadPtr(_rtype, _rtype##_RSLT( \
_f(FP_FIELD(_p1, p->params[0]), \
FP_FIELD(_p2, p->params[1]), \
FP_FIELD(_p3, p->params[2]), \
FP_FIELD(_p4, p->params[3]), \
FP_FIELD(_p5, p->params[4]), \
FP_FIELD(_p6, p->params[5]), \
FP_FIELD(_p7, p->params[6]), \
t))); \
break;
// void functions, with time
#define VFNT_VA(_fid, _f) \
case _fid: \
_f(p, t); \
break;
#define VFNT_0(_fid, _f) \
case _fid: \
_f(t); \
break;
#define VFNT_1(_fid, _f, _p1) \
case _fid: \
_f(FP_FIELD(_p1, p->params[0]), \
t); \
break;
#define VFNT_2(_fid, _f, _p1, _p2) \
case _fid: \
_f(FP_FIELD(_p1, p->params[0]), \
FP_FIELD(_p2, p->params[1]), \
t); \
break;
#define VFNT_3(_fid, _f, _p1, _p2, _p3) \
case _fid: \
_f(FP_FIELD(_p1, p->params[0]), \
FP_FIELD(_p2, p->params[1]), \
FP_FIELD(_p3, p->params[2]), \
t); \
break;
#define VFNT_4(_fid, _f, _p1, _p2, _p3, _p4) \
case _fid: \
_f(FP_FIELD(_p1, p->params[0]), \
FP_FIELD(_p2, p->params[1]), \
FP_FIELD(_p3, p->params[2]), \
FP_FIELD(_p4, p->params[3]), \
t); \
break;
#define VFNT_5(_fid, _f, _p1, _p2, _p3, _p4, _p5) \
case _fid: \
_f(FP_FIELD(_p1, p->params[0]), \
FP_FIELD(_p2, p->params[1]), \
FP_FIELD(_p3, p->params[2]), \
FP_FIELD(_p4, p->params[3]), \
FP_FIELD(_p5, p->params[4]), \
t); \
break;
#define VFNT_6(_fid, _f, _p1, _p2, _p3, _p4, _p5, _p6) \
case _fid: \
_f(FP_FIELD(_p1, p->params[0]), \
FP_FIELD(_p2, p->params[1]), \
FP_FIELD(_p3, p->params[2]), \
FP_FIELD(_p4, p->params[3]), \
FP_FIELD(_p5, p->params[4]), \
FP_FIELD(_p6, p->params[5]), \
t); \
break;
#define VFNT_7(_fid, _f, _p1, _p2, _p3, _p4, _p5, _p6, _p7) \
case _fid: \
_f(FP_FIELD(_p1, p->params[0]), \
FP_FIELD(_p2, p->params[1]), \
FP_FIELD(_p3, p->params[2]), \
FP_FIELD(_p4, p->params[3]), \
FP_FIELD(_p5, p->params[4]), \
FP_FIELD(_p6, p->params[5]), \
FP_FIELD(_p7, p->params[6]), \
t); \
break;
#define VFNT_8(_fid, _f, _p1, _p2, _p3, _p4, _p5, _p6, _p7, _p8) \
case _fid: \
_f(FP_FIELD(_p1, p->params[0]), \
FP_FIELD(_p2, p->params[1]), \
FP_FIELD(_p3, p->params[2]), \
FP_FIELD(_p4, p->params[3]), \
FP_FIELD(_p5, p->params[4]), \
FP_FIELD(_p6, p->params[5]), \
FP_FIELD(_p7, p->params[6]), \
FP_FIELD(_p8, p->params[7]), \
t); \
break;
#define VFNT_9(_fid, _f, _p1, _p2, _p3, _p4, _p5, _p6, _p7, _p8, _p9) \
case _fid: \
_f(FP_FIELD(_p1, p->params[0]), \
FP_FIELD(_p2, p->params[1]), \
FP_FIELD(_p3, p->params[2]), \
FP_FIELD(_p4, p->params[3]), \
FP_FIELD(_p5, p->params[4]), \
FP_FIELD(_p6, p->params[5]), \
FP_FIELD(_p7, p->params[6]), \
FP_FIELD(_p8, p->params[7]), \
FP_FIELD(_p9, p->params[8]), \
t); \
break;
#define VFNT_10(_fid, _f, _p1, _p2, _p3, _p4, _p5, _p6, _p7, _p8, _p9, _p10) \
case _fid: \
_f(FP_FIELD(_p1, p->params[0]), \
FP_FIELD(_p2, p->params[1]), \
FP_FIELD(_p3, p->params[2]), \
FP_FIELD(_p4, p->params[3]), \
FP_FIELD(_p5, p->params[4]), \
FP_FIELD(_p6, p->params[5]), \
FP_FIELD(_p7, p->params[6]), \
FP_FIELD(_p8, p->params[7]), \
FP_FIELD(_p9, p->params[8]), \
FP_FIELD(_p10, p->params[9]), \
t); \
break;
#define VFNT_11(_fid, _f, _p1, _p2, _p3, _p4, _p5, _p6, _p7, _p8, _p9, _p10, _p11) \
case _fid: \
_f(FP_FIELD(_p1, p->params[0]), \
FP_FIELD(_p2, p->params[1]), \
FP_FIELD(_p3, p->params[2]), \
FP_FIELD(_p4, p->params[3]), \
FP_FIELD(_p5, p->params[4]), \
FP_FIELD(_p6, p->params[5]), \
FP_FIELD(_p7, p->params[6]), \
FP_FIELD(_p8, p->params[7]), \
FP_FIELD(_p9, p->params[8]), \
FP_FIELD(_p10, p->params[9]), \
FP_FIELD(_p11, p->params[10]), \
t); \
break;
// parameter type field selectors
#define TYPE_FLOAT_FP_FIELD f
#define TYPE_INT_FP_FIELD i
#define TYPE_RGBA_FP_FIELD p
#define TYPE_POINT3_FP_FIELD p
#define TYPE_FRGBA_FP_FIELD p4
#define TYPE_POINT4_FP_FIELD p4
#define TYPE_BOOL_FP_FIELD i
#define TYPE_ANGLE_FP_FIELD f
#define TYPE_PCNT_FRAC_FP_FIELD f
#define TYPE_WORLD_FP_FIELD f
#define TYPE_STRING_FP_FIELD s
#define TYPE_FILENAME_FP_FIELD s
#define TYPE_HSV_FP_FIELD p
#define TYPE_COLOR_CHANNEL_FP_FIELD f
#define TYPE_TIMEVALUE_FP_FIELD i
#define TYPE_RADIOBTN_INDEX_FP_FIELD i
#define TYPE_MTL_FP_FIELD mtl
#define TYPE_TEXMAP_FP_FIELD tex
#define TYPE_BITMAP_FP_FIELD bm
#define TYPE_INODE_FP_FIELD n
#define TYPE_REFTARG_FP_FIELD r
#define TYPE_INDEX_FP_FIELD i
#define TYPE_MATRIX3_FP_FIELD m
#define TYPE_VOID_FP_FIELD void_paramtype_bad
#define TYPE_ENUM_FP_FIELD i
#define TYPE_INTERVAL_FP_FIELD intvl
#define TYPE_ANGAXIS_FP_FIELD aa
#define TYPE_QUAT_FP_FIELD q
#define TYPE_RAY_FP_FIELD ray
#define TYPE_POINT2_FP_FIELD p2
#define TYPE_BITARRAY_FP_FIELD bits
#define TYPE_CLASS_FP_FIELD cd
#define TYPE_MESH_FP_FIELD msh
#define TYPE_OBJECT_FP_FIELD obj
#define TYPE_CONTROL_FP_FIELD ctrl
#define TYPE_POINT_FP_FIELD pt
#define TYPE_TSTR_FP_FIELD tstr
#define TYPE_IOBJECT_FP_FIELD iobj
#define TYPE_INTERFACE_FP_FIELD fpi
#define TYPE_HWND_FP_FIELD hwnd
#define TYPE_NAME_FP_FIELD s
#define TYPE_COLOR_FP_FIELD clr
#define TYPE_ACOLOR_FP_FIELD aclr
#define TYPE_FPVALUE_FP_FIELD fpv
#define TYPE_VALUE_FP_FIELD v
#define TYPE_DWORD_FP_FIELD d
#define TYPE_bool_FP_FIELD b
#define TYPE_INTPTR_FP_FIELD intptr
#define TYPE_INT64_FP_FIELD i64
#define TYPE_DOUBLE_FP_FIELD dbl
// Tab<>s of the above...
#define TYPE_FLOAT_TAB_FP_FIELD f_tab
#define TYPE_INT_TAB_FP_FIELD i_tab
#define TYPE_RGBA_TAB_FP_FIELD p_tab
#define TYPE_POINT3_TAB_FP_FIELD p_tab
#define TYPE_FRGBA_TAB_FP_FIELD p4_tab
#define TYPE_POINT4_TAB_FP_FIELD p4_tab
#define TYPE_BOOL_TAB_FP_FIELD i_tab
#define TYPE_ANGLE_TAB_FP_FIELD f_tab
#define TYPE_PCNT_FRAC_TAB_FP_FIELD f_tab
#define TYPE_WORLD_TAB_FP_FIELD f_tab
#define TYPE_STRING_TAB_FP_FIELD s_tab
#define TYPE_FILENAME_TAB_FP_FIELD s_tab
#define TYPE_HSV_TAB_FP_FIELD p_tab
#define TYPE_COLOR_CHANNEL_TAB_FP_FIELD f_tab
#define TYPE_TIMEVALUE_TAB_FP_FIELD i_tab
#define TYPE_RADIOBTN_INDEX_TAB_FP_FIELD i_tab
#define TYPE_MTL_TAB_FP_FIELD mtl_tab
#define TYPE_TEXMAP_TAB_FP_FIELD tex_tab
#define TYPE_BITMAP_TAB_FP_FIELD bm_tab
#define TYPE_INODE_TAB_FP_FIELD n_tab
#define TYPE_REFTARG_TAB_FP_FIELD r_tab
#define TYPE_INDEX_TAB_FP_FIELD i_tab
#define TYPE_MATRIX3_TAB_FP_FIELD m3_tab
#define TYPE_ENUM_TAB_FP_FIELD i_tab
#define TYPE_INTERVAL_TAB_FP_FIELD intvl_tab
#define TYPE_ANGAXIS_TAB_FP_FIELD aa_tab
#define TYPE_QUAT_TAB_FP_FIELD q_tab
#define TYPE_RAY_TAB_FP_FIELD ray_tab
#define TYPE_POINT2_TAB_FP_FIELD p2_tab
#define TYPE_BITARRAY_TAB_FP_FIELD bits_tab
#define TYPE_CLASS_TAB_FP_FIELD cd_tab
#define TYPE_MESH_TAB_FP_FIELD msh_tab
#define TYPE_OBJECT_TAB_FP_FIELD obj_tab
#define TYPE_CONTROL_TAB_FP_FIELD ctrl_tab
#define TYPE_POINT_TAB_FP_FIELD pt_tab
#define TYPE_TSTR_TAB_FP_FIELD tstr_tab
#define TYPE_IOBJECT_TAB_FP_FIELD iobj_tab
#define TYPE_INTERFACE_TAB_FP_FIELD fpi_tab
#define TYPE_HWND_TAB_FP_FIELD hwnd_tab
#define TYPE_NAME_TAB_FP_FIELD s_tab
#define TYPE_COLOR_TAB_FP_FIELD clr_tab
#define TYPE_ACOLOR_TAB_FP_FIELD aclr_tab
#define TYPE_FPVALUE_TAB_FP_FIELD fpv_tab
#define TYPE_VALUE_TAB_FP_FIELD v_tab
#define TYPE_DWORD_TAB_FP_FIELD d_tab
#define TYPE_bool_TAB_FP_FIELD b_tab
#define TYPE_INTPTR_TAB_FP_FIELD intptr_tab
#define TYPE_INT64_TAB_FP_FIELD i64_tab
#define TYPE_DOUBLE_TAB_FP_FIELD dbl_tab
// by-pointer fields
#define TYPE_FLOAT_BP_FP_FIELD fptr
#define TYPE_INT_BP_FP_FIELD iptr
#define TYPE_BOOL_BP_FP_FIELD iptr
#define TYPE_ANGLE_BP_FP_FIELD fptr
#define TYPE_PCNT_FRAC_BP_FP_FIELD fptr
#define TYPE_WORLD_BP_FP_FIELD fptr
#define TYPE_COLOR_CHANNEL_BP_FP_FIELD fptr
#define TYPE_TIMEVALUE_BP_FP_FIELD iptr
#define TYPE_RADIOBTN_INDEX_BP_FP_FIELD iptr
#define TYPE_INDEX_BP_FP_FIELD iptr
#define TYPE_ENUM_BP_FP_FIELD iptr
#define TYPE_DWORD_BP_FP_FIELD dptr
#define TYPE_bool_BP_FP_FIELD bptr
#define TYPE_INTPTR_BP_FP_FIELD intptrptr
#define TYPE_INT64_BP_FP_FIELD i64ptr
#define TYPE_DOUBLE_BP_FP_FIELD dblptr
// by-reference fields
#define TYPE_FLOAT_BR_FP_FIELD fptr
#define TYPE_INT_BR_FP_FIELD iptr
#define TYPE_RGBA_BR_FP_FIELD p
#define TYPE_POINT3_BR_FP_FIELD p
#define TYPE_FRGBA_BR_FP_FIELD p4
#define TYPE_POINT4_BR_FP_FIELD p4
#define TYPE_BOOL_BR_FP_FIELD iptr
#define TYPE_ANGLE_BR_FP_FIELD fptr
#define TYPE_PCNT_FRAC_BR_FP_FIELD fptr
#define TYPE_WORLD_BR_FP_FIELD fptr
#define TYPE_HSV_BR_FP_FIELD p
#define TYPE_COLOR_CHANNEL_BR_FP_FIELD f
#define TYPE_TIMEVALUE_BR_FP_FIELD iptr
#define TYPE_RADIOBTN_INDEX_BR_FP_FIELD iptr
#define TYPE_BITMAP_BR_FP_FIELD bm
#define TYPE_INDEX_BR_FP_FIELD iptr
#define TYPE_ENUM_BR_FP_FIELD iptr
#define TYPE_REFTARG_BR_FP_FIELD r
#define TYPE_MATRIX3_BR_FP_FIELD m
#define TYPE_ANGAXIS_BR_FP_FIELD aa
#define TYPE_QUAT_BR_FP_FIELD q
#define TYPE_BITARRAY_BR_FP_FIELD bits
#define TYPE_RAY_BR_FP_FIELD ray
#define TYPE_POINT2_BR_FP_FIELD p2
#define TYPE_MESH_BR_FP_FIELD msh
#define TYPE_INTERVAL_BR_FP_FIELD intvl
#define TYPE_POINT_BR_FP_FIELD pt
#define TYPE_TSTR_BR_FP_FIELD tstr
#define TYPE_COLOR_BR_FP_FIELD clr
#define TYPE_ACOLOR_BR_FP_FIELD aclr
#define TYPE_FPVALUE_BR_FP_FIELD fpv
#define TYPE_DWORD_BR_FP_FIELD dptr
#define TYPE_bool_BR_FP_FIELD bptr
#define TYPE_INTPTR_BR_FP_FIELD intptrptr
#define TYPE_INT64_BR_FP_FIELD i64ptr
#define TYPE_DOUBLE_BR_FP_FIELD dblptr
// Tab<> by-reference fields
#define TYPE_FLOAT_TAB_BR_FP_FIELD f_tab
#define TYPE_INT_TAB_BR_FP_FIELD i_tab
#define TYPE_RGBA_TAB_BR_FP_FIELD p_tab
#define TYPE_POINT3_TAB_BR_FP_FIELD p_tab
#define TYPE_FRGBA_TAB_BR_FP_FIELD p4_tab
#define TYPE_POINT4_TAB_BR_FP_FIELD p4_tab
#define TYPE_BOOL_TAB_BR_FP_FIELD i_tab
#define TYPE_ANGLE_TAB_BR_FP_FIELD f_tab
#define TYPE_PCNT_FRAC_TAB_BR_FP_FIELD f_tab
#define TYPE_WORLD_TAB_BR_FP_FIELD f_tab
#define TYPE_STRING_TAB_BR_FP_FIELD s_tab
#define TYPE_FILENAME_TAB_BR_FP_FIELD s_tab
#define TYPE_HSV_TAB_BR_FP_FIELD p_tab
#define TYPE_COLOR_CHANNEL_TAB_BR_FP_FIELD f_tab
#define TYPE_TIMEVALUE_TAB_BR_FP_FIELD i_tab
#define TYPE_RADIOBTN_INDEX_TAB_BR_FP_FIELD i_tab
#define TYPE_MTL_TAB_BR_FP_FIELD mtl_tab
#define TYPE_TEXMAP_TAB_BR_FP_FIELD tex_tab
#define TYPE_BITMAP_TAB_BR_FP_FIELD bm_tab
#define TYPE_INODE_TAB_BR_FP_FIELD n_tab
#define TYPE_REFTARG_TAB_BR_FP_FIELD r_tab
#define TYPE_INDEX_TAB_BR_FP_FIELD i_tab
#define TYPE_ENUM_TAB_BR_FP_FIELD i_tab
#define TYPE_MATRIX3_TAB_BR_FP_FIELD m3_tab
#define TYPE_ANGAXIS_TAB_BR_FP_FIELD aa_tab
#define TYPE_QUAT_TAB_BR_FP_FIELD q_tab
#define TYPE_BITARRAY_TAB_BR_FP_FIELD bits_tab
#define TYPE_CLASS_TAB_BR_FP_FIELD cd_tab
#define TYPE_RAY_TAB_BR_FP_FIELD ray_tab
#define TYPE_POINT2_TAB_BR_FP_FIELD p2_tab
#define TYPE_MESH_TAB_BR_FP_FIELD msh_tab
#define TYPE_OBJECT_TAB_BR_FP_FIELD obj_tab
#define TYPE_CONTROL_TAB_BR_FP_FIELD ctrl_tab
#define TYPE_INTERVAL_TAB_BR_FP_FIELD intvl_tab
#define TYPE_POINT_TAB_BR_FP_FIELD pt_tab
#define TYPE_HWND_TAB_BR_FP_FIELD hwnd_tab
#define TYPE_TSTR_TAB_BR_FP_FIELD tstr_tab
#define TYPE_IOBJECT_TAB_BR_FP_FIELD iobj_tab
#define TYPE_INTERFACE_TAB_BR_FP_FIELD fpi_tab
#define TYPE_NAME_TAB_BR_FP_FIELD s_tab
#define TYPE_COLOR_TAB_BR_FP_FIELD clr_tab
#define TYPE_ACOLOR_TAB_BR_FP_FIELD aclr_tab
#define TYPE_FPVALUE_TAB_BR_FP_FIELD fpv_tab
#define TYPE_VALUE_TAB_BR_FP_FIELD v_tab
#define TYPE_DWORD_TAB_BR_FP_FIELD d_tab
#define TYPE_bool_TAB_BR_FP_FIELD b_tab
#define TYPE_INTPTR_TAB_BR_FP_FIELD intptr_tab
#define TYPE_INT64_TAB_BR_FP_FIELD i64_tab
#define TYPE_DOUBLE_TAB_BR_FP_FIELD dbl_tab
// by-value fields
#define TYPE_RGBA_BV_FP_FIELD p
#define TYPE_POINT3_BV_FP_FIELD p
#define TYPE_FRGBA_BV_FP_FIELD p4
#define TYPE_POINT4_BV_FP_FIELD p4
#define TYPE_HSV_BV_FP_FIELD p
#define TYPE_BITMAP_BV_FP_FIELD bm
#define TYPE_MATRIX3_BV_FP_FIELD m
#define TYPE_ANGAXIS_BV_FP_FIELD aa
#define TYPE_QUAT_BV_FP_FIELD q
#define TYPE_BITARRAY_BV_FP_FIELD bits
#define TYPE_RAY_BV_FP_FIELD ray
#define TYPE_POINT2_BV_FP_FIELD p2
#define TYPE_MESH_BV_FP_FIELD msh
#define TYPE_INTERVAL_BV_FP_FIELD intvl
#define TYPE_POINT_BV_FP_FIELD pt
#define TYPE_TSTR_BV_FP_FIELD tstr
#define TYPE_COLOR_BV_FP_FIELD clr
#define TYPE_ACOLOR_BV_FP_FIELD aclr
#define TYPE_FPVALUE_BV_FP_FIELD fpv
#define TYPE_CLASS_BV_FP_FIELD cd
// by-val Tab<> fields
#define TYPE_FLOAT_TAB_BV_FP_FIELD f_tab
#define TYPE_INT_TAB_BV_FP_FIELD i_tab
#define TYPE_RGBA_TAB_BV_FP_FIELD p_tab
#define TYPE_POINT3_TAB_BV_FP_FIELD p_tab
#define TYPE_FRGBA_TAB_BV_FP_FIELD p4_tab
#define TYPE_POINT4_TAB_BV_FP_FIELD p4_tab
#define TYPE_BOOL_TAB_BV_FP_FIELD i_tab
#define TYPE_ANGLE_TAB_BV_FP_FIELD f_tab
#define TYPE_PCNT_FRAC_TAB_BV_FP_FIELD f_tab
#define TYPE_WORLD_TAB_BV_FP_FIELD f_tab
#define TYPE_STRING_TAB_BV_FP_FIELD s_tab
#define TYPE_FILENAME_TAB_BV_FP_FIELD s_tab
#define TYPE_HSV_TAB_BV_FP_FIELD p_tab
#define TYPE_COLOR_CHANNEL_TAB_BV_FP_FIELD f_tab
#define TYPE_TIMEVALUE_TAB_BV_FP_FIELD i_tab
#define TYPE_RADIOBTN_INDEX_TAB_BV_FP_FIELD i_tab
#define TYPE_MTL_TAB_BV_FP_FIELD mtl_tab
#define TYPE_TEXMAP_TAB_BV_FP_FIELD tex_tab
#define TYPE_BITMAP_TAB_BV_FP_FIELD bm_tab
#define TYPE_INODE_TAB_BV_FP_FIELD n_tab
#define TYPE_REFTARG_TAB_BV_FP_FIELD r_tab
#define TYPE_INDEX_TAB_BV_FP_FIELD i_tab
#define TYPE_ENUM_TAB_BV_FP_FIELD i_tab
#define TYPE_MATRIX3_TAB_BV_FP_FIELD m3_tab
#define TYPE_ANGAXIS_TAB_BV_FP_FIELD aa_tab
#define TYPE_QUAT_TAB_BV_FP_FIELD q_tab
#define TYPE_BITARRAY_TAB_BV_FP_FIELD bits_tab
#define TYPE_CLASS_TAB_BV_FP_FIELD cd_tab
#define TYPE_RAY_TAB_BV_FP_FIELD ray_tab
#define TYPE_POINT2_TAB_BV_FP_FIELD p2_tab
#define TYPE_MESH_TAB_BV_FP_FIELD msh_tab
#define TYPE_OBJECT_TAB_BV_FP_FIELD obj_tab
#define TYPE_CONTROL_TAB_BV_FP_FIELD ctrl_tab
#define TYPE_INTERVAL_TAB_BV_FP_FIELD intvl_tab
#define TYPE_POINT_TAB_BV_FP_FIELD pt_tab
#define TYPE_HWND_TAB_BV_FP_FIELD hwnd_tab
#define TYPE_TSTR_TAB_BV_FP_FIELD tstr_tab
#define TYPE_IOBJECT_TAB_BV_FP_FIELD iobj_tab
#define TYPE_INTERFACE_TAB_BV_FP_FIELD fpi_tab
#define TYPE_NAME_TAB_BV_FP_FIELD s_tab
#define TYPE_COLOR_TAB_BV_FP_FIELD clr_tab
#define TYPE_ACOLOR_TAB_BV_FP_FIELD aclr_tab
#define TYPE_FPVALUE_TAB_BV_FP_FIELD fpv_tab
#define TYPE_VALUE_TAB_BV_FP_FIELD v_tab
#define TYPE_DWORD_TAB_BV_FP_FIELD d_tab
#define TYPE_bool_TAB_BV_FP_FIELD b_tab
#define TYPE_INTPTR_TAB_BV_FP_FIELD intptr_tab
#define TYPE_INT64_TAB_BV_FP_FIELD i64_tab
#define TYPE_DOUBLE_TAB_BV_FP_FIELD dbl_tab
// field access macros...
// base types, yield 'conventional' type passing conventions
// ie, ints, floats, points, colors, 3D math types are passed as values, all
// others passed as pointers
#define TYPE_FLOAT_FIELD(_v) (((_v).f))
#define TYPE_INT_FIELD(_v) (((_v).i))
#define TYPE_RGBA_FIELD(_v) (*((_v).p))
#define TYPE_POINT3_FIELD(_v) (*((_v).p))
#define TYPE_FRGBA_FIELD(_v) (*((_v).p4))
#define TYPE_POINT4_FIELD(_v) (*((_v).p4))
#define TYPE_BOOL_FIELD(_v) (((_v).i))
#define TYPE_ANGLE_FIELD(_v) (((_v).f))
#define TYPE_PCNT_FRAC_FIELD(_v) (((_v).f))
#define TYPE_WORLD_FIELD(_v) (((_v).f))
#define TYPE_STRING_FIELD(_v) (((_v).s))
#define TYPE_FILENAME_FIELD(_v) (((_v).s))
#define TYPE_HSV_FIELD(_v) (*((_v).p))
#define TYPE_COLOR_CHANNEL_FIELD(_v) (((_v).f))
#define TYPE_TIMEVALUE_FIELD(_v) (((_v).i))
#define TYPE_RADIOBTN_INDEX_FIELD(_v) (((_v).i))
#define TYPE_MTL_FIELD(_v) (((_v).mtl))
#define TYPE_TEXMAP_FIELD(_v) (((_v).tex))
#define TYPE_BITMAP_FIELD(_v) (((_v).bm))
#define TYPE_INODE_FIELD(_v) (((_v).n))
#define TYPE_REFTARG_FIELD(_v) (((_v).r))
#define TYPE_INDEX_FIELD(_v) (((_v).i))
#define TYPE_ENUM_FIELD(_v) (((_v).i))
#define TYPE_MATRIX3_FIELD(_v) (*((_v).m))
#define TYPE_ANGAXIS_FIELD(_v) (*((_v).aa))
#define TYPE_QUAT_FIELD(_v) (*((_v).q))
#define TYPE_BITARRAY_FIELD(_v) (((_v).bits))
#define TYPE_CLASS_FIELD(_v) (((_v).cd))
#define TYPE_RAY_FIELD(_v) (*((_v).ray))
#define TYPE_POINT2_FIELD(_v) (*((_v).p2))
#define TYPE_MESH_FIELD(_v) (((_v).msh))
#define TYPE_OBJECT_FIELD(_v) (((_v).obj))
#define TYPE_CONTROL_FIELD(_v) (((_v).ctrl))
#define TYPE_INTERVAL_FIELD(_v) (*((_v).intvl))
#define TYPE_POINT_FIELD(_v) (*((_v).pt))
#define TYPE_TSTR_FIELD(_v) (*((_v).tstr))
#define TYPE_IOBJECT_FIELD(_v) (((_v).iobj))
#define TYPE_INTERFACE_FIELD(_v) (((_v).fpi))
#define TYPE_HWND_FIELD(_v) (((_v).hwnd))
#define TYPE_NAME_FIELD(_v) (((_v).s))
#define TYPE_COLOR_FIELD(_v) (((_v).clr))
#define TYPE_ACOLOR_FIELD(_v) (((_v).aclr))
#define TYPE_FPVALUE_FIELD(_v) (((_v).fpv))
#define TYPE_VALUE_FIELD(_v) (((_v).v))
#define TYPE_DWORD_FIELD(_v) (((_v).d))
#define TYPE_bool_FIELD(_v) (((_v).b))
#define TYPE_INTPTR_FIELD(_v) (((_v).intptr))
#define TYPE_INT64_FIELD(_v) (((_v).i64))
#define TYPE_DOUBLE_FIELD(_v) (((_v).dbl))
// all Tab<> types passed by pointer
#define TYPE_FLOAT_TAB_FIELD(_v) (((_v).f_tab))
#define TYPE_INT_TAB_FIELD(_v) (((_v).i_tab))
#define TYPE_RGBA_TAB_FIELD(_v) (((_v).p_tab))
#define TYPE_POINT3_TAB_FIELD(_v) (((_v).p_tab))
#define TYPE_FRGBA_TAB_FIELD(_v) (((_v).p4_tab))
#define TYPE_POINT4_TAB_FIELD(_v) (((_v).p4_tab))
#define TYPE_BOOL_TAB_FIELD(_v) (((_v).i_tab))
#define TYPE_ANGLE_TAB_FIELD(_v) (((_v).f_tab))
#define TYPE_PCNT_FRAC_TAB_FIELD(_v) (((_v).f_tab))
#define TYPE_WORLD_TAB_FIELD(_v) (((_v).f_tab))
#define TYPE_STRING_TAB_FIELD(_v) (((_v).s_tab))
#define TYPE_FILENAME_TAB_FIELD(_v) (((_v).s_tab))
#define TYPE_HSV_TAB_FIELD(_v) (((_v).p_tab))
#define TYPE_COLOR_CHANNEL_TAB_FIELD(_v) (((_v).f_tab))
#define TYPE_TIMEVALUE_TAB_FIELD(_v) (((_v).i_tab))
#define TYPE_RADIOBTN_INDEX_TAB_FIELD(_v) (((_v).i_tab))
#define TYPE_MTL_TAB_FIELD(_v) (((_v).mtl_tab))
#define TYPE_TEXMAP_TAB_FIELD(_v) (((_v).tex_tab))
#define TYPE_BITMAP_TAB_FIELD(_v) (((_v).bm_tab))
#define TYPE_INODE_TAB_FIELD(_v) (((_v).n_tab))
#define TYPE_REFTARG_TAB_FIELD(_v) (((_v).r_tab))
#define TYPE_INDEX_TAB_FIELD(_v) (((_v).i_tab))
#define TYPE_ENUM_TAB_FIELD(_v) (((_v).i_tab))
#define TYPE_MATRIX3_TAB_FIELD(_v) (((_v).m3_tab))
#define TYPE_ANGAXIS_TAB_FIELD(_v) (((_v).aa_tab))
#define TYPE_QUAT_TAB_FIELD(_v) (((_v).q_tab))
#define TYPE_BITARRAY_TAB_FIELD(_v) (((_v).bits_tab))
#define TYPE_CLASS_TAB_FIELD(_v) (((_v).cd_tab))
#define TYPE_RAY_TAB_FIELD(_v) (((_v).ray_tab))
#define TYPE_POINT2_TAB_FIELD(_v) (((_v).p2_tab))
#define TYPE_MESH_TAB_FIELD(_v) (((_v).msh_tab))
#define TYPE_OBJECT_TAB_FIELD(_v) (((_v).obj_tab))
#define TYPE_CONTROL_TAB_FIELD(_v) (((_v).ctrl_tab))
#define TYPE_INTERVAL_TAB_FIELD(_v) (((_v).intvl_tab))
#define TYPE_POINT_TAB_FIELD(_v) (((_v).pt_tab))
#define TYPE_TSTRT_TAB_FIELD(_v) (((_v).tstr_tab))
#define TYPE_IOBJECT_TAB_FIELD(_v) (((_v).iobj_tab))
#define TYPE_INTERFACE_TAB_FIELD(_v) (((_v).fpi_tab))
#define TYPE_HWND_TAB_FIELD(_v) (((_v).hwnd_tab))
#define TYPE_NAME_TAB_FIELD(_v) (((_v).s_tab))
#define TYPE_COLOR_TAB_FIELD(_v) (((_v).clr_tab))
#define TYPE_ACOLOR_TAB_FIELD(_v) (((_v).aclr_tab))
#define TYPE_FPVALUE_TAB_FIELD(_v) (((_v).fpv_tab))
#define TYPE_VALUE_TAB_FIELD(_v) (((_v).v_tab))
#define TYPE_DWORD_TAB_FIELD(_v) (((_v).d_tab))
#define TYPE_bool_TAB_FIELD(_v) (((_v).b_tab))
#define TYPE_INTPTR_TAB_FIELD(_v) (((_v).intptr_tab))
#define TYPE_INT64_TAB_FIELD(_v) (((_v).i64_tab))
#define TYPE_DOUBLE_TAB_FIELD(_v) (((_v).dbl_tab))
// the following variants all assume a pointer is used as the source of the
// param, but deliver it to the called interface function in the given mode,
// _BP -> a pointer, eg, int* x
// _BR -> a reference, eg, int& x
// _BV -> a dereferenced value, only for pointer-based types, derived by *fpvalue.ptr
// * (pointer) field access macros
// pass by-pointer types for int & float types, implies * parameters, int* & float* are passed via .ptr fields, only for FnPub use
#define TYPE_FLOAT_BP_FIELD(_v) (((_v).fptr))
#define TYPE_INT_BP_FIELD(_v) (((_v).iptr))
#define TYPE_BOOL_BP_FIELD(_v) (((_v).iptr))
#define TYPE_ANGLE_BP_FIELD(_v) (((_v).fptr))
#define TYPE_PCNT_FRAC_BP_FIELD(_v) (((_v).fptr))
#define TYPE_WORLD_BP_FIELD(_v) (((_v).fptr))
#define TYPE_COLOR_CHANNEL_BP_FIELD(_v) (((_v).fptr))
#define TYPE_TIMEVALUE_BP_FIELD(_v) (((_v).iptr))
#define TYPE_RADIOBTN_INDEX_BP_FIELD(_v) (((_v).iptr))
#define TYPE_INDEX_BP_FIELD(_v) (((_v).iptr))
#define TYPE_ENUM_BP_FIELD(_v) (((_v).iptr))
#define TYPE_DWORD_BP_FIELD(_v) (((_v).dptr))
#define TYPE_bool_BP_FIELD(_v) (((_v).bptr))
#define TYPE_INTPTR_BP_FIELD(_v) (((_v).intptrptr))
#define TYPE_INT64_BP_FIELD(_v) (((_v).i64ptr))
#define TYPE_DOUBLE_BP_FIELD(_v) (((_v).dblptr))
// there are no specific by-pointer Tab<> types, all Tab<> types are by-pointer by default
// & (reference) field access macros
// pass by-ref types, implies & parameters, int& & float& are passed via .ptr fields, only for FnPub use
#define TYPE_FLOAT_BR_FIELD(_v) (*((_v).fptr))
#define TYPE_INT_BR_FIELD(_v) (*((_v).iptr))
#define TYPE_RGBA_BR_FIELD(_v) (*((_v).p))
#define TYPE_POINT3_BR_FIELD(_v) (*((_v).p))
#define TYPE_FRGBA_BR_FIELD(_v) (*((_v).p4))
#define TYPE_POINT4_BR_FIELD(_v) (*((_v).p4))
#define TYPE_BOOL_BR_FIELD(_v) (*((_v).iptr))
#define TYPE_ANGLE_BR_FIELD(_v) (*((_v).fptr))
#define TYPE_PCNT_FRAC_BR_FIELD(_v) (*((_v).fptr))
#define TYPE_WORLD_BR_FIELD(_v) (*((_v).fptr))
#define TYPE_HSV_BR_FIELD(_v) (*((_v).p))
#define TYPE_COLOR_CHANNEL_BR_FIELD(_v) (*((_v).f))
#define TYPE_TIMEVALUE_BR_FIELD(_v) (*((_v).iptr))
#define TYPE_RADIOBTN_INDEX_BR_FIELD(_v) (*((_v).iptr))
#define TYPE_BITMAP_BR_FIELD(_v) (*((_v).bm))
#define TYPE_INDEX_BR_FIELD(_v) (*((_v).iptr))
#define TYPE_ENUM_BR_FIELD(_v) (*((_v).iptr))
#define TYPE_REFTARG_BR_FIELD(_v) (*((_v).r))
#define TYPE_MATRIX3_BR_FIELD(_v) (*((_v).m))
#define TYPE_ANGAXIS_BR_FIELD(_v) (*((_v).aa))
#define TYPE_QUAT_BR_FIELD(_v) (*((_v).q))
#define TYPE_BITARRAY_BR_FIELD(_v) (*((_v).bits))
#define TYPE_RAY_BR_FIELD(_v) (*((_v).ray))
#define TYPE_POINT2_BR_FIELD(_v) (*((_v).p2))
#define TYPE_MESH_BR_FIELD(_v) (*((_v).msh))
#define TYPE_INTERVAL_BR_FIELD(_v) (*((_v).intvl))
#define TYPE_POINT_BR_FIELD(_v) (*((_v).pt))
#define TYPE_TSTR_BR_FIELD(_v) (*((_v).tstr))
#define TYPE_COLOR_BR_FIELD(_v) (*((_v).clr))
#define TYPE_ACOLOR_BR_FIELD(_v) (*((_v).aclr))
#define TYPE_FPVALUE_BR_FIELD(_v) (*((_v).fpv))
#define TYPE_DWORD_BR_FIELD(_v) (*((_v).d))
#define TYPE_bool_BR_FIELD(_v) (*((_v).b))
#define TYPE_INTPTR_BR_FIELD(_v) (*((_v).intptrptr))
#define TYPE_INT64_BR_FIELD(_v) (*((_v).i64ptr))
#define TYPE_DOUBLE_BR_FIELD(_v) (*((_v).dblptr))
// refs to Tab<>s
#define TYPE_FLOAT_TAB_BR_FIELD(_v) (*((_v).f_tab))
#define TYPE_INT_TAB_BR_FIELD(_v) (*((_v).i_tab))
#define TYPE_RGBA_TAB_BR_FIELD(_v) (*((_v).p_tab))
#define TYPE_POINT3_TAB_BR_FIELD(_v) (*((_v).p_tab))
#define TYPE_FRGBA_TAB_BR_FIELD(_v) (*((_v).p4_tab))
#define TYPE_POINT4_TAB_BR_FIELD(_v) (*((_v).p4_tab))
#define TYPE_BOOL_TAB_BR_FIELD(_v) (*((_v).i_tab))
#define TYPE_ANGLE_TAB_BR_FIELD(_v) (*((_v).f_tab))
#define TYPE_PCNT_FRAC_TAB_BR_FIELD(_v) (*((_v).f_tab))
#define TYPE_WORLD_TAB_BR_FIELD(_v) (*((_v).f_tab))
#define TYPE_STRING_TAB_BR_FIELD(_v) (*((_v).s_tab))
#define TYPE_FILENAME_TAB_BR_FIELD(_v) (*((_v).s_tab))
#define TYPE_HSV_TAB_BR_FIELD(_v) (*((_v).p_tab))
#define TYPE_COLOR_CHANNEL_TAB_BR_FIELD(_v) (*((_v).f_tab))
#define TYPE_TIMEVALUE_TAB_BR_FIELD(_v) (*((_v).i_tab))
#define TYPE_RADIOBTN_INDEX_TAB_BR_FIELD(_v) (*((_v).i_tab))
#define TYPE_MTL_TAB_BR_FIELD(_v) (*((_v).mtl_tab))
#define TYPE_TEXMAP_TAB_BR_FIELD(_v) (*((_v).tex_tab))
#define TYPE_BITMAP_TAB_BR_FIELD(_v) (*((_v).bm_tab))
#define TYPE_INODE_TAB_BR_FIELD(_v) (*((_v).n_tab))
#define TYPE_REFTARG_TAB_BR_FIELD(_v) (*((_v).r_tab))
#define TYPE_INDEX_TAB_BR_FIELD(_v) (*((_v).i_tab))
#define TYPE_ENUM_TAB_BR_FIELD(_v) (*((_v).i_tab))
#define TYPE_MATRIX3_TAB_BR_FIELD(_v) (*((_v).m3_tab))
#define TYPE_ANGAXIS_TAB_BR_FIELD(_v) (*((_v).aa_tab))
#define TYPE_QUAT_TAB_BR_FIELD(_v) (*((_v).q_tab))
#define TYPE_BITARRAY_TAB_BR_FIELD(_v) (*((_v).bits_tab))
#define TYPE_CLASS_TAB_BR_FIELD(_v) (*((_v).cd_tab))
#define TYPE_RAY_TAB_BR_FIELD(_v) (*((_v).ray_tab))
#define TYPE_POINT2_TAB_BR_FIELD(_v) (*((_v).p2_tab))
#define TYPE_MESH_TAB_BR_FIELD(_v) (*((_v).msh_tab))
#define TYPE_OBJECT_TAB_BR_FIELD(_v) (*((_v).obj_tab))
#define TYPE_CONTROL_TAB_BR_FIELD(_v) (*((_v).ctrl_tab))
#define TYPE_INTERVAL_TAB_BR_FIELD(_v) (*((_v).intvl_tab))
#define TYPE_POINT_TAB_BR_FIELD(_v) (*((_v).pt_tab))
#define TYPE_HWND_TAB_BR_FIELD(_v) (*((_v).hwnd_tab))
#define TYPE_TSTR_TAB_BR_FIELD(_v) (*((_v).tstr_tab))
#define TYPE_IOBJECT_TAB_BR_FIELD(_v) (*((_v).iobj_tab))
#define TYPE_INTERFACE_TAB_BR_FIELD(_v) (*((_v).fpi_tab))
#define TYPE_NAME_TAB_BR_FIELD(_v) (*((_v).s_tab))
#define TYPE_COLOR_TAB_BR_FIELD(_v) (*((_v).clr_tab))
#define TYPE_ACOLOR_TAB_BR_FIELD(_v) (*((_v).aclr_tab))
#define TYPE_FPVALUE_TAB_BR_FIELD(_v) (*((_v).fpv_tab))
#define TYPE_VALUE_TAB_BR_FIELD(_v) (*((_v).v_tab))
#define TYPE_DWORD_TAB_BR_FIELD(_v) (*((_v).d_tab))
#define TYPE_bool_TAB_BR_FIELD(_v) (*((_v).b_tab))
#define TYPE_INTPTR_TAB_BR_FIELD(_v) (*((_v).intptr_tab))
#define TYPE_INT64_TAB_BR_FIELD(_v) (*((_v).i64_tab))
#define TYPE_DOUBLE_TAB_BR_FIELD(_v) (*((_v).dbl_tab))
// by value field access macros
// pass by-value types, implies dereferencing the (meaningful) pointer-based values, only for FnPub use
#define TYPE_RGBA_BV_FIELD(_v) (*((_v).p))
#define TYPE_POINT3_BV_FIELD(_v) (*((_v).p))
#define TYPE_HSV_BV_FIELD(_v) (*((_v).p))
#define TYPE_FRGBA_BV_FIELD(_v) (*((_v).p4))
#define TYPE_POINT4_BV_FIELD(_v) (*((_v).p4))
#define TYPE_BITMAP_BV_FIELD(_v) (*((_v).bm))
#define TYPE_MATRIX3_BV_FIELD(_v) (*((_v).m))
#define TYPE_ANGAXIS_BV_FIELD(_v) (*((_v).aa))
#define TYPE_QUAT_BV_FIELD(_v) (*((_v).q))
#define TYPE_BITARRAY_BV_FIELD(_v) (*((_v).bits))
#define TYPE_RAY_BV_FIELD(_v) (*((_v).ray))
#define TYPE_POINT2_BV_FIELD(_v) (*((_v).p2))
#define TYPE_MESH_BV_FIELD(_v) (*((_v).msh))
#define TYPE_INTERVAL_BV_FIELD(_v) (*((_v).intvl))
#define TYPE_POINT_BV_FIELD(_v) (*((_v).pt))
#define TYPE_TSTR_BV_FIELD(_v) (*((_v).tstr))
#define TYPE_COLOR_BV_FIELD(_v) (*((_v).clr))
#define TYPE_ACOLOR_BV_FIELD(_v) (*((_v).aclr))
#define TYPE_FPVALUE_BV_FIELD(_v) (*((_v).fpv))
#define TYPE_CLASS_BV_FIELD(_v) (*((_v).cd))
// pass by-val Tab<> types
#define TYPE_FLOAT_TAB_BV_FIELD(_v) (*((_v).f_tab))
#define TYPE_INT_TAB_BV_FIELD(_v) (*((_v).i_tab))
#define TYPE_RGBA_TAB_BV_FIELD(_v) (*((_v).p_tab))
#define TYPE_POINT3_TAB_BV_FIELD(_v) (*((_v).p_tab))
#define TYPE_FRGBA_TAB_BV_FIELD(_v) (*((_v).p4_tab))
#define TYPE_POINT4_TAB_BV_FIELD(_v) (*((_v).p4_tab))
#define TYPE_BOOL_TAB_BV_FIELD(_v) (*((_v).i_tab))
#define TYPE_ANGLE_TAB_BV_FIELD(_v) (*((_v).f_tab))
#define TYPE_PCNT_FRAC_TAB_BV_FIELD(_v) (*((_v).f_tab))
#define TYPE_WORLD_TAB_BV_FIELD(_v) (*((_v).f_tab))
#define TYPE_STRING_TAB_BV_FIELD(_v) (*((_v).s_tab))
#define TYPE_FILENAME_TAB_BV_FIELD(_v) (*((_v).s_tab))
#define TYPE_HSV_TAB_BV_FIELD(_v) (*((_v).p_tab))
#define TYPE_COLOR_CHANNEL_TAB_BV_FIELD(_v) (*((_v).f_tab))
#define TYPE_TIMEVALUE_TAB_BV_FIELD(_v) (*((_v).i_tab))
#define TYPE_RADIOBTN_INDEX_TAB_BV_FIELD(_v) (*((_v).i_tab))
#define TYPE_MTL_TAB_BV_FIELD(_v) (*((_v).mtl_tab))
#define TYPE_TEXMAP_TAB_BV_FIELD(_v) (*((_v).tex_tab))
#define TYPE_BITMAP_TAB_BV_FIELD(_v) (*((_v).bm_tab))
#define TYPE_INODE_TAB_BV_FIELD(_v) (*((_v).n_tab))
#define TYPE_REFTARG_TAB_BV_FIELD(_v) (*((_v).r_tab))
#define TYPE_INDEX_TAB_BV_FIELD(_v) (*((_v).i_tab))
#define TYPE_ENUM_TAB_BV_FIELD(_v) (*((_v).i_tab))
#define TYPE_MATRIX3_TAB_BV_FIELD(_v) (*((_v).m3_tab))
#define TYPE_ANGAXIS_TAB_BV_FIELD(_v) (*((_v).aa_tab))
#define TYPE_QUAT_TAB_BV_FIELD(_v) (*((_v).q_tab))
#define TYPE_BITARRAY_TAB_BV_FIELD(_v) (*((_v).bits_tab))
#define TYPE_CLASS_TAB_BV_FIELD(_v) (*((_v).cd_tab))
#define TYPE_RAY_TAB_BV_FIELD(_v) (*((_v).ray_tab))
#define TYPE_POINT2_TAB_BV_FIELD(_v) (*((_v).p2_tab))
#define TYPE_MESH_TAB_BV_FIELD(_v) (*((_v).msh_tab))
#define TYPE_OBJECT_TAB_BV_FIELD(_v) (*((_v).obj_tab))
#define TYPE_CONTROL_TAB_BV_FIELD(_v) (*((_v).ctrl_tab))
#define TYPE_INTERVAL_TAB_BV_FIELD(_v) (*((_v).intvl_tab))
#define TYPE_POINT_TAB_BV_FIELD(_v) (*((_v).pt_tab))
#define TYPE_HWND_TAB_BV_FIELD(_v) (*((_v).hwnd_tab))
#define TYPE_TSTR_TAB_BV_FIELD(_v) (*((_v).tstr_tab))
#define TYPE_IOBJECT_TAB_BV_FIELD(_v) (*((_v).iobj_tab))
#define TYPE_INTERFACE_TAB_BV_FIELD(_v) (*((_v).fpi_tab))
#define TYPE_NAME_TAB_BV_FIELD(_v) (*((_v).s_tab))
#define TYPE_COLOR_TAB_BV_FIELD(_v) (*((_v).clr_tab))
#define TYPE_ACOLOR_TAB_BV_FIELD(_v) (*((_v).aclr_tab))
#define TYPE_FPVALUE_TAB_BV_FIELD(_v) (*((_v).fpv_tab))
#define TYPE_VALUE_TAB_BV_FIELD(_v) (*((_v).v_tab))
#define TYPE_DWORD_TAB_BV_FIELD(_v) (*((_v).d_tab))
#define TYPE_bool_TAB_BV_FIELD(_v) (*((_v).b_tab))
#define TYPE_INTPTR_TAB_BV_FIELD(_v) (*((_v).intptr_tab))
#define TYPE_INT64_TAB_BV_FIELD(_v) (*((_v).i64_tab))
#define TYPE_DOUBLE_TAB_BV_FIELD(_v) (*((_v).dbl_tab))
// --- type result operators ----------------------
// used to generate an rvalue from the type's corresponding C++ type
// for assignment to the type's carrying field in FPValue.
// mostly empty, used by BY_REF & BY_VAL types to get pointers, since these
// types are actualy carried by pointer fields
// base types
#define TYPE_FLOAT_RSLT
#define TYPE_INT_RSLT
#define TYPE_RGBA_RSLT
#define TYPE_POINT3_RSLT
#define TYPE_FRGBA_RSLT
#define TYPE_POINT4_RSLT
#define TYPE_BOOL_RSLT
#define TYPE_ANGLE_RSLT
#define TYPE_PCNT_FRAC_RSLT
#define TYPE_WORLD_RSLT
#define TYPE_STRING_RSLT
#define TYPE_FILENAME_RSLT
#define TYPE_HSV_RSLT
#define TYPE_COLOR_CHANNEL_RSLT
#define TYPE_TIMEVALUE_RSLT
#define TYPE_RADIOBTN_INDEX_RSLT
#define TYPE_MTL_RSLT
#define TYPE_TEXMAP_RSLT
#define TYPE_BITMAP_RSLT
#define TYPE_INODE_RSLT
#define TYPE_REFTARG_RSLT
#define TYPE_INDEX_RSLT
#define TYPE_ENUM_RSLT
#define TYPE_MATRIX3_RSLT
#define TYPE_VOID_RSLT
#define TYPE_INTERVAL_RSLT
#define TYPE_ANGAXIS_RSLT
#define TYPE_QUAT_RSLT
#define TYPE_RAY_RSLT
#define TYPE_POINT2_RSLT
#define TYPE_BITARRAY_RSLT
#define TYPE_CLASS_RSLT
#define TYPE_MESH_RSLT
#define TYPE_OBJECT_RSLT
#define TYPE_CONTROL_RSLT
#define TYPE_POINT_RSLT
#define TYPE_TSTR_RSLT
#define TYPE_IOBJECT_RSLT
#define TYPE_INTERFACE_RSLT
#define TYPE_HWND_RSLT
#define TYPE_NAME_RSLT
#define TYPE_COLOR_RSLT
#define TYPE_ACOLOR_RSLT
#define TYPE_FPVALUE_RSLT
#define TYPE_VALUE_RSLT
#define TYPE_DWORD_RSLT
#define TYPE_bool_RSLT
#define TYPE_INTPTR_RSLT
#define TYPE_INT64_RSLT
#define TYPE_DOUBLE_RSLT
// Tab<>s of the above...
#define TYPE_FLOAT_TAB_RSLT
#define TYPE_INT_TAB_RSLT
#define TYPE_RGBA_TAB_RSLT
#define TYPE_POINT3_TAB_RSLT
#define TYPE_FRGBA_TAB_RSLT
#define TYPE_POINT4_TAB_RSLT
#define TYPE_BOOL_TAB_RSLT
#define TYPE_ANGLE_TAB_RSLT
#define TYPE_PCNT_FRAC_TAB_RSLT
#define TYPE_WORLD_TAB_RSLT
#define TYPE_STRING_TAB_RSLT
#define TYPE_FILENAME_TAB_RSLT
#define TYPE_HSV_TAB_RSLT
#define TYPE_COLOR_CHANNEL_TAB_RSLT
#define TYPE_TIMEVALUE_TAB_RSLT
#define TYPE_RADIOBTN_INDEX_TAB_RSLT
#define TYPE_MTL_TAB_RSLT
#define TYPE_TEXMAP_TAB_RSLT
#define TYPE_BITMAP_TAB_RSLT
#define TYPE_INODE_TAB_RSLT
#define TYPE_REFTARG_TAB_RSLT
#define TYPE_INDEX_TAB_RSLT
#define TYPE_ENUM_TAB_RSLT
#define TYPE_MATRIX3_TAB_RSLT
#define TYPE_INTERVAL_TAB_RSLT
#define TYPE_ANGAXIS_TAB_RSLT
#define TYPE_QUAT_TAB_RSLT
#define TYPE_RAY_TAB_RSLT
#define TYPE_POINT2_TAB_RSLT
#define TYPE_BITARRAY_TAB_RSLT
#define TYPE_CLASS_TAB_RSLT
#define TYPE_MESH_TAB_RSLT
#define TYPE_OBJECT_TAB_RSLT
#define TYPE_CONTROL_TAB_RSLT
#define TYPE_POINT_TAB_RSLT
#define TYPE_TSTR_TAB_RSLT
#define TYPE_IOBJECT_TAB_RSLT
#define TYPE_INTERFACE_TAB_RSLT
#define TYPE_HWND_TAB_RSLT
#define TYPE_NAME_TAB_RSLT
#define TYPE_COLOR_TAB_RSLT
#define TYPE_ACOLOR_TAB_RSLT
#define TYPE_FPVALUE_TAB_RSLT
#define TYPE_VALUE_TAB_RSLT
#define TYPE_DWORD_TAB_RSLT
#define TYPE_bool_TAB_RSLT
#define TYPE_INTPTR_TAB_RSLT
#define TYPE_INT64_TAB_RSLT
#define TYPE_DOUBLE_TAB_RSLT
// by-pointer
// foo* =
#define TYPE_FLOAT_BP_RSLT
#define TYPE_INT_BP_RSLT
#define TYPE_BOOL_BP_RSLT
#define TYPE_ANGLE_BP_RSLT
#define TYPE_PCNT_FRAC_BP_RSLT
#define TYPE_WORLD_BP_RSLT
#define TYPE_COLOR_CHANNEL_BP_RSLT
#define TYPE_TIMEVALUE_BP_RSLT
#define TYPE_RADIOBTN_INDEX_BP_RSLT
#define TYPE_INDEX_BP_RSLT
#define TYPE_ENUM_BP_RSLT
#define TYPE_DWORD_BP_RSLT
#define TYPE_bool_BP_RSLT
#define TYPE_INTPTR_BP_RSLT
#define TYPE_INT64_BP_RSLT
#define TYPE_DOUBLE_BP_RSLT
// by-reference
#define TYPE_FLOAT_BR_RSLT &
#define TYPE_INT_BR_RSLT &
#define TYPE_RGBA_BR_RSLT &
#define TYPE_POINT3_BR_RSLT &
#define TYPE_FRGBA_BR_RSLT &
#define TYPE_POINT4_BR_RSLT &
#define TYPE_BOOL_BR_RSLT &
#define TYPE_ANGLE_BR_RSLT &
#define TYPE_PCNT_FRAC_BR_RSLT &
#define TYPE_WORLD_BR_RSLT &
#define TYPE_HSV_BR_RSLT &
#define TYPE_COLOR_CHANNEL_BR_RSLT &
#define TYPE_TIMEVALUE_BR_RSLT &
#define TYPE_RADIOBTN_INDEX_BR_RSLT &
#define TYPE_BITMAP_BR_RSLT &
#define TYPE_INDEX_BR_RSLT &
#define TYPE_ENUM_BR_RSLT &
#define TYPE_REFTARG_BR_RSLT &
#define TYPE_MATRIX3_BR_RSLT &
#define TYPE_ANGAXIS_BR_RSLT &
#define TYPE_QUAT_BR_RSLT &
#define TYPE_BITARRAY_BR_RSLT &
#define TYPE_RAY_BR_RSLT &
#define TYPE_POINT2_BR_RSLT &
#define TYPE_MESH_BR_RSLT &
#define TYPE_INTERVAL_BR_RSLT &
#define TYPE_POINT_BR_RSLT &
#define TYPE_TSTR_BR_RSLT &
#define TYPE_COLOR_BR_RSLT &
#define TYPE_ACOLOR_BR_RSLT &
#define TYPE_FPVALUE_BR_RSLT &
#define TYPE_DWORD_BR_RSLT &
#define TYPE_bool_BR_RSLT &
#define TYPE_INTPTR_BR_RSLT &
#define TYPE_INT64_BR_RSLT &
#define TYPE_DOUBLE_BR_RSLT &
// Tab<> by-reference &
#define TYPE_FLOAT_TAB_BR_RSLT &
#define TYPE_INT_TAB_BR_RSLT &
#define TYPE_RGBA_TAB_BR_RSLT &
#define TYPE_POINT3_TAB_BR_RSLT &
#define TYPE_FRGBA_TAB_BR_RSLT &
#define TYPE_POINT4_TAB_BR_RSLT &
#define TYPE_BOOL_TAB_BR_RSLT &
#define TYPE_ANGLE_TAB_BR_RSLT &
#define TYPE_PCNT_FRAC_TAB_BR_RSLT &
#define TYPE_WORLD_TAB_BR_RSLT &
#define TYPE_STRING_TAB_BR_RSLT &
#define TYPE_FILENAME_TAB_BR_RSLT &
#define TYPE_HSV_TAB_BR_RSLT &
#define TYPE_COLOR_CHANNEL_TAB_BR_RSLT &
#define TYPE_TIMEVALUE_TAB_BR_RSLT &
#define TYPE_RADIOBTN_INDEX_TAB_BR_RSLT &
#define TYPE_MTL_TAB_BR_RSLT &
#define TYPE_TEXMAP_TAB_BR_RSLT &
#define TYPE_BITMAP_TAB_BR_RSLT &
#define TYPE_INODE_TAB_BR_RSLT &
#define TYPE_REFTARG_TAB_BR_RSLT &
#define TYPE_INDEX_TAB_BR_RSLT &
#define TYPE_ENUM_TAB_BR_RSLT &
#define TYPE_MATRIX3_TAB_BR_RSLT &
#define TYPE_ANGAXIS_TAB_BR_RSLT &
#define TYPE_QUAT_TAB_BR_RSLT &
#define TYPE_BITARRAY_TAB_BR_RSLT &
#define TYPE_CLASS_TAB_BR_RSLT &
#define TYPE_RAY_TAB_BR_RSLT &
#define TYPE_POINT2_TAB_BR_RSLT &
#define TYPE_MESH_TAB_BR_RSLT &
#define TYPE_OBJECT_TAB_BR_RSLT &
#define TYPE_CONTROL_TAB_BR_RSLT &
#define TYPE_INTERVAL_TAB_BR_RSLT &
#define TYPE_POINT_TAB_BR_RSLT &
#define TYPE_HWND_TAB_BR_RSLT &
#define TYPE_TSTR_TAB_BR_RSLT &
#define TYPE_IOBJECT_TAB_BR_RSLT &
#define TYPE_INTERFACE_TAB_BR_RSLT &
#define TYPE_NAME_TAB_BR_RSLT &
#define TYPE_COLOR_TAB_BR_RSLT &
#define TYPE_ACOLOR_TAB_BR_RSLT &
#define TYPE_FPVALUE_TAB_BR_RSLT &
#define TYPE_VALUE_TAB_BR_RSLT &
#define TYPE_DWORD_TAB_BR_RSLT &
#define TYPE_bool_TAB_BR_RSLT &
#define TYPE_INTPTR_TAB_BR_RSLT &
#define TYPE_INT64_TAB_BR_RSLT &
#define TYPE_DOUBLE_TAB_BR_RSLT &
// by-value
#define TYPE_RGBA_BV_RSLT &
#define TYPE_POINT3_BV_RSLT &
#define TYPE_HSV_BV_RSLT &
#define TYPE_FRGBA_BV_RSLT &
#define TYPE_POINT4_BV_RSLT &
#define TYPE_BITMAP_BV_RSLT &
#define TYPE_MATRIX3_BV_RSLT &
#define TYPE_ANGAXIS_BV_RSLT &
#define TYPE_QUAT_BV_RSLT &
#define TYPE_BITARRAY_BV_RSLT &
#define TYPE_RAY_BV_RSLT &
#define TYPE_POINT2_BV_RSLT &
#define TYPE_MESH_BV_RSLT &
#define TYPE_INTERVAL_BV_RSLT &
#define TYPE_POINT_BV_RSLT &
#define TYPE_TSTR_BV_RSLT &
#define TYPE_COLOR_BV_RSLT &
#define TYPE_ACOLOR_BV_RSLT &
#define TYPE_FPVALUE_BV_RSLT &
#define TYPE_CLASS_BV_RSLT &
// by-val Tab<>
#define TYPE_FLOAT_TAB_BV_RSLT &
#define TYPE_INT_TAB_BV_RSLT &
#define TYPE_RGBA_TAB_BV_RSLT &
#define TYPE_POINT3_TAB_BV_RSLT &
#define TYPE_FRGBA_TAB_BV_RSLT &
#define TYPE_POINT4_TAB_BV_RSLT &
#define TYPE_BOOL_TAB_BV_RSLT &
#define TYPE_ANGLE_TAB_BV_RSLT &
#define TYPE_PCNT_FRAC_TAB_BV_RSLT &
#define TYPE_WORLD_TAB_BV_RSLT &
#define TYPE_STRING_TAB_BV_RSLT &
#define TYPE_FILENAME_TAB_BV_RSLT &
#define TYPE_HSV_TAB_BV_RSLT &
#define TYPE_COLOR_CHANNEL_TAB_BV_RSLT &
#define TYPE_TIMEVALUE_TAB_BV_RSLT &
#define TYPE_RADIOBTN_INDEX_TAB_BV_RSLT &
#define TYPE_MTL_TAB_BV_RSLT &
#define TYPE_TEXMAP_TAB_BV_RSLT &
#define TYPE_BITMAP_TAB_BV_RSLT &
#define TYPE_INODE_TAB_BV_RSLT &
#define TYPE_REFTARG_TAB_BV_RSLT &
#define TYPE_INDEX_TAB_BV_RSLT &
#define TYPE_ENUM_TAB_BV_RSLT &
#define TYPE_MATRIX3_TAB_BV_RSLT &
#define TYPE_ANGAXIS_TAB_BV_RSLT &
#define TYPE_QUAT_TAB_BV_RSLT &
#define TYPE_BITARRAY_TAB_BV_RSLT &
#define TYPE_CLASS_TAB_BV_RSLT &
#define TYPE_RAY_TAB_BV_RSLT &
#define TYPE_POINT2_TAB_BV_RSLT &
#define TYPE_MESH_TAB_BV_RSLT &
#define TYPE_OBJECT_TAB_BV_RSLT &
#define TYPE_CONTROL_TAB_BV_RSLT &
#define TYPE_INTERVAL_TAB_BV_RSLT &
#define TYPE_POINT_TAB_BV_RSLT &
#define TYPE_HWND_TAB_BV_RSLT &
#define TYPE_TSTR_TAB_BV_RSLT &
#define TYPE_IOBJECT_TAB_BV_RSLT &
#define TYPE_INTERFACE_TAB_BV_RSLT &
#define TYPE_NAME_TAB_BV_RSLT &
#define TYPE_COLOR_TAB_BV_RSLT &
#define TYPE_ACOLOR_TAB_BV_RSLT &
#define TYPE_FPVALUE_TAB_BV_RSLT &
#define TYPE_VALUE_TAB_BV_RSLT &
#define TYPE_DWORD_TAB_BV_RSLT &
#define TYPE_bool_TAB_BV_RSLT &
#define TYPE_INTPTR_TAB_BV_RSLT &
#define TYPE_INT64_TAB_BV_RSLT &
#define TYPE_DOUBLE_TAB_BV_RSLT &
// types for each of the fields
#define TYPE_FLOAT_TYPE float
#define TYPE_INT_TYPE int
#define TYPE_RGBA_TYPE Point3
#define TYPE_POINT3_TYPE Point3
#define TYPE_FRGBA_TYPE Point4
#define TYPE_POINT4_TYPE Point4
#define TYPE_BOOL_TYPE BOOL
#define TYPE_ANGLE_TYPE float
#define TYPE_PCNT_FRAC_TYPE float
#define TYPE_WORLD_TYPE float
#define TYPE_STRING_TYPE MCHAR*
#define TYPE_FILENAME_TYPE MCHAR*
#define TYPE_HSV_TYPE Point3
#define TYPE_COLOR_CHANNEL_TYPE float
#define TYPE_TIMEVALUE_TYPE int
#define TYPE_RADIOBTN_INDEX_TYPE int
#define TYPE_MTL_TYPE Mtl*
#define TYPE_TEXMAP_TYPE Texmap*
#define TYPE_BITMAP_TYPE PBBitmap*
#define TYPE_INODE_TYPE INode*
#define TYPE_REFTARG_TYPE ReferenceTarget*
#define TYPE_INDEX_TYPE int
#define TYPE_ENUM_TYPE int
#define TYPE_MATRIX3_TYPE Matrix*
#define TYPE_VOID_TYPE void
#define TYPE_INTERVAL_TYPE Interval*
#define TYPE_ANGAXIS_TYPE AngAxis*
#define TYPE_QUAT_TYPE Quat*
#define TYPE_RAY_TYPE Ray*
#define TYPE_POINT2_TYPE Point2*
#define TYPE_BITARRAY_TYPE BitArray*
#define TYPE_CLASS_TYPE ClassID*
#define TYPE_MESH_TYPE Mesh*
#define TYPE_OBJECT_TYPE Object*
#define TYPE_CONTROL_TYPE Control*
#define TYPE_POINT_TYPE POINT*
#define TYPE_TSTR_TYPE MSTR*
#define TYPE_IOBJECT_TYPE IObject*
#define TYPE_INTERFACE_TYPE FPInterface*
#define TYPE_HWND_TYPE HWND
#define TYPE_NAME_TYPE MCHAR*
#define TYPE_COLOR_TYPE Color*
#define TYPE_ACOLOR_TYPE AColor*
#define TYPE_FPVALUE_TYPE FPValue*
#define TYPE_VALUE_TYPE Value*
#define TYPE_DWORD_TYPE DWORD
#define TYPE_bool_TYPE bool
#define TYPE_INTPTR_TYPE INT_PTR
#define TYPE_INT64_TYPE INT64
#define TYPE_DOUBLE_TYPE double
// Tab<>s of the above...
#define TYPE_FLOAT_TAB_TYPE Tab<float>*
#define TYPE_INT_TAB_TYPE Tab<int>*
#define TYPE_RGBA_TAB_TYPE Tab<Point3>*
#define TYPE_POINT3_TAB_TYPE Tab<Point3>*
#define TYPE_FRGBA_TAB_TYPE Tab<Point4>*
#define TYPE_POINT4_TAB_TYPE Tab<Point4>*
#define TYPE_BOOL_TAB_TYPE Tab<BOOL>*
#define TYPE_ANGLE_TAB_TYPE Tab<float>*
#define TYPE_PCNT_FRAC_TAB_TYPE Tab<float>*
#define TYPE_WORLD_TAB_TYPE Tab<float>*
#define TYPE_STRING_TAB_TYPE Tab<MCHAR*>*
#define TYPE_FILENAME_TAB_TYPE Tab<MCHAR*>*
#define TYPE_HSV_TAB_TYPE Tab<Point3>*
#define TYPE_COLOR_CHANNEL_TAB_TYPE Tab<float>*
#define TYPE_TIMEVALUE_TAB_TYPE Tab<int>*
#define TYPE_RADIOBTN_INDEX_TAB_TYPE Tab<int>*
#define TYPE_MTL_TAB_TYPE Tab<Mtl*>*
#define TYPE_TEXMAP_TAB_TYPE Tab<Texmap*>*
#define TYPE_BITMAP_TAB_TYPE Tab<PBBitmap*>*
#define TYPE_INODE_TAB_TYPE Tab<INode*>*
#define TYPE_REFTARG_TAB_TYPE Tab<ReferenceTarget*>*
#define TYPE_INDEX_TAB_TYPE Tab<int>*
#define TYPE_ENUM_TAB_TYPE Tab<int>*
#define TYPE_MATRIX3_TAB_TYPE Tab<Matrix*>*
#define TYPE_VOID_TAB_TYPE Tab<void>*
#define TYPE_INTERVAL_TAB_TYPE Tab<Interval*>*
#define TYPE_ANGAXIS_TAB_TYPE Tab<AngAxis*>*
#define TYPE_QUAT_TAB_TYPE Tab<Quat*>*
#define TYPE_RAY_TAB_TYPE Tab<Ray*>*
#define TYPE_POINT2_TAB_TYPE Tab<Point2*>*
#define TYPE_BITARRAY_TAB_TYPE Tab<BitArray*>*
#define TYPE_CLASS_TAB_TYPE Tab<ClassID*>*
#define TYPE_MESH_TAB_TYPE Tab<Mesh*>*
#define TYPE_OBJECT_TAB_TYPE Tab<Object*>*
#define TYPE_CONTROL_TAB_TYPE Tab<Control*>*
#define TYPE_POINT_TAB_TYPE Tab<POINT*>*
#define TYPE_TSTR_TAB_TYPE Tab<MSTR*>*
#define TYPE_IOBJECT_TAB_TYPE Tab<IObject*>*
#define TYPE_INTERFACE_TAB_TYPE Tab<FPInterface*>*
#define TYPE_HWND_TAB_TYPE Tab<HWND>*
#define TYPE_NAME_TAB_TYPE Tab<MCHAR*>*
#define TYPE_COLOR_TAB_TYPE Tab<Color*>*
#define TYPE_ACOLOR_TAB_TYPE Tab<AColor*>*
#define TYPE_FPVALUE_TAB_TYPE Tab<FPValue*>*
#define TYPE_VALUE_TAB_TYPE Tab<Value*>*
#define TYPE_DWORD_TAB_TYPE Tab<DWORD>*
#define TYPE_bool_TAB_TYPE Tab<bool>*
#define TYPE_INTPTR_TAB_TYPE Tab<INT_PTR>*
#define TYPE_INT64_TAB_TYPE Tab<INT64>*
#define TYPE_DOUBLE_TAB_TYPE Tab<double>*
// by-pointer
// foo* =
#define TYPE_FLOAT_BP_TYPE float*
#define TYPE_INT_BP_TYPE int*
#define TYPE_BOOL_BP_TYPE int*
#define TYPE_ANGLE_BP_TYPE float*
#define TYPE_PCNT_FRAC_BP_TYPE float*
#define TYPE_WORLD_BP_TYPE float*
#define TYPE_COLOR_CHANNEL_BP_TYPE float*
#define TYPE_TIMEVALUE_BP_TYPE int*
#define TYPE_RADIOBTN_INDEX_BP_TYPE int*
#define TYPE_INDEX_BP_TYPE int*
#define TYPE_ENUM_BP_TYPE int*
#define TYPE_DWORD_BP_TYPE DWORD*
#define TYPE_bool_BP_TYPE bool*
#define TYPE_INTPTR_BP_TYPE INT_PTR*
#define TYPE_INT64_BP_TYPE INT64*
#define TYPE_DOUBLE_BP_TYPE double*
// by-reference
#define TYPE_FLOAT_BR_TYPE float&
#define TYPE_INT_BR_TYPE int&
#define TYPE_RGBA_BR_TYPE Point3&
#define TYPE_POINT3_BR_TYPE Point3&
#define TYPE_FRGBA_BR_TYPE Point4&
#define TYPE_POINT4_BR_TYPE Point4&
#define TYPE_BOOL_BR_TYPE int&
#define TYPE_ANGLE_BR_TYPE float&
#define TYPE_PCNT_FRAC_BR_TYPE float&
#define TYPE_WORLD_BR_TYPE float&
#define TYPE_HSV_BR_TYPE Point3&
#define TYPE_COLOR_CHANNEL_BR_TYPE float&
#define TYPE_TIMEVALUE_BR_TYPE int&
#define TYPE_RADIOBTN_INDEX_BR_TYPE int&
#define TYPE_BITMAP_BR_TYPE PBBitmap&
#define TYPE_INDEX_BR_TYPE int&
#define TYPE_ENUM_BR_TYPE int&
#define TYPE_REFTARG_BR_TYPE ReferenceTarget&
#define TYPE_MATRIX3_BR_TYPE Matrix3&
#define TYPE_ANGAXIS_BR_TYPE AngAxis&
#define TYPE_QUAT_BR_TYPE Quat&
#define TYPE_BITARRAY_BR_TYPE BitArray&
#define TYPE_RAY_BR_TYPE Ray&
#define TYPE_POINT2_BR_TYPE Point2&
#define TYPE_MESH_BR_TYPE Mesh&
#define TYPE_INTERVAL_BR_TYPE Interval&
#define TYPE_POINT_BR_TYPE POINT&
#define TYPE_TSTR_BR_TYPE MSTR&
#define TYPE_COLOR_BR_TYPE Color&
#define TYPE_ACOLOR_BR_TYPE AColor&
#define TYPE_FPVALUE_BR_TYPE FPValue&
#define TYPE_DWORD_BR_TYPE DWORD&
#define TYPE_bool_BR_TYPE bool&
#define TYPE_INTPTR_BR_TYPE INT_PTR&
#define TYPE_INT64_BR_TYPE INT64&
#define TYPE_DOUBLE_BR_TYPE double&
// Tab<> by-reference
#define TYPE_FLOAT_TAB_BR_TYPE Tab<float>&
#define TYPE_INT_TAB_BR_TYPE Tab<int>&
#define TYPE_RGBA_TAB_BR_TYPE Tab<Point3>&
#define TYPE_POINT3_TAB_BR_TYPE Tab<Point3>&
#define TYPE_FRGBA_TAB_BR_TYPE Tab<Point4>&
#define TYPE_POINT4_TAB_BR_TYPE Tab<Point4>&
#define TYPE_BOOL_TAB_BR_TYPE Tab<BOOL>&
#define TYPE_ANGLE_TAB_BR_TYPE Tab<float>&
#define TYPE_PCNT_FRAC_TAB_BR_TYPE Tab<float>&
#define TYPE_WORLD_TAB_BR_TYPE Tab<float>&
#define TYPE_STRING_TAB_BR_TYPE Tab<MCHAR*>&
#define TYPE_FILENAME_TAB_BR_TYPE Tab<MCHAR*>&
#define TYPE_HSV_TAB_BR_TYPE Tab<Point3>&
#define TYPE_COLOR_CHANNEL_TAB_BR_TYPE Tab<float>&
#define TYPE_TIMEVALUE_TAB_BR_TYPE Tab<int>&
#define TYPE_RADIOBTN_INDEX_TAB_BR_TYPE Tab<int>&
#define TYPE_MTL_TAB_BR_TYPE Tab<Mtl*>&
#define TYPE_TEXMAP_TAB_BR_TYPE Tab<Texmap*>&
#define TYPE_BITMAP_TAB_BR_TYPE Tab<PBBitmap*>&
#define TYPE_INODE_TAB_BR_TYPE Tab<INode*>&
#define TYPE_REFTARG_TAB_BR_TYPE Tab<ReferenceTarget*>&
#define TYPE_INDEX_TAB_BR_TYPE Tab<int>&
#define TYPE_ENUM_TAB_BR_TYPE Tab<int>&
#define TYPE_MATRIX3_TAB_BR_TYPE Tab<Matrix*>&
#define TYPE_VOID_TAB_BR_TYPE Tab<void>&
#define TYPE_INTERVAL_TAB_BR_TYPE Tab<Interval*>&
#define TYPE_ANGAXIS_TAB_BR_TYPE Tab<AngAxis*>&
#define TYPE_QUAT_TAB_BR_TYPE Tab<Quat*>&
#define TYPE_RAY_TAB_BR_TYPE Tab<Ray*>&
#define TYPE_POINT2_TAB_BR_TYPE Tab<Point2*>&
#define TYPE_BITARRAY_TAB_BR_TYPE Tab<BitArray*>&
#define TYPE_CLASS_TAB_BR_TYPE Tab<ClassID*>&
#define TYPE_MESH_TAB_BR_TYPE Tab<Mesh*>&
#define TYPE_OBJECT_TAB_BR_TYPE Tab<Object*>&
#define TYPE_CONTROL_TAB_BR_TYPE Tab<Control*>&
#define TYPE_POINT_TAB_BR_TYPE Tab<POINT*>&
#define TYPE_TSTR_TAB_BR_TYPE Tab<MSTR*>&
#define TYPE_IOBJECT_TAB_BR_TYPE Tab<IObject*>&
#define TYPE_INTERFACE_TAB_BR_TYPE Tab<FPInterface*>&
#define TYPE_HWND_TAB_BR_TYPE Tab<HWND>&
#define TYPE_NAME_TAB_BR_TYPE Tab<MCHAR*>&
#define TYPE_COLOR_TAB_BR_TYPE Tab<Color*>&
#define TYPE_ACOLOR_TAB_BR_TYPE Tab<AColor*>&
#define TYPE_FPVALUE_TAB_BR_TYPE Tab<FPValue*>&
#define TYPE_VALUE_TAB_BR_TYPE Tab<Value*>&
#define TYPE_DWORD_TAB_BR_TYPE Tab<DWORD>&
#define TYPE_bool_TAB_BR_TYPE Tab<bool>&
#define TYPE_INTPTR_TAB_BR_TYPE Tab<INT_PTR>&
#define TYPE_INT64_TAB_BR_TYPE Tab<INT64>&
#define TYPE_DOUBLE_TAB_BR_TYPE Tab<double>&
// by-value
#define TYPE_RGBA_BV_TYPE Point3
#define TYPE_POINT3_BV_TYPE Point3
#define TYPE_HSV_BV_TYPE Point3
#define TYPE_FRGBA_BV_TYPE Point4
#define TYPE_POINT4_BV_TYPE Point4
#define TYPE_BITMAP_BV_TYPE PBBitmap
#define TYPE_MATRIX3_BV_TYPE Matrix3
#define TYPE_ANGAXIS_BV_TYPE AngAxis
#define TYPE_QUAT_BV_TYPE Quat
#define TYPE_BITARRAY_BV_TYPE BitArray
#define TYPE_RAY_BV_TYPE Ray
#define TYPE_POINT2_BV_TYPE Point2
#define TYPE_MESH_BV_TYPE Mesh
#define TYPE_INTERVAL_BV_TYPE Interval
#define TYPE_POINT_BV_TYPE POINT
#define TYPE_TSTR_BV_TYPE MSTR
#define TYPE_COLOR_BV_TYPE Color
#define TYPE_ACOLOR_BV_TYPE AColor
#define TYPE_FPVALUE_BV_TYPE FPValue
#define TYPE_CLASS_BV_TYPE ClassID
// by-val Tab<>
#define TYPE_FLOAT_TAB_BV_TYPE Tab<float>
#define TYPE_INT_TAB_BV_TYPE Tab<int>
#define TYPE_RGBA_TAB_BV_TYPE Tab<Point3>
#define TYPE_POINT3_TAB_BV_TYPE Tab<Point3>
#define TYPE_FRGBA_TAB_BV_TYPE Tab<Point4>
#define TYPE_POINT4_TAB_BV_TYPE Tab<Point4>
#define TYPE_BOOL_TAB_BV_TYPE Tab<BOOL>
#define TYPE_ANGLE_TAB_BV_TYPE Tab<float>
#define TYPE_PCNT_FRAC_TAB_BV_TYPE Tab<float>
#define TYPE_WORLD_TAB_BV_TYPE Tab<float>
#define TYPE_STRING_TAB_BV_TYPE Tab<MCHAR*>
#define TYPE_FILENAME_TAB_BV_TYPE Tab<MCHAR*>
#define TYPE_HSV_TAB_BV_TYPE Tab<Point3>
#define TYPE_COLOR_CHANNEL_TAB_BV_TYPE Tab<float>
#define TYPE_TIMEVALUE_TAB_BV_TYPE Tab<int>
#define TYPE_RADIOBTN_INDEX_TAB_BV_TYPE Tab<int>
#define TYPE_MTL_TAB_BV_TYPE Tab<Mtl*>
#define TYPE_TEXMAP_TAB_BV_TYPE Tab<Texmap*>
#define TYPE_BITMAP_TAB_BV_TYPE Tab<PBBitmap*>
#define TYPE_INODE_TAB_BV_TYPE Tab<INode*>
#define TYPE_REFTARG_TAB_BV_TYPE Tab<ReferenceTarget*>
#define TYPE_INDEX_TAB_BV_TYPE Tab<int>
#define TYPE_ENUM_TAB_BV_TYPE Tab<int>
#define TYPE_MATRIX3_TAB_BV_TYPE Tab<Matrix*>
#define TYPE_VOID_TAB_BV_TYPE Tab<void>
#define TYPE_INTERVAL_TAB_BV_TYPE Tab<Interval*>
#define TYPE_ANGAXIS_TAB_BV_TYPE Tab<AngAxis*>
#define TYPE_QUAT_TAB_BV_TYPE Tab<Quat*>
#define TYPE_RAY_TAB_BV_TYPE Tab<Ray*>
#define TYPE_POINT2_TAB_BV_TYPE Tab<Point2*>
#define TYPE_BITARRAY_TAB_BV_TYPE Tab<BitArray*>
#define TYPE_CLASS_TAB_BV_TYPE Tab<ClassID*>
#define TYPE_MESH_TAB_BV_TYPE Tab<Mesh*>
#define TYPE_OBJECT_TAB_BV_TYPE Tab<Object*>
#define TYPE_CONTROL_TAB_BV_TYPE Tab<Control*>
#define TYPE_POINT_TAB_BV_TYPE Tab<POINT*>
#define TYPE_TSTR_TAB_BV_TYPE Tab<MSTR*>
#define TYPE_IOBJECT_TAB_BV_TYPE Tab<IObject*>
#define TYPE_INTERFACE_TAB_BV_TYPE Tab<FPInterface*>
#define TYPE_HWND_TAB_BV_TYPE Tab<HWND>
#define TYPE_NAME_TAB_BV_TYPE Tab<MCHAR*>
#define TYPE_COLOR_TAB_BV_TYPE Tab<Color*>
#define TYPE_ACOLOR_TAB_BV_TYPE Tab<AColor*>
#define TYPE_FPVALUE_TAB_BV_TYPE Tab<FPValue*>
#define TYPE_VALUE_TAB_BV_TYPE Tab<Value*>
#define TYPE_DWORD_TAB_BV_TYPE Tab<DWORD>
#define TYPE_bool_TAB_BV_TYPE Tab<bool>
#define TYPE_INTPTR_TAB_BV_TYPE Tab<INT_PTR>
#define TYPE_INT64_TAB_BV_TYPE Tab<INT64>
#define TYPE_DOUBLE_TAB_BV_TYPE Tab<double>
#endif //__IFNPUB__
| [
"[email protected]"
]
| [
[
[
1,
3301
]
]
]
|
92cf1195518a8cfdf968e5a32549a84b37f3771a | f6a8ffe1612a9a39fc1daa4e7849cad56ec351f0 | /ChromaKeyer/trunk/ChromaKeyer/ImageObject.h | 09cc585f5722dbae079c72dd2fd898e9ac176e35 | []
| no_license | comebackfly/c-plusplus-programming | 03e097ec5b85a4bf1d8fdd47041a82d7b6ca0753 | d9b2fb3caa60459fe459cacc5347ccc533b4b1ec | refs/heads/master | 2021-01-01T18:12:09.667814 | 2011-07-18T22:30:31 | 2011-07-18T22:30:31 | 35,753,632 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 476 | h | #pragma once
class ImageObject
{
public:
ImageObject(void);
ImageObject(unsigned char* pix, int width, int height, int bpp);
~ImageObject(void);
int* getPixelValue(int index);
int getWidth();
int getHeight();
int getBytesPerPixel();
unsigned char* getImageContent();
void setPixelValue(int index, int* values);
int* addPixelValues(int* pixelOne, int* pixelTwo );
private:
unsigned char *imageContent;
int width;
int height;
int bpp;
}; | [
"[email protected]@5f9f56c3-fb77-04ef-e3c5-e71eb3e36737"
]
| [
[
[
1,
24
]
]
]
|
dd985c94ac92e07b45e91bd57f808de351b87971 | 5d35825d03fbfe9885316ec7d757b7bcb8a6a975 | /src/CheckBox.cpp | b7b9bf8543b923b69e7406c98bb78bcba9854c2f | []
| no_license | jjzhang166/3D-Landscape-linux | ce887d290b72ebcc23386782dd30bdd198db93ef | 4f87eab887750e3dc5edcb524b9e1ad99977bd94 | refs/heads/master | 2023-03-15T05:24:40.303445 | 2010-03-25T00:23:43 | 2010-03-25T00:23:43 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,633 | cpp | #include "CheckBox.h"
CheckBox::CheckBox(int x, int y, int width, int height,
int layout, QString title)
{
this->x = x;
this->y = y;
this->width = width;
this->height = height;
this->layout = layout;
this->spacing = 5;
this->title = title;
this->title_size = (int)(this->height * 0.2);
this->titleTextR.setX(this->x + this->spacing);
this->titleTextR.setY(this->y + this->spacing);
this->titleTextR.setWidth(this->width - this->spacing*2);
this->titleTextR.setHeight(this->title_size - this->spacing*2);
}
//items QList should be populated beforehand
void CheckBox::initialize()
{
int currX = this->x + this->spacing;
int currY = this->y + this->spacing + this->title_size;
int itemHeight = 0;
int itemWidth = 0;
int itemSpacing = 0;
if(!layout)
{
//itemHeight = (this->height - this->title_size - this->spacing -
// (this->items.size() * this->spacing)) / this->items.size();
itemHeight = (this->height - this->title_size - this->spacing -
(this->items.size() * this->spacing)) / this->items.size();
//currX += (this->width/2) - (itemSize/2);
if(this->items.size() > 1)
itemSpacing = (this->height - this->title_size - this->spacing*2 -
(itemHeight * this->items.size())) / (this->items.size() - 1);
else
itemSpacing = this->spacing;
}
else
{
//itemWidth = (this->width - this->spacing -
// (this->items.size() * this->spacing)) / this->items.size();
itemWidth = (this->width - this->spacing -
(this->items.size() * this->spacing)) / this->items.size();
if(this->items.size() > 1)
itemSpacing = (this->width - this->spacing*2 -
(itemWidth * this->items.size())) / (this->items.size() - 1);
else
itemSpacing = this->spacing;
//currY += (this->height/2) - (itemSize/2) + this->title_size;
}
for(int i = 0; i < this->items.size(); i++)
{
if(layout)
{
this->items[i]->width = itemWidth;
this->items[i]->height = this->height - this->spacing*2;
this->items[i]->x = currX;
this->items[i]->y = currY;
currX += this->items[i]->width + itemSpacing;
}
else
{
this->items[i]->height = itemHeight;
this->items[i]->width = this->width - this->spacing*2;
this->items[i]->x = currX;
this->items[i]->y = currY;
currY += this->items[i]->height + itemSpacing;
}
this->items[i]->calculateInnerPositions();
}
}
void CheckBox::render(QPainter *painter)
{
QBrush brush(QColor(255, 255, 255, 200));
painter->setBrush(brush);
painter->setPen(QPen(QColor(0, 0, 0, 200)));
painter->drawRoundedRect(this->x, this->y, this->width, this->height, 5, 5);
QFont titleFont("Arial");
titleFont.setPixelSize(this->titleTextR.height());
QFontMetrics fm(titleFont);
int textWidthInPixels = fm.width(this->title);
if ( textWidthInPixels > (this->titleTextR.width()))
{
titleFont.setStretch
((100 * this->titleTextR.width()) / textWidthInPixels) ;
}
painter->setFont(titleFont);
painter->drawText(this->titleTextR, Qt::AlignCenter, this->title);
for(int i = 0; i < this->items.size(); i++)
{
this->items[i]->render(painter);
}
}
void CheckBox::resize(int x, int y, int width, int height)
{
this->x = x;
this->y = y;
this->width = width;
this->height = height;
this->title_size = (int)(this->height * 0.2);
this->titleTextR.setX(this->x + this->spacing);
this->titleTextR.setY(this->y + this->spacing);
this->titleTextR.setWidth(this->width - this->spacing*2);
this->titleTextR.setHeight(this->title_size - this->spacing*2);
this->initialize();
}
void CheckBox::processMouseEvent(QMouseEvent *e)
{
for(int i = 0; i < this->items.size(); i++)
{
if(this->items[i]->isInside(e->x(), e->y()))
{
cout << "Item clicked: " <<
this->items[i]->label.toStdString() << endl;
}
}
}
CheckBox::~CheckBox()
{
for(int i = 0; i < this->items.size(); i++)
{
delete this->items[i];
}
}
| [
"[email protected]"
]
| [
[
[
1,
160
]
]
]
|
88cd0e3dccade3104762f6a5dffccab9970feb8c | fcdddf0f27e52ece3f594c14fd47d1123f4ac863 | /terralib/src/terralib/image_processing/TePDIPrincipalComponentsFusion.hpp | 5887f45b265770523e7f2525da3d50e41d469b19 | []
| no_license | radtek/terra-printer | 32a2568b1e92cb5a0495c651d7048db6b2bbc8e5 | 959241e52562128d196ccb806b51fda17d7342ae | refs/heads/master | 2020-06-11T01:49:15.043478 | 2011-12-12T13:31:19 | 2011-12-12T13:31:19 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,540 | hpp | /*
TerraLib - a library for developing GIS applications.
Copyright 2001, 2002, 2003 INPE and Tecgraf/PUC-Rio.
This code is part of the TerraLib library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
You should have received a copy of the GNU Lesser General Public
License along with this library.
The authors reassure the license terms regarding the warranties.
They specifically disclaim any warranties, including, but not limited to,
the implied warranties of merchantability and fitness for a particular
purpose. The library provided hereunder is on an "as is" basis, and the
authors have no obligation to provide maintenance, support, updates,
enhancements, or modifications.
In no event shall INPE be held liable to any party
for direct, indirect, special, incidental, or consequential damages arising
out of the use of this library and its documentation.
*/
#ifndef TEPDIPRINCIPALCOMPONENTSFUSION_HPP
#define TEPDIPRINCIPALCOMPONENTSFUSION_HPP
#include "TePDIAlgorithm.hpp"
/**
* @brief This is the class for principal components generation.
* @author Felipe Castro da Silva <[email protected]>
* @ingroup PDIFusionAlgorithms
*
* @note The required parameters are:
*
* @param input_rasters (TePDITypes::TePDIRasterVectorType) - Low resolution rasters.
* @param bands (std::vector< int >) - The bands from each low resolution raster.
* @param output_rasters (TePDITypes::TePDIRasterVectorType) - High resolution fused rasters.
* @param reference_raster (TePDITypes::TePDIRasterPtrType) - High resolution raster.
* @param reference_raster_band (int) - Reference raster band number.
* @param resampling_type (TePDIInterpolator::InterpMethod) -
* Resampling type.
* @param fit_histogram (bool) - Fit the reference histogram to the
* low resolution rasters histograms (better collor quality).
* @param output_rasters (TePDITypes::TePDIRasterVectorType) - High resolution fused rasters.
*
*/
class PDI_DLL TePDIPrincipalComponentsFusion : public TePDIAlgorithm {
public :
/**
* @brief Default Constructor.
*
*/
TePDIPrincipalComponentsFusion();
/**
* @brief Default Destructor
*/
~TePDIPrincipalComponentsFusion();
/**
* @brief Checks if the supplied parameters fits the requirements of each
* PDI algorithm implementation.
*
* @note Error log messages must be generated. No exceptions generated.
*
* @param parameters The parameters to be checked.
* @return true if the parameters are OK. false if not.
*/
bool CheckParameters( const TePDIParameters& parameters ) const;
protected :
/**
* @brief Decide the direction of the analysis based on the analysis_type parameter.
*
* @return true if OK. false on error.
*/
bool RunImplementation();
/**
* @brief Reset the internal state to the initial state.
*
* @param params The new parameters referente at initial state.
*/
void ResetState( const TePDIParameters& params );
};
/** @example TePDIFusion_test.cpp
* Fusion algorithms test.
*/
#endif //TEPDIPRINCIPALCOMPONENTS_HPP
| [
"[email protected]@58180da6-ba8b-8960-36a5-00cc02a3ddec"
]
| [
[
[
1,
95
]
]
]
|
893a8640c23c918c8921af5231160194e516a296 | 6dac9369d44799e368d866638433fbd17873dcf7 | /src/branches/01032005/include/sound/ISoundBuffer.h | 48a88d4461e117e22d310e4083e5aac86629997c | []
| no_license | christhomas/fusionengine | 286b33f2c6a7df785398ffbe7eea1c367e512b8d | 95422685027bb19986ba64c612049faa5899690e | refs/heads/master | 2020-04-05T22:52:07.491706 | 2006-10-24T11:21:28 | 2006-10-24T11:21:28 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,509 | h | #ifndef _ISOUNDBUFFER_H_
#define _ISOUNDBUFFER_H_
#include <vector>
/** @ingroup Sound_Group
* @brief The base class for all Sound buffers
*/
class ISoundBuffer{
protected:
/** @var unsigned int m_channel
* @brief The id of the sound channel
*/
unsigned int m_channel;
public:
/** @var unsigned int m_id;
* @brief The id of the sound object within fusion
*/
unsigned int m_id;
/** @typedef std::vector<ISoundBuffer *> soundbuffer_t
* @brief An array of soundbuffers
*/
typedef std::vector<ISoundBuffer *> soundbuffer_t;
/** Soundbuffer base class Constructor */
ISoundBuffer(){};
/** Soundbuffer base class Deconstructor */
virtual ~ISoundBuffer(){};
/** Loads a sound source from a file */
virtual bool Load(std::string filename) = 0;
/** Closes the sound object */
virtual bool Close(void) = 0;
/** Plays the sound object */
virtual int Play(void) = 0;
/** Pauses the sound object */
virtual bool Pause(bool pause) = 0;
/** Stops the sound object */
virtual bool Stop(void) = 0;
/** Sets the play position within the sound source */
virtual bool SetPosition(int position) = 0;
/** Sets the volume of the sound source
*
* @todo Should I implement the volume as a percentage? map 0 -> 255 onto 0 -> 100 for example
*/
virtual bool Volume(unsigned char volume) = 0;
/** Requests the status of the sound object */
virtual bool IsPlaying(void) = 0;
};
#endif // #ifndef _ISOUNDBUFFER_H_
| [
"chris_a_thomas@1bf15c89-c11e-0410-aefd-b6ca7aeaabe7"
]
| [
[
[
1,
60
]
]
]
|
3f51993149101d41e79b06ec8e7878928f55582a | f177993b13e97f9fecfc0e751602153824dfef7e | /ImProSln/OSCSender/stdafx.cpp | c3e5bf1e73dca822ff88a3f82c8cb84402bf484e | []
| no_license | svn2github/imtophooksln | 7bd7412947d6368ce394810f479ebab1557ef356 | bacd7f29002135806d0f5047ae47cbad4c03f90e | refs/heads/master | 2020-05-20T04:00:56.564124 | 2010-09-24T09:10:51 | 2010-09-24T09:10:51 | 11,787,598 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 296 | cpp | // stdafx.cpp : source file that includes just the standard includes
// OSCSender.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
// TODO: reference any additional headers you need in STDAFX.H
// and not in this file
| [
"ndhumuscle@fa729b96-8d43-11de-b54f-137c5e29c83a"
]
| [
[
[
1,
8
]
]
]
|
44ce5a4862bc66d2a0cc8df14d366f1b202306ea | 2982a765bb21c5396587c86ecef8ca5eb100811f | /util/wm5/LibMathematics/ComputationalGeometry/Wm5Delaunay3.cpp | 8a27cbc560af93bb7886ab9d75c87f7f9afabcf9 | []
| no_license | evanw/cs224final | 1a68c6be4cf66a82c991c145bcf140d96af847aa | af2af32732535f2f58bf49ecb4615c80f141ea5b | refs/heads/master | 2023-05-30T19:48:26.968407 | 2011-05-10T16:21:37 | 2011-05-10T16:21:37 | 1,653,696 | 27 | 9 | null | null | null | null | UTF-8 | C++ | false | false | 39,082 | cpp | // Geometric Tools, LLC
// Copyright (c) 1998-2010
// Distributed under the Boost Software License, Version 1.0.
// http://www.boost.org/LICENSE_1_0.txt
// http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt
//
// File Version: 5.0.4 (2010/12/22)
#include "Wm5MathematicsPCH.h"
#include "Wm5Delaunay3.h"
#include "Wm5Delaunay2.h"
#include "Wm5Query3Filtered.h"
#include "Wm5Query3Int64.h"
#include "Wm5Query3Integer.h"
#include "Wm5Query3Rational.h"
// Indexing for the vertices of the triangle opposite a vertex. The triangle
// opposite vertex j is
// <gsIndex[j][0], gsIndex[j][1], gsIndex[j][2]>
// and is listed in counterclockwise order when viewed from outside the
// tetrahedron.
static const int gsIndex[4][3] = { {1,2,3}, {0,3,2}, {0,1,3}, {0,2,1} };
namespace Wm5
{
//----------------------------------------------------------------------------
template <typename Real>
Delaunay3<Real>::Delaunay3 (int numVertices, Vector3<Real>* vertices,
Real epsilon, bool owner, Query::Type queryType)
:
Delaunay<Real>(numVertices, epsilon, owner, queryType),
mVertices(vertices),
mNumUniqueVertices(0),
mSVertices(0),
mQuery(0),
mLineOrigin(Vector3<Real>::ZERO),
mLineDirection(Vector3<Real>::ZERO),
mPlaneOrigin(Vector3<Real>::ZERO),
mPathLast(-1),
mPath(0),
mLastFaceV0(-1),
mLastFaceV1(-1),
mLastFaceV2(-1),
mLastFaceOpposite(-1),
mLastFaceOppositeIndex(-1)
{
mPlaneDirection[0] = Vector3<Real>::ZERO;
mPlaneDirection[1] = Vector3<Real>::ZERO;
typename Vector3<Real>::Information info;
Vector3<Real>::GetInformation(mNumVertices, mVertices, mEpsilon, info);
if (info.mDimension == 0)
{
// The values of mDimension, mIndices, and mAdjacencies were
// already initialized by the Delaunay base class.
return;
}
if (info.mDimension == 1)
{
// The set is (nearly) collinear. The caller is responsible for
// creating a Delaunay1 object.
mDimension = 1;
mLineOrigin = info.mOrigin;
mLineDirection = info.mDirection[0];
return;
}
if (info.mDimension == 2)
{
// The set is (nearly) coplanar. The caller is responsible for
// creating a Delaunay2 object.
mDimension = 2;
mPlaneOrigin = info.mOrigin;
mPlaneDirection[0] = info.mDirection[0];
mPlaneDirection[1] = info.mDirection[1];
return;
}
mDimension = 3;
// Allocate storage for the input vertices and the supertetrahedron
// vertices.
mSVertices = new1<Vector3<Real> >(mNumVertices + 4);
int i;
if (queryType != Query::QT_RATIONAL && queryType != Query::QT_FILTERED)
{
// Transform the vertices to the cube [0,1]^3.
mMin = Vector3<Real>(info.mMin[0], info.mMin[1], info.mMin[2]);
mScale = ((Real)1)/info.mMaxRange;
for (i = 0; i < mNumVertices; ++i)
{
mSVertices[i] = (mVertices[i] - mMin)*mScale;
}
// Construct the supertetrahedron to contain [0,1]^3.
mSupervertices[0] = mNumVertices++;
mSupervertices[1] = mNumVertices++;
mSupervertices[2] = mNumVertices++;
mSupervertices[3] = mNumVertices++;
mSVertices[mSupervertices[0]] = Vector3<Real>((Real)-1,(Real)-1,
(Real)-1);
mSVertices[mSupervertices[1]] = Vector3<Real>((Real)+6,(Real)-1,
(Real)-1);
mSVertices[mSupervertices[2]] = Vector3<Real>((Real)-1,(Real)+6,
(Real)-1);
mSVertices[mSupervertices[3]] = Vector3<Real>((Real)-1,(Real)-1,
(Real)+6);
Real expand;
if (queryType == Query::QT_INT64)
{
// Scale the vertices to the cube [0,2^{10}]^3 to allow use of
// 64-bit integers for tetrahedralization.
expand = (Real)(1 << 10);
mQuery = new0 Query3Int64<Real>(mNumVertices, mSVertices);
}
else if (queryType == Query::QT_INTEGER)
{
// Scale the vertices to the cube [0,2^{20}]^3 to get more
// precision for TInteger than for 64-bit integers for
// tetrahedralization.
expand = (Real)(1 << 20);
mQuery = new0 Query3Integer<Real>(mNumVertices, mSVertices);
}
else // queryType == Query::QT_REAL
{
// No scaling for floating point.
expand = (Real)1;
mQuery = new0 Query3<Real>(mNumVertices, mSVertices);
}
mScale *= expand;
for (i = 0; i < mNumVertices; ++i)
{
mSVertices[i] *= expand;
}
}
else
{
// No transformation needed for exact rational arithmetic.
mMin = Vector3<Real>::ZERO;
mScale = (Real)1;
memcpy(mSVertices, mVertices, mNumVertices*sizeof(Vector3<Real>));
// Construct the supertriangle to contain [min,max].
Vector3<Real> minValue =
Vector3<Real>(info.mMin[0], info.mMin[1], info.mMin[2]);
Vector3<Real> maxValue =
Vector3<Real>(info.mMax[0], info.mMax[1], info.mMax[2]);
Vector3<Real> delta = maxValue - minValue;
Vector3<Real> superMin = minValue - delta;
Vector3<Real> superMax = maxValue + ((Real)5.0)*delta;
mSupervertices[0] = mNumVertices++;
mSupervertices[1] = mNumVertices++;
mSupervertices[2] = mNumVertices++;
mSupervertices[3] = mNumVertices++;
mSVertices[mSupervertices[0]] = superMin;
mSVertices[mSupervertices[1]] = Vector3<Real>(superMax[0],
superMin[1], superMin[2]);
mSVertices[mSupervertices[2]] = Vector3<Real>(superMin[0],
superMax[1], superMin[2]);
mSVertices[mSupervertices[3]] = Vector3<Real>(superMin[0],
superMin[1], superMax[2]);
if (queryType == Query::QT_RATIONAL)
{
mQuery = new0 Query3Rational<Real>(mNumVertices, mSVertices);
}
else // queryType == Query::QT_FILTERED
{
mQuery = new0 Query3Filtered<Real>(mNumVertices, mSVertices,
mEpsilon);
}
}
Tetrahedron* tetra = new0 Tetrahedron(mSupervertices[0],
mSupervertices[1], mSupervertices[2], mSupervertices[3]);
mTetrahedra.insert(tetra);
// Incrementally update the tetrahedralization. The set of processed
// points is maintained to eliminate duplicates, either in the original
// input points or in the points obtained by snap rounding.
std::set<Vector3<Real> > processed;
for (i = 0; i < mNumVertices - 4; ++i)
{
if (processed.find(mSVertices[i]) == processed.end())
{
Update(i);
processed.insert(mSVertices[i]);
}
}
mNumUniqueVertices = (int)processed.size();
// Remove tetrahedra sharing a vertex of the supertetrahedron.
RemoveTetrahedra();
// Assign integer values to the tetrahedra for use by the caller.
std::map<Tetrahedron*,int> permute;
typename std::set<Tetrahedron*>::iterator iter = mTetrahedra.begin();
typename std::set<Tetrahedron*>::iterator end = mTetrahedra.end();
for (i = 0; iter != end; ++iter)
{
tetra = *iter;
permute[tetra] = i++;
}
permute[(Tetrahedron*)0] = -1;
// Put Delaunay tetrahedra into an array (vertices and adjacency info).
mNumSimplices = (int)mTetrahedra.size();
if (mNumSimplices > 0)
{
mIndices = new1<int>(4*mNumSimplices);
mAdjacencies = new1<int>(4*mNumSimplices);
i = 0;
iter = mTetrahedra.begin();
end = mTetrahedra.end();
for (/**/; iter != end; ++iter)
{
tetra = *iter;
mIndices[i] = tetra->V[0];
mAdjacencies[i] = permute[tetra->Adj[0]];
++i;
mIndices[i] = tetra->V[1];
mAdjacencies[i] = permute[tetra->Adj[1]];
++i;
mIndices[i] = tetra->V[2];
mAdjacencies[i] = permute[tetra->Adj[2]];
++i;
mIndices[i] = tetra->V[3];
mAdjacencies[i] = permute[tetra->Adj[3]];
++i;
}
assertion(i == 4*mNumSimplices, "Unexpected mismatch\n");
mPathLast = -1;
mPath = new1<int>(mNumSimplices + 1);
memset(mPath, 0, (mNumSimplices + 1)*sizeof(int));
}
// Restore the vertex count to the original (discards the vertices of the
// supertetrahedron).
mNumVertices -= 4;
iter = mTetrahedra.begin();
end = mTetrahedra.end();
for (/**/; iter != end; ++iter)
{
tetra = *iter;
delete0(tetra);
}
}
//----------------------------------------------------------------------------
template <typename Real>
Delaunay3<Real>::~Delaunay3 ()
{
delete0(mQuery);
delete1(mSVertices);
delete1(mPath);
if (mOwner)
{
delete1(mVertices);
}
}
//----------------------------------------------------------------------------
template <typename Real>
const Vector3<Real>* Delaunay3<Real>::GetVertices () const
{
return mVertices;
}
//----------------------------------------------------------------------------
template <typename Real>
int Delaunay3<Real>::GetNumUniqueVertices () const
{
return mNumUniqueVertices;
}
//----------------------------------------------------------------------------
template <typename Real>
const Vector3<Real>& Delaunay3<Real>::GetLineOrigin () const
{
return mLineOrigin;
}
//----------------------------------------------------------------------------
template <typename Real>
const Vector3<Real>& Delaunay3<Real>::GetLineDirection () const
{
return mLineDirection;
}
//----------------------------------------------------------------------------
template <typename Real>
Delaunay1<Real>* Delaunay3<Real>::GetDelaunay1 () const
{
assertion(mDimension == 1, "The dimension must be 1\n");
if (mDimension != 1)
{
return 0;
}
Real* projection = new1<Real>(mNumVertices);
for (int i = 0; i < mNumVertices; ++i)
{
Vector3<Real> diff = mVertices[i] - mLineOrigin;
projection[i] = mLineDirection.Dot(diff);
}
return new0 Delaunay1<Real>(mNumVertices, projection, mEpsilon, true,
mQueryType);
}
//----------------------------------------------------------------------------
template <typename Real>
const Vector3<Real>& Delaunay3<Real>::GetPlaneOrigin () const
{
return mPlaneOrigin;
}
//----------------------------------------------------------------------------
template <typename Real>
const Vector3<Real>& Delaunay3<Real>::GetPlaneDirection (int i) const
{
return mPlaneDirection[i];
}
//----------------------------------------------------------------------------
template <typename Real>
Delaunay2<Real>* Delaunay3<Real>::GetDelaunay2 () const
{
assertion(mDimension == 2, "The dimension must be 2\n");
if (mDimension != 2)
{
return 0;
}
Vector2<Real>* projection = new1<Vector2<Real> >(mNumVertices);
for (int i = 0; i < mNumVertices; ++i)
{
Vector3<Real> diff = mVertices[i] - mPlaneOrigin;
projection[i][0] = mPlaneDirection[0].Dot(diff);
projection[i][1] = mPlaneDirection[1].Dot(diff);
}
return new0 Delaunay2<Real>(mNumVertices, projection, mEpsilon, true,
mQueryType);
}
//----------------------------------------------------------------------------
template <typename Real>
bool Delaunay3<Real>::GetHull (int& numTriangles, int*& indices) const
{
assertion(mDimension == 3, "The dimension must be 3\n");
if (mDimension != 3)
{
return false;
}
numTriangles = 0;
indices = 0;
// Count the number of triangles that are not shared by two tetrahedra.
int i, numAdjacent = 4*mNumSimplices;
for (i = 0; i < numAdjacent; ++i)
{
if (mAdjacencies[i] == -1)
{
numTriangles++;
}
}
assertion(numTriangles > 0, "There must be at least one tetrahedron\n");
if (numTriangles == 0)
{
return false;
}
// Enumerate the triangles. The prototypical case is the single
// tetrahedron V[0] = (0,0,0), V[1] = (1,0,0), V[2] = (0,1,0), and
// V[3] = (0,0,1) with no adjacent tetrahedra. The mIndices[] array
// is <0,1,2,3>.
// i = 0, face = 0:
// skip index 0, <x,1,2,3>, no swap, triangle = <1,2,3>
// i = 1, face = 1:
// skip index 1, <0,x,2,3>, swap, triangle = <0,3,2>
// i = 2, face = 2:
// skip index 2, <0,1,x,3>, no swap, triangle = <0,1,3>
// i = 3, face = 3:
// skip index 3, <0,1,2,x>, swap, triangle = <0,2,1>
// To guarantee counterclockwise order of triangles when viewed outside
// the tetrahedron, the swap of the last two indices occurs when
// iFace is an odd number: (iFace % 2) != 0
indices = new1<int>(3*numTriangles);
int* currentIndex = indices;
for (i = 0; i < numAdjacent; ++i)
{
if (mAdjacencies[i] == -1)
{
int tetra = i/4, face = i%4;
for (int j = 0; j < 4; ++j)
{
if (j != face)
{
*currentIndex++ = mIndices[4*tetra + j];
}
}
if ((face % 2) != 0)
{
int save = *(currentIndex-1);
*(currentIndex-1) = *(currentIndex-2);
*(currentIndex-2) = save;
}
}
}
return true;
}
//----------------------------------------------------------------------------
template <typename Real>
int Delaunay3<Real>::GetContainingTetrahedron (const Vector3<Real>& p) const
{
assertion(mDimension == 3, "The dimension must be 3\n");
if (mDimension != 3)
{
return -1;
}
// Convert to scaled coordinates.
Vector3<Real> scP = (p - mMin)*mScale;
// Start at first tetrahedron in mesh.
int index = (mPathLast >= 0 ? mPath[mPathLast] : 0);
mPathLast = -1;
mLastFaceV0 = -1;
mLastFaceV1 = -1;
mLastFaceV2 = -1;
mLastFaceOpposite = -1;
mLastFaceOppositeIndex = -1;
// Use tetrahedron faces as binary separating planes.
for (int i = 0; i < mNumSimplices; ++i)
{
mPath[++mPathLast] = index;
int* vertices = &mIndices[4*index];
// <V1,V2,V3> counterclockwise when viewed outside tetrahedron.
if (mQuery->ToPlane(scP, vertices[1], vertices[2], vertices[3]) > 0)
{
index = mAdjacencies[4*index];
if (index == -1)
{
mLastFaceV0 = vertices[1];
mLastFaceV1 = vertices[2];
mLastFaceV2 = vertices[3];
mLastFaceOpposite = vertices[0];
mLastFaceOppositeIndex = 0;
return -1;
}
continue;
}
// <V0,V3,V2> counterclockwise when viewed outside tetrahedron.
if (mQuery->ToPlane(scP, vertices[0], vertices[2], vertices[3]) < 0)
{
index = mAdjacencies[4*index + 1];
if (index == -1)
{
mLastFaceV0 = vertices[0];
mLastFaceV1 = vertices[2];
mLastFaceV2 = vertices[3];
mLastFaceOpposite = vertices[1];
mLastFaceOppositeIndex = 1;
return -1;
}
continue;
}
// <V0,V1,V3> counterclockwise when viewed outside tetrahedron.
if (mQuery->ToPlane(scP, vertices[0], vertices[1], vertices[3]) > 0)
{
index = mAdjacencies[4*index + 2];
if (index == -1)
{
mLastFaceV0 = vertices[0];
mLastFaceV1 = vertices[1];
mLastFaceV2 = vertices[3];
mLastFaceOpposite = vertices[2];
mLastFaceOppositeIndex = 2;
return -1;
}
continue;
}
// <V0,V2,V1> counterclockwise when viewed outside tetrahedron.
if (mQuery->ToPlane(scP, vertices[0], vertices[1], vertices[2]) < 0)
{
index = mAdjacencies[4*index + 3];
if (index == -1)
{
mLastFaceV0 = vertices[0];
mLastFaceV1 = vertices[1];
mLastFaceV2 = vertices[2];
mLastFaceOpposite = vertices[3];
mLastFaceOppositeIndex = 3;
return -1;
}
continue;
}
mLastFaceV0 = -1;
mLastFaceV1 = -1;
mLastFaceV2 = -1;
mLastFaceOppositeIndex = -1;
return index;
}
return -1;
}
//----------------------------------------------------------------------------
template <typename Real>
int Delaunay3<Real>::GetPathLast () const
{
return mPathLast;
}
//----------------------------------------------------------------------------
template <typename Real>
const int* Delaunay3<Real>::GetPath () const
{
return mPath;
}
//----------------------------------------------------------------------------
template <typename Real>
int Delaunay3<Real>::GetLastFace (int& v0, int& v1, int& v2, int& v3) const
{
v0 = mLastFaceV0;
v1 = mLastFaceV1;
v2 = mLastFaceV2;
v3 = mLastFaceOpposite;
return mLastFaceOppositeIndex;
}
//----------------------------------------------------------------------------
template <typename Real>
bool Delaunay3<Real>::GetVertexSet (int i, Vector3<Real> vertices[4]) const
{
assertion(mDimension == 3, "The dimension must be 3\n");
if (mDimension != 3)
{
return false;
}
if (0 <= i && i < mNumSimplices)
{
vertices[0] = mVertices[mIndices[4*i ]];
vertices[1] = mVertices[mIndices[4*i + 1]];
vertices[2] = mVertices[mIndices[4*i + 2]];
vertices[3] = mVertices[mIndices[4*i + 3]];
return true;
}
return false;
}
//----------------------------------------------------------------------------
template <typename Real>
bool Delaunay3<Real>::GetIndexSet (int i, int indices[4]) const
{
assertion(mDimension == 3, "The dimension must be 3\n");
if (mDimension != 3)
{
return false;
}
if (0 <= i && i < mNumSimplices)
{
indices[0] = mIndices[4*i ];
indices[1] = mIndices[4*i + 1];
indices[2] = mIndices[4*i + 2];
indices[3] = mIndices[4*i + 3];
return true;
}
return false;
}
//----------------------------------------------------------------------------
template <typename Real>
bool Delaunay3<Real>::GetAdjacentSet (int i, int adjacencies[4]) const
{
assertion(mDimension == 3, "The dimension must be 3\n");
if (mDimension != 3)
{
return false;
}
if (0 <= i && i < mNumSimplices)
{
adjacencies[0] = mAdjacencies[4*i ];
adjacencies[1] = mAdjacencies[4*i + 1];
adjacencies[2] = mAdjacencies[4*i + 2];
adjacencies[3] = mAdjacencies[4*i + 3];
return true;
}
return false;
}
//----------------------------------------------------------------------------
template <typename Real>
bool Delaunay3<Real>::GetBarycentricSet (int i, const Vector3<Real>& p,
Real bary[4]) const
{
assertion(mDimension == 3, "The dimension must be 3\n");
if (mDimension != 3)
{
return false;
}
if (0 <= i && i < mNumSimplices)
{
Vector3<Real> v0 = mVertices[mIndices[4*i ]];
Vector3<Real> v1 = mVertices[mIndices[4*i + 1]];
Vector3<Real> v2 = mVertices[mIndices[4*i + 2]];
Vector3<Real> v3 = mVertices[mIndices[4*i + 3]];
p.GetBarycentrics(v0, v1, v2, v3, bary);
return true;
}
return false;
}
//----------------------------------------------------------------------------
template <typename Real>
Delaunay3<Real>::Delaunay3 (const char* filename, int mode)
:
Delaunay<Real>(0, (Real)0, false, Query::QT_REAL),
mVertices(0),
mSVertices(0),
mQuery(0),
mPath(0)
{
bool loaded = Load(filename, mode);
assertion(loaded, "Cannot open file %s\n", filename);
WM5_UNUSED(loaded);
}
//----------------------------------------------------------------------------
template <typename Real>
bool Delaunay3<Real>::Load (const char* filename, int mode)
{
FileIO inFile(filename, mode);
if (!inFile)
{
return false;
}
Delaunay<Real>::Load(inFile);
delete0(mQuery);
delete1(mSVertices);
delete1(mPath);
if (mOwner)
{
delete1(mVertices);
}
mOwner = true;
mVertices = new1<Vector3<Real> >(mNumVertices);
mSVertices = new1<Vector3<Real> >(mNumVertices + 4);
mPath = new1<int>(mNumSimplices + 1);
inFile.Read(sizeof(int), &mNumUniqueVertices);
inFile.Read(sizeof(int), 4, mSupervertices);
inFile.Read(sizeof(int), &mPathLast);
inFile.Read(sizeof(int), &mLastFaceV0);
inFile.Read(sizeof(int), &mLastFaceV1);
inFile.Read(sizeof(int), &mLastFaceV2);
inFile.Read(sizeof(int), &mLastFaceOpposite);
inFile.Read(sizeof(int), &mLastFaceOppositeIndex);
inFile.Read(sizeof(int), mNumSimplices + 1, mPath);
inFile.Read(sizeof(Real), 3*mNumVertices, mVertices);
inFile.Read(sizeof(Real), 3*(mNumVertices + 4), mSVertices);
inFile.Read(sizeof(Real), 3, &mMin);
inFile.Read(sizeof(Real), 3, &mScale);
inFile.Read(sizeof(Real), 3, &mLineOrigin);
inFile.Read(sizeof(Real), 3, &mLineDirection);
inFile.Read(sizeof(Real), 3, &mPlaneOrigin);
inFile.Read(sizeof(Real), 6, mPlaneDirection);
inFile.Close();
switch (mQueryType)
{
case Query::QT_INT64:
{
mQuery = new0 Query3Int64<Real>(mNumVertices, mSVertices);
break;
}
case Query::QT_INTEGER:
{
mQuery = new0 Query3Integer<Real>(mNumVertices, mSVertices);
break;
}
case Query::QT_RATIONAL:
{
mQuery = new0 Query3Rational<Real>(mNumVertices, mSVertices);
break;
}
case Query::QT_REAL:
{
mQuery = new0 Query3<Real>(mNumVertices, mSVertices);
break;
}
case Query::QT_FILTERED:
{
mQuery = new0 Query3Filtered<Real>(mNumVertices, mSVertices,
mEpsilon);
break;
}
}
return true;
}
//----------------------------------------------------------------------------
template <typename Real>
bool Delaunay3<Real>::Save (const char* filename, int mode) const
{
FileIO outFile(filename, mode);
if (!outFile)
{
return false;
}
Delaunay<Real>::Save(outFile);
outFile.Write(sizeof(int), &mNumUniqueVertices);
outFile.Write(sizeof(int), 4, mSupervertices);
outFile.Write(sizeof(int), &mPathLast);
outFile.Write(sizeof(int), &mLastFaceV0);
outFile.Write(sizeof(int), &mLastFaceV1);
outFile.Write(sizeof(int), &mLastFaceV2);
outFile.Write(sizeof(int), &mLastFaceOpposite);
outFile.Write(sizeof(int), &mLastFaceOpposite);
outFile.Write(sizeof(int), mNumSimplices + 1 ,mPath);
outFile.Write(sizeof(Real), 3*mNumVertices, mVertices);
outFile.Write(sizeof(Real), 3*(mNumVertices + 4), mSVertices);
outFile.Write(sizeof(Real), 3, &mMin);
outFile.Write(sizeof(Real), 3, &mScale);
outFile.Write(sizeof(Real), 3, &mLineOrigin);
outFile.Write(sizeof(Real), 3, &mLineDirection);
outFile.Write(sizeof(Real), 3, &mPlaneOrigin);
outFile.Write(sizeof(Real), 6, mPlaneDirection);
outFile.Close();
return true;
}
//----------------------------------------------------------------------------
template <typename Real>
void Delaunay3<Real>::Update (int i)
{
// Locate the tetrahedron containing vertex i.
Tetrahedron* tetra = GetContainingTetrahedron(i);
// Locate and remove the tetrahedra forming the insertion polyhedron.
std::stack<Tetrahedron*> tetraStack;
ETManifoldMesh polyhedron(0, Face::TCreator);
tetraStack.push(tetra);
tetra->OnStack = true;
int j, v0, v1, v2;
Face* face;
while (!tetraStack.empty())
{
tetra = tetraStack.top();
tetraStack.pop();
tetra->OnStack = false;
for (j = 0; j < 4; ++j)
{
Tetrahedron* adj = tetra->Adj[j];
if (adj)
{
// Detach tetrahedron and adjacent tetrahedron from each
// other.
int nullIndex = tetra->DetachFrom(j, adj);
if (adj->IsInsertionComponent(i, tetra, mQuery,
mSupervertices))
{
if (!adj->OnStack)
{
// Adjacent triangle inside insertion polyhedron.
tetraStack.push(adj);
adj->OnStack = true;
}
}
else
{
// Adjacent tetrahedron outside insertion polyhedron.
v0 = tetra->V[gsIndex[j][0]];
v1 = tetra->V[gsIndex[j][1]];
v2 = tetra->V[gsIndex[j][2]];
face = (Face*)polyhedron.InsertTriangle(v0, v1, v2);
face->NullIndex = nullIndex;
face->Tetra = adj;
}
}
else
{
// The tetrahedron is in the insertion polyhedron, but the
// adjacent one does not exist. This means one of two things:
// (1) We are at a face of the supertetrahedron, and that
// face is part of the insertion polyhedron.
// (2) We are at a face that was recently shared by the
// tetrahedron and the adjacent, but we detached those
// tetrahedra from each other. These faces should be
// ignored.
v0 = tetra->V[gsIndex[j][0]];
if (IsSupervertex(v0))
{
v1 = tetra->V[gsIndex[j][1]];
if (IsSupervertex(v1))
{
v2 = tetra->V[gsIndex[j][2]];
if (IsSupervertex(v2))
{
face = (Face*)polyhedron.InsertTriangle(v0, v1,
v2);
face->NullIndex = -1;
face->Tetra = 0;
}
}
}
}
}
mTetrahedra.erase(tetra);
delete0(tetra);
}
// Insert the new tetrahedra formed by the input point and the faces of
// the insertion polyhedron.
const ETManifoldMesh::TMap& tetraMap = polyhedron.GetTriangles();
assertion(tetraMap.size() >= 4 && polyhedron.IsClosed(),
"Polyhedron must be at least a tetrahedron\n");
typename ETManifoldMesh::TMapCIterator iter = tetraMap.begin();
typename ETManifoldMesh::TMapCIterator end = tetraMap.end();
for (/**/; iter != end; ++iter)
{
face = (Face*)iter->second;
// Create and insert the new tetrahedron.
tetra = new0 Tetrahedron(i, face->V[0], face->V[1], face->V[2]);
mTetrahedra.insert(tetra);
// Establish the adjacency links across the polyhedron face.
tetra->Adj[0] = face->Tetra;
if (face->Tetra)
{
face->Tetra->Adj[face->NullIndex] = tetra;
}
// Update the faces's tetrahedron pointer to point to the newly
// created tetrahedron. This information is used later to establish
// the links between the new tetrahedra.
face->Tetra = tetra;
}
// Establish the adjacency links between the new tetrahedra.
Face* adjFace;
iter = tetraMap.begin();
end = tetraMap.end();
for (/**/; iter != end; ++iter)
{
face = (Face*)iter->second;
adjFace = (Face*)face->T[0];
face->Tetra->Adj[3] = adjFace->Tetra;
assertion(SharesFace(3, face->Tetra, adjFace->Tetra),
"Face sharing is incorrect\n");
adjFace = (Face*)face->T[1];
face->Tetra->Adj[1] = adjFace->Tetra;
assertion(SharesFace(1, face->Tetra, adjFace->Tetra),
"Face sharing is incorrect\n");
adjFace = (Face*)face->T[2];
face->Tetra->Adj[2] = adjFace->Tetra;
assertion(SharesFace(2, face->Tetra, adjFace->Tetra),
"Face sharing is incorrect\n");
}
}
//----------------------------------------------------------------------------
template <typename Real>
typename Delaunay3<Real>::Tetrahedron*
Delaunay3<Real>::GetContainingTetrahedron (int i) const
{
// Locate which tetrahedron in the current mesh contains vertex i. By
// construction, there must be such a tetrahedron (the vertex cannot be
// outside the supertetrahedron).
Tetrahedron* tetra = *mTetrahedra.begin();
const int numTriangles = (int)mTetrahedra.size();
for (int t = 0; t < numTriangles; ++t)
{
int* vertices = tetra->V;
// <V1,V2,V3> counterclockwise when viewed outside tetrahedron.
if (mQuery->ToPlane(i, vertices[1], vertices[2], vertices[3]) > 0)
{
tetra = tetra->Adj[0];
if (!tetra)
{
break;
}
continue;
}
// <V0,V3,V2> counterclockwise when viewed outside tetrahedron.
if (mQuery->ToPlane(i, vertices[0], vertices[2], vertices[3]) < 0)
{
tetra = tetra->Adj[1];
if (!tetra)
{
break;
}
continue;
}
// <V0,V1,V3> counterclockwise when viewed outside tetrahedron.
if (mQuery->ToPlane(i, vertices[0], vertices[1], vertices[3]) > 0)
{
tetra = tetra->Adj[2];
if (!tetra)
{
break;
}
continue;
}
// <V0,V2,V1> counterclockwise when viewed outside tetrahedron.
if (mQuery->ToPlane(i, vertices[0], vertices[1], vertices[2]) < 0)
{
tetra = tetra->Adj[3];
if (!tetra)
{
break;
}
continue;
}
return tetra;
}
assertion(false, "Delaunay vertices must lie in some tetrahedron\n");
return 0;
}
//----------------------------------------------------------------------------
template <typename Real>
void Delaunay3<Real>::RemoveTetrahedra ()
{
// Identify those triangles sharing a vertex of the supertetrahedron.
std::set<Tetrahedron*> removeTetra;
Tetrahedron* tetra;
int j;
typename std::set<Tetrahedron*>::iterator iter = mTetrahedra.begin();
typename std::set<Tetrahedron*>::iterator end = mTetrahedra.end();
for (/**/; iter != end; ++iter)
{
tetra = *iter;
for (j = 0; j < 4; ++j)
{
if (IsSupervertex(tetra->V[j]))
{
removeTetra.insert(tetra);
break;
}
}
}
// Remove the tetrahedra from the mesh.
iter = removeTetra.begin();
end = removeTetra.end();
for (/**/; iter != end; ++iter)
{
tetra = *iter;
for (j = 0; j < 4; ++j)
{
// Break the links with adjacent tetrahedra.
Tetrahedron* adj = tetra->Adj[j];
if (adj)
{
for (int k = 0; k < 4; ++k)
{
if (adj->Adj[k] == tetra)
{
adj->Adj[k] = 0;
break;
}
}
}
}
mTetrahedra.erase(tetra);
delete0(tetra);
}
}
//----------------------------------------------------------------------------
template <typename Real>
bool Delaunay3<Real>::IsSupervertex (int i) const
{
for (int j = 0; j < 4; j++)
{
if (i == mSupervertices[j])
{
return true;
}
}
return false;
}
//----------------------------------------------------------------------------
template <typename Real>
bool Delaunay3<Real>::SharesFace (int i, Tetrahedron* face, Tetrahedron* adj)
{
int faceIndex[3], count = 0, j;
for (j = 0; j < 4; ++j)
{
if (j != i)
{
faceIndex[count] = face->V[j];
++count;
}
}
for (i = 0; i < 4; ++i)
{
if (adj->V[i] != faceIndex[0] &&
adj->V[i] != faceIndex[1] &&
adj->V[i] != faceIndex[2])
{
break;
}
}
if (i == 4)
{
return false;
}
int adjIndex[3];
for (j = 0, count = 0; j < 4; ++j)
{
if (j != i)
{
adjIndex[count] = adj->V[j];
++count;
}
}
if (faceIndex[0] > faceIndex[1])
{
j = faceIndex[0];
faceIndex[0] = faceIndex[1];
faceIndex[1] = j;
}
if (faceIndex[1] > faceIndex[2])
{
j = faceIndex[1];
faceIndex[1] = faceIndex[2];
faceIndex[2] = j;
}
if (faceIndex[0] > faceIndex[1])
{
j = faceIndex[0];
faceIndex[0] = faceIndex[1];
faceIndex[1] = j;
}
if (adjIndex[0] > adjIndex[1])
{
j = adjIndex[0];
adjIndex[0] = adjIndex[1];
adjIndex[1] = j;
}
if (adjIndex[1] > adjIndex[2])
{
j = adjIndex[1];
adjIndex[1] = adjIndex[2];
adjIndex[2] = j;
}
if (adjIndex[0] > adjIndex[1])
{
j = adjIndex[0];
adjIndex[0] = adjIndex[1];
adjIndex[1] = j;
}
if (adjIndex[0] != faceIndex[0]
|| adjIndex[1] != faceIndex[1]
|| adjIndex[2] != faceIndex[2])
{
return false;
}
return true;
}
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
// Delaunay3::Tetrahedron
//----------------------------------------------------------------------------
template <typename Real>
Delaunay3<Real>::Tetrahedron::Tetrahedron (int v0, int v1, int v2, int v3)
{
V[0] = v0;
V[1] = v1;
V[2] = v2;
V[3] = v3;
Adj[0] = 0;
Adj[1] = 0;
Adj[2] = 0;
Adj[3] = 0;
Time = -1;
IsComponent = false;
OnStack = false;
}
//----------------------------------------------------------------------------
template <typename Real>
bool Delaunay3<Real>::Tetrahedron::IsInsertionComponent (int i,
Tetrahedron* adj, const Query3<Real>* query, const int* supervertices)
{
if (i != Time)
{
Time = i;
// Determine if the circumsphere of the tetrahedron contains the
// input point.
int relation = query->ToCircumsphere(i, V[0], V[1],
V[2], V[3]);
IsComponent = (relation <= 0);
if (IsComponent)
{
return true;
}
// It is possible that a tetrahedron that shares a supervertex does
// not have the circumsphere-containing property, but all faces of
// it (other than the shared one with the calling tetrahedron) are
// visible. These are also included in the insertion polyhedron.
for (int j = 0; j < 4; ++j)
{
for (int k = 0; k < 4; ++k)
{
if (V[j] == supervertices[k])
{
// Tetrahedron shares a supervertex.
int numInvisible = 0;
for (int k0 = 0; k0 < 4; ++k0)
{
if (Adj[k] != adj)
{
int v0 = V[gsIndex[k0][0]];
int v1 = V[gsIndex[k0][1]];
int v2 = V[gsIndex[k0][2]];
relation = query->ToPlane(i, v0, v1, v2);
if (relation > 0)
{
numInvisible++;
}
}
}
IsComponent = (numInvisible == 0);
return IsComponent;
}
}
}
}
return IsComponent;
}
//----------------------------------------------------------------------------
template <typename Real>
int Delaunay3<Real>::Tetrahedron::DetachFrom (int adjIndex, Tetrahedron* adj)
{
assertion(0 <= adjIndex && adjIndex < 4 && Adj[adjIndex] == adj,
"Invalid input index.\n");
Adj[adjIndex] = 0;
for (int i = 0; i < 4; ++i)
{
if (adj->Adj[i] == this)
{
adj->Adj[i] = 0;
return i;
}
}
return -1;
}
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
// Delaunay3::Face
//----------------------------------------------------------------------------
template <typename Real>
Delaunay3<Real>::Face::Face (int v0, int v1, int v2, int nullIndex,
Tetrahedron* tetra)
:
ETManifoldMesh::Triangle(v0, v1, v2),
NullIndex(nullIndex),
Tetra(tetra)
{
}
//----------------------------------------------------------------------------
template <typename Real>
ETManifoldMesh::TPtr Delaunay3<Real>::Face::TCreator (int v0, int v1, int v2)
{
return new0 Face(v0, v1, v2, 0, 0);
}
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
// Explicit instantiation.
//----------------------------------------------------------------------------
template WM5_MATHEMATICS_ITEM
class Delaunay3<float>;
template WM5_MATHEMATICS_ITEM
class Delaunay3<double>;
//----------------------------------------------------------------------------
}
| [
"[email protected]"
]
| [
[
[
1,
1217
]
]
]
|
c40b1f7c26ca8e3718787a8b552c48385fd255fc | 3ec3b97044e4e6a87125470cfa7eef535f26e376 | /darkbits-secret_of_fantasy_2/src/Mother.cpp | f9cae8027aa5025e2be132f3d3195f71dfe48d84 | []
| no_license | strategist922/TINS-Is-not-speedhack-2010 | 6d7a43ebb9ab3b24208b3a22cbcbb7452dae48af | 718b9d037606f0dbd9eb6c0b0e021eeb38c011f9 | refs/heads/master | 2021-01-18T14:14:38.724957 | 2010-10-17T14:04:40 | 2010-10-17T14:04:40 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 362 | cpp | #include "Precompiled.hpp"
#include "Mother.hpp"
Mother::Mother(int homeX, int homeY )
:PlayerCharacter("MOTHER",homeX, homeY, 1, 1, 400, 3.0f)
, myRemoveMyself(false)
{
}
void Mother::remove()
{
myRemoveMyself = true;
}
bool Mother::isToBeDestroyed()
{
if (myRemoveMyself)
return true;
return PlayerCharacter::isToBeDestroyed();
}
| [
"[email protected]"
]
| [
[
[
1,
21
]
]
]
|
477b2a344a4a7ab7fe0f3ef0e9c76f1cd8a676ec | de75637338706776f8770c9cd169761cec128579 | /Out-Of-Date/Source/GUI/SkinLoader.cpp | 37e96b1d52a2fcfd778d6b6ea6bf4faf6c39658d | []
| no_license | huytd/fosengine | e018957abb7b2ea2c4908167ec83cb459c3de716 | 1cebb1bec49720a8e9ecae1c3d0c92e8d16c27c5 | refs/heads/master | 2021-01-18T23:47:32.402023 | 2008-07-12T07:20:10 | 2008-07-12T07:20:10 | 38,933,821 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,797 | cpp | #include "SkinLoader.h"
#include <IFileSystem.h>
#include "CConfigMap.h"
#include "CConfigReader.h"
#include <IReadFile.h>
#include <IVideoDriver.h>
namespace irr
{
core::stringc GetContextPathFromFilename( const core::stringc& filename )
{
core::stringc path;
s32 i=filename.size()-1;
while ( i >= 0 && filename[i] != '/' )
{
i--;
}
path = filename.subString( 0, i+1 );
return path;
}
CConfigMap* LoadConfigFromFile( io::IFileSystem* fileSystem, const core::stringc& filename )
{
io::IReadFile* file = fileSystem->createAndOpenFile( filename.c_str() );
if ( !file )
return 0;
CConfigMap* map = new CConfigMap();
CConfigReader reader;
reader.loadReadFile(file);
file->drop();
while ( reader.nextConfig() )
{
core::stringc name = reader.getConfigName();
core::stringc value = reader.getConfigValue();
map->setConfig(name,value);
}
return map;
}
static void ParseGUIElementStyle( video::IVideoDriver* driver, CConfigMap* cfg, gui::SImageGUIElementStyle& elem, const core::stringc& name, const core::stringc& context )
{
core::stringc s = cfg->getConfig(name+".SrcBorder");
sscanf_s( s.c_str(), "%d , %d , %d , %d", &elem.SrcBorder.Top, &elem.SrcBorder.Left, &elem.SrcBorder.Bottom, &elem.SrcBorder.Right );
s = cfg->getConfig(name+".DstBorder");
sscanf_s( s.c_str(), "%d , %d , %d , %d", &elem.DstBorder.Top, &elem.DstBorder.Left, &elem.DstBorder.Bottom, &elem.DstBorder.Right );
s = cfg->getConfig(name+".Texture");
elem.Texture = driver->getTexture((context + s).c_str());
s = cfg->getConfig(name+".Color");
if ( s != "" )
{
s32 a,r,g,b;
sscanf_s( s.c_str(), "%d , %d , %d , %d", &a, &r, &g, &b );
elem.Color = video::SColor(a,r,g,b);
}
}
gui::SImageGUISkinConfig LoadGUISkinFromFile( io::IFileSystem* fileSystem, video::IVideoDriver* driver, const core::stringc& filename )
{
gui::SImageGUISkinConfig skin;
CConfigMap* cfg = LoadConfigFromFile(fileSystem, filename);
if ( !cfg )
return skin;
core::stringc context = GetContextPathFromFilename(filename);
ParseGUIElementStyle( driver, cfg, skin.Button, "Button", context );
ParseGUIElementStyle( driver, cfg, skin.ButtonPressed, "ButtonPressed", context );
ParseGUIElementStyle( driver, cfg, skin.SunkenPane, "SunkenPane", context );
ParseGUIElementStyle( driver, cfg, skin.Window, "Window", context );
ParseGUIElementStyle( driver, cfg, skin.ProgressBar, "ProgressBar", context );
ParseGUIElementStyle( driver, cfg, skin.ProgressBarFilled, "ProgressBarFilled", context );
delete cfg;
return skin;
}
} | [
"doqkhanh@52f955dd-904d-0410-b1ed-9fe3d3cbfe06"
]
| [
[
[
1,
92
]
]
]
|
dbb8ba038a4275a322262dc981987a041d76cf2f | 709cd826da3ae55945fd7036ecf872ee7cdbd82a | /Term/WildMagic2/Source/Intersection/WmlIntrInterval.cpp | a28b80e74ac86ad0620c6267a30ee709ee7792dc | []
| no_license | argapratama/kucgbowling | 20dbaefe1596358156691e81ccceb9151b15efb0 | 65e40b6f33c5511bddf0fa350c1eefc647ace48a | refs/heads/master | 2018-01-08T15:27:44.784437 | 2011-06-19T15:23:39 | 2011-06-19T15:23:39 | 36,738,655 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,599 | cpp | // Magic Software, Inc.
// http://www.magic-software.com
// http://www.wild-magic.com
// Copyright (c) 2003. All Rights Reserved
//
// The Wild Magic Library (WML) source code is supplied under the terms of
// the license agreement http://www.magic-software.com/License/WildMagic.pdf
// and may not be copied or disclosed except in accordance with the terms of
// that agreement.
#include "WmlIntrInterval.h"
using namespace Wml;
//----------------------------------------------------------------------------
template <class Real>
int Wml::FindIntersection (Real fU0, Real fU1, Real fV0, Real fV1,
Real& rfW0, Real& rfW1)
{
assert( fU0 < fU1 && fV0 < fV1 );
if ( fU1 < fV0 || fU0 > fV1 )
{
return 0;
}
else if ( fU1 > fV0 )
{
if ( fU0 < fV1 )
{
rfW0 = ( fU0 < fV0 ? fV0 : fU0 );
rfW1 = ( fU1 > fV1 ? fV1 : fU1 );
return 2;
}
else // fU0 == fV1
{
rfW0 = fU0;
return 1;
}
}
else // fU1 == fV0
{
rfW0 = fU1;
return 1;
}
}
//----------------------------------------------------------------------------
template <class Real>
int Wml::FindIntersection (Real fU0, Real fU1, Real& rfV0, Real& rfV1)
{
assert( fU0 < fU1 && rfV0 < rfV1 );
if ( fU1 < rfV0 || fU0 > rfV1 )
{
return 0;
}
else if ( fU1 > rfV0 )
{
if ( fU0 < rfV1 )
{
if ( fU0 > rfV0 )
rfV0 = fU0;
if ( fU1 < rfV1 )
rfV1 = fU1;
return 2;
}
else // fU0 == fV1
{
rfV0 = fU0;
return 1;
}
}
else // fU1 == fV0
{
rfV0 = fU1;
return 1;
}
}
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
// explicit instantiation
//----------------------------------------------------------------------------
namespace Wml
{
template WML_ITEM int FindIntersection<float> (float, float, float,
float, float&, float&);
template WML_ITEM int FindIntersection<float> (float, float, float&,
float&);
template WML_ITEM int FindIntersection<double> (double, double, double,
double, double&, double&);
template WML_ITEM int FindIntersection<double> (double, double, double&,
double&);
}
//----------------------------------------------------------------------------
| [
"[email protected]"
]
| [
[
[
1,
94
]
]
]
|
92b511b1f356fa269bc2d60a529c2ccba8966785 | 9c62af23e0a1faea5aaa8dd328ba1d82688823a5 | /rl/branches/persistence2/engine/core/include/GameEventManager.h | 5cc0cf954919e232a672add0b6b7d726b2a56a33 | [
"ClArtistic",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain"
]
| permissive | jacmoe/dsa-hl-svn | 55b05b6f28b0b8b216eac7b0f9eedf650d116f85 | 97798e1f54df9d5785fb206c7165cd011c611560 | refs/heads/master | 2021-04-22T12:07:43.389214 | 2009-11-27T22:01:03 | 2009-11-27T22:01:03 | null | 0 | 0 | null | null | null | null | ISO-8859-1 | C++ | false | false | 6,013 | h | /* This source file is part of Rastullahs Lockenpracht.
* Copyright (C) 2003-2008 Team Pantheon. http://www.team-pantheon.de
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the Clarified Artistic License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* Clarified Artistic License for more details.
*
* You should have received a copy of the Clarified Artistic License
* along with this program; if not you can get it here
* http://www.jpaulmorrison.com/fbp/artistic2.htm.
*/
#ifndef __GameEventManager_H__
#define __GameEventManager_H__
#include <list>
#include "Actor.h"
#include "GameTask.h"
#include "GameAreaEventSource.h"
#include "GameAreaListener.h"
#include "CorePrerequisites.h"
#include "PhysicsGenericContactCallback.h"
namespace rl {
class PhysicalThing;
class GameNewtonBodyAreaType;
class Zone;
typedef std::set<GameAreaEventSource*> GameAreaEventSourceList;
/** GameEventManager
*
* @see GameAreaListener, GameAreaEventSource, GameAreaEvent, GameAreaTypes
*/
class _RlCoreExport GameEventManager
: public GameTask,
public Ogre::Singleton<GameEventManager>,
public PhysicsGenericContactCallback
{
public:
/** Default Constructor */
GameEventManager( );
/** Default Deconstructor */
virtual ~GameEventManager();
/** Wird vom Gameloop aufgerufen, wenn nicht pausiert
* Führt die Anfragen der eingetragenen GameAreaEventSource durch
* @param elapsedTime Die vergangene Zeit
*/
virtual void run( Ogre::Real elapsedTime );
/** DEPRECATED! Fügt eine Sphere Area hinzu, und hängt einen Listener an
*
* @param actor Der Actor um den herum die Kugel aufgespannt werden soll
* @param queryMask Die Maske um die SzenenAnfrage zu beschleunigen
* @param radius Der Radius der Kugel
* @param list Der neu hinzuzufügende Listener
* @param forceNew erstellt auf jeden Fall eine neue GameAreaEventSource (z.B. für den ZoneManager)
* @retval Die GameAreaEventSource, der der Listener hinzugefügt wurde
*/
GameAreaEventSource* addSphereAreaListener( Actor* actor, Ogre::Real radius,
GameAreaListener* list, unsigned long queryMask = 0xFFFFFFFF, bool forceNew = false);
/** Fügt eine neue Mesh-Area hinzu und hängt einen Listener an
*
* @param actor der actor um den herum die area gelegt werden soll, kann NULL sein
* @param ent die Entity mit dem Mesh, das für die Area verwendet werden soll, falls NULL wird das mesh des actors verwendet
* @param geom der Geometrietype, sinnvoll wäre GT_CONVEXHULL (eventuell GT_MESH)
* @param list Der neu hinzuzufpgende Listener
* @param queryMask Die Querymaske, welche Aktoren von der Area betroffen sind
* @param forceNew erstellt auf jeden Fall eine neue GameAreaEventSource (z.B. für den ZoneManager)
* @retval Die GameAreaEventSource, der der Listener hinzugefügt wurde
*/
GameAreaEventSource* addMeshAreaListener( Actor* actor,
Ogre::Entity* ent, GeometryType geom, GameAreaListener* list,
unsigned long queryMask = 0xFFFFFFFF,
Ogre::Vector3 offset = Ogre::Vector3::ZERO, Ogre::Quaternion orientation = Ogre::Quaternion::IDENTITY,
bool forceNew = false);
GameAreaEventSource* addMeshAreaListener( Actor* actor,
GeometryType geom, GameAreaListener* list,
unsigned long queryMask = 0xFFFFFFFF,
Ogre::Vector3 offset = Ogre::Vector3::ZERO, Ogre::Quaternion orientation = Ogre::Quaternion::IDENTITY,
bool forceNew = false);
/** Fügt eine neue Area hinzu und hängt einen Listener an
*
* @param actor Der Actor um den herum die Area aufgespannt werden soll, kann NULL sein
* @param aabb Die Größe der Area
* @param geom der Geometrietype, möglich sind GT_BOX, GT_ELLIPSOID, GT_SPHERE, GT_PYRAMID
* @param list Der neu hinzuzufpgende Listener
* @param queryMask Die Querymaske, welche Aktoren von der Area betroffen sind
* @param forceNew erstellt auf jeden Fall eine neue GameAreaEventSource (z.B. für den ZoneManager)
* @retval Die GameAreaEventSource, der der Listener hinzugefügt wurde
*/
GameAreaEventSource* addAreaListener( Actor* actor,
Ogre::AxisAlignedBox aabb, GeometryType geom, GameAreaListener* list,
unsigned long queryMask = 0xFFFFFFFF,
Ogre::Vector3 offset = Ogre::Vector3::ZERO, Ogre::Quaternion orientation = Ogre::Quaternion::IDENTITY,
bool forceNew = false);
/** Entfernt an allen Areas diesen Listener
*
* @param list Der Listener an den GameAreaEventSource
* @note Dabei werden alle GameAreaEventSource, an denen keine
Listener befestigt sind, entfernt und gelöscht.
*/
void removeAreaListener( GameAreaListener* list );
/** Entfernt eine bestimmte GameAreaEventSource
*
*/
void removeAreaEventSource( GameAreaEventSource *gam );
/** Entfernt alle Areas die an einen Actor geknüpft sind
*
* @param actor Der Actor der GameAreaEventSource
*/
void removeAllAreas( Actor* actor );
virtual const Ogre::String& getName() const;
void removeQueuedDeletionSources();
/// newton collision callback functions
void userProcess(OgreNewt::ContactJoint &contactJoint, Ogre::Real timestep, int threadid);
/// notify about newton world update
void notifyNewtonWorldUpdate();
private:
GameAreaEventSourceList mAreaEventSources;
GameAreaEventSourceList mQueuedDeletionSources;
typedef std::map<OgreNewt::Body*, GameNewtonBodyAreaType*> NewtonBodyGameAreaMap;
NewtonBodyGameAreaMap mBodyGameAreaMap;
Actor* bodyToActor(OgreNewt::Body* body);
};
}
#endif
| [
"timm@4c79e8ff-cfd4-0310-af45-a38c79f83013"
]
| [
[
[
1,
149
]
]
]
|
ed48f4bf15d81ab50afcada88d58a6e62675de10 | c95a83e1a741b8c0eb810dd018d91060e5872dd8 | /Game/Shared/WeaponMgr.h | 0c010c60a8678f9cc2f2e447a9217e3f042116f9 | []
| no_license | rickyharis39/nolf2 | ba0b56e2abb076e60d97fc7a2a8ee7be4394266c | 0da0603dc961e73ac734ff365bfbfb8abb9b9b04 | refs/heads/master | 2021-01-01T17:21:00.678517 | 2011-07-23T12:11:19 | 2011-07-23T12:11:19 | 38,495,312 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 20,621 | h | // ----------------------------------------------------------------------- //
//
// MODULE : WeaponMgr.h
//
// PURPOSE : WeaponMgr definition - Controls attributes of all weapons
//
// CREATED : 12/02/98
//
// (c) 1998-2002 Monolith Productions, Inc. All Rights Reserved
//
// ----------------------------------------------------------------------- //
#ifndef __WEAPON_MGR_H__
#define __WEAPON_MGR_H__
#include "ltbasetypes.h"
#include "DamageTypes.h"
#include "CommandIds.h"
#include "TemplateList.h"
#include "GameButeMgr.h"
#include "ButeListReader.h"
class CWeaponMgr;
class CFXButeMgrPlugin;
struct PROJECTILEFX;
struct IMPACTFX;
struct IMPACTFX;
struct IMPACTFX;
struct IMPACTFX;
struct FIREFX;
struct WEAPONANIS;
struct TRACERFX;
struct CMuzzleFX;
struct CScaleFX;
struct PEXPLFX;
struct DLIGHTFX;
struct IMPACTFX;
struct PROJECTILEFX;
struct FIREFX;
extern CWeaponMgr* g_pWeaponMgr;
#define WEAPON_MIN_IDLE_TIME 5.0f
#define WEAPON_MAX_IDLE_TIME 15.0f
#define WEAPON_SOUND_RADIUS 2000.0f
#define WEAPON_KEY_FIRE "FIRE_KEY"
#define WEAPON_KEY_SOUND "SOUND_KEY"
#define WEAPON_KEY_BUTE_SOUND "BUTE_SOUND_KEY"
#define WEAPON_KEY_LOOPSOUND "LOOP_SOUND_KEY"
#define WEAPON_KEY_FX "FX"
#define WEAPON_KEY_FIREFX "FIREFX_KEY"
#define WEAPON_KEY_FLASHLIGHT "FLASHLIGHT"
#define WEAPON_KEY_DEFLECT "DEFLECT"
#define WEAPON_KEY_HIDE_MODEL_PIECE "HIDE_PIECE_KEY" // usage: HIDE_PIECE_KEY <piece name>
#define WEAPON_KEY_SHOW_MODEL_PIECE "SHOW_PIECE_KEY" // usage: SHOW_PIECE_KEY <piece name>
#define WEAPON_KEY_SHELLCASING "SHELL_CASING"
#define WEAPON_KEY_HIDE_PVATTACHFX "HIDE_PVATTACHFX" // usage: HIDE_PVFX <index of a PVAttachFXName#>
#define WEAPON_KEY_SHOW_PVATTACHFX "SHOW_PVATTACHFX" // usage: SHOW_PVFX <index of a PVAttachFXName#>
#define WEAPON_KEY_HIDE_PVATTACHMENT "HIDE_PVATTACHMENT" // usage: HIDE_PVATTACHMENT <index of a PlayerViewAttachment>
#define WEAPON_KEY_SHOW_PVATTACHMENT "SHOW_PVATTACHMENT" // usage: SHOW_PVATTACHMENT <index of a PlayerViewAttachment>
#define WEAPON_DEFAULT_FILE "Attributes\\Weapons.txt"
#define WEAPON_DEFAULT_MULTI_FILE "Attributes\\mp_weapons.txt"
#define WMGR_INVALID_ID 255
#define WMGR_MAX_NAME_LENGTH 32
#define WMGR_MAX_FILE_PATH 64
#define WMGR_MAX_AMMO_IDS 10
#define WMGR_MAX_MOD_IDS 6
#define WMGR_MAX_RELOAD_SNDS 3
#define WMGR_MAX_MISC_SNDS 5
#define WMGR_MAX_PVFX_TYPES 5
#define WMGR_MAX_PVCLIENTFX_ATTACHMENTS 10
#define WMGR_MAX_WEAPONANI_IDLE 3
#define WMGR_MAX_WEAPONANI_FIRE 3
// Helper function for allocating memory for a string property and returning a pointer to the new string
inline char* GetString( CButeMgr & buteMgr, const char* szTagName, const char* szAttName, uint32 dwMaxLen, char* defVal = "" )
{
static char szTemp[WMGR_MAX_FILE_PATH] = { '\0' };
char *szResult = LTNULL;
// clear old string
szTemp[ 0 ] = '\0';
// look for the new string
buteMgr.GetString( szTagName, szAttName, defVal, szTemp, ARRAY_LEN(szTemp) );
ASSERT( strlen(szTemp) < dwMaxLen );
// allocate memory for the string and copy the string into it
// NOTE: the caller of this function is responsible
// for this memory
szResult = debug_newa(char, strlen(szTemp) + 1);
SAFE_STRCPY( szResult, szTemp );
return szResult;
}
// Helper function for allocating memory for an array of string properties and returning a pointer to the new strings
inline char** GetStringArray( CButeMgr & buteMgr, const char* szTagName, const char* szAttName, uint32 dwMaxStrLen, int nMaxArrayLen, int &nArrayLen )
{
static char szTemp[WMGR_MAX_FILE_PATH] = {0};
char **szResult = LTNULL;
nArrayLen = 0;
sprintf(szTemp, "%s%d", szAttName, nArrayLen);
while( buteMgr.Exist( szTagName, szTemp ) && nArrayLen < nMaxArrayLen )
{
nArrayLen++;
sprintf( szTemp, "%s%d", szAttName, nArrayLen );
}
if( nArrayLen )
{
szResult = debug_newa( char*, nArrayLen );
for( int i = 0; i < nArrayLen; i++ )
{
sprintf( szTemp, "%s%d", szAttName, i );
szResult[i] = GetString( buteMgr, szTagName, szTemp, dwMaxStrLen );
}
}
return szResult;
}
enum WeaponState
{
W_INACTIVE,
W_IDLE,
W_BEGIN_FIRING,
W_FIRING,
W_FIRED,
W_END_FIRING,
W_SWAT_DEFENSE,
W_HOLD_DEFENSE,
W_ARM_DEFENSE,
W_RELOADING,
W_FIRING_NOAMMO,
W_SELECT,
W_DESELECT,
W_AUTO_SWITCH
};
enum AmmoType
{
// NOTE: These values 0, 1, 3 are important. The Weapons.txt file
// refers to these numbers, DO NOT change them!
VECTOR=0,
PROJECTILE=1,
GADGET=3,
UNKNOWN_AMMO_TYPE=4
};
enum ModType
{
SILENCER=0,
SCOPE,
UNKNOWN_MOD_TYPE
};
struct MOD
{
MOD();
~MOD();
LTBOOL Init(CButeMgr & buteMgr, char* aTagName);
LTBOOL Override(CButeMgr &buteMgr, char *aTagName);
int GetWeaponId() const; // CWeaponMgr::GetWeaponIdFromModId(int nModId)
LTBOOL bInited;
int nId;
ModType eType;
char *szSocket;
char *szName;
char *szIcon;
char *szZoomInSound;
char *szZoomOutSound;
char *szAttachModel;
char *szPowerupModel;
char *szPickUpSound;
char *szRespawnSound;
char *szPowerupFX;
char *szRespawnWaitFX;
CButeListReader blrAttachSkins;
CButeListReader blrPowerupSkins;
CButeListReader blrAttachRenderStyles;
CButeListReader blrPowerupRenderStyles;
CButeListReader blrRespawnWaitSkins;
CButeListReader blrRespawnWaitRenderStyles;
LTVector vAttachScale;
LTVector vScreenTintColor;
LTFLOAT fScreenTintTime;
int nNameId;
int nDescriptionId;
int nZoomLevel;
int nPriority;
int nAISilencedFireSndRadius;
LTBOOL bIntegrated;
LTFLOAT fPowerupScale;
bool bRespawnWaitVisible;
bool bRespawnWaitTranslucent;
private:
void InitMembers( CButeMgr &buteMgr, char *aTagName );
};
typedef CTList<MOD*> ModList;
struct GEAR
{
GEAR();
~GEAR();
LTBOOL Init(CButeMgr & buteMgr, char* aTagName);
LTBOOL Override(CButeMgr &buteMgr, char *aTagName);
LTBOOL bInited;
int nId;
int nNameId;
int nDescriptionId;
char *szName;
char *szIcon;
char *szModel;
char *szPickUpSound;
char *szRespawnSound;
char *szPowerupFX;
char *szRespawnWaitFX;
CButeListReader blrSkins;
CButeListReader blrRenderStyles;
CButeListReader blrRespawnWaitSkins;
CButeListReader blrRespawnWaitRenderStyles;
DamageType eProtectionType;
LTFLOAT fProtection;
LTFLOAT fArmor;
LTFLOAT fHealth;
LTFLOAT fStealth;
LTBOOL bSelectable;
LTBOOL bExclusive;
LTVector vScreenTintColor;
LTFLOAT fScreenTintTime;
bool bRespawnWaitVisible;
bool bRespawnWaitTranslucent;
// Indicates server option has set restriction.
bool bServerRestricted;
bool bCanServerRestrict;
private:
void InitMembers( CButeMgr &buteMgr, char *aTagName );
};
typedef CTList<GEAR*> GearList;
// This struct is used to contain all the animation overrides for a particular
// ammo type...
struct WEAPONANIS
{
WEAPONANIS();
~WEAPONANIS();
LTBOOL Init(CButeMgr & buteMgr, char* aTagName);
LTBOOL Override(CButeMgr &buteMgr, char *aTagName);
LTBOOL bInited;
int nId;
char *szName;
char *szSelectAni;
char *szDeselectAni;
char *szReloadAni;
int nNumIdleAnis;
char *szIdleAnis[WMGR_MAX_WEAPONANI_IDLE];
int nNumFireAnis;
char *szFireAnis[WMGR_MAX_WEAPONANI_FIRE];
private:
void InitMembers( CButeMgr &buteMgr, char *aTagName );
};
typedef CTList<WEAPONANIS*> WeaponAnisList;
struct AMMO
{
AMMO();
~AMMO();
LTBOOL Init(CButeMgr & buteMgr, char* aTagName);
LTBOOL Override(CButeMgr &buteMgr, char *aTagName);
std::string GetNormalIcon() const;
std::string GetDisabledIcon() const;
std::string GetUnselectedIcon() const;
LTBOOL bInited;
int nId;
// int nNameId;
int nDescId;
AmmoType eType;
LTFLOAT fPriority;
char* szName;
char* szLongName;
char* szShortName;
int GetMaxAmount(HOBJECT hCharacter) const;
int nSpawnedAmount;
int nSelectionAmount;
int nInstDamage;
DamageType eInstDamageType;
int nAreaDamage;
int nAreaDamageRadius;
DamageType eAreaDamageType;
float fFireRecoilMult;
LTFLOAT fProgDamage;
LTFLOAT fProgDamageDuration;
LTFLOAT fProgDamageRadius;
LTFLOAT fProgDamageLifetime;
DamageType eProgDamageType;
bool bCanBeDeflected;
std::string sDeflectSurfaceType;
bool bCanAdjustInstDamage;
PROJECTILEFX *pProjectileFX; // Points at CFXButeMgr::m_ProjectileFXList element
IMPACTFX *pImpactFX; // Points at CFXButeMgr::m_ImpactFXList element
IMPACTFX *pUWImpactFX; // Points at CFXButeMgr::m_ImpactFXList element
IMPACTFX *pRicochetFX; // Points at CFXButeMgr::m_ImpactFXList element
IMPACTFX *pBlockedFX; // Points at CFXButeMgr::m_ImpactFXList element
IMPACTFX *pMoveableImpactOverrideFX; // Points at CFXButeMgr::m_MoveableImpactOverrideFXName element
FIREFX *pFireFX; // Points at CFXButeMgr::m_FireFXList element
WEAPONANIS *pAniOverrides; // Points at m_pWeaponAnisList element
TRACERFX *pTracerFX; // Points at CFXButeMgr::m_TracerFXList element
// Indicates server option has set restriction.
bool bServerRestricted;
bool bCanServerRestrict;
private:
int nNameId;
int nMaxAmount;
char *szIcon;
void InitMembers( CButeMgr &buteMgr, char *aTagName );
};
typedef CTList<AMMO*> AmmoList;
struct WEAPON
{
WEAPON();
~WEAPON();
LTBOOL Init(CButeMgr & buteMgr, char* aTagName);
LTBOOL Override(CButeMgr &buteMgr, char *aTagName);
std::string GetNormalIcon() const;
std::string GetDisabledIcon() const;
std::string GetUnselectedIcon() const;
std::string GetSilhouetteIcon() const;
void Save(CButeMgr & buteMgr) const;
LTBOOL bInited;
int nId;
int nDescriptionId;
int nClientWeaponType;
int nIsAmmoNoPickupId;
int nAniType;
char* szName;
char* szLongName;
char* szShortName;
LTVector vPos;
LTVector vMuzzlePos;
LTVector vBreachOffset;
char *szPVModel;
char *szHHModel;
CButeListReader blrPVSkins;
CButeListReader blrHHSkins;
CButeListReader blrPVRenderStyles;
CButeListReader blrHHRenderStyles;
CButeListReader blrHiddenPieceNames; // A list of model pieces that will be hidden when the weapon fires
LTVector vHHScale;
char *szSilencedFireSound;
char *szAltFireSound;
char *szFireSound;
char *szDryFireSound;
char *szReloadSounds[WMGR_MAX_RELOAD_SNDS];
char *szSelectSound;
char *szDeselectSound;
char *szPrimitiveType;
char *szSubroutineNeeded;
char *szMiscSounds[WMGR_MAX_MISC_SNDS];
int nFireSoundRadius;
int nAIFireSoundRadius;
int nWeaponSoundRadius; // All non-fire sounds (Reload, Select, Deselect... etc.)
LTBOOL bEnvironmentMap;
LTBOOL bInfiniteAmmo;
LTBOOL bLooksDangerous;
LTBOOL bHideWhenEmpty;
LTBOOL bIsAmmo;
LTBOOL bUseUWMuzzleFX;
int nShotsPerClip;
int nNumAmmoIds;
int *aAmmoIds;
int nDefaultAmmoId;
int nNumModIds;
int *aModIds;
int nNumPVFXTypes;
int *aPVFXTypes;
int nMinPerturb;
int nMaxPerturb;
int nRange;
LTVector vRecoil;
int nVectorsPerRound;
int nAIWeaponType;
float fAIMinBurstInterval;
float fAIMaxBurstInterval;
int nAIMinBurstShots;
int nAIMaxBurstShots;
LTBOOL bAIAnimatesReloads;
float fFireRecoilPitch;
float fFireRecoilDecay;
CMuzzleFX *pPVMuzzleFX; // Player-view muzzle fx
char *szPVMuzzleFxName;
char *szHHMuzzleFxName;
int nNumPVAttachClientFX; // FXEd player view attachments
char *szPVAttachClientFX[ WMGR_MAX_PVCLIENTFX_ATTACHMENTS ];
uint32 m_nFireDelay; // Minimum time (ms) between firing
char *szHolsterAttachment;
float fFireAnimRateScale;
float fReloadAnimRateScale;
char *szPowerupFX;
char *szRespawnWaitFX;
CButeListReader blrRespawnWaitSkins;
CButeListReader blrRespawnWaitRenderStyles;
bool bRespawnWaitVisible;
bool bRespawnWaitTranslucent;
// Indicates server option has set restriction.
bool bServerRestricted;
bool bCanServerRestrict;
private:
int nNameId;
void InitMembers( CButeMgr &ButeMgr, char *aTagName );
char *szIcon;
};
typedef CTList<WEAPON*> WeaponList;
struct WeaponPath
{
WeaponPath()
{
vPath.Init();
vR.Init();
vU.Init();
nWeaponId = WMGR_INVALID_ID;
fPerturbU = 1.0f; // 0.0 - 1.0
fPerturbR = 1.0f; // 0.0 - 1.0
}
LTVector vPath;
LTVector vU;
LTVector vR;
uint8 nWeaponId;
LTFLOAT fPerturbU;
LTFLOAT fPerturbR;
};
class CWeaponMgr : public CGameButeMgr
{
private :
// Not allowed to create directly. Use Instance().
CWeaponMgr();
// Copy ctor and assignment operator not implemented and should never be used.
CWeaponMgr( CWeaponMgr const& other );
CWeaponMgr& operator=( CWeaponMgr const& other );
public :
// This destructor should be private, but if it is, the compiler complains
// that the Instance function does not have access to it. Instance should
// have access since it's a member function. Compiler bug?
~CWeaponMgr();
// Call this to get the singleton instance of the weapon mgr.
static CWeaponMgr& Instance( );
#ifndef _CLIENTBUILD
LTBOOL ReadWeaponProp(char* pPropName, uint8 & m_nWeaponId, uint8 & m_nAmmoId);
void ReadWeapon(char* szString, uint8 & nWeaponId, uint8 & nAmmoId);
#endif // _CLIENTBUILD
LTBOOL Init(const char* szAttributeFile = WEAPON_DEFAULT_FILE);
LTBOOL LoadOverrideButes( const char *szAttributeFile = WEAPON_DEFAULT_MULTI_FILE);
void Term();
void CalculateWeaponPath(WeaponPath & wp);
LTBOOL WriteFile();
void Reload();
int GetNumWeapons() const { return m_nNumWeapons; }
uint8 GetNumWeaponClasses() const { return m_nNumClasses; }
int GetNumAmmoIds() const { return m_nNumAmmos; }
int GetNumModIds() const { return m_nNumMods; }
int GetNumGearIds() const { return m_nNumGear; }
LTBOOL IsValidWeaponId(int nWeaponId) const;
LTBOOL IsValidAmmoId(int nAmmoId) const;
LTBOOL IsValidModId(int nModId) const ;
LTBOOL IsValidGearId(int nGearId) const;
LTBOOL IsPlayerWeapon(int nWeaponId) const;
int GetWeaponId(int nCommandId) const;
int GetCommandId(int nWeaponId) const;
uint8 GetWeaponClass(int nWeaponId) const;
int GetFirstWeaponCommandId() const;
int GetLastWeaponCommandId() const;
uint8 GetWeaponPriorities(uint8* pPriorityArray, int nArrayLen) const;
WEAPON const *GetWeapon(int nWeaponId) const;
WEAPON const *GetWeapon(const char* pWeaponName) const;
AMMO const *GetAmmo(int nAmmoId) const;
AMMO const *GetAmmo(char const* pAmmoName) const;
MOD const *GetMod(int nModId) const;
MOD const *GetMod(char const* pModName) const;
GEAR const *GetGear(int nGearId) const;
GEAR const *GetGear(char const* pGearName) const;
WEAPONANIS* GetWeaponAnis(char* pAnisName);
// Find the first weapon that uses this type of ammo...
WEAPON const *GetCorrespondingWeapon(AMMO const *pAmmo) const;
// Left in for backwards compatibility...
CScaleFX* GetScaleFX(int nScaleFXId);
PEXPLFX* GetPExplFX(int nPExplFXId);
DLIGHTFX* GetDLightFX(int nDLightFXId);
IMPACTFX* GetImpactFX(int nImpactFXId);
PROJECTILEFX* GetProjectileFX(int nProjFXId);
FIREFX* GetFireFX(int nFireFXId);
uint32 GetFileCRC() { return m_nFileCRC; }
// Checks if weaponida is better than weaponidb.
bool IsBetterWeapon( uint8 nWeaponIdA, uint8 nWeaponIdB ) const;
const char* GetMPDefaultWeapons() const;
protected :
WEAPON** m_pWeaponList; // All weapon data
int32 m_nNumWeapons;
AMMO** m_pAmmoList; // All ammo data
int32 m_nNumAmmos;
MOD** m_pModList; // All mod data
int32 m_nNumMods;
GEAR** m_pGearList; // All gear data
int32 m_nNumGear;
WEAPONANIS** m_pWeaponAnisList; // Weapon Ani overrides
int32 m_nNumWeaponAnis;
int* m_pWeaponOrder; // Order of weapon selection
int m_nFirstPlayerWeapon; // First weapon player can use
int m_nLastPlayerWeapon; // Last weapon player can use
uint8* m_pClasses; // indices into weapon order
uint8 m_nNumClasses;
uint8* m_pWeaponPriorities; // Used with auto-weapon switching
uint8 m_nNumWeaponPriorities;
void ClearLists(); // Clear all the above lists
uint32 m_nFileCRC;
std::string m_sMPDefaults;
};
// Map a commandid to a weapon id...
inline int CWeaponMgr::GetWeaponId(int nCommandId) const
{
int nId = nCommandId - COMMAND_ID_WEAPON_BASE;
if (!m_pWeaponOrder || nId < 0 || nId >= m_nNumWeapons)
{
return WMGR_INVALID_ID;
}
return m_pWeaponOrder[nId];
}
inline int CWeaponMgr::GetFirstWeaponCommandId() const
{
return COMMAND_ID_WEAPON_BASE + m_nFirstPlayerWeapon;
}
inline int CWeaponMgr::GetLastWeaponCommandId() const
{
return COMMAND_ID_WEAPON_BASE + m_nLastPlayerWeapon;
}
inline LTBOOL CWeaponMgr::IsPlayerWeapon(int nWeaponId) const
{
int nCommandId = GetCommandId(nWeaponId);
return (nCommandId >= GetFirstWeaponCommandId() && nCommandId <= GetLastWeaponCommandId());
}
// Map weapon id to command id...
inline int CWeaponMgr::GetCommandId(int nWeaponId) const
{
if (!m_pWeaponOrder || !IsValidWeaponId(nWeaponId))
{
return WMGR_INVALID_ID;
}
for (int i=0; i < m_nNumWeapons; i++)
{
if (m_pWeaponOrder[i] == nWeaponId)
{
return COMMAND_ID_WEAPON_BASE + i;
}
}
return WMGR_INVALID_ID;
}
// Get a weapons class
inline uint8 CWeaponMgr::GetWeaponClass(int nWeaponId) const
{
if (!m_pClasses || !m_pWeaponOrder || !IsValidWeaponId(nWeaponId))
{
return 0;
}
int i=0;
int nOrder = -1;
while (i < m_nNumWeapons && nOrder < 0)
{
if (m_pWeaponOrder[i] == nWeaponId)
{
nOrder = i;
}
i++;
}
if (nOrder < 0)
return 0;
uint8 nClass = 0;
while (nClass < m_nNumClasses)
{
if (nOrder <= (int)m_pClasses[nClass])
return (nClass+1);
nClass++;
}
return 0;
}
inline uint8 CWeaponMgr::GetWeaponPriorities(uint8* pPriorityArray, int nArrayLen) const
{
if (!m_pWeaponPriorities || m_nNumWeaponPriorities < 1 || !pPriorityArray) return 0;
int nNumWeapons = 0;
for (int i=0; i < m_nNumWeaponPriorities; i++)
{
if (i < nArrayLen)
{
pPriorityArray[i] = m_pWeaponPriorities[i];
nNumWeapons++;
}
else
{
break;
}
}
return nNumWeapons;
}
inline LTBOOL CWeaponMgr::IsValidWeaponId(int nWeaponId) const
{
return (LTBOOL) (0 <= nWeaponId && nWeaponId < m_nNumWeapons);
}
inline LTBOOL CWeaponMgr::IsValidAmmoId(int nAmmoId) const
{
return (LTBOOL) (0 <= nAmmoId && nAmmoId < m_nNumAmmos);
}
inline LTBOOL CWeaponMgr::IsValidModId(int nModId) const
{
return (LTBOOL) (0 <= nModId && nModId < m_nNumMods);
}
inline LTBOOL CWeaponMgr::IsValidGearId(int nGearId) const
{
return (LTBOOL) (0 <= nGearId && nGearId < m_nNumGear);
}
inline LTBOOL FiredWeapon(WeaponState eState)
{
return (eState == W_FIRED);
}
////////////////////////////////////////////////////////////////////////////
//
// CWeaponMgrPlugin is used to help facilitate populating the DEdit object
// properties that use WeaponMgr
//
////////////////////////////////////////////////////////////////////////////
#ifndef _CLIENTBUILD
#include "iobjectplugin.h"
class CWeaponMgrPlugin : public IObjectPlugin
{
public:
CWeaponMgrPlugin();
virtual ~CWeaponMgrPlugin();
virtual LTRESULT PreHook_EditStringList(
const char* szRezPath,
const char* szPropName,
char** aszStrings,
uint32* pcStrings,
const uint32 cMaxStrings,
const uint32 cMaxStringLength);
void PopulateStringList(char** aszStrings, uint32* pcStrings,
const uint32 cMaxStrings, const uint32 cMaxStringLength);
protected :
CFXButeMgrPlugin* m_pFXButeMgrPlugin;
static LTBOOL sm_bInitted;
};
#endif // _CLIENTBUILD
#endif // __WEAPON_MGR_H__
| [
"[email protected]"
]
| [
[
[
1,
845
]
]
]
|
a5a431809fe41cf57e10ef9fb36ac8b0f38423fc | 57574cc7192ea8564bd630dbc2a1f1c4806e4e69 | /Poker/Cliente/Panel.h | 4fd7403b05fdecf1a865c01ea13b1253d07c7a55 | []
| no_license | natlehmann/taller-2010-2c-poker | 3c6821faacccd5afa526b36026b2b153a2e471f9 | d07384873b3705d1cd37448a65b04b4105060f19 | refs/heads/master | 2016-09-05T23:43:54.272182 | 2010-11-17T11:48:00 | 2010-11-17T11:48:00 | 32,321,142 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,111 | h | #ifndef _PANEL_H__
#define _PANEL_H__
#include "SDL.h"
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <string.h>
#include "Contenedor.h"
#include "ComponentePanel.h"
#include "TextBox.h"
#include "Color.h"
#define PANEL_SEPARACION_BOTONES_H 10
#define PANEL_SEPARACION_BOTONES_V 4
#define ANCHO_DEFAULT_COMPONENTE 40
#define CORRECCION_ALTURA_COMPONENTE 6
#define MAX_CANT_COMPONENTES 6
using namespace std;
class Panel : public Contenedor
{
private:
Color* borde;
Color* fondo;
ComponentePanel* componentes[MAX_CANT_COMPONENTES];
bool hayNuevosComponentes;
void configurar();
protected:
virtual void dibujarSobreSup(SDL_Surface* superficie);
public:
Panel(void);
virtual ~Panel(void);
/**
* Agrega un boton en una posicion determinada.
*/
void agregarComponente(ComponentePanel* componente, int posicion);
ComponentePanel** getComponentes();
virtual ElementoGrafico* getElementoPorId(string id);
void setFondo(Color* color);
Color* getFondo();
void setBorde(Color* color);
};
#endif //_PANEL_H__
| [
"[email protected]@a9434d28-8610-e991-b0d0-89a272e3a296",
"pablooddo@a9434d28-8610-e991-b0d0-89a272e3a296"
]
| [
[
[
1,
11
],
[
15,
27
],
[
31,
51
],
[
55,
55
],
[
57,
57
]
],
[
[
12,
14
],
[
28,
30
],
[
52,
54
],
[
56,
56
]
]
]
|
8709fd0747e971838eddee91a9798d85bc41ca4d | 508bfb3220be28811600a2cbf0aabae382f78775 | /AcademicCrawler-sdk/Qt/Qt-4.6.2/include/QtGui/qitemselectionmodel.h | d200655f456771e449c6285de1a184b2e0c6e41b | []
| no_license | darkbtf/academic-crawler | 295f3bd74b18e700402bc2be59f15694d6195471 | 5dfcb0f1b88b93aa7545ef233344a41570011532 | refs/heads/master | 2021-01-01T19:21:00.162442 | 2011-03-10T16:29:25 | 2011-03-10T16:29:25 | 42,468,175 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 9,040 | h | /****************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation ([email protected])
**
** This file is part of the QtGui module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial Usage
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you have questions regarding the use of this file, please contact
** Nokia at [email protected].
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QITEMSELECTIONMODEL_H
#define QITEMSELECTIONMODEL_H
#include <QtCore/qset.h>
#include <QtCore/qvector.h>
#include <QtCore/qlist.h>
#include <QtCore/qabstractitemmodel.h>
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Gui)
#ifndef QT_NO_ITEMVIEWS
class Q_GUI_EXPORT QItemSelectionRange
{
public:
inline QItemSelectionRange() {}
inline QItemSelectionRange(const QItemSelectionRange &other)
: tl(other.tl), br(other.br) {}
inline QItemSelectionRange(const QModelIndex &topLeft, const QModelIndex &bottomRight);
explicit inline QItemSelectionRange(const QModelIndex &index)
{ tl = index; br = tl; }
inline int top() const { return tl.row(); }
inline int left() const { return tl.column(); }
inline int bottom() const { return br.row(); }
inline int right() const { return br.column(); }
inline int width() const { return br.column() - tl.column() + 1; }
inline int height() const { return br.row() - tl.row() + 1; }
inline QModelIndex topLeft() const { return QModelIndex(tl); }
inline QModelIndex bottomRight() const { return QModelIndex(br); }
inline QModelIndex parent() const { return tl.parent(); }
inline const QAbstractItemModel *model() const { return tl.model(); }
inline bool contains(const QModelIndex &index) const
{
return (parent() == index.parent()
&& tl.row() <= index.row() && tl.column() <= index.column()
&& br.row() >= index.row() && br.column() >= index.column());
}
inline bool contains(int row, int column, const QModelIndex &parentIndex) const
{
return (parent() == parentIndex
&& tl.row() <= row && tl.column() <= column
&& br.row() >= row && br.column() >= column);
}
bool intersects(const QItemSelectionRange &other) const;
QItemSelectionRange intersect(const QItemSelectionRange &other) const; // ### Qt 5: make QT4_SUPPORT
inline QItemSelectionRange intersected(const QItemSelectionRange &other) const
{ return intersect(other); }
inline bool operator==(const QItemSelectionRange &other) const
{ return (tl == other.tl && br == other.br); }
inline bool operator!=(const QItemSelectionRange &other) const
{ return !operator==(other); }
inline bool isValid() const
{
return (tl.isValid() && br.isValid() && tl.parent() == br.parent()
&& top() <= bottom() && left() <= right());
}
QModelIndexList indexes() const;
private:
QPersistentModelIndex tl, br;
};
Q_DECLARE_TYPEINFO(QItemSelectionRange, Q_MOVABLE_TYPE);
inline QItemSelectionRange::QItemSelectionRange(const QModelIndex &atopLeft,
const QModelIndex &abottomRight)
{ tl = atopLeft; br = abottomRight; }
class QItemSelection;
class QItemSelectionModelPrivate;
class Q_GUI_EXPORT QItemSelectionModel : public QObject
{
Q_OBJECT
Q_DECLARE_PRIVATE(QItemSelectionModel)
Q_FLAGS(SelectionFlags)
public:
enum SelectionFlag {
NoUpdate = 0x0000,
Clear = 0x0001,
Select = 0x0002,
Deselect = 0x0004,
Toggle = 0x0008,
Current = 0x0010,
Rows = 0x0020,
Columns = 0x0040,
SelectCurrent = Select | Current,
ToggleCurrent = Toggle | Current,
ClearAndSelect = Clear | Select
};
Q_DECLARE_FLAGS(SelectionFlags, SelectionFlag)
explicit QItemSelectionModel(QAbstractItemModel *model);
explicit QItemSelectionModel(QAbstractItemModel *model, QObject *parent);
virtual ~QItemSelectionModel();
QModelIndex currentIndex() const;
bool isSelected(const QModelIndex &index) const;
bool isRowSelected(int row, const QModelIndex &parent) const;
bool isColumnSelected(int column, const QModelIndex &parent) const;
bool rowIntersectsSelection(int row, const QModelIndex &parent) const;
bool columnIntersectsSelection(int column, const QModelIndex &parent) const;
bool hasSelection() const;
QModelIndexList selectedIndexes() const;
QModelIndexList selectedRows(int column = 0) const;
QModelIndexList selectedColumns(int row = 0) const;
const QItemSelection selection() const;
const QAbstractItemModel *model() const;
public Q_SLOTS:
void setCurrentIndex(const QModelIndex &index, QItemSelectionModel::SelectionFlags command);
virtual void select(const QModelIndex &index, QItemSelectionModel::SelectionFlags command);
virtual void select(const QItemSelection &selection, QItemSelectionModel::SelectionFlags command);
virtual void clear();
virtual void reset();
void clearSelection();
Q_SIGNALS:
void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
void currentChanged(const QModelIndex ¤t, const QModelIndex &previous);
void currentRowChanged(const QModelIndex ¤t, const QModelIndex &previous);
void currentColumnChanged(const QModelIndex ¤t, const QModelIndex &previous);
protected:
QItemSelectionModel(QItemSelectionModelPrivate &dd, QAbstractItemModel *model);
void emitSelectionChanged(const QItemSelection &newSelection, const QItemSelection &oldSelection);
private:
Q_DISABLE_COPY(QItemSelectionModel)
Q_PRIVATE_SLOT(d_func(), void _q_columnsAboutToBeRemoved(const QModelIndex&, int, int))
Q_PRIVATE_SLOT(d_func(), void _q_rowsAboutToBeRemoved(const QModelIndex&, int, int))
Q_PRIVATE_SLOT(d_func(), void _q_columnsAboutToBeInserted(const QModelIndex&, int, int))
Q_PRIVATE_SLOT(d_func(), void _q_rowsAboutToBeInserted(const QModelIndex&, int, int))
Q_PRIVATE_SLOT(d_func(), void _q_layoutAboutToBeChanged())
Q_PRIVATE_SLOT(d_func(), void _q_layoutChanged())
};
Q_DECLARE_OPERATORS_FOR_FLAGS(QItemSelectionModel::SelectionFlags)
// dummy implentation of qHash() necessary for instantiating QList<QItemSelectionRange>::toSet() with MSVC
inline uint qHash(const QItemSelectionRange &) { return 0; }
class Q_GUI_EXPORT QItemSelection : public QList<QItemSelectionRange>
{
public:
QItemSelection() {}
QItemSelection(const QModelIndex &topLeft, const QModelIndex &bottomRight);
void select(const QModelIndex &topLeft, const QModelIndex &bottomRight);
bool contains(const QModelIndex &index) const;
QModelIndexList indexes() const;
void merge(const QItemSelection &other, QItemSelectionModel::SelectionFlags command);
static void split(const QItemSelectionRange &range,
const QItemSelectionRange &other,
QItemSelection *result);
};
#ifndef QT_NO_DEBUG_STREAM
Q_GUI_EXPORT QDebug operator<<(QDebug, const QItemSelectionRange &);
#endif
#endif // QT_NO_ITEMVIEWS
QT_END_NAMESPACE
QT_END_HEADER
#endif // QITEMSELECTIONMODEL_H
| [
"ulmonkey1987@7c5ce3f8-edad-37de-be84-b98c484540b5"
]
| [
[
[
1,
229
]
]
]
|
23fa2e3e02a50187bd9563b39ffbadcd6a052ab6 | 0f8559dad8e89d112362f9770a4551149d4e738f | /Wall_Destruction/Havok/Source/Common/Base/DebugUtil/DeterminismUtil/hkCheckDeterminismUtil.h | 9f914ef8c39bf1390ea23767f949bcc850263030 | []
| no_license | TheProjecter/olafurabertaymsc | 9360ad4c988d921e55b8cef9b8dcf1959e92d814 | 456d4d87699342c5459534a7992f04669e75d2e1 | refs/heads/master | 2021-01-10T15:15:49.289873 | 2010-09-20T12:58:48 | 2010-09-20T12:58:48 | 45,933,002 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 10,808 | h | /*
*
* Confidential Information of Telekinesys Research Limited (t/a Havok). Not for disclosure or distribution without Havok's
* prior written consent. This software contains code, techniques and know-how which is confidential and proprietary to Havok.
* Level 2 and Level 3 source code contains trade secrets of Havok. Havok Software (C) Copyright 1999-2009 Telekinesys Research Limited t/a Havok. All Rights Reserved. Use of this software is subject to the terms of an end user license agreement.
*
*/
#ifndef HKBASE_HKDEBUGUTIL_CHECK_DETERMINISM_UTIL_H
#define HKBASE_HKDEBUGUTIL_CHECK_DETERMINISM_UTIL_H
// Uncomment the next line if you want to check the engine for determinism
//#define HK_ENABLE_DETERMINISM_CHECKS
#if defined (HK_ENABLE_DETERMINISM_CHECKS)
#include <Common/Base/Thread/Thread/hkThreadLocalData.h>
#include <Common/Base/System/Io/IStream/hkIStream.h>
#include <Common/Base/System/Io/OStream/hkOStream.h>
#define HK_ON_DETERMINISM_CHECKS_ENABLED(code) code
#define HK_ENABLE_INTERNAL_DATA_RANDOMIZATION // this may be useful when debugging multithreading non-determinism issues
#define HK_ON_ENABLE_INTERNAL_DATA_RANDOMIZATION(x) x
//#define HK_DETERMINISM_CHECK_SIZES
//#define HK_ENABLE_DETERMINISM_CHECKS_FOR_SOLVER
#else
# define HK_ON_DETERMINISM_CHECKS_ENABLED(code)
# define HK_ON_ENABLE_INTERNAL_DATA_RANDOMIZATION(x)
#endif
extern struct hkCheckDeterminismUtil* g_checkDeterminismUtil;
#if defined(HK_DETERMINISM_CHECK_SIZES)
# include <Common/Base/Container/PointerMap/hkPointerMap.h>
#endif
class hkIstream;
class hkOstream;
class hkCriticalSection;
class hkMemoryTrack;
/// This is a small helper class allowing to check the determinism of
/// a system. Basically it works by running an application twice:
/// First a binary logfile is created and the second time the system
/// checks against this binary logfile.
///
/// Usage quick start:
///
/// You activate writing or reading+checking with startWriteMode() or startCheckMode() functions from anywhere in your app.
/// Similarly you call finish() when you're done with writing or reading+checking.
///
/// Then for every single thread that you're intending to use the utility in, you must call workerThreadStartFrame() before
/// and workerThreadFinishFrame() after any use of the utility.
///
/// The workerThreadStartFrame() function takes a parameter isPrimaryWorkerThread. This can be true for only one thread.
/// That 'marked' thread is allowed to used the utility immediately. This is used when the primary thread performs special
/// operations besides the jobs taken off of the job queue.
///
/// Other threads must register a job first. The primary thread can also register jobs, when it starts working
/// in parallel to other threads.
///
/// Why do we need to register jobs? When multithreading, before the utility is used, you must tell it what that thread
/// is about to start doing -- you must do that, as the same thread may be given different jobs on each consecutive run.
/// You do that by calling registerAndStartJob() and finishJob(). Those functions take a job ID which must be unique
/// across all jobs performed during that one frame.
///
/// Soo, only now after starting, and before finishing a job. You can use the hkCheckDeterminismUtil::checkMt() function.
struct hkCheckDeterminismUtil
{
public:
HK_DECLARE_NONVIRTUAL_CLASS_ALLOCATOR( HK_MEMORY_CLASS_BASE_CLASS, hkCheckDeterminismUtil );
// Frame-unique ID
//
// This id has to be unique for a job in the scope of a single frame.
// It is made up of the hkpSimulationIslands's unite tag, job type, job task's sequential id, and one another counter (hmm).
// See hkCheckDeterminismUtil::Fuid hkpDynamicsJob::getFuid().
struct Fuid
{
HK_DECLARE_NONVIRTUAL_CLASS_ALLOCATOR( HK_MEMORY_CLASS_BASE_CLASS, hkCheckDeterminismUtil::Fuid );
hkUint32 m_0;
hkUint8 m_1;
hkUint16 m_2;
hkUint32 m_3, m_4;
static Fuid& getZeroFuid();
hkBool operator==(const Fuid& f)
{
return m_0 == f.m_0 && m_1 == f.m_1 && m_2 == f.m_2 && m_3 == f.m_3 && m_4 == f.m_4;
}
hkBool operator!=(const Fuid& f)
{
return m_0 != f.m_0 || m_1 != f.m_1 || m_2 != f.m_2 || m_3 != f.m_3 || m_4 != f.m_4;
}
};
hkCheckDeterminismUtil();
~hkCheckDeterminismUtil();
static hkCheckDeterminismUtil& getInstance() { HK_ASSERT2(0xad8655d2, g_checkDeterminismUtil, "Instance not created."); return *g_checkDeterminismUtil; }
static void HK_CALL createInstance() { HK_ASSERT2(0xad8655d3, !g_checkDeterminismUtil, "Instance already created."); g_checkDeterminismUtil = new hkCheckDeterminismUtil(); }
static void HK_CALL destroyInstance() { delete g_checkDeterminismUtil; g_checkDeterminismUtil = HK_NULL; }
/// Sets this utility to write mode. Call at startup of your test
/// Make sure to call finish() at the end.
void startWriteMode(const char* filename = "hkDeterminismCheckfile.bin");
/// Sets this utility to check mode. Call at startup of your test
/// Make sure to call finish() at the end.
void startCheckMode(const char* filename = "hkDeterminismCheckfile.bin");
//
// Registration functions used at the beginning and end of each hkpDynamicsJob.
//
# if defined (HK_ENABLE_DETERMINISM_CHECKS)
/// check an array, but only check the crc number of the whole array
template<typename TYPE>
static HK_ALWAYS_INLINE void HK_CALL checkMtCrc( int id, const TYPE* object, int numObjects = 1 ) { getInstance().checkCrcImpl( id, object, sizeof(TYPE ) * numObjects ); }
/// check an array of objects
template<typename TYPE>
static HK_FORCE_INLINE void HK_CALL checkMt( int id, const TYPE* object, int numObjects = 1 ) { getInstance().checkImpl( id, object, sizeof(TYPE ) * numObjects ); }
/// check a simple type object
template<typename TYPE>
static HK_FORCE_INLINE void HK_CALL checkMt( int id, const TYPE& object ) { getInstance().checkImpl( id, &object, sizeof(TYPE )); }
static void HK_CALL initThread() { initThreadImpl(); }
static void HK_CALL quitThread() { quitThreadImpl(); }
static void HK_CALL workerThreadStartFrame(hkBool isPrimaryWorkerThread) { getInstance().workerThreadStartFrameImpl(isPrimaryWorkerThread); }
static void HK_CALL workerThreadFinishFrame() { getInstance().workerThreadFinishFrameImpl(); }
static void HK_CALL registerAndStartJob(Fuid& jobFuid) { getInstance().registerAndStartJobImpl(jobFuid); }
static void HK_CALL finishJob(Fuid& jobFuid) { getInstance().finishJobImpl(jobFuid); }
static void HK_CALL combineRegisteredJobs() { getInstance().combineRegisteredJobsImpl(); }
static void HK_CALL extractRegisteredJobs() { getInstance().extractRegisteredJobsImpl(); }
static void HK_CALL clearRegisteredJobs() { getInstance().clearRegisteredJobsImpl(); }
# else
template<typename TYPE> static HK_ALWAYS_INLINE void HK_CALL checkMtCrc( int id, const TYPE* object, int numObjects = 1 ) { }
template<typename TYPE> static HK_ALWAYS_INLINE void HK_CALL checkMt( int id, const TYPE* object, int numObjects = 1 ) { }
template<typename TYPE> static HK_ALWAYS_INLINE void HK_CALL checkMt( int id, const TYPE& object ) { }
static HK_ALWAYS_INLINE void HK_CALL initThread() { }
static HK_ALWAYS_INLINE void HK_CALL quitThread() { }
static HK_ALWAYS_INLINE void HK_CALL workerThreadStartFrame(hkBool isPrimaryWorkerThread){ }
static HK_ALWAYS_INLINE void HK_CALL workerThreadFinishFrame() { }
static HK_ALWAYS_INLINE void HK_CALL registerAndStartJob(Fuid& jobFuid) { }
static HK_ALWAYS_INLINE void HK_CALL finishJob(Fuid& jobFuid) { }
static HK_ALWAYS_INLINE void HK_CALL combineRegisteredJobs() { }
static HK_ALWAYS_INLINE void HK_CALL extractRegisteredJobs() { }
static HK_ALWAYS_INLINE void HK_CALL clearRegisteredJobs() { }
# endif
static void HK_CALL initThreadImpl();
static void HK_CALL quitThreadImpl();
void workerThreadStartFrameImpl(hkBool isPrimaryWorkerThread);
void workerThreadFinishFrameImpl();
void registerAndStartJobImpl(Fuid& jobFuid);
void finishJobImpl(Fuid& jobFuid);
void combineRegisteredJobsImpl();
void extractRegisteredJobsImpl();
void clearRegisteredJobsImpl();
void checkImpl( int id, const void* object, int size);
void checkCrcImpl( int id, const void* object, int size);
/// Call this function at the end of your write/check run. This closes the open files
void finish();
void flushWrite();
static void setCurrentJobFuid(Fuid jobFuid);
static Fuid getCurrentJobFuid();
public:
enum Mode
{
MODE_IDLE,
MODE_WRITE,
MODE_COMPARE
};
Mode m_mode;
hkBool m_inSingleThreadedCode;
hkMemoryTrack* m_memoryTrack; ///
hkIstream* m_sharedInputStream;
hkOstream* m_sharedOutputStream;
hkIstream* m_primaryWorkerThreadInputStream;
hkOstream* m_primaryWorkerThreadOutputStream;
int m_primaryWorkerThreadJobInfoIdx;
hkCriticalSection* m_shared;
struct JobInfo
{
HK_DECLARE_NONVIRTUAL_CLASS_ALLOCATOR( HK_MEMORY_CLASS_BASE_CLASS, hkCheckDeterminismUtil::JobInfo );
Fuid m_jobFuid;
// This is the data. In multi threaded mode, the thread-local m_input/outputStreams connect to the corresponding hkArray.
// This array is resizable, therefore it has to point to the data array.
hkMemoryTrack* m_data; // for write
hkBool m_isOpen;
};
hkArray<JobInfo> m_registeredJobs;
#if defined(HK_DETERMINISM_CHECK_SIZES)
hkPointerMap<int,int> m_sizePerId;
#endif
hkBool m_writingStFromWorker;
};
# if defined (HK_ENABLE_DETERMINISM_CHECKS)
extern int hkCheckDeterminismUtil_id;
extern float* hkCheckDeterminismUtil_reference;
extern float* hkCheckDeterminismUtil_object;
extern int hkCheckDeterminismUtil_size;
extern float* hkCheckDeterminismUtil_crcObject;
#endif
#endif // HKBASE_HKDEBUGUTIL_CHECK_DETERMINISM_UTIL_H
/*
* Havok SDK - NO SOURCE PC DOWNLOAD, BUILD(#20091222)
*
* Confidential Information of Havok. (C) Copyright 1999-2009
* Telekinesys Research Limited t/a Havok. All Rights Reserved. The Havok
* Logo, and the Havok buzzsaw logo are trademarks of Havok. Title, ownership
* rights, and intellectual property rights in the Havok software remain in
* Havok and/or its suppliers.
*
* Use of this software for evaluation purposes is subject to and indicates
* acceptance of the End User licence Agreement for this product. A copy of
* the license is included with this software and is also available at www.havok.com/tryhavok.
*
*/
| [
"[email protected]"
]
| [
[
[
1,
256
]
]
]
|
98c0e3ee65c36f6f630f3feaf90ba2f8459cca6c | d2996420f8c3a6bbeef63a311dd6adc4acc40436 | /src/graviator_client.cpp | 0488cdf40e7810b66d132bcf26d4136e87d72a1d | []
| no_license | aruwen/graviator | 4d2e06e475492102fbf5d65754be33af641c0d6c | 9a881db9bb0f0de2e38591478429626ab8030e1d | refs/heads/master | 2021-01-19T00:13:10.843905 | 2011-03-13T13:15:25 | 2011-03-13T13:15:25 | 32,136,578 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,728 | cpp | /*
-----------------------------------------------------------------------------
Filename: graviator_client.cpp
-----------------------------------------------------------------------------
This source file is generated by the
___ _ __ __ _ _
/___\__ _ _ __ ___ /_\ _ __ _ __/ / /\ \ (_)______ _ _ __ __| |
// // _` | '__/ _ \ //_\\| '_ \| '_ \ \/ \/ / |_ / _` | '__/ _` |
/ \_// (_| | | | __/ / _ \ |_) | |_) \ /\ /| |/ / (_| | | | (_| |
\___/ \__, |_| \___| \_/ \_/ .__/| .__/ \/ \/ |_/___\__,_|_| \__,_|
|___/ |_| |_|
Ogre 1.7.x Application Wizard for VC9 (August 2010)
http://code.google.com/p/ogreappwizards/
-----------------------------------------------------------------------------
*/
#include "graviator_client.h"
#include "client\hud\ClientHudResources.h"
#include <OgreException.h>
#include <OgreConfigFile.h>
#include <OgreCamera.h>
#include <OgreViewport.h>
#include <OgreSceneManager.h>
#include <OgreRenderWindow.h>
#include <OgreWindowEventUtilities.h>
//-------------------------------------------------------------------------------------
graviator_client::graviator_client(void):
mRoot(0),
mPluginsCfg(Ogre::StringUtil::BLANK),
mResourcesCfg(Ogre::StringUtil::BLANK),
mShutDown(false)
{
}
//-------------------------------------------------------------------------------------
graviator_client::~graviator_client(void)
{
ClientHUDResources::destroy();
delete mRoot;
}
bool graviator_client::go(void)
{
#ifdef _DEBUG
mResourcesCfg = "resources_d.cfg";
mPluginsCfg = "plugins_d.cfg";
#else
mResourcesCfg = "resources.cfg";
mPluginsCfg = "plugins.cfg";
#endif
mRoot = new Ogre::Root(mPluginsCfg);
Ogre::ConfigFile cf;
cf.load(mResourcesCfg);
Ogre::ConfigFile::SectionIterator seci = cf.getSectionIterator();
Ogre::String secName, typeName, archName;
while (seci.hasMoreElements())
{
secName = seci.peekNextKey();
Ogre::ConfigFile::SettingsMultiMap *settings = seci.getNext();
Ogre::ConfigFile::SettingsMultiMap::iterator i;
for (i = settings->begin(); i != settings->end(); ++i)
{
typeName = i->first;
archName = i->second;
Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
archName, typeName, secName);
}
}
if(!(mRoot->restoreConfig() || mRoot->showConfigDialog()))
{
return false;
}
mWindow = mRoot->initialise(true, "Graviator");
Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(3);
Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
//-------------------------------------------------------------------------------------
OIS::ParamList pl;
size_t windowHnd = 0;
std::ostringstream windowHndStr;
mWindow->getCustomAttribute("WINDOW", &windowHnd);
windowHndStr << windowHnd;
pl.insert(std::make_pair(std::string("WINDOW"), windowHndStr.str()));
mOISInputManager = OIS::InputManager::createInputSystem( pl );
mKeyboard = static_cast<OIS::Keyboard *>(mOISInputManager->createInputObject(OIS::OISKeyboard, true ));
mMouse = static_cast<OIS::Mouse *>(mOISInputManager->createInputObject(OIS::OISMouse, true ));
mMouse->setEventCallback(this);
mRoot->addFrameListener(this);
//-------------------------------------------------------------------------------------
ClientStateSharedElements *sharedElements = new ClientStateSharedElements;
sharedElements->root = mRoot;
sharedElements->window = mWindow;
sharedElements->mouse = mMouse;
sharedElements->keyboard = mKeyboard;
mStateManager = new ClientStateManager(sharedElements, LOBBY_STATE);
//-------------------------------------------------------------------------------------
while(true)
{
// Pump window messages for nice behaviour
Ogre::WindowEventUtilities::messagePump();
if(!mStateManager->update())
mShutDown = true;
if(mWindow->isClosed())
return false;
// Render a frame
Sleep(10);
if(!mRoot->renderOneFrame())
return false;
}
return true;
}
bool graviator_client::frameRenderingQueued(const Ogre::FrameEvent& evt)
{
if (mWindow->isClosed()) return false;
if (mShutDown) return false;
mKeyboard->capture();
mMouse->capture();
if(!processUnbufferedInput(evt)) return false;
return true;
}
bool graviator_client::mouseMoved(const OIS::MouseEvent &arg )
{
return mStateManager->mouseMoved(arg);
}
bool graviator_client::processUnbufferedInput(const Ogre::FrameEvent &evt)
{
return mStateManager->processUnbufferedInput(evt);
}
//-------------------------------------------------------------------------------------
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
#define WIN32_LEAN_AND_MEAN
#include "windows.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT )
#else
int main(int argc, char *argv[])
#endif
{
// Create application object
graviator_client app;
try {
app.go();
} catch( Ogre::Exception& e ) {
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
MessageBox( NULL, e.getFullDescription().c_str(), "An exception has occured!", MB_OK | MB_ICONERROR | MB_TASKMODAL);
#else
std::cerr << "An exception has occured: " <<
e.getFullDescription().c_str() << std::endl;
#endif
}
return 0;
}
#ifdef __cplusplus
}
#endif
| [
"[email protected]@c8d5bfcc-1391-a108-90e5-e810ef6ef867"
]
| [
[
[
1,
210
]
]
]
|
69d628b76a44e7ff5b63864a9971958fe2f27d74 | 4b0f51aeecddecf3f57a29ffa7a184ae48f1dc61 | /CleanProject/OgreMaxLoader/Include/OgreMaxScene.cpp | 0bb51823eb4e5c97b093b6eb9d7007affba35462 | []
| no_license | bahao247/apeengine2 | 56560dbf6d262364fbc0f9f96ba4231e5e4ed301 | f2617b2a42bdf2907c6d56e334c0d027fb62062d | refs/heads/master | 2021-01-10T14:04:02.319337 | 2009-08-26T08:23:33 | 2009-08-26T08:23:33 | 45,979,392 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 129,980 | cpp | /*
* OgreMaxViewer - An Ogre 3D-based viewer for .scene and .mesh files
* Copyright 2008 Derek Nedelman
*
* This code is available under the OgreMax Free License:
* -You may use this code for any purpose, commercial or non-commercial.
* -If distributing derived works (that use this source code) in binary or source code form,
* you must give the following credit in your work's end-user documentation:
* "Portions of this work provided by OgreMax (www.ogremax.com)"
*
* Derek Nedelman assumes no responsibility for any harm caused by using this code.
*
* OgreMaxViewer was written by Derek Nedelman and released at www.ogremax.com
*/
//Includes---------------------------------------------------------------------
#include "OgreMaxScene.hpp"
#include "OgreMaxUtilities.hpp"
#include <OgreHardwarePixelBuffer.h>
#include <OgreRenderTarget.h>
#include <OgreRenderTexture.h>
#include <OgreMaterialManager.h>
#include <OgreRoot.h>
#include <OgreRenderSystem.h>
#include <OgreRenderWindow.h>
#include <OgreSubEntity.h>
#include <OgreBillboard.h>
#include <OgreShadowCameraSetupFocused.h>
#include <OgreShadowCameraSetupLiSPSM.h>
#include <OgreShadowCameraSetupPlaneOptimal.h>
using namespace Ogre;
using namespace OgreMax;
using namespace OgreMax::Types;
//Local classes----------------------------------------------------------------
/**
* Internal model loading callback used when creating an instance of a model
* It translates model callbacks to scene callbacks
*/
class SceneModelInstanceCallback : public OgreMaxModelInstanceCallback
{
public:
SceneModelInstanceCallback(OgreMaxScene* scene, OgreMaxSceneCallback* sceneCallback)
{
this->scene = scene;
this->sceneCallback = sceneCallback;
}
virtual void CreatedLight(const OgreMaxModel* model, Light* light)
{
if (this->sceneCallback != 0)
this->sceneCallback->CreatedLight(this->scene, light);
CreatedMovableObject(model, light);
}
virtual void CreatedCamera(const OgreMaxModel* model, Camera* camera)
{
if (this->sceneCallback != 0)
this->sceneCallback->CreatedCamera(this->scene, camera);
CreatedMovableObject(model, camera);
}
virtual void CreatedMesh(const OgreMaxModel* model, Mesh* mesh)
{
if (this->sceneCallback != 0)
this->sceneCallback->CreatedMesh(this->scene, mesh);
}
virtual void CreatedEntity(const OgreMaxModel* model, Entity* entity)
{
if (this->sceneCallback != 0)
this->sceneCallback->CreatedEntity(this->scene, entity);
CreatedMovableObject(model, entity);
}
virtual void CreatedParticleSystem(const OgreMaxModel* model, ParticleSystem* particleSystem)
{
if (this->sceneCallback != 0)
this->sceneCallback->CreatedParticleSystem(this->scene, particleSystem);
CreatedMovableObject(model, particleSystem);
}
virtual void CreatedBillboardSet(const OgreMaxModel* model, BillboardSet* billboardSet)
{
if (this->sceneCallback != 0)
this->sceneCallback->CreatedBillboardSet(this->scene, billboardSet);
CreatedMovableObject(model, billboardSet);
}
virtual void CreatedPlane(const OgreMaxModel* model, const Plane& plane, Entity* entity)
{
if (this->sceneCallback != 0)
this->sceneCallback->CreatedPlane(this->scene, plane, entity);
CreatedMovableObject(model, entity);
}
virtual void CreatedMovableObject(const OgreMaxModel* model, MovableObject* object)
{
if (this->sceneCallback != 0)
this->sceneCallback->CreatedMovableObject(this->scene, object);
}
virtual void CreatedNodeAnimationTrack(const OgreMaxModel* model, SceneNode* node, AnimationTrack* animationTrack, bool enabled, bool looping)
{
if (this->sceneCallback != 0)
this->sceneCallback->CreatedNodeAnimationTrack(this->scene, node, animationTrack, enabled, looping);
}
virtual void CreatedNodeAnimationState(const OgreMaxModel* model, SceneNode* node, AnimationState* animationState)
{
if (this->sceneCallback != 0)
this->sceneCallback->CreatedNodeAnimationState(this->scene, node, animationState);
}
virtual void StartedCreatingNode(const OgreMaxModel* model, SceneNode* node)
{
node->setFixedYawAxis(false, this->scene->GetUpAxis() == UP_AXIS_Y ? Vector3::UNIT_Y : Vector3::UNIT_Z);
if (this->sceneCallback != 0)
this->sceneCallback->StartedCreatingNode(this->scene, node);
}
virtual void FinishedCreatingNode(const OgreMaxModel* model, SceneNode* node)
{
if (this->sceneCallback != 0)
this->sceneCallback->FinishedCreatingNode(this->scene, node);
}
virtual void HandleObjectExtraData(ObjectExtraDataPtr objectExtraData)
{
this->scene->HandleNewObjectExtraData(objectExtraData);
}
private:
OgreMaxScene* scene;
OgreMaxSceneCallback* sceneCallback;
};
//Implementation---------------------------------------------------------------
OgreMaxScene::OgreMaxScene()
{
this->sceneManager = 0;
this->rootNode = 0;
this->callback = 0;
this->upAxis = UP_AXIS_Y;
this->unitsPerMeter = 0;
this->environmentNear = 0;
this->environmentFar = 10000;
this->shadowOptimalPlane = 0;
this->backgroundColor = ColourValue::Black;
this->loadedRenderTextures.reserve(32);
this->currentRenderTextureIndex = 0;
this->loadedFromFileSystem = false;
}
OgreMaxScene::~OgreMaxScene()
{
Destroy();
}
void OgreMaxScene::Load
(
const String& fileName,
RenderWindow* renderWindow,
LoadOptions loadOptions,
SceneManager* sceneManager,
SceneNode* rootNode,
OgreMaxSceneCallback* callback,
const String& defaultResourceGroupName
)
{
OgreMaxOneRenderWindow oneRenderWindow(renderWindow);
Load(fileName, oneRenderWindow, loadOptions, sceneManager, rootNode, callback, defaultResourceGroupName);
}
void OgreMaxScene::Load
(
const String& fileNameOrContent,
OgreMaxRenderWindowIterator& renderWindows,
LoadOptions loadOptions,
SceneManager* sceneManager,
SceneNode* rootNode,
OgreMaxSceneCallback* callback,
const String& defaultResourceGroupName
)
{
bool isFileName = (loadOptions & FILE_NAME_CONTAINS_CONTENT) == 0;
//Parse the directory and file base name from the input file name, if it's a file name
String directory, fileBaseName;
if (isFileName)
{
StringUtil::splitFilename(fileNameOrContent, fileBaseName, directory);
if (!directory.empty())
{
//A full path was passed in. Assume the caller wants the directory to be added as
//a resource location and that the directory be the base all other resource
//locations are relative to
SetBaseResourceLocation(directory);
}
}
//Notify callback, possibly getting a new resource group name
String resourceGroupName = defaultResourceGroupName;
if (callback != 0)
callback->LoadingSceneFile(this, fileBaseName, resourceGroupName);
//Load the XML document
TiXmlDocument document;
if (isFileName)
{
//Load it from a file
String absoluteFileName = OgreMaxUtilities::JoinPath(this->baseResourceLocation, fileBaseName);
if (loadOptions & NO_FILE_SYSTEM_CHECK)
{
//Caller wants to load from the Ogre resource system
OgreMaxUtilities::LoadXmlDocument(fileBaseName, document, resourceGroupName);
}
else if (OgreMaxUtilities::IsFileReadable(absoluteFileName))
{
//Load from disk
if (document.LoadFile(absoluteFileName.c_str()))
{
//The file was successfully loaded. Enable the use of the resource locations in the file
this->loadedFromFileSystem = true;
}
else
{
StringUtil::StrStreamType errorMessage;
errorMessage << "Unable to load OgreMax scene file: " << absoluteFileName;
OGRE_EXCEPT
(
Exception::ERR_INVALID_STATE,
errorMessage.str(),
"OgreMaxScene::Load"
);
}
}
else if (!this->baseResourceLocation.empty())
{
//File isn't readable and the caller wanted it to be
StringUtil::StrStreamType errorMessage;
errorMessage << "Unable to read OgreMax scene file: " << absoluteFileName;
OGRE_EXCEPT
(
Exception::ERR_FILE_NOT_FOUND,
errorMessage.str(),
"OgreMaxScene::Load"
);
}
else
{
//Everything else failed. Load from the Ogre resource system
OgreMaxUtilities::LoadXmlDocument(fileBaseName, document, resourceGroupName);
}
}
else
{
//Load it from memory
document.Parse(fileNameOrContent.c_str());
if (document.Error())
{
StringUtil::StrStreamType errorMessage;
errorMessage << "There was an error parsing the scene XML content: " << document.ErrorDesc();
OGRE_EXCEPT
(
Exception::ERR_INVALIDPARAMS,
errorMessage.str(),
"OgreMaxScene::Load"
);
}
}
Load(document.RootElement(), renderWindows, loadOptions, sceneManager, rootNode, callback, resourceGroupName);
}
void OgreMaxScene::Load
(
TiXmlElement* objectElement,
OgreMaxRenderWindowIterator& renderWindows,
LoadOptions loadOptions,
SceneManager* sceneManager,
SceneNode* rootNode,
OgreMaxSceneCallback* callback,
const String& defaultResourceGroupName
)
{
this->renderWindows = &renderWindows;
this->loadOptions = loadOptions;
this->sceneManager = sceneManager;
this->rootNode = rootNode;
this->callback = callback;
this->defaultResourceGroupName = defaultResourceGroupName;
//Send "start" notification to callback
if (this->callback != 0)
this->callback->StartedLoad(this);
try
{
//Perform scene loading
LoadScene(objectElement);
}
catch (...)
{
//Send "ended with failure" notification to callback
if (this->callback != 0)
this->callback->FinishedLoad(this, false);
throw;
}
//Send "ended with success" notification to callback
if (this->callback != 0)
this->callback->FinishedLoad(this, true);
}
void OgreMaxScene::Update(Real elapsedTime)
{
//Update managed animation states
for (AnimationStates::iterator stateIterator = this->animationStates.begin();
stateIterator != this->animationStates.end();
++stateIterator)
{
AnimationState* animationState = stateIterator->second;
if (animationState->getEnabled())
animationState->addTime(elapsedTime);
}
}
const String& OgreMaxScene::GetBaseResourceLocation() const
{
return this->baseResourceLocation;
}
void OgreMaxScene::SetBaseResourceLocation(const String& directory)
{
this->baseResourceLocation = directory;
}
void OgreMaxScene::Destroy()
{
//Delete planes
delete this->shadowOptimalPlane;
this->shadowOptimalPlane = 0;
for (MovablePlanesMap::iterator plane = this->movablePlanes.begin();
plane != this->movablePlanes.end();
++plane)
{
delete plane->second;
}
this->movablePlanes.clear();
//Delete render textures
//Note that this does not destroy the Ogre resources that the render textures use
for (size_t renderTextureIndex = 0; renderTextureIndex < this->loadedRenderTextures.size(); renderTextureIndex++)
{
LoadedRenderTexture* loadedRenderTexture = this->loadedRenderTextures[renderTextureIndex];
size_t faceCount = loadedRenderTexture->renderTexture->getNumFaces();
for (size_t faceIndex = 0; faceIndex < faceCount; faceIndex++)
{
RenderTarget* renderTarget = loadedRenderTexture->renderTexture->getBuffer(faceIndex)->getRenderTarget();
renderTarget->removeListener(this);
renderTarget->removeAllViewports();
}
delete loadedRenderTexture;
}
this->loadedRenderTextures.clear();
//Delete the extra object data
this->allObjectExtraData.clear();
//Delete the models
for (ModelMap::iterator item = this->modelMap.begin();
item != this->modelMap.end();
++item)
{
delete item->second;
}
this->modelMap.clear();
//Clear out some lists
this->externalItems.clear();
this->loadedObjects.clear();
this->animationStates.clear();
this->renderTargets.clear();
this->queryFlags.clear();
this->visibilityFlags.clear();
this->resourceLocations.clear();
//Reset some variables
this->currentRenderTextureIndex = 0;
this->baseResourceLocation = StringUtil::BLANK;
this->loadedFromFileSystem = false;
}
void OgreMaxScene::SetNamePrefix(const String& name, WhichNamePrefix prefixes)
{
if (prefixes & OBJECT_NAME_PREFIX)
this->objectNamePrefix = name;
if (prefixes & NODE_NAME_PREFIX)
this->nodeNamePrefix = name;
if (prefixes & NODE_ANIMATION_NAME_PREFIX)
this->nodeAnimationNamePrefix = name;
}
SceneManager* OgreMaxScene::GetSceneManager()
{
return this->sceneManager;
}
SceneNode* OgreMaxScene::GetRootNode()
{
return this->rootNode;
}
SceneNode* OgreMaxScene::GetSceneNode(const String& name, bool nameIncludesPrefix)
{
if (nameIncludesPrefix)
return this->sceneManager->getSceneNode(name);
else
{
String prefixedName = this->nodeNamePrefix;
prefixedName += name;
return this->sceneManager->getSceneNode(name);
}
}
UpAxis OgreMaxScene::GetUpAxis() const
{
return this->upAxis;
}
const Vector3& OgreMaxScene::GetUpVector() const
{
return this->upAxis == UP_AXIS_Y ? Vector3::UNIT_Y : Vector3::UNIT_Z;
}
Real OgreMaxScene::GetUnitsPerMeter()
{
return this->unitsPerMeter;
}
const String OgreMaxScene::GetUnitType()
{
return this->unitType;
}
const ObjectExtraData& OgreMaxScene::GetSceneExtraData() const
{
return this->sceneExtraData;
}
const ObjectExtraData& OgreMaxScene::GetTerrainExtraData() const
{
return this->terrainExtraData;
}
const ObjectExtraData& OgreMaxScene::GetSkyBoxExtraData() const
{
return this->skyBoxExtraData;
}
const ObjectExtraData& OgreMaxScene::GetSkyDomeExtraData() const
{
return this->skyDomeExtraData;
}
const ObjectExtraData& OgreMaxScene::GetSkyPlaneExtraData() const
{
return this->skyPlaneExtraData;
}
const OgreMaxScene::ExternalItemList& OgreMaxScene::GetExternalItems() const
{
return this->externalItems;
}
const ColourValue& OgreMaxScene::GetBackgroundColor() const
{
return this->backgroundColor;
}
Real OgreMaxScene::GetEnvironmentNear() const
{
return this->environmentNear;
}
const FogParameters& OgreMaxScene::GetFogParameters() const
{
return this->fogParameters;
}
Real OgreMaxScene::GetEnvironmentFar() const
{
return this->environmentFar;
}
MovablePlane* OgreMaxScene::GetShadowOptimalPlane()
{
return this->shadowOptimalPlane;
}
MovablePlane* OgreMaxScene::GetMovablePlane(const String& name)
{
MovablePlane* plane = 0;
String movablePlaneName;
OgreMaxUtilities::CreateMovablePlaneName(movablePlaneName, name);
MovablePlanesMap::iterator planeIterator = this->movablePlanes.find(movablePlaneName);
if (planeIterator != this->movablePlanes.end())
plane = planeIterator->second;
return plane;
}
OgreMaxScene::AnimationStates& OgreMaxScene::GetAnimationStates()
{
return this->animationStates;
}
AnimationState* OgreMaxScene::GetAnimationState(const String& animationName)
{
AnimationStates::iterator stateIterator = this->animationStates.find(animationName);
if (stateIterator != this->animationStates.end())
return stateIterator->second;
else
return 0;
}
OgreMaxScene::ObjectExtraDataMap& OgreMaxScene::GetAllObjectExtraData()
{
return this->allObjectExtraData;
}
OgreMaxScene::NodeObjectExtraDataMap& OgreMaxScene::GetAllNodeObjectExtraData()
{
return this->allNodeObjectExtraData;
}
const OgreMaxScene::ModelMap& OgreMaxScene::GetModelMap() const
{
return this->modelMap;
}
OgreMaxModel* OgreMaxScene::GetModel(const String& fileName)
{
//Look up item and return it if found
ModelMap::iterator item = this->modelMap.find(fileName);
if (item != this->modelMap.end())
return item->second;
//Model couldn't be found, so load it
OgreMaxModel* model = new OgreMaxModel;
try
{
model->Load(fileName, this->defaultResourceGroupName);
}
catch (...)
{
delete model;
throw;
}
//If we're here, the model was loaded. Add it to the lookup
this->modelMap[fileName] = model;
return model;
}
const FlagAliases& OgreMaxScene::GetQueryFlagAliases() const
{
return this->queryFlags;
}
const FlagAliases& OgreMaxScene::GetVisibilityFlagAliases() const
{
return this->visibilityFlags;
}
ObjectExtraData* OgreMaxScene::GetObjectExtraData(const MovableObject* object) const
{
ObjectExtraDataMap::const_iterator item = this->allObjectExtraData.find(object);
if (item != this->allObjectExtraData.end())
return item->second.getPointer();
else
return 0;
}
Types::ObjectExtraData* OgreMaxScene::GetObjectExtraData(const Ogre::Node* node) const
{
NodeObjectExtraDataMap::const_iterator item = this->allNodeObjectExtraData.find(node);
if (item != this->allNodeObjectExtraData.end())
return item->second.getPointer();
else
return 0;
}
const OgreMaxScene::ResourceLocations& OgreMaxScene::GetResourceLocations() const
{
return this->resourceLocations;
}
void OgreMaxScene::HandleNewObjectExtraData(ObjectExtraDataPtr objectExtraData)
{
bool hasOwner =
objectExtraData->object != 0 ||
objectExtraData->node != 0;
if (hasOwner && this->callback != 0)
this->callback->HandleObjectExtraData(objectExtraData);
//Store the object extra data if there is an object associated with it
if (objectExtraData->object != 0)
this->allObjectExtraData[objectExtraData->object] = objectExtraData;
else if (objectExtraData->node != 0)
this->allNodeObjectExtraData[objectExtraData->node] = objectExtraData;
}
void OgreMaxScene::DestroyedSceneNode(const SceneNode* node)
{
NodeObjectExtraDataMap::iterator extraDataIterator = this->allNodeObjectExtraData.find(node);
if (extraDataIterator != this->allNodeObjectExtraData.end())
this->allNodeObjectExtraData.erase(extraDataIterator);
}
void OgreMaxScene::DestroyedObject(const MovableObject* object)
{
ObjectExtraDataMap::iterator extraDataIterator = this->allObjectExtraData.find(object);
if (extraDataIterator != this->allObjectExtraData.end())
this->allObjectExtraData.erase(extraDataIterator);
}
void OgreMaxScene::preRenderTargetUpdate(const RenderTargetEvent& e)
{
RenderTargetMap::iterator renderTarget = this->renderTargets.find(e.source);
if (renderTarget != this->renderTargets.end())
{
LoadedRenderTexture& loadedRenderTexture = *renderTarget->second;
RenderTextureParameters& params = loadedRenderTexture.parameters;
//Set scheme
this->previousActiveScheme = MaterialManager::getSingleton().getActiveScheme();
if (params.scheme.empty())
MaterialManager::getSingleton().setActiveScheme(MaterialManager::DEFAULT_SCHEME_NAME);
else
MaterialManager::getSingleton().setActiveScheme(params.scheme);
//Hide all the hidden objects
if (loadedRenderTexture.renderObjectNode != 0 && params.hideRenderObject)
loadedRenderTexture.renderObjectNode->setVisible(false, false);
loadedRenderTexture.hiddenObjects.Hide();
//Show all the exclusive objects
loadedRenderTexture.exclusiveObjects.Show();
//If render target is for a cube map texture, update cube face camera positions
if (params.textureType == TEX_TYPE_CUBE_MAP)
{
//Get the position from which the cube map will be rendered
Vector3 position;
loadedRenderTexture.GetReferencePosition(position);
//Set position into cube face cameras
size_t faceCount = loadedRenderTexture.renderTexture->getNumFaces();
for (size_t faceIndex = 0; faceIndex < faceCount; faceIndex++)
loadedRenderTexture.cubeFaceCameras[faceIndex]->setPosition(position);
}
}
}
void OgreMaxScene::postRenderTargetUpdate(const RenderTargetEvent& e)
{
RenderTargetMap::iterator renderTarget = this->renderTargets.find(e.source);
if (renderTarget != this->renderTargets.end())
{
LoadedRenderTexture& loadedRenderTexture = *renderTarget->second;
RenderTextureParameters& params = loadedRenderTexture.parameters;
//Restore scheme
MaterialManager::getSingleton().setActiveScheme(this->previousActiveScheme);
//Show all the hidden objects
if (loadedRenderTexture.renderObjectNode != 0 && params.hideRenderObject)
loadedRenderTexture.renderObjectNode->setVisible(true, false);
loadedRenderTexture.hiddenObjects.Show();
//Hide all the exclusive objects
loadedRenderTexture.exclusiveObjects.Hide();
}
}
String OgreMaxScene::GetNewObjectName(const TiXmlElement* objectElement, SceneNode* node)
{
//Get the name from either the "name" attribute or the node
String name = OgreMaxUtilities::GetStringAttribute(objectElement, "name");
if (name.empty() && node != 0)
name = node->getName();
String prefixedName = this->objectNamePrefix;
prefixedName += name;
//Make sure the name is unique
if (this->loadedObjects.find(prefixedName) != this->loadedObjects.end())
{
StringUtil::StrStreamType errorMessage;
errorMessage << "Duplicate object name: " << prefixedName;
OGRE_EXCEPT
(
Exception::ERR_DUPLICATE_ITEM,
errorMessage.str(),
"OgreMaxScene::GetNewObjectName"
);
}
return prefixedName;
}
void OgreMaxScene::UpdateLoadProgress(ProgressCalculator* calculator, Real amount)
{
//Update the specified calculator
calculator->Update(amount);
//Send progress notification to callback
if (this->callback != 0)
this->callback->UpdatedLoadProgress(this, this->loadProgress.GetProgress());
}
void OgreMaxScene::LoadScene(const TiXmlElement* objectElement)
{
static const Version CURRENT_OGRE_VERSION(OGRE_VERSION_MAJOR, OGRE_VERSION_MINOR, OGRE_VERSION_PATCH);
static const String CURRENT_OGRE_VERSION_STRING = CURRENT_OGRE_VERSION.ToString();
this->sceneExtraData.id = OgreMaxUtilities::GetStringAttribute(objectElement, "id");
this->formatVersion = Version(OgreMaxUtilities::GetStringAttribute(objectElement, "formatVersion"));
this->minOgreVersion = Version(OgreMaxUtilities::GetStringAttribute(objectElement, "minOgreVersion"));
this->author = OgreMaxUtilities::GetStringAttribute(objectElement, "author");
String upAxisText = OgreMaxUtilities::GetStringAttribute(objectElement, "upAxis");
if (!upAxisText.empty())
this->upAxis = OgreMaxUtilities::ParseUpAxis(upAxisText);
this->unitsPerMeter = OgreMaxUtilities::GetRealAttribute(objectElement, "unitsPerMeter", 0);
this->unitType = OgreMaxUtilities::GetStringAttribute(objectElement, "unitType");
//Make sure the Ogre version used to compile this viewer supports the Ogre version
//required by the scene file
if (this->minOgreVersion > CURRENT_OGRE_VERSION)
{
StringUtil::StrStreamType errorMessage;
errorMessage
<< "The scene file's required Ogre version (" << this->minOgreVersion.ToString()
<< ") is not supported by the Ogre version this viewer uses ( " << CURRENT_OGRE_VERSION_STRING << ")";
OGRE_EXCEPT
(
Exception::ERR_NOT_IMPLEMENTED,
errorMessage.str(),
"OgreMaxScene::LoadScene"
);
}
//Create scene manager
if (this->sceneManager == 0)
{
//Create the scene manager
String sceneManager = OgreMaxUtilities::GetStringAttribute(objectElement, "sceneManager", "generic");
SceneType sceneType;
if (OgreMaxUtilities::ParseSceneManager(sceneManager, sceneType))
this->sceneManager = Root::getSingleton().createSceneManager(sceneType, this->sceneExtraData.id);
else
this->sceneManager = Root::getSingleton().createSceneManager(sceneManager, this->sceneExtraData.id);
//Notify callback
if (this->callback != 0)
this->callback->CreatedSceneManager(this, this->sceneManager);
}
//Get the root node
if (this->rootNode == 0)
this->rootNode = this->sceneManager->getRootSceneNode();
//Load resource locations
if ((this->loadOptions & SKIP_RESOURCE_LOCATIONS) == 0)
{
//Notify callback
if (this->callback != 0)
this->callback->LoadingResourceLocations(this);
const TiXmlElement* resourceLocationsElement = objectElement->FirstChildElement("resourceLocations");
if (resourceLocationsElement != 0)
LoadResourceLocations(resourceLocationsElement);
//If necessary, add the base resource directory
if (this->loadedFromFileSystem)
{
String baseResourceLocation = !this->baseResourceLocation.empty() ? this->baseResourceLocation : "./";
ResourceLocation resourceLocation(baseResourceLocation, "FileSystem");
AddResourceLocation(resourceLocation);
}
//Commit new resource locations
CommitResourceLocations();
//Notify callback
if (this->callback != 0)
this->callback->LoadedResourceLocations(this, this->resourceLocations);
}
//Load environment settings
const TiXmlElement* environmentElement = objectElement->FirstChildElement("environment");
if (environmentElement != 0)
LoadEnvironment(environmentElement);
//Create render textures
const TiXmlElement* renderTexturesElement = objectElement->FirstChildElement("renderTextures");
if (renderTexturesElement != 0)
LoadRenderTextures(renderTexturesElement);
//Parse child elements
const TiXmlElement* instancedGeometriesElement = 0;
const TiXmlElement* staticGeometriesElement = 0;
const TiXmlElement* portalConnectedZonesElement = 0;
String elementName;
const TiXmlElement* childElement = 0;
while (childElement = OgreMaxUtilities::IterateChildElements(objectElement, childElement))
{
elementName = childElement->Value();
if (elementName == "nodes")
LoadNodes(childElement);
else if (elementName == "externals")
LoadExternals(childElement);
else if (elementName == "terrain")
LoadTerrain(childElement);
else if (elementName == "octree")
LoadOctree(childElement);
else if (elementName == "light")
LoadLight(childElement, MovableObjectOwner());
else if (elementName == "camera")
LoadCamera(childElement, MovableObjectOwner());
else if (elementName == "userDataReference")
OgreMaxUtilities::LoadUserDataReference(childElement, this->sceneExtraData.userDataReference);
else if (elementName == "userData")
OgreMaxUtilities::GetChildText(childElement, this->sceneExtraData.userData);
else if (elementName == "queryFlags")
LoadQueryFlagAliases(childElement);
else if (elementName == "visibilityFlags")
LoadVisibilityFlagAliases(childElement);
else if (elementName == "instancedGeometries")
instancedGeometriesElement = childElement;
else if (elementName == "staticGeometries")
staticGeometriesElement = childElement;
else if (elementName == "portalConnectedZones")
portalConnectedZonesElement = childElement;
}
//Set default lighting if necessary
if (this->loadOptions & SET_DEFAULT_LIGHTING)
OgreMaxUtilities::SetDefaultLighting(this->sceneManager, this->upAxis);
//Load instanced geometries
if (instancedGeometriesElement != 0)
LoadInstancedGeometries(instancedGeometriesElement);
//Load static geometries
if (staticGeometriesElement != 0)
LoadStaticGeometries(staticGeometriesElement);
//Load portal connected zones
if (portalConnectedZonesElement == 0)
LoadPortalConnectedZones(portalConnectedZonesElement);
//Perform final steps for look and tracking targets
FinishLoadingLookAndTrackTargets();
//Perform final steps for render textures
FinishLoadingRenderTextures();
}
void OgreMaxScene::FinishLoadingLookAndTrackTargets()
{
//Resolve look targets
for (LookTargetList::iterator lookTarget = this->lookTargets.begin();
lookTarget != this->lookTargets.end();
++lookTarget)
{
SceneNode* lookTargetNode = GetSceneNode(lookTarget->nodeName, false);
//Get position
Vector3 position;
if (lookTarget->isPositionSet)
position = lookTarget->position;
else
{
lookTarget->relativeTo = Node::TS_WORLD;
position = lookTargetNode->_getDerivedPosition();
}
//Set look at depending on whether we have a node or camera
if (lookTarget->sourceNode != 0)
lookTarget->sourceNode->lookAt(position, lookTarget->relativeTo, lookTarget->localDirection);
else if (lookTarget->sourceCamera != 0)
lookTarget->sourceCamera->lookAt(position);
}
this->lookTargets.clear();
//Resolve track targets
for (TrackTargetList::iterator trackTarget = this->trackTargets.begin();
trackTarget != this->trackTargets.end();
++trackTarget)
{
SceneNode* trackTargetNode = GetSceneNode(trackTarget->nodeName, false);
//Set tracking depending on whether we have a node or camera
if (trackTarget->sourceNode != 0)
trackTarget->sourceNode->setAutoTracking(true, trackTargetNode, trackTarget->localDirection, trackTarget->offset);
else if (trackTarget->sourceCamera != 0)
trackTarget->sourceCamera->setAutoTracking(true, trackTargetNode, trackTarget->offset);
}
this->trackTargets.clear();
}
void OgreMaxScene::LoadInstancedGeometries(const TiXmlElement* objectElement)
{
//Ensure instancing is supported
if (!Root::getSingleton().getRenderSystem()->getCapabilities()->hasCapability(RSC_VERTEX_PROGRAM))
{
OGRE_EXCEPT
(
Exception::ERR_INVALIDPARAMS,
"Instanced geometry is not supported by the current render system and/or video card",
"OgreMaxScene::LoadInstancedGeometry"
);
}
//Read all the instanced geometries
String elementName;
const TiXmlElement* childElement = 0;
while (childElement = OgreMaxUtilities::IterateChildElements(objectElement, childElement))
{
elementName = childElement->Value();
if (elementName == "instancedGeometry")
LoadInstancedGeometry(childElement);
}
}
void OgreMaxScene::LoadInstancedGeometry(const TiXmlElement* objectElement)
{
String name = OgreMaxUtilities::GetStringAttribute(objectElement, "name");
bool castShadows = OgreMaxUtilities::GetBoolAttribute(objectElement, "castShadows", true);
ObjectVisibility visibility = OgreMaxUtilities::GetObjectVisibilityAttribute(objectElement, "visible");
unsigned int batchCount = OgreMaxUtilities::GetUIntAttribute(objectElement, "batchCount", 0);
String renderQueue = OgreMaxUtilities::GetStringAttribute(objectElement, "renderQueue");
Real renderingDistance = OgreMaxUtilities::GetRealAttribute(objectElement, "renderingDistance", 0);
Vector3 origin = Vector3::ZERO;
Vector3 dimensions(1000000, 1000000, 1000000);
const TiXmlElement* entitiesElement = 0;
//Iterate over all the child elements
String elementName;
const TiXmlElement* childElement = 0;
while (childElement = OgreMaxUtilities::IterateChildElements(objectElement, childElement))
{
elementName = childElement->Value();
if (elementName == "origin")
origin = OgreMaxUtilities::LoadXYZ(childElement);
else if (elementName == "dimensions")
dimensions = OgreMaxUtilities::LoadXYZ(childElement);
else if (elementName == "entities")
entitiesElement = childElement;
}
//Create the instanced geometry
InstancedGeometry* instancedGeometry = this->sceneManager->createInstancedGeometry(name);
instancedGeometry->setCastShadows(castShadows);
OgreMaxUtilities::SetObjectVisibility(instancedGeometry, visibility);
instancedGeometry->setOrigin(origin);
instancedGeometry->setBatchInstanceDimensions(dimensions);
if (!renderQueue.empty())
instancedGeometry->setRenderQueueGroup(OgreMaxUtilities::ParseRenderQueue(renderQueue));
instancedGeometry->setRenderingDistance(renderingDistance);
//Add the entities
childElement = 0;
while (childElement = OgreMaxUtilities::IterateChildElements(entitiesElement, childElement))
{
elementName = childElement->Value();
if (elementName == "entity")
LoadInstancedGeometryEntity(childElement, instancedGeometry);
}
//Build the instanced geometry
instancedGeometry->build();
//Add additional batch instances
for (unsigned int batchIndex = 0; batchIndex < batchCount; batchIndex++)
instancedGeometry->addBatchInstance();
}
void OgreMaxScene::LoadInstancedGeometryEntity(const TiXmlElement* objectElement, InstancedGeometry* instancedGeometry)
{
static const String TEMP_ENTITY_NAME("__instancedGeometryEntity");
String meshFile = OgreMaxUtilities::GetStringAttribute(objectElement, "meshFile");
Vector3 position = Vector3::ZERO;
Quaternion rotation = Quaternion::IDENTITY;
Vector3 scale = Vector3::UNIT_SCALE;
std::vector<EntityParameters::Subentity> subentities;
String elementName;
const TiXmlElement* childElement = 0;
while (childElement = OgreMaxUtilities::IterateChildElements(objectElement, childElement))
{
elementName = childElement->Value();
if (elementName == "position")
position = OgreMaxUtilities::LoadXYZ(childElement);
else if (elementName == "rotation")
rotation = OgreMaxUtilities::LoadRotation(childElement);
else if (elementName == "scale")
scale = OgreMaxUtilities::LoadXYZ(childElement);
else if (elementName == "subentities")
OgreMaxUtilities::LoadSubentities(childElement, subentities);
}
if (!meshFile.empty())
{
//Create temporary entity
Entity* entity = OgreMaxUtilities::CreateEntity(this->sceneManager, TEMP_ENTITY_NAME, meshFile, subentities);
//Add entity to the static geometry
instancedGeometry->addEntity(entity, position, rotation, scale);
//Destroy entity
this->sceneManager->destroyEntity(entity);
}
}
void OgreMaxScene::LoadStaticGeometries(const TiXmlElement* objectElement)
{
//Read all the static geometries
String elementName;
const TiXmlElement* childElement = 0;
while (childElement = OgreMaxUtilities::IterateChildElements(objectElement, childElement))
{
elementName = childElement->Value();
if (elementName == "staticGeometry")
LoadStaticGeometry(childElement);
}
}
void OgreMaxScene::LoadStaticGeometry(const TiXmlElement* objectElement)
{
String name = OgreMaxUtilities::GetStringAttribute(objectElement, "name");
bool castShadows = OgreMaxUtilities::GetBoolAttribute(objectElement, "castShadows", true);
ObjectVisibility visibility = OgreMaxUtilities::GetObjectVisibilityAttribute(objectElement, "visible");
String renderQueue = OgreMaxUtilities::GetStringAttribute(objectElement, "renderQueue");
Real renderingDistance = OgreMaxUtilities::GetRealAttribute(objectElement, "renderingDistance", 0);
Vector3 origin = Vector3::ZERO;
Vector3 dimensions(1000000, 1000000, 1000000);
const TiXmlElement* entitiesElement = 0;
//Iterate over all the child elements
String elementName;
const TiXmlElement* childElement = 0;
while (childElement = OgreMaxUtilities::IterateChildElements(objectElement, childElement))
{
elementName = childElement->Value();
if (elementName == "origin")
origin = OgreMaxUtilities::LoadXYZ(childElement);
else if (elementName == "dimensions")
dimensions = OgreMaxUtilities::LoadXYZ(childElement);
else if (elementName == "entities")
entitiesElement = childElement;
}
//Create the instanced geometry
StaticGeometry* staticGeometry = this->sceneManager->createStaticGeometry(name);
staticGeometry->setCastShadows(castShadows);
OgreMaxUtilities::SetObjectVisibility(staticGeometry, visibility);
staticGeometry->setOrigin(origin);
staticGeometry->setRegionDimensions(dimensions);
if (!renderQueue.empty())
staticGeometry->setRenderQueueGroup(OgreMaxUtilities::ParseRenderQueue(renderQueue));
staticGeometry->setRenderingDistance(renderingDistance);
//Add the entities
childElement = 0;
while (childElement = OgreMaxUtilities::IterateChildElements(entitiesElement, childElement))
{
elementName = childElement->Value();
if (elementName == "entity")
LoadStaticGeometryEntity(childElement, staticGeometry);
}
//Build the static geometry
staticGeometry->build();
}
void OgreMaxScene::LoadStaticGeometryEntity(const TiXmlElement* objectElement, StaticGeometry* staticGeometry)
{
static const String TEMP_ENTITY_NAME("__staticGeometryEntity");
String meshFile = OgreMaxUtilities::GetStringAttribute(objectElement, "meshFile");
Vector3 position = Vector3::ZERO;
Quaternion rotation = Quaternion::IDENTITY;
Vector3 scale = Vector3::UNIT_SCALE;
std::vector<EntityParameters::Subentity> subentities;
String elementName;
const TiXmlElement* childElement = 0;
while (childElement = OgreMaxUtilities::IterateChildElements(objectElement, childElement))
{
elementName = childElement->Value();
if (elementName == "position")
position = OgreMaxUtilities::LoadXYZ(childElement);
else if (elementName == "rotation")
rotation = OgreMaxUtilities::LoadRotation(childElement);
else if (elementName == "scale")
scale = OgreMaxUtilities::LoadXYZ(childElement);
else if (elementName == "subentities")
OgreMaxUtilities::LoadSubentities(childElement, subentities);
}
if (!meshFile.empty())
{
//Create temporary entity
Entity* entity = OgreMaxUtilities::CreateEntity(this->sceneManager, TEMP_ENTITY_NAME, meshFile, subentities);
//Add entity to the static geometry
staticGeometry->addEntity(entity, position, rotation, scale);
//Destroy entity
this->sceneManager->destroyEntity(entity);
}
}
void OgreMaxScene::LoadPortalConnectedZones(const TiXmlElement* objectElement)
{
#if OGRE_VERSION_MAJOR > 1 && OGRE_VERSION_MINOR >= 5
//TODO: Implement this
#endif
}
bool OgreMaxScene::LoadResourceLocations(const TiXmlElement* objectElement)
{
//Exit early if resource locations are not allowed
if (!this->loadedFromFileSystem)
return false;
size_t locationCount = 0;
ResourceLocation resourceLocation;
//Iterate over all the resource groups
String elementName;
const TiXmlElement* childElement = 0;
while (childElement = OgreMaxUtilities::IterateChildElements(objectElement, childElement))
{
elementName = childElement->Value();
if (elementName == "resourceLocation")
{
//Name
resourceLocation.name = OgreMaxUtilities::GetStringAttribute(childElement, "name");
if (!this->baseResourceLocation.empty())
resourceLocation.name = OgreMaxUtilities::JoinPath(this->baseResourceLocation, resourceLocation.name);
//Type
resourceLocation.type = OgreMaxUtilities::GetStringAttribute(childElement, "type");
//Recursive
resourceLocation.recursive = OgreMaxUtilities::GetBoolAttribute(childElement, "recursive", false);
//Add location
if (AddResourceLocation(resourceLocation))
locationCount++;
}
}
return locationCount > 0;
}
bool OgreMaxScene::AddResourceLocation(const ResourceLocation& resourceLocation)
{
//Normalize the resource location by expanding the name to a full path
ResourceLocation normalizedResourceLocation = resourceLocation;
OgreMaxUtilities::MakeFullPath(normalizedResourceLocation.name);
//Determine whether resource location has already been added
bool isNewResourceLocation =
this->resourceLocations.find(normalizedResourceLocation) == this->resourceLocations.end();
//Add resource location if it's new
if (isNewResourceLocation)
{
//Hold onto the resource location for later
this->resourceLocations.insert(normalizedResourceLocation);
}
return isNewResourceLocation;
}
void OgreMaxScene::CommitResourceLocations()
{
//Count the number of uninitialized locations
int newResourceLocationCount = 0;
for (ResourceLocations::iterator resourceLocationIterator = this->resourceLocations.begin();
resourceLocationIterator != this->resourceLocations.end();
++resourceLocationIterator)
{
if (!resourceLocationIterator->initialized)
{
newResourceLocationCount++;
//Add resource location to Ogre
ResourceGroupManager::getSingleton().addResourceLocation
(
resourceLocationIterator->name,
resourceLocationIterator->type,
this->defaultResourceGroupName,
resourceLocationIterator->recursive
);
//The resource location is no longer uninitialized
//This seems to fix a compiler error with GCC
const_cast<ResourceLocation&>(*resourceLocationIterator).initialized = true;
}
}
if (newResourceLocationCount > 0)
ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
}
void OgreMaxScene::LoadQueryFlagAliases(const TiXmlElement* objectElement)
{
//Exit early if skip option is set
if ((this->loadOptions & SKIP_QUERY_FLAG_ALIASES) != 0)
return;
//Allocate the query flags
size_t queryFlagCount = OgreMaxUtilities::GetElementCount(objectElement, "queryFlag");
this->queryFlags.resize(queryFlagCount);
//Iterate over all the query flags
size_t index = 0;
String elementName;
const TiXmlElement* childElement = 0;
while (childElement = OgreMaxUtilities::IterateChildElements(objectElement, childElement))
{
this->queryFlags[index].name = OgreMaxUtilities::GetStringAttribute(childElement, "name");
this->queryFlags[index].bit = OgreMaxUtilities::GetIntAttribute(childElement, "bit", 0);
index++;
}
}
void OgreMaxScene::LoadVisibilityFlagAliases(const TiXmlElement* objectElement)
{
//Exit early if skip option is set
if ((this->loadOptions & SKIP_VISIBILITY_FLAG_ALIASES) != 0)
return;
//Allocate the visibility flags
size_t visibilityFlagCount = OgreMaxUtilities::GetElementCount(objectElement, "visibilityFlag");
this->visibilityFlags.resize(visibilityFlagCount);
//Iterate over all the visibility flags
size_t index = 0;
String elementName;
const TiXmlElement* childElement = 0;
while (childElement = OgreMaxUtilities::IterateChildElements(objectElement, childElement))
{
this->visibilityFlags[index].name = OgreMaxUtilities::GetStringAttribute(childElement, "name");
this->visibilityFlags[index].bit = OgreMaxUtilities::GetIntAttribute(childElement, "bit", 0);
index++;
}
}
void OgreMaxScene::LoadNodes(const TiXmlElement* objectElement)
{
//Exit early if skip option is set
if ((this->loadOptions & SKIP_NODES) != 0)
return;
//Initialize progress counters
size_t nodeCount = OgreMaxUtilities::GetElementCount(objectElement, "node");
this->loadProgress.nodes->SetRange(nodeCount);
//Iterate over all the node children
String elementName;
String modelName;
const TiXmlElement* childElement = 0;
while (childElement = OgreMaxUtilities::IterateChildElements(objectElement, childElement))
{
elementName = childElement->Value();
if (elementName == "node" || elementName == "modelInstance")
LoadNode(childElement, this->rootNode);
else if (elementName == "position")
this->rootNode->setPosition(OgreMaxUtilities::LoadXYZ(childElement));
else if (elementName == "rotation")
this->rootNode->setOrientation(OgreMaxUtilities::LoadRotation(childElement));
else if (elementName == "scale")
this->rootNode->setScale(OgreMaxUtilities::LoadXYZ(childElement));
}
this->rootNode->setInitialState();
}
void OgreMaxScene::LoadExternals(const TiXmlElement* objectElement)
{
//Exit early if skip option is set
if ((this->loadOptions & SKIP_EXTERNALS) != 0)
return;
//Initialize progress counter
size_t itemCount = OgreMaxUtilities::GetChildElementCount(objectElement, "item");
this->loadProgress.externals->SetRange(itemCount);
//Iterate over all the node children
String elementName;
const TiXmlElement* childElement = 0;
while (childElement = OgreMaxUtilities::IterateChildElements(objectElement, childElement))
{
elementName = childElement->Value();
if (elementName == "item")
LoadExternalItem(childElement);
}
}
void OgreMaxScene::LoadEnvironment(const TiXmlElement* objectElement)
{
//Exit early if skip option is set
if ((this->loadOptions & SKIP_ENVIRONMENT) != 0)
return;
//Iterate over all the node children
String elementName;
const TiXmlElement* childElement = 0;
while (childElement = OgreMaxUtilities::IterateChildElements(objectElement, childElement))
{
elementName = childElement->Value();
if (elementName == "fog")
LoadFog(childElement);
else if (elementName == "skyBox")
LoadSkyBox(childElement);
else if (elementName == "skyDome")
LoadSkyDome(childElement);
else if (elementName == "skyPlane")
LoadSkyPlane(childElement);
else if (elementName == "clipping")
OgreMaxUtilities::LoadClipping(childElement, this->environmentNear, this->environmentFar);
else if (elementName == "colourAmbient")
this->sceneManager->setAmbientLight(OgreMaxUtilities::LoadColor(childElement));
else if (elementName == "colourBackground")
{
this->backgroundColor = OgreMaxUtilities::LoadColor(childElement);
//Set all viewports to the specified background color
if (this->renderWindows->Start())
{
do
{
RenderWindow* renderWindow = this->renderWindows->GetCurrent();
unsigned short viewportCount = renderWindow->getNumViewports();
for (unsigned short viewportIndex = 0; viewportIndex < viewportCount; viewportIndex++)
renderWindow->getViewport(viewportIndex)->setBackgroundColour(backgroundColor);
}while (this->renderWindows->MoveNext());
}
}
else if (elementName == "shadows")
LoadShadows(childElement);
}
//Set fog parameters into scene manager
Real linearStart = this->fogParameters.linearStart * this->environmentFar;
Real linearEnd = this->fogParameters.linearEnd * this->environmentFar;
this->sceneManager->setFog
(
this->fogParameters.mode,
this->fogParameters.color,
this->fogParameters.expDensity,
linearStart,
linearEnd
);
}
void OgreMaxScene::LoadRenderTextures(const TiXmlElement* objectElement)
{
//Get default pixel format
//It's unlikely that this would vary among render windows, but just take the minimum anyway
unsigned int bestColorDepth = 32;
if (this->renderWindows->Start())
{
do
{
bestColorDepth = std::min(this->renderWindows->GetCurrent()->getColourDepth(), bestColorDepth);
}while (this->renderWindows->MoveNext());
}
PixelFormat defaultPixelFormat = (bestColorDepth == 16) ? PF_A4R4G4B4 : PF_A8R8G8B8;
//Read all the render textures
const TiXmlElement* renderTextureElement = 0;
while (renderTextureElement = OgreMaxUtilities::IterateChildElements(objectElement, renderTextureElement))
{
LoadedRenderTexture* loadedRenderTexture = new LoadedRenderTexture;
this->loadedRenderTextures.push_back(loadedRenderTexture);
RenderTextureParameters& renderTextureParams = loadedRenderTexture->parameters;
renderTextureParams.name = OgreMaxUtilities::GetStringAttribute(renderTextureElement, "name");
renderTextureParams.width = OgreMaxUtilities::GetIntAttribute(renderTextureElement, "width", 512);
renderTextureParams.height = OgreMaxUtilities::GetIntAttribute(renderTextureElement, "height", 512);
renderTextureParams.pixelFormat = OgreMaxUtilities::GetPixelFormatAttribute(renderTextureElement, "pixelFormat", defaultPixelFormat);
renderTextureParams.textureType = OgreMaxUtilities::GetTextureTypeAttribute(renderTextureElement, "textureType", renderTextureParams.textureType);
renderTextureParams.cameraName = OgreMaxUtilities::GetStringAttribute(renderTextureElement, "camera");
renderTextureParams.scheme = OgreMaxUtilities::GetStringAttribute(renderTextureElement, "scheme");
renderTextureParams.clearEveryFrame = OgreMaxUtilities::GetBoolAttribute(renderTextureElement, "clearEveryFrame", renderTextureParams.clearEveryFrame);
renderTextureParams.autoUpdate = OgreMaxUtilities::GetBoolAttribute(renderTextureElement, "autoUpdate", renderTextureParams.autoUpdate);
renderTextureParams.hideRenderObject = OgreMaxUtilities::GetBoolAttribute(renderTextureElement, "hideRenderObject", renderTextureParams.hideRenderObject);
renderTextureParams.renderObjectName = OgreMaxUtilities::GetStringAttribute(renderTextureElement, "renderObjectName");
renderTextureParams.backgroundColor = this->backgroundColor;
renderTextureParams.resourceGroupName = this->defaultResourceGroupName;
String elementName;
const TiXmlElement* childElement = 0;
while (childElement = OgreMaxUtilities::IterateChildElements(renderTextureElement, childElement))
{
elementName = childElement->Value();
if (elementName == "backgroundColor")
renderTextureParams.backgroundColor = OgreMaxUtilities::LoadColor(childElement);
else if (elementName == "materials")
{
size_t materialCount = OgreMaxUtilities::GetElementCount(childElement, "material");
renderTextureParams.materials.resize(materialCount);
LoadRenderTextureMaterials(childElement, renderTextureParams.materials);
}
else if (elementName == "hiddenObjects")
LoadObjectNames(childElement, "hiddenObject", renderTextureParams.hiddenObjects);
else if (elementName == "exclusiveObjects")
LoadObjectNames(childElement, "exclusiveObject", renderTextureParams.exclusiveObjects);
else if (elementName == "renderPlane")
renderTextureParams.renderPlane = OgreMaxUtilities::LoadPlane(childElement);
}
//Notify callback
if (this->callback != 0)
this->callback->LoadingRenderTexture(this, renderTextureParams);
//Create the render texture
loadedRenderTexture->renderTexture = TextureManager::getSingleton().createManual
(
renderTextureParams.name,
renderTextureParams.resourceGroupName,
renderTextureParams.textureType,
renderTextureParams.width,
renderTextureParams.height,
0,
renderTextureParams.pixelFormat,
TU_RENDERTARGET
);
//Initialize all the texture's render targets
size_t faceCount = loadedRenderTexture->renderTexture->getNumFaces();
for (size_t faceIndex = 0; faceIndex < faceCount; faceIndex++)
{
RenderTarget* renderTarget = loadedRenderTexture->renderTexture->getBuffer(faceIndex)->getRenderTarget();
renderTarget->setAutoUpdated(renderTextureParams.autoUpdate);
renderTarget->addListener(this);
this->renderTargets[renderTarget] = loadedRenderTexture;
}
}
}
void OgreMaxScene::FinishLoadingRenderTextures()
{
static const Quaternion CUBE_FACE_CAMERA_ORIENTATIONS[] =
{
Quaternion(0.707107, 0, -0.707107, 0),
Quaternion(-0.707107, 0, -0.707107, 0),
Quaternion(0.707107, 0.707107, 0, 0),
Quaternion(0.707107, -0.707107, 0, 0),
Quaternion(1, 0, 0, 0),
Quaternion(0, 0, -1, 0)
};
for (; this->currentRenderTextureIndex < this->loadedRenderTextures.size(); this->currentRenderTextureIndex++)
{
LoadedRenderTexture* loadedRenderTexture = this->loadedRenderTextures[this->currentRenderTextureIndex];
const RenderTextureParameters& renderTextureParams = loadedRenderTexture->parameters;
//Create the scheme
if (!renderTextureParams.scheme.empty())
MaterialManager::getSingleton()._getSchemeIndex(renderTextureParams.scheme);
//Get the camera
//First try the camera callback
if (this->callback != 0)
loadedRenderTexture->camera = this->callback->GetRenderTextureCamera(this, renderTextureParams);
//If there's no camera yet, get the camera from the scene
if (loadedRenderTexture->camera == 0 &&
!renderTextureParams.cameraName.empty() &&
this->sceneManager->hasCamera(renderTextureParams.cameraName))
{
loadedRenderTexture->camera = this->sceneManager->getCamera(renderTextureParams.cameraName);
}
//Set up viewport and render object (either a reflection plane for 2D, or an object for 3D)
size_t faceCount = loadedRenderTexture->renderTexture->getNumFaces();
if (renderTextureParams.textureType == TEX_TYPE_2D)
{
Viewport* viewport = 0;
if (loadedRenderTexture->camera != 0)
{
RenderTarget* renderTarget = loadedRenderTexture->renderTexture->getBuffer()->getRenderTarget();
//Add viewport
Viewport* viewport = renderTarget->addViewport(loadedRenderTexture->camera);
viewport->setClearEveryFrame(renderTextureParams.clearEveryFrame);
viewport->setBackgroundColour(renderTextureParams.backgroundColor);
viewport->setMaterialScheme(renderTextureParams.scheme);
loadedRenderTexture->viewports[0] = viewport;
//Set up render object (reflection plane)
if (!renderTextureParams.renderObjectName.empty())
{
//Build the plane name
String movablePlaneName;
OgreMaxUtilities::CreateMovablePlaneName(movablePlaneName, renderTextureParams.renderObjectName);
//Get or create the render plane
MovablePlanesMap::iterator planeIterator = this->movablePlanes.find(movablePlaneName);
if (planeIterator != this->movablePlanes.end())
{
//Found an existing movable plane
loadedRenderTexture->renderPlane = planeIterator->second;
loadedRenderTexture->renderObjectNode = (SceneNode*)loadedRenderTexture->renderPlane->getParentNode();
}
else
{
//Create a new movable plane
loadedRenderTexture->renderPlane = new MovablePlane(movablePlaneName);
this->movablePlanes[movablePlaneName] = loadedRenderTexture->renderPlane;
loadedRenderTexture->renderPlane->normal = renderTextureParams.renderPlane.normal;
loadedRenderTexture->renderPlane->d = renderTextureParams.renderPlane.d;
}
//Configure reflection
for (size_t materialIndex = 0; materialIndex < renderTextureParams.materials.size(); materialIndex++)
{
const RenderTextureParameters::Material& renderTextureMaterial =
renderTextureParams.materials[materialIndex];
MaterialPtr material = MaterialManager::getSingleton().getByName(renderTextureMaterial.name);
if (!material.isNull())
{
if (renderTextureMaterial.techniqueIndex < material->getNumTechniques())
{
Technique* technique = material->getTechnique(renderTextureMaterial.techniqueIndex);
if (renderTextureMaterial.passIndex < technique->getNumPasses())
{
Pass* pass = technique->getPass(renderTextureMaterial.passIndex);
if (renderTextureMaterial.textureUnitIndex < pass->getNumTextureUnitStates())
{
TextureUnitState* textureUnit =
pass->getTextureUnitState(renderTextureMaterial.textureUnitIndex);
textureUnit->setProjectiveTexturing(true, loadedRenderTexture->camera);
}
}
}
}
}
loadedRenderTexture->camera->enableReflection(loadedRenderTexture->renderPlane);
loadedRenderTexture->camera->enableCustomNearClipPlane(loadedRenderTexture->renderPlane);
}
}
}
else if (renderTextureParams.textureType == TEX_TYPE_CUBE_MAP)
{
//Get the render object, if any
if (!renderTextureParams.renderObjectName.empty() && this->sceneManager->hasSceneNode(renderTextureParams.renderObjectName))
loadedRenderTexture->renderObjectNode = GetSceneNode(renderTextureParams.renderObjectName, false);
//Get the position from which the cube map will be rendered
Vector3 position;
loadedRenderTexture->GetReferencePosition(position);
//Create a camera and viewport for each cube face
String cameraName;
for (size_t faceIndex = 0; faceIndex < faceCount; faceIndex++)
{
//Build a unique camera name
cameraName = loadedRenderTexture->camera->getName() + "_CubeFaceCamera" + StringConverter::toString(faceIndex);
//Create camera
Camera* cubeFaceCamera = this->sceneManager->createCamera(cameraName);
cubeFaceCamera->setAspectRatio(1);
cubeFaceCamera->setFOVy(Degree(90));
cubeFaceCamera->setPosition(position);
cubeFaceCamera->setOrientation(CUBE_FACE_CAMERA_ORIENTATIONS[faceIndex]);
//Use the reference camera's clip distances, if possible
if (loadedRenderTexture->camera != 0)
{
cubeFaceCamera->setNearClipDistance(loadedRenderTexture->camera->getNearClipDistance());
cubeFaceCamera->setFarClipDistance(loadedRenderTexture->camera->getFarClipDistance());
}
loadedRenderTexture->cubeFaceCameras[faceIndex] = cubeFaceCamera;
//Add viewport
RenderTarget* renderTarget = loadedRenderTexture->renderTexture->getBuffer(faceIndex)->getRenderTarget();
Viewport* viewport = renderTarget->addViewport(cubeFaceCamera);
viewport->setClearEveryFrame(renderTextureParams.clearEveryFrame);
viewport->setBackgroundColour(renderTextureParams.backgroundColor);
viewport->setMaterialScheme(renderTextureParams.scheme);
loadedRenderTexture->viewports[faceIndex] = viewport;
}
}
GetRenderTextureObjects(loadedRenderTexture);
//Notify callback
if (this->callback != 0)
this->callback->CreatedRenderTexture(this, loadedRenderTexture);
}
}
void OgreMaxScene::GetRenderTextureObjects(LoadedRenderTexture* loadedRenderTexture)
{
const RenderTextureParameters& renderTextureParams = loadedRenderTexture->parameters;
//Get hidden objects
loadedRenderTexture->hiddenObjects.reserve(renderTextureParams.hiddenObjects.size());
for (size_t hiddenIndex = 0; hiddenIndex < renderTextureParams.hiddenObjects.size(); hiddenIndex++)
{
if (this->sceneManager->hasSceneNode(renderTextureParams.hiddenObjects[hiddenIndex]))
{
SceneNode* node = GetSceneNode(renderTextureParams.hiddenObjects[hiddenIndex], false);
loadedRenderTexture->hiddenObjects.push_back(node);
}
}
loadedRenderTexture->hiddenObjects.Hide();
//Get exclusive objects
loadedRenderTexture->exclusiveObjects.reserve(renderTextureParams.exclusiveObjects.size());
for (size_t exclusiveIndex = 0; exclusiveIndex < renderTextureParams.exclusiveObjects.size(); exclusiveIndex++)
{
if (this->sceneManager->hasSceneNode(renderTextureParams.exclusiveObjects[exclusiveIndex]))
{
SceneNode* node = GetSceneNode(renderTextureParams.exclusiveObjects[exclusiveIndex], false);
loadedRenderTexture->exclusiveObjects.push_back(node);
}
}
loadedRenderTexture->exclusiveObjects.Hide();
}
void OgreMaxScene::LoadTerrain(const TiXmlElement* objectElement)
{
//Exit early if skip option is set
if ((this->loadOptions & SKIP_TERRAIN) != 0)
return;
String renderQueue = OgreMaxUtilities::GetStringAttribute(objectElement, "renderQueue");
String dataFile = OgreMaxUtilities::GetStringAttribute(objectElement, "dataFile");
if (!dataFile.empty())
{
this->sceneManager->setWorldGeometry(dataFile);
if (!renderQueue.empty())
this->sceneManager->setWorldGeometryRenderQueue(OgreMaxUtilities::ParseRenderQueue(renderQueue));
}
//Parse child elements
String elementName;
const TiXmlElement* childElement = 0;
while (childElement = OgreMaxUtilities::IterateChildElements(objectElement, childElement))
{
elementName = childElement->Value();
if (elementName == "rotation")
{
SceneNode* terrainNode = this->sceneManager->getSceneNode("Terrain");
Quaternion rotation = OgreMaxUtilities::LoadRotation(childElement);
terrainNode->setOrientation(rotation);
}
else if (elementName == "userDataReference")
OgreMaxUtilities::LoadUserDataReference(childElement, this->terrainExtraData.userDataReference);
else if (elementName == "userData")
OgreMaxUtilities::GetChildText(childElement, this->terrainExtraData.userData);
}
//Notify callback
if (this->callback != 0)
this->callback->CreatedTerrain(this, dataFile);
}
void OgreMaxScene::LoadOctree(const TiXmlElement* objectElement)
{
//Exit early if skip option is set
if ((this->loadOptions & SKIP_OCTREE) != 0)
return;
//TODO: Implement this?
}
void OgreMaxScene::LoadNode(const TiXmlElement* objectElement, SceneNode* parentNode)
{
ObjectExtraData extraData;
String name = this->nodeNamePrefix;
name += OgreMaxUtilities::GetStringAttribute(objectElement, "name");
//Get/load the model
String modelFileName = OgreMaxUtilities::GetStringAttribute(objectElement, "modelName");
OgreMaxModel* model = modelFileName.empty() ? 0 : GetModel(modelFileName);
extraData.id = OgreMaxUtilities::GetStringAttribute(objectElement, "id");
//Create the node
SceneNode* node = name.empty() ? parentNode->createChildSceneNode() : parentNode->createChildSceneNode(name);
//Notify callback
if (this->callback != 0)
this->callback->StartedCreatingNode(this, node);
//Create the model instance if there is one
if (model != 0)
{
//Determine options
OgreMaxModel::InstanceOptions instanceOptions = OgreMaxModel::NO_INITIAL_TRANSFORMATION;
if (this->loadOptions & NO_ANIMATION_STATES)
instanceOptions |= OgreMaxModel::NO_ANIMATION_STATES;
//Create the node that will contain the instance
SceneNode* modelNode = node->createChildSceneNode();
//Create the instance
SceneModelInstanceCallback sceneModelInstanceCallback(this, this->callback);
model->CreateInstance
(
this->sceneManager,
name,
(this->callback != 0) ? &sceneModelInstanceCallback : 0,
instanceOptions,
node,
this->defaultResourceGroupName,
modelNode,
this
);
}
//Iterate over all the node children
bool isInitialStateSet = false;
String elementName;
const TiXmlElement* childElement = 0;
while (childElement = OgreMaxUtilities::IterateChildElements(objectElement, childElement))
{
elementName = childElement->Value();
if (elementName == "userDataReference")
OgreMaxUtilities::LoadUserDataReference(childElement, extraData.userDataReference);
else if (elementName == "userData")
OgreMaxUtilities::GetChildText(childElement, extraData.userData);
else if (elementName == "position")
node->setPosition(OgreMaxUtilities::LoadXYZ(childElement));
else if (elementName == "rotation")
node->setOrientation(OgreMaxUtilities::LoadRotation(childElement));
else if (elementName == "scale")
node->setScale(OgreMaxUtilities::LoadXYZ(childElement));
else if (elementName == "lookTarget")
LoadLookTarget(childElement, node, 0);
else if (elementName == "trackTarget")
LoadTrackTarget(childElement, node, 0);
else if (elementName == "node" || elementName == "modelInstance")
LoadNode(childElement, node);
else if (elementName == "entity")
LoadEntity(childElement, node);
else if (elementName == "light")
LoadLight(childElement, node);
else if (elementName == "camera")
LoadCamera(childElement, node);
else if (elementName == "particleSystem")
LoadParticleSystem(childElement, node);
else if (elementName == "billboardSet")
LoadBillboardSet(childElement, node);
else if (elementName == "plane")
LoadPlane(childElement, node);
else if (elementName == "animations")
{
LoadNodeAnimations(childElement, node);
OgreMaxUtilities::SetIdentityInitialState(node);
isInitialStateSet = true;
}
}
//Set the initial state if it hasn't already been set
if (!isInitialStateSet)
node->setInitialState();
//Set the node's visibility
String visibilityText = OgreMaxUtilities::GetStringAttribute(objectElement, "visibility");
NodeVisibility visibility = OgreMaxUtilities::ParseNodeVisibility(visibilityText);
OgreMaxUtilities::SetNodeVisibility(node, visibility);
//Handle node extra data
if (extraData.HasUserData())
{
ObjectExtraDataPtr objectExtraData(new ObjectExtraData(extraData));
//Set extra data owner node
objectExtraData->node = node;
//Process the extra data
HandleNewObjectExtraData(objectExtraData);
}
//Notify callback
if (this->callback != 0)
this->callback->FinishedCreatingNode(this, node);
//Update progress counter
UpdateLoadProgress(this->loadProgress.nodes, 1);
}
void OgreMaxScene::LoadFog(const TiXmlElement* objectElement)
{
this->fogParameters.expDensity = OgreMaxUtilities::GetRealAttribute(objectElement, "expDensity", this->fogParameters.expDensity);
this->fogParameters.linearStart = OgreMaxUtilities::GetRealAttribute(objectElement, "linearStart", this->fogParameters.linearStart);
this->fogParameters.linearEnd = OgreMaxUtilities::GetRealAttribute(objectElement, "linearEnd", this->fogParameters.linearEnd);
String fogModeText = OgreMaxUtilities::GetStringAttribute(objectElement, "mode", "none");
if (!fogModeText.empty())
this->fogParameters.mode = OgreMaxUtilities::ParseFogMode(fogModeText);
const TiXmlElement* colorElement = objectElement->FirstChildElement("colourDiffuse");
if (colorElement != 0)
this->fogParameters.color = OgreMaxUtilities::LoadColor(colorElement);
}
void OgreMaxScene::LoadSkyBox(const TiXmlElement* objectElement)
{
//Exit early if skip option is set
if ((this->loadOptions & SKIP_SKY) != 0)
return;
SkyBoxParameters parameters;
parameters.enabled = OgreMaxUtilities::GetBoolAttribute(objectElement, "enable", true);
parameters.material = OgreMaxUtilities::GetStringAttribute(objectElement, "material");
parameters.distance = OgreMaxUtilities::GetRealAttribute(objectElement, "distance", 5000);
parameters.drawFirst = OgreMaxUtilities::GetBoolAttribute(objectElement, "drawFirst", true);
parameters.resourceGroupName = this->defaultResourceGroupName;
//Parse child elements
String elementName;
const TiXmlElement* childElement = 0;
while (childElement = OgreMaxUtilities::IterateChildElements(objectElement, childElement))
{
elementName = childElement->Value();
if (elementName == "rotation")
parameters.rotation = OgreMaxUtilities::LoadRotation(childElement);
else if (elementName == "userDataReference")
OgreMaxUtilities::LoadUserDataReference(childElement, parameters.extraData.userDataReference);
else if (elementName == "userData")
OgreMaxUtilities::GetChildText(childElement, parameters.extraData.userData);
}
//Notify callback
if (this->callback != 0)
this->callback->LoadingSkyBox(this, parameters);
//Hold onto extra data
this->skyBoxExtraData = parameters.extraData;
this->sceneManager->setSkyBox
(
parameters.enabled,
parameters.material,
parameters.distance,
parameters.drawFirst,
parameters.rotation,
parameters.resourceGroupName
);
}
void OgreMaxScene::LoadSkyDome(const TiXmlElement* objectElement)
{
//Exit early if skip option is set
if ((this->loadOptions & SKIP_SKY) != 0)
return;
SkyDomeParameters parameters;
parameters.enabled = OgreMaxUtilities::GetBoolAttribute(objectElement, "enable", true);
parameters.material = OgreMaxUtilities::GetStringAttribute(objectElement, "material");
parameters.curvature = OgreMaxUtilities::GetRealAttribute(objectElement, "curvature", 10);
parameters.tiling = OgreMaxUtilities::GetRealAttribute(objectElement, "tiling", 8);
parameters.distance = OgreMaxUtilities::GetRealAttribute(objectElement, "distance", 4000);
parameters.drawFirst = OgreMaxUtilities::GetBoolAttribute(objectElement, "drawFirst", true);
parameters.xSegments = OgreMaxUtilities::GetIntAttribute(objectElement, "xSegments", 16);
parameters.ySegments = OgreMaxUtilities::GetIntAttribute(objectElement, "ySegments", 16);
parameters.resourceGroupName = this->defaultResourceGroupName;
//Parse child elements
String elementName;
const TiXmlElement* childElement = 0;
while (childElement = OgreMaxUtilities::IterateChildElements(objectElement, childElement))
{
elementName = childElement->Value();
if (elementName == "rotation")
parameters.rotation = OgreMaxUtilities::LoadRotation(childElement);
else if (elementName == "userDataReference")
OgreMaxUtilities::LoadUserDataReference(childElement, parameters.extraData.userDataReference);
else if (elementName == "userData")
OgreMaxUtilities::GetChildText(childElement, parameters.extraData.userData);
}
//Notify callback
if (this->callback != 0)
this->callback->LoadingSkyDome(this, parameters);
//Hold onto extra data
this->skyDomeExtraData = parameters.extraData;
this->sceneManager->setSkyDome
(
parameters.enabled,
parameters.material,
parameters.curvature,
parameters.tiling,
parameters.distance,
parameters.drawFirst,
parameters.rotation,
parameters.xSegments,
parameters.ySegments,
-1,
parameters.resourceGroupName
);
}
void OgreMaxScene::LoadSkyPlane(const TiXmlElement* objectElement)
{
//Exit early if skip option is set
if ((this->loadOptions & SKIP_SKY) != 0)
return;
SkyPlaneParameters parameters;
parameters.enabled = OgreMaxUtilities::GetBoolAttribute(objectElement, "enable", true);
parameters.material = OgreMaxUtilities::GetStringAttribute(objectElement, "material");
parameters.plane = OgreMaxUtilities::GetPlaneAttributes(objectElement, 0, -1, 0, 5000);
parameters.scale = OgreMaxUtilities::GetRealAttribute(objectElement, "scale", 1000);
parameters.bow = OgreMaxUtilities::GetRealAttribute(objectElement, "bow", 0);
parameters.tiling = OgreMaxUtilities::GetRealAttribute(objectElement, "tiling", 10);
parameters.drawFirst = OgreMaxUtilities::GetBoolAttribute(objectElement, "drawFirst", true);
parameters.xSegments = OgreMaxUtilities::GetIntAttribute(objectElement, "xSegments", 1);
parameters.ySegments = OgreMaxUtilities::GetIntAttribute(objectElement, "ySegments", 1);
parameters.resourceGroupName = this->defaultResourceGroupName;
//Parse child elements
String elementName;
const TiXmlElement* childElement = 0;
while (childElement = OgreMaxUtilities::IterateChildElements(objectElement, childElement))
{
elementName = childElement->Value();
if (elementName == "userDataReference")
OgreMaxUtilities::LoadUserDataReference(childElement, parameters.extraData.userDataReference);
else if (elementName == "userData")
OgreMaxUtilities::GetChildText(childElement, parameters.extraData.userData);
}
//Notify callback
if (this->callback != 0)
this->callback->LoadingSkyPlane(this, parameters);
//Hold onto extra data
this->skyPlaneExtraData = parameters.extraData;
this->sceneManager->setSkyPlane
(
parameters.enabled,
parameters.plane,
parameters.material,
parameters.scale,
parameters.tiling,
parameters.drawFirst,
parameters.bow,
parameters.xSegments,
parameters.ySegments,
parameters.resourceGroupName
);
}
void OgreMaxScene::LoadShadows(const TiXmlElement* objectElement)
{
//Exit early if skip option is set
if ((this->loadOptions & SKIP_SHADOWS) != 0)
return;
ShadowParameters params;
String techniqueText = OgreMaxUtilities::GetStringAttribute(objectElement, "technique", "none");
if (!techniqueText.empty())
params.shadowTechnique = OgreMaxUtilities::ParseShadowTechnique(techniqueText);
params.selfShadow = OgreMaxUtilities::GetBoolAttribute(objectElement, "selfShadow", params.selfShadow);
params.farDistance = OgreMaxUtilities::GetRealAttribute(objectElement, "farDistance", params.farDistance);
//Parse child elements
String elementName;
const TiXmlElement* childElement = 0;
while (childElement = OgreMaxUtilities::IterateChildElements(objectElement, childElement))
{
elementName = childElement->Value();
if (elementName == "shadowTextures")
{
params.textureSize = OgreMaxUtilities::GetIntAttribute(childElement, "size", params.textureSize);
params.textureCount = OgreMaxUtilities::GetIntAttribute(childElement, "count", params.textureCount);
params.textureOffset = OgreMaxUtilities::GetRealAttribute(childElement, "offset", params.textureOffset);
params.textureFadeStart = OgreMaxUtilities::GetRealAttribute(childElement, "fadeStart", params.textureFadeStart);
params.textureFadeEnd = OgreMaxUtilities::GetRealAttribute(childElement, "fadeEnd", params.textureFadeEnd);
params.textureShadowCasterMaterial = OgreMaxUtilities::GetStringAttribute(childElement, "shadowCasterMaterial");
params.textureShadowReceiverMaterial = OgreMaxUtilities::GetStringAttribute(childElement, "shadowReceiverMaterial");
}
else if (elementName == "colourShadow")
params.shadowColor = OgreMaxUtilities::LoadColor(childElement);
else if (elementName == "shadowCameraSetup")
{
params.cameraSetup = OgreMaxUtilities::GetStringAttribute(childElement, "type", "lispsm");
const Vector3& upVector = GetUpVector();
params.optimalPlane = OgreMaxUtilities::GetPlaneAttributes(objectElement, upVector.x, upVector.y, upVector.z, 0);
}
}
//Set the shadow parameters
if (params.shadowTechnique == SHADOWTYPE_NONE)
{
//Turn off shadows
this->sceneManager->setShadowTechnique(SHADOWTYPE_NONE);
}
else
{
//Turn on shadows
this->sceneManager->setShadowTechnique(params.shadowTechnique);
this->sceneManager->setShadowTextureSelfShadow(params.selfShadow);
this->sceneManager->setShadowColour(params.shadowColor);
if (params.farDistance > 0)
this->sceneManager->setShadowFarDistance(params.farDistance);
//Set shadow texture parameters if necessary
if (this->sceneManager->isShadowTechniqueTextureBased())
{
RenderSystem* renderSystem = Root::getSingleton().getRenderSystem();
//Determine texture size
if (!renderSystem->getCapabilities()->hasCapability(RSC_HWRENDER_TO_TEXTURE))
{
//Render to texture not supported, so ensure the shadow texture
//size doesn't exceed the window size
//Take minimum render window dimension as window size
int windowSize = 4096;
if (this->renderWindows->Start())
{
do
{
RenderWindow* renderWindow = this->renderWindows->GetCurrent();
windowSize = (int)std::min(renderWindow->getWidth(), renderWindow->getHeight());
}while (this->renderWindows->MoveNext());
}
//Use the lesser of the texture and window sizes
params.textureSize = std::min(params.textureSize, windowSize);
}
//If necessary, make sure the texture size is a power of two
if (!OgreMaxUtilities::IsPowerOfTwo(params.textureSize) &&
!renderSystem->getCapabilities()->hasCapability(RSC_NON_POWER_OF_2_TEXTURES))
{
params.textureSize = OgreMaxUtilities::NextSmallestPowerOfTwo(params.textureSize);
}
//Determine texture pixel format
if (this->callback != 0)
this->callback->CreatingShadowTextures(this, params);
if (params.pixelFormat == PF_UNKNOWN)
{
//Choose a default format
if (renderSystem->getName().find("GL") != String::npos)
{
//OpenGL performs better with a half-float format
params.pixelFormat = PF_FLOAT16_R;
}
else
{
//D3D is the opposite - if you ask for PF_FLOAT16_R you
//get an integer format instead. You can ask for PF_FLOAT16_GR
//but the precision doesn't work well
params.pixelFormat = PF_FLOAT32_R;
}
}
//Set texture size, count, pixel format
this->sceneManager->setShadowTextureSettings(params.textureSize, params.textureCount, params.pixelFormat);
//Set other texture settings
this->sceneManager->setShadowDirLightTextureOffset(params.textureOffset);
this->sceneManager->setShadowTextureFadeStart(params.textureFadeStart);
this->sceneManager->setShadowTextureFadeEnd(params.textureFadeEnd);
this->sceneManager->setShadowTextureCasterMaterial(params.textureShadowCasterMaterial);
this->sceneManager->setShadowTextureReceiverMaterial(params.textureShadowReceiverMaterial);
}
//Set shadow camera setup
ShadowCameraSetupPtr shadowCameraSetupPtr;
if (!params.cameraSetup.empty())
{
//Use the specified setup
shadowCameraSetupPtr = ShadowCameraSetupPtr(ParseShadowCameraSetup(params.cameraSetup, params.optimalPlane));
}
else
{
//Create the appropriate default setup
shadowCameraSetupPtr = ShadowCameraSetupPtr(new DefaultShadowCameraSetup());
}
this->sceneManager->setShadowCameraSetup(shadowCameraSetupPtr);
}
}
void OgreMaxScene::LoadExternalItem(const TiXmlElement* objectElement)
{
ExternalItem item;
item.name = OgreMaxUtilities::GetStringAttribute(objectElement, "name");
item.type = OgreMaxUtilities::GetStringAttribute(objectElement, "type");
//Parse child elements
String elementName;
const TiXmlElement* childElement = 0;
while (childElement = OgreMaxUtilities::IterateChildElements(objectElement, childElement))
{
elementName = childElement->Value();
if (elementName == "file")
item.file = OgreMaxUtilities::GetStringAttribute(childElement, "name");
else if (elementName == "position")
item.position = OgreMaxUtilities::LoadXYZ(childElement);
else if (elementName == "rotation")
item.rotation = OgreMaxUtilities::LoadRotation(childElement);
else if (elementName == "scale")
item.scale = OgreMaxUtilities::LoadXYZ(childElement);
else if (elementName == "boundingVolume")
OgreMaxUtilities::LoadBoundingVolume(childElement, item.boundingVolume);
else if (elementName == "userDataReference")
OgreMaxUtilities::LoadUserDataReference(childElement, item.userDataReference);
else if (elementName == "userData")
OgreMaxUtilities::GetChildText(childElement, item.userData);
else if (elementName == "noteTracks")
OgreMaxUtilities::LoadNoteTracks(childElement, item.noteTracks);
}
//Notify callback
if (this->callback != 0)
this->callback->CreatedExternal(this, item);
//Store external if necessary
if ((this->loadOptions & NO_EXTERNALS) == 0)
this->externalItems.push_back(item);
//Update progress counter
UpdateLoadProgress(this->loadProgress.externals, 1);
}
void OgreMaxScene::LoadEntity(const TiXmlElement* objectElement, const MovableObjectOwner& owner)
{
ObjectExtraDataPtr objectExtraData(new ObjectExtraData);
EntityParameters parameters;
parameters.name = GetNewObjectName(objectElement, owner.node);
parameters.queryFlags = OgreMaxUtilities::GetUIntAttribute(objectElement, "queryFlags", 0);
parameters.visibilityFlags = OgreMaxUtilities::GetUIntAttribute(objectElement, "visibilityFlags", 0);
parameters.visibility = OgreMaxUtilities::GetObjectVisibilityAttribute(objectElement, "visible");
parameters.meshFile = OgreMaxUtilities::GetStringAttribute(objectElement, "meshFile");
parameters.materialFile = OgreMaxUtilities::GetStringAttribute(objectElement, "materialFile");
parameters.castShadows = OgreMaxUtilities::GetBoolAttribute(objectElement, "castShadows", true);
String renderQueue = OgreMaxUtilities::GetStringAttribute(objectElement, "renderQueue");
parameters.renderQueue = OgreMaxUtilities::ParseRenderQueue(renderQueue);
parameters.renderingDistance = OgreMaxUtilities::GetRealAttribute(objectElement, "renderingDistance", 0);
parameters.resourceGroupName = this->defaultResourceGroupName;
objectExtraData->id = OgreMaxUtilities::GetStringAttribute(objectElement, "id");
objectExtraData->receiveShadows = OgreMaxUtilities::GetBoolAttribute(objectElement, "receiveShadows", true);
//Parse child elements
const TiXmlElement* boneAttachmentsElement = 0;
String elementName;
const TiXmlElement* childElement = 0;
while (childElement = OgreMaxUtilities::IterateChildElements(objectElement, childElement))
{
elementName = childElement->Value();
if (elementName == "vertexBuffer")
OgreMaxUtilities::LoadBufferUsage(childElement, parameters.vertexBufferUsage, parameters.vertexBufferShadowed);
else if (elementName == "indexBuffer")
OgreMaxUtilities::LoadBufferUsage(childElement, parameters.indexBufferUsage, parameters.indexBufferShadowed);
else if (elementName == "userDataReference")
OgreMaxUtilities::LoadUserDataReference(childElement, objectExtraData->userDataReference);
else if (elementName == "userData")
OgreMaxUtilities::GetChildText(childElement, objectExtraData->userData);
else if (elementName == "noteTracks")
{
objectExtraData->noteTracks = SharedPtr<NoteTracks>(new NoteTracks);
OgreMaxUtilities::LoadNoteTracks(childElement, *objectExtraData->noteTracks.get());
}
else if (elementName == "customParameters")
OgreMaxUtilities::LoadCustomParameters(childElement, parameters.customParameters);
else if (elementName == "subentities")
OgreMaxUtilities::LoadSubentities(childElement, parameters.subentities);
else if (elementName == "boneAttachments")
boneAttachmentsElement = childElement;
}
parameters.extraData = objectExtraData;
//Notify callback
if (this->callback != 0)
this->callback->LoadingEntity(this, parameters);
//Load the mesh
bool isNewMesh = !MeshManager::getSingleton().resourceExists(parameters.meshFile);
MeshPtr mesh = MeshManager::getSingleton().load
(
parameters.meshFile,
parameters.resourceGroupName,
parameters.vertexBufferUsage, parameters.indexBufferUsage,
parameters.vertexBufferShadowed, parameters.indexBufferShadowed
);
//Notify callback if the mesh was just loaded
if (isNewMesh && this->callback != 0)
this->callback->CreatedMesh(this, mesh.getPointer());
//Create entity
Entity* entity = this->sceneManager->createEntity(parameters.name, parameters.meshFile);
if (parameters.queryFlags != 0)
entity->setQueryFlags(parameters.queryFlags);
if (parameters.visibilityFlags != 0)
entity->setVisibilityFlags(parameters.visibilityFlags);
OgreMaxUtilities::SetObjectVisibility(entity, parameters.visibility);
entity->setCastShadows(parameters.castShadows);
entity->setRenderQueueGroup(parameters.renderQueue);
entity->setRenderingDistance(parameters.renderingDistance);
OgreMaxUtilities::SetCustomParameters(entity, parameters.customParameters);
if (!parameters.materialFile.empty())
entity->setMaterialName(parameters.materialFile);
objectExtraData->object = entity;
//Set subentity materials
size_t subentityCount = std::min(parameters.subentities.size(), (size_t)entity->getNumSubEntities());
for (size_t subentityIndex = 0; subentityIndex < subentityCount; subentityIndex++)
{
SubEntity* subentity = entity->getSubEntity((unsigned int)subentityIndex);
subentity->setMaterialName(parameters.subentities[subentityIndex].materialName);
}
//Attach entity to the owner
owner.Attach(entity);
//Load bone attachments
if (boneAttachmentsElement != 0)
LoadBoneAttachments(boneAttachmentsElement, entity);
//Add to loaded objects map
this->loadedObjects[parameters.name] = entity;
//Process the extra data
HandleNewObjectExtraData(objectExtraData);
//Notify callback
if (this->callback != 0)
this->callback->CreatedEntity(this, entity);
}
void OgreMaxScene::LoadLight(const TiXmlElement* objectElement, const MovableObjectOwner& owner)
{
//Exit early if skip option is set
if (owner.node == 0 && (this->loadOptions & SKIP_SCENE_LIGHT) != 0)
return;
ObjectExtraDataPtr objectExtraData(new ObjectExtraData);
String name = GetNewObjectName(objectElement, owner.node);
objectExtraData->id = OgreMaxUtilities::GetStringAttribute(objectElement, "id");
uint32 queryFlags = OgreMaxUtilities::GetUIntAttribute(objectElement, "queryFlags", 0);
uint32 visibilityFlags = OgreMaxUtilities::GetUIntAttribute(objectElement, "visibilityFlags", 0);
ObjectVisibility visibility = OgreMaxUtilities::GetObjectVisibilityAttribute(objectElement, "visible");
String type = OgreMaxUtilities::GetStringAttribute(objectElement, "type", "point");
bool castShadows = OgreMaxUtilities::GetBoolAttribute(objectElement, "castShadows", true);
float power = OgreMaxUtilities::GetRealAttribute(objectElement, "power", 1);
//Create the light
Light* light = this->sceneManager->createLight(name);
if (queryFlags != 0)
light->setQueryFlags(queryFlags);
if (visibilityFlags != 0)
light->setVisibilityFlags(visibilityFlags);
OgreMaxUtilities::SetObjectVisibility(light, visibility);
light->setType(OgreMaxUtilities::ParseLightType(type));
light->setCastShadows(castShadows);
light->setPowerScale(power);
//Parse child elements
String elementName;
const TiXmlElement* childElement = 0;
while (childElement = OgreMaxUtilities::IterateChildElements(objectElement, childElement))
{
elementName = childElement->Value();
if (elementName == "colourDiffuse")
light->setDiffuseColour(OgreMaxUtilities::LoadColor(childElement));
else if (elementName == "colourSpecular")
light->setSpecularColour(OgreMaxUtilities::LoadColor(childElement));
else if (elementName == "lightRange")
LoadLightRange(childElement, light);
else if (elementName == "lightAttenuation")
LoadLightAttenuation(childElement, light);
else if (elementName == "position")
light->setPosition(OgreMaxUtilities::LoadXYZ(childElement));
else if (elementName == "normal")
light->setDirection(OgreMaxUtilities::LoadXYZ(childElement));
else if (elementName == "userDataReference")
OgreMaxUtilities::LoadUserDataReference(childElement, objectExtraData->userDataReference);
else if (elementName == "userData")
OgreMaxUtilities::GetChildText(childElement, objectExtraData->userData);
else if (elementName == "noteTracks")
{
objectExtraData->noteTracks = SharedPtr<NoteTracks>(new NoteTracks);
OgreMaxUtilities::LoadNoteTracks(childElement, *objectExtraData->noteTracks.get());
}
}
//Set extra data owner object
objectExtraData->object = light;
//Attach light to the node
owner.Attach(light);
//Add to loaded objects map
this->loadedObjects[name] = light;
//Process the extra data
HandleNewObjectExtraData(objectExtraData);
//Notify callback
if (this->callback != 0)
this->callback->CreatedLight(this, light);
//A light was loaded, so there's no need for the default lighting flag to be set
this->loadOptions = this->loadOptions & ~SET_DEFAULT_LIGHTING;
}
void OgreMaxScene::LoadCamera(const TiXmlElement* objectElement, const MovableObjectOwner& owner)
{
//Exit early if skip option is set
if (owner.node == 0 && (this->loadOptions & SKIP_SCENE_CAMERA) != 0)
return;
ObjectExtraDataPtr objectExtraData(new ObjectExtraData);
String name = GetNewObjectName(objectElement, owner.node);
objectExtraData->id = OgreMaxUtilities::GetStringAttribute(objectElement, "id");
uint32 queryFlags = OgreMaxUtilities::GetUIntAttribute(objectElement, "queryFlags", 0);
uint32 visibilityFlags = OgreMaxUtilities::GetUIntAttribute(objectElement, "visibilityFlags", 0);
ObjectVisibility visibility = OgreMaxUtilities::GetObjectVisibilityAttribute(objectElement, "visible");
Real fov = OgreMaxUtilities::GetRealAttribute(objectElement, "fov", Math::PI/2);
Real aspectRatio = OgreMaxUtilities::GetRealAttribute(objectElement, "aspectRatio", (Real)1.33);
String projectionType = OgreMaxUtilities::GetStringAttribute(objectElement, "type", "perspective");
//Create the camera
Camera* camera = this->sceneManager->createCamera(name);
if (queryFlags != 0)
camera->setQueryFlags(queryFlags);
if (visibilityFlags != 0)
camera->setVisibilityFlags(visibilityFlags);
OgreMaxUtilities::SetObjectVisibility(camera, visibility);
camera->setFOVy(Radian(fov));
camera->setAspectRatio(aspectRatio);
camera->setProjectionType(OgreMaxUtilities::ParseProjectionType(projectionType));
//Parse child elements
String elementName;
const TiXmlElement* childElement = 0;
while (childElement = OgreMaxUtilities::IterateChildElements(objectElement, childElement))
{
elementName = childElement->Value();
if (elementName == "clipping")
{
Real nearClip, farClip;
OgreMaxUtilities::LoadClipping(childElement, nearClip, farClip);
camera->setNearClipDistance(nearClip);
camera->setFarClipDistance(farClip);
}
else if (elementName == "position")
camera->setPosition(OgreMaxUtilities::LoadXYZ(childElement));
else if (elementName == "rotation")
camera->setOrientation(OgreMaxUtilities::LoadRotation(childElement));
else if (elementName == "normal")
camera->setDirection(OgreMaxUtilities::LoadXYZ(childElement));
else if (elementName == "lookTarget")
LoadLookTarget(childElement, 0, camera);
else if (elementName == "trackTarget")
LoadTrackTarget(childElement, 0, camera);
else if (elementName == "userDataReference")
OgreMaxUtilities::LoadUserDataReference(childElement, objectExtraData->userDataReference);
else if (elementName == "userData")
OgreMaxUtilities::GetChildText(childElement, objectExtraData->userData);
else if (elementName == "noteTracks")
{
objectExtraData->noteTracks = SharedPtr<NoteTracks>(new NoteTracks);
OgreMaxUtilities::LoadNoteTracks(childElement, *objectExtraData->noteTracks.get());
}
}
//Set extra data owner object
objectExtraData->object = camera;
//Attach camera to the node
owner.Attach(camera);
//Add to loaded objects map
this->loadedObjects[name] = camera;
//Process the extra data
HandleNewObjectExtraData(objectExtraData);
//Notify callback
if (this->callback != 0)
this->callback->CreatedCamera(this, camera);
}
void OgreMaxScene::LoadParticleSystem(const TiXmlElement* objectElement, const MovableObjectOwner& owner)
{
ObjectExtraDataPtr objectExtraData(new ObjectExtraData);
String name = GetNewObjectName(objectElement, owner.node);
objectExtraData->id = OgreMaxUtilities::GetStringAttribute(objectElement, "id");
uint32 queryFlags = OgreMaxUtilities::GetUIntAttribute(objectElement, "queryFlags", 0);
uint32 visibilityFlags = OgreMaxUtilities::GetUIntAttribute(objectElement, "visibilityFlags", 0);
ObjectVisibility visibility = OgreMaxUtilities::GetObjectVisibilityAttribute(objectElement, "visible");
String renderQueue = OgreMaxUtilities::GetStringAttribute(objectElement, "renderQueue");
Real renderingDistance = OgreMaxUtilities::GetRealAttribute(objectElement, "renderingDistance", 0);
String file = OgreMaxUtilities::GetStringAttribute(objectElement, "file");
//Create the particle system
ParticleSystem* particleSystem = this->sceneManager->createParticleSystem(name, file);
if (queryFlags != 0)
particleSystem->setQueryFlags(queryFlags);
if (visibilityFlags != 0)
particleSystem->setVisibilityFlags(visibilityFlags);
OgreMaxUtilities::SetObjectVisibility(particleSystem, visibility);
particleSystem->setRenderQueueGroup(OgreMaxUtilities::ParseRenderQueue(renderQueue));
particleSystem->setRenderingDistance(renderingDistance);
//Parse child elements
String elementName;
const TiXmlElement* childElement = 0;
while (childElement = OgreMaxUtilities::IterateChildElements(objectElement, childElement))
{
elementName = childElement->Value();
if (elementName == "userDataReference")
OgreMaxUtilities::LoadUserDataReference(childElement, objectExtraData->userDataReference);
else if (elementName == "userData")
OgreMaxUtilities::GetChildText(childElement, objectExtraData->userData);
else if (elementName == "noteTracks")
{
objectExtraData->noteTracks = SharedPtr<NoteTracks>(new NoteTracks);
OgreMaxUtilities::LoadNoteTracks(childElement, *objectExtraData->noteTracks.get());
}
}
//Set extra data owner object
objectExtraData->object = particleSystem;
//Attach particle system to the node
owner.Attach(particleSystem);
//Add to loaded objects map
this->loadedObjects[name] = particleSystem;
//Process the extra data
HandleNewObjectExtraData(objectExtraData);
//Notify callback
if (this->callback != 0)
this->callback->CreatedParticleSystem(this, particleSystem);
}
void OgreMaxScene::LoadBillboardSet(const TiXmlElement* objectElement, const MovableObjectOwner& owner)
{
ObjectExtraDataPtr objectExtraData(new ObjectExtraData);
String name = GetNewObjectName(objectElement, owner.node);
objectExtraData->id = OgreMaxUtilities::GetStringAttribute(objectElement, "id");
uint32 queryFlags = OgreMaxUtilities::GetUIntAttribute(objectElement, "queryFlags", 0);
uint32 visibilityFlags = OgreMaxUtilities::GetUIntAttribute(objectElement, "visibilityFlags", 0);
ObjectVisibility visibility = OgreMaxUtilities::GetObjectVisibilityAttribute(objectElement, "visible");
String material = OgreMaxUtilities::GetStringAttribute(objectElement, "material");
Real width = OgreMaxUtilities::GetRealAttribute(objectElement, "width", 10);
Real height = OgreMaxUtilities::GetRealAttribute(objectElement, "height", 10);
String type = OgreMaxUtilities::GetStringAttribute(objectElement, "type", "point");
String origin = OgreMaxUtilities::GetStringAttribute(objectElement, "origin", "center");
String rotationType = OgreMaxUtilities::GetStringAttribute(objectElement, "rotationType", "vertex");
uint32 poolSize = OgreMaxUtilities::GetUIntAttribute(objectElement, "poolSize", 0);
bool autoExtendPool = OgreMaxUtilities::GetBoolAttribute(objectElement, "autoExtendPool", true);
bool cullIndividual = OgreMaxUtilities::GetBoolAttribute(objectElement, "cullIndividual", false);
bool sort = OgreMaxUtilities::GetBoolAttribute(objectElement, "sort", false);
bool accurateFacing = OgreMaxUtilities::GetBoolAttribute(objectElement, "accurateFacing", false);
String renderQueue = OgreMaxUtilities::GetStringAttribute(objectElement, "renderQueue");
Real renderingDistance = OgreMaxUtilities::GetRealAttribute(objectElement, "renderingDistance", 0);
std::vector<CustomParameter> customParameters;
//Create the particle system
BillboardSet* billboardSet = this->sceneManager->createBillboardSet(name);
if (queryFlags != 0)
billboardSet->setQueryFlags(queryFlags);
if (visibilityFlags != 0)
billboardSet->setVisibilityFlags(visibilityFlags);
OgreMaxUtilities::SetObjectVisibility(billboardSet, visibility);
billboardSet->setRenderQueueGroup(OgreMaxUtilities::ParseRenderQueue(renderQueue));
billboardSet->setRenderingDistance(renderingDistance);
billboardSet->setMaterialName(material);
billboardSet->setDefaultWidth(width);
billboardSet->setDefaultHeight(height);
billboardSet->setBillboardType(OgreMaxUtilities::ParseBillboardType(type));
billboardSet->setBillboardOrigin(OgreMaxUtilities::ParseBillboardOrigin(origin));
billboardSet->setBillboardRotationType(OgreMaxUtilities::ParseBillboardRotationType(rotationType));
if (poolSize > 0)
billboardSet->setPoolSize(poolSize);
billboardSet->setAutoextend(autoExtendPool);
billboardSet->setCullIndividually(cullIndividual);
billboardSet->setSortingEnabled(sort);
billboardSet->setUseAccurateFacing(accurateFacing);
//Parse child elements
String elementName;
const TiXmlElement* childElement = 0;
while (childElement = OgreMaxUtilities::IterateChildElements(objectElement, childElement))
{
elementName = childElement->Value();
if (elementName == "billboard")
LoadBillboard(childElement, billboardSet);
else if (elementName == "commonDirection")
{
Vector3 commonDirection = OgreMaxUtilities::LoadXYZ(childElement);
billboardSet->setCommonDirection(commonDirection);
}
else if (elementName == "commonUpVector")
{
Vector3 commonUpVector = OgreMaxUtilities::LoadXYZ(childElement);
billboardSet->setCommonUpVector(commonUpVector);
}
else if (elementName == "userDataReference")
OgreMaxUtilities::LoadUserDataReference(childElement, objectExtraData->userDataReference);
else if (elementName == "userData")
OgreMaxUtilities::GetChildText(childElement, objectExtraData->userData);
else if (elementName == "noteTracks")
{
objectExtraData->noteTracks = SharedPtr<NoteTracks>(new NoteTracks);
OgreMaxUtilities::LoadNoteTracks(childElement, *objectExtraData->noteTracks.get());
}
else if (elementName == "customParameters")
OgreMaxUtilities::LoadCustomParameters(childElement, customParameters);
}
OgreMaxUtilities::SetCustomParameters(billboardSet, customParameters);
//Set extra data owner object
objectExtraData->object = billboardSet;
//Attach billboard set to the node
owner.Attach(billboardSet);
//Add to loaded objects map
this->loadedObjects[name] = billboardSet;
//Process the extra data
HandleNewObjectExtraData(objectExtraData);
//Notify callback
if (this->callback != 0)
this->callback->CreatedBillboardSet(this, billboardSet);
}
void OgreMaxScene::LoadPlane(const TiXmlElement* objectElement, const MovableObjectOwner& owner)
{
ObjectExtraDataPtr objectExtraData(new ObjectExtraData);
PlaneParameters parameters;
parameters.name = GetNewObjectName(objectElement, owner.node);
parameters.queryFlags = OgreMaxUtilities::GetUIntAttribute(objectElement, "queryFlags", 0);
parameters.visibilityFlags = OgreMaxUtilities::GetUIntAttribute(objectElement, "visibilityFlags", 0);
parameters.visibility = OgreMaxUtilities::GetObjectVisibilityAttribute(objectElement, "visible");
parameters.planeName = parameters.name;
parameters.distance = OgreMaxUtilities::GetRealAttribute(objectElement, "distance", 0);
parameters.width = OgreMaxUtilities::GetRealAttribute(objectElement, "width", 10);
parameters.height = OgreMaxUtilities::GetRealAttribute(objectElement, "height", 10);
parameters.xSegments = OgreMaxUtilities::GetIntAttribute(objectElement, "xSegments", 1);
parameters.ySegments = OgreMaxUtilities::GetIntAttribute(objectElement, "ySegments", 1);
parameters.numTexCoordSets = OgreMaxUtilities::GetIntAttribute(objectElement, "numTexCoordSets", 1);
parameters.uTile = OgreMaxUtilities::GetRealAttribute(objectElement, "uTile", 1);
parameters.vTile = OgreMaxUtilities::GetRealAttribute(objectElement, "vTile", 1);
parameters.material = OgreMaxUtilities::GetStringAttribute(objectElement, "material");
parameters.normals = OgreMaxUtilities::GetBoolAttribute(objectElement, "normals", true);
parameters.createMovablePlane = OgreMaxUtilities::GetBoolAttribute(objectElement, "movablePlane", true);
parameters.castShadows = OgreMaxUtilities::GetBoolAttribute(objectElement, "castShadows", true);
parameters.resourceGroupName = this->defaultResourceGroupName;
String renderQueue = OgreMaxUtilities::GetStringAttribute(objectElement, "renderQueue");
parameters.renderQueue = OgreMaxUtilities::ParseRenderQueue(renderQueue);
parameters.renderingDistance = OgreMaxUtilities::GetRealAttribute(objectElement, "renderingDistance", 0);
objectExtraData->id = OgreMaxUtilities::GetStringAttribute(objectElement, "id");
objectExtraData->receiveShadows = OgreMaxUtilities::GetBoolAttribute(objectElement, "receiveShadows", true);
//Parse child elements
String elementName;
const TiXmlElement* childElement = 0;
while (childElement = OgreMaxUtilities::IterateChildElements(objectElement, childElement))
{
elementName = childElement->Value();
if (elementName == "normal")
parameters.normal = OgreMaxUtilities::LoadXYZ(childElement);
else if (elementName == "upVector")
parameters.upVector = OgreMaxUtilities::LoadXYZ(childElement);
else if (elementName == "vertexBuffer")
OgreMaxUtilities::LoadBufferUsage(childElement, parameters.vertexBufferUsage, parameters.vertexBufferShadowed);
else if (elementName == "indexBuffer")
OgreMaxUtilities::LoadBufferUsage(childElement, parameters.indexBufferUsage, parameters.indexBufferShadowed);
else if (elementName == "userDataReference")
OgreMaxUtilities::LoadUserDataReference(childElement, objectExtraData->userDataReference);
else if (elementName == "userData")
OgreMaxUtilities::GetChildText(childElement, objectExtraData->userData);
else if (elementName == "noteTracks")
{
objectExtraData->noteTracks = SharedPtr<NoteTracks>(new NoteTracks);
OgreMaxUtilities::LoadNoteTracks(childElement, *objectExtraData->noteTracks.get());
}
else if (elementName == "customParameters")
OgreMaxUtilities::LoadCustomParameters(childElement, parameters.customParameters);
}
parameters.extraData = objectExtraData;
//Notify callback
if (this->callback != 0)
this->callback->LoadingPlane(this, parameters);
//Create movable plane if the name hasn't already been used
MovablePlane* movablePlane = 0;
if (parameters.createMovablePlane)
{
String movablePlaneName;
OgreMaxUtilities::CreateMovablePlaneName(movablePlaneName, parameters.planeName);
if (this->movablePlanes.find(movablePlaneName) == this->movablePlanes.end())
{
movablePlane = new MovablePlane(movablePlaneName);
this->movablePlanes[movablePlaneName] = movablePlane;
movablePlane->normal = parameters.normal;
movablePlane->d = parameters.distance;
}
}
//Create plane mesh
Plane plane(parameters.normal, parameters.distance);
MeshManager::getSingleton().createPlane
(
parameters.planeName,
parameters.resourceGroupName,
plane,
parameters.width, parameters.height,
parameters.xSegments, parameters.ySegments,
parameters.normals, parameters.numTexCoordSets,
parameters.uTile, parameters.vTile,
parameters.upVector,
parameters.vertexBufferUsage, parameters.indexBufferUsage,
parameters.vertexBufferShadowed, parameters.indexBufferShadowed
);
//Create plane entity
Entity* entity = this->sceneManager->createEntity(parameters.name, parameters.planeName);
if (parameters.queryFlags != 0)
entity->setQueryFlags(parameters.queryFlags);
if (parameters.visibilityFlags != 0)
entity->setVisibilityFlags(parameters.visibilityFlags);
OgreMaxUtilities::SetObjectVisibility(entity, parameters.visibility);
entity->setCastShadows(parameters.castShadows);
entity->setRenderQueueGroup(parameters.renderQueue);
entity->setRenderingDistance(parameters.renderingDistance);
OgreMaxUtilities::SetCustomParameters(entity, parameters.customParameters);
entity->setMaterialName(parameters.material);
objectExtraData->object = entity;
//Attach plane entity and movable object to the node
owner.Attach(entity);
if (movablePlane != 0)
owner.Attach(movablePlane);
//Add to loaded objects map
this->loadedObjects[parameters.name] = entity;
//Process the extra data
HandleNewObjectExtraData(objectExtraData);
//Notify callback
if (this->callback != 0)
this->callback->CreatedPlane(this, plane, entity);
}
void OgreMaxScene::LoadBoneAttachments(const TiXmlElement* objectElement, Entity* entity)
{
const TiXmlElement* childElement = 0;
while (childElement = OgreMaxUtilities::IterateChildElements(objectElement, childElement))
LoadBoneAttachment(childElement, entity);
}
void OgreMaxScene::LoadBoneAttachment(const TiXmlElement* objectElement, Entity* entity)
{
bool attachedSomething = false;
MovableObjectOwner owner(entity);
String name = OgreMaxUtilities::GetStringAttribute(objectElement, "name");
owner.boneName = OgreMaxUtilities::GetStringAttribute(objectElement, "bone");
String elementName;
const TiXmlElement* childElement = 0;
while (childElement = OgreMaxUtilities::IterateChildElements(objectElement, childElement))
{
elementName = childElement->Value();
if (elementName == "position")
owner.attachPosition = OgreMaxUtilities::LoadXYZ(childElement);
else if (elementName == "rotation")
owner.attachRotation = OgreMaxUtilities::LoadRotation(childElement);
else if (elementName == "scale")
owner.attachScale = OgreMaxUtilities::LoadXYZ(childElement);
else if (elementName == "entity")
{
LoadEntity(childElement, owner);
attachedSomething = true;
}
else if (elementName == "light")
{
LoadLight(childElement, owner);
attachedSomething = true;
}
else if (elementName == "camera")
{
LoadCamera(childElement, owner);
attachedSomething = true;
}
else if (elementName == "particleSystem")
{
LoadParticleSystem(childElement, owner);
attachedSomething = true;
}
else if (elementName == "billboardSet")
{
LoadBillboardSet(childElement, owner);
attachedSomething = true;
}
else if (elementName == "plane")
{
LoadPlane(childElement, owner);
attachedSomething = true;
}
}
if (!attachedSomething)
owner.AttachEmpty(name);
}
void OgreMaxScene::LoadLookTarget(const TiXmlElement* objectElement, SceneNode* node, Camera* camera)
{
LookTarget lookTarget(node, camera);
lookTarget.nodeName = OgreMaxUtilities::GetStringAttribute(objectElement, "nodeName");
String relativeTo = OgreMaxUtilities::GetStringAttribute(objectElement, "relativeTo");
if (!relativeTo.empty())
lookTarget.relativeTo = OgreMaxUtilities::ParseTransformSpace(relativeTo);
//Parse child elements
String elementName;
const TiXmlElement* childElement = 0;
while (childElement = OgreMaxUtilities::IterateChildElements(objectElement, childElement))
{
elementName = childElement->Value();
if (elementName == "position")
{
lookTarget.position = OgreMaxUtilities::LoadXYZ(childElement);
lookTarget.isPositionSet = true;
}
else if (elementName == "localDirection")
lookTarget.localDirection = OgreMaxUtilities::LoadXYZ(childElement);
}
//Store look target information for later
this->lookTargets.push_back(lookTarget);
}
void OgreMaxScene::LoadTrackTarget(const TiXmlElement* objectElement, SceneNode* node, Camera* camera)
{
TrackTarget trackTarget(node, camera);
trackTarget.nodeName = OgreMaxUtilities::GetStringAttribute(objectElement, "nodeName");
//Parse child elements
String elementName;
const TiXmlElement* childElement = 0;
while (childElement = OgreMaxUtilities::IterateChildElements(objectElement, childElement))
{
elementName = childElement->Value();
if (elementName == "offset")
trackTarget.offset = OgreMaxUtilities::LoadXYZ(childElement);
else if (elementName == "localDirection")
trackTarget.localDirection = OgreMaxUtilities::LoadXYZ(childElement);
}
//Store track target information for later
this->trackTargets.push_back(trackTarget);
}
void OgreMaxScene::LoadBillboard(const TiXmlElement* objectElement, BillboardSet* billboardSet)
{
Real width = OgreMaxUtilities::GetRealAttribute(objectElement, "width", 0);
Real height = OgreMaxUtilities::GetRealAttribute(objectElement, "height", 0);
Radian rotationAngle = Radian(OgreMaxUtilities::GetRealAttribute(objectElement, "rotation", 0));
Vector3 position = Vector3::ZERO;
ColourValue color = ColourValue::White;
FloatRect texCoordRectangle(0, 0, 0, 0);
//Parse child elements
String elementName;
const TiXmlElement* childElement = 0;
while (childElement = OgreMaxUtilities::IterateChildElements(objectElement, childElement))
{
elementName = childElement->Value();
if (elementName == "position")
position = OgreMaxUtilities::LoadXYZ(childElement);
else if (elementName == "rotation")
{
Quaternion rotation = OgreMaxUtilities::LoadRotation(childElement);
Vector3 rotationAxis;
rotation.ToAngleAxis(rotationAngle, rotationAxis);
}
else if (elementName == "colourDiffuse")
color = OgreMaxUtilities::LoadColor(childElement);
else if (elementName == "texCoordRectangle")
texCoordRectangle = OgreMaxUtilities::LoadFloatRectangle(childElement);
}
//Create the billboard
Billboard* billboard = billboardSet->createBillboard(position, color);
//Set rotation angle
if (rotationAngle.valueRadians() != 0)
billboard->setRotation(rotationAngle);
//Set dimensions
if (width != 0 && height != 0)
billboard->setDimensions(width, height);
//Set texture coordinate rectangle
if (texCoordRectangle.width() != 0 && texCoordRectangle.height() != 0)
billboard->setTexcoordRect(texCoordRectangle);
}
void OgreMaxScene::LoadLightRange(const TiXmlElement* objectElement, Light* light)
{
if (light->getType() == Light::LT_SPOTLIGHT)
{
String value;
value = OgreMaxUtilities::GetStringAttribute(objectElement, "inner");
if (!value.empty())
light->setSpotlightInnerAngle(Radian(StringConverter::parseReal(value)));
value = OgreMaxUtilities::GetStringAttribute(objectElement, "outer");
if (!value.empty())
light->setSpotlightOuterAngle(Radian(StringConverter::parseReal(value)));
value = OgreMaxUtilities::GetStringAttribute(objectElement, "falloff");
if (!value.empty())
light->setSpotlightFalloff(StringConverter::parseReal(value));
}
}
void OgreMaxScene::LoadLightAttenuation(const TiXmlElement* objectElement, Light* light)
{
String value;
value = OgreMaxUtilities::GetStringAttribute(objectElement, "range");
Real range = value.empty() ? light->getAttenuationRange() : StringConverter::parseReal(value);
value = OgreMaxUtilities::GetStringAttribute(objectElement, "constant");
Real constant = value.empty() ? light->getAttenuationConstant() : StringConverter::parseReal(value);
value = OgreMaxUtilities::GetStringAttribute(objectElement, "linear");
Real linear = value.empty() ? light->getAttenuationLinear() : StringConverter::parseReal(value);
value = OgreMaxUtilities::GetStringAttribute(objectElement, "quadric");
Real quadric = value.empty() ? light->getAttenuationQuadric() : StringConverter::parseReal(value);
light->setAttenuation(range, constant, linear, quadric);
}
void OgreMaxScene::LoadNodeAnimations(const TiXmlElement* objectElement, SceneNode* node)
{
//Parse child elements
String elementName;
const TiXmlElement* childElement = 0;
while (childElement = OgreMaxUtilities::IterateChildElements(objectElement, childElement))
{
elementName = childElement->Value();
if (elementName == "animation")
LoadNodeAnimation(childElement, node);
}
}
void OgreMaxScene::LoadNodeAnimation(const TiXmlElement* objectElement, SceneNode* node)
{
Types::NodeAnimationParameters params;
//Get enabled and looping states
params.enable = OgreMaxUtilities::GetBoolAttribute(objectElement, "enable", params.enable);
params.looping = OgreMaxUtilities::GetBoolAttribute(objectElement, "loop", params.looping);
//Animation name
params.name = this->nodeAnimationNamePrefix;
params.name += OgreMaxUtilities::GetStringAttribute(objectElement, "name");
//Get existing animation or create new one
Animation* animation;
if (this->sceneManager->hasAnimation(params.name))
animation = this->sceneManager->getAnimation(params.name);
else
{
//Length
params.length = OgreMaxUtilities::GetRealAttribute(objectElement, "length", 0);
//Interpolation mode
String interpolationModeText = OgreMaxUtilities::GetStringAttribute(objectElement, "interpolationMode");
if (!interpolationModeText.empty())
params.interpolationMode = OgreMaxUtilities::ParseAnimationInterpolationMode(interpolationModeText);
//Rotation interpolation mode
String rotationInterpolationModeText = OgreMaxUtilities::GetStringAttribute(objectElement, "rotationInterpolationMode");
if (!rotationInterpolationModeText.empty())
params.rotationInterpolationMode = OgreMaxUtilities::ParseAnimationRotationInterpolationMode(rotationInterpolationModeText);
//Notify the callback
if (this->callback != 0)
this->callback->LoadingNodeAnimation(this, params);
//Create animation
animation = this->sceneManager->createAnimation(params.name, params.length);
animation->setInterpolationMode(params.interpolationMode);
animation->setRotationInterpolationMode(params.rotationInterpolationMode);
//Notify the callback
if (this->callback != 0)
this->callback->CreatedNodeAnimation(this, node, animation);
}
//Create animation track for node
NodeAnimationTrack* animationTrack = animation->createNodeTrack(animation->getNumNodeTracks() + 1, node);
//Load animation keyframes
String elementName;
const TiXmlElement* childElement = 0;
while (childElement = OgreMaxUtilities::IterateChildElements(objectElement, childElement))
{
elementName = childElement->Value();
if (elementName == "keyframe")
LoadNodeAnimationKeyFrame(childElement, animationTrack);
}
//Notify callback
if (this->callback != 0)
this->callback->CreatedNodeAnimationTrack(this, node, animationTrack, params.enable, params.looping);
if ((this->loadOptions & NO_ANIMATION_STATES) == 0)
{
//Create a new animation state to track the animation
if (GetAnimationState(params.name) == 0)
{
//No animation state has been created for the animation yet
AnimationState* animationState = this->sceneManager->createAnimationState(params.name);
this->animationStates[params.name] = animationState;
animationState->setEnabled(params.enable);
animationState->setLoop(params.looping);
//Notify callback
if (this->callback != 0)
this->callback->CreatedNodeAnimationState(this, node, animationState);
}
}
}
void OgreMaxScene::LoadNodeAnimationKeyFrame(const TiXmlElement* objectElement, NodeAnimationTrack* animationTrack)
{
//Key time
Real keyTime = OgreMaxUtilities::GetRealAttribute(objectElement, "time", 0);
//Create the key frame
TransformKeyFrame* keyFrame = animationTrack->createNodeKeyFrame(keyTime);
//Parse child elements
String elementName;
const TiXmlElement* childElement = 0;
while (childElement = OgreMaxUtilities::IterateChildElements(objectElement, childElement))
{
elementName = childElement->Value();
if (elementName == "translation")
keyFrame->setTranslate(OgreMaxUtilities::LoadXYZ(childElement));
else if (elementName == "rotation")
keyFrame->setRotation(OgreMaxUtilities::LoadRotation(childElement));
else if (elementName == "scale")
keyFrame->setScale(OgreMaxUtilities::LoadXYZ(childElement));
}
}
void OgreMaxScene::LoadObjectNames(const TiXmlElement* objectElement, const String& elementName, std::vector<String>& names)
{
size_t objectCount = OgreMaxUtilities::GetElementCount(objectElement, elementName);
names.resize(objectCount);
size_t index = 0;
const TiXmlElement* childElement = 0;
while (childElement = OgreMaxUtilities::IterateChildElements(objectElement, childElement))
{
names[index++] = childElement->Attribute("name");
}
}
void OgreMaxScene::LoadRenderTextureMaterials
(
const TiXmlElement* objectElement,
std::vector<RenderTextureParameters::Material>& materials
)
{
size_t index = 0;
const TiXmlElement* childElement = 0;
while (childElement = OgreMaxUtilities::IterateChildElements(objectElement, childElement))
{
RenderTextureParameters::Material& material = materials[index++];
material.name = childElement->Attribute("name");
material.techniqueIndex = OgreMaxUtilities::GetIntAttribute(childElement, "technique", 0);
material.passIndex = OgreMaxUtilities::GetIntAttribute(childElement, "pass", 0);
material.textureUnitIndex = OgreMaxUtilities::GetIntAttribute(childElement, "textureUnit", 0);
}
}
ShadowCameraSetup* OgreMaxScene::ParseShadowCameraSetup(const String& type, Plane optimalPlane)
{
String typeLower = type;
StringUtil::toLowerCase(typeLower);
if (typeLower == "uniform")
return new DefaultShadowCameraSetup;
else if (typeLower == "uniformfocused")
return new FocusedShadowCameraSetup;
else if (typeLower == "lispsm")
return new LiSPSMShadowCameraSetup;
else if (typeLower == "planeoptimal")
{
//The plane optimal setup requires a plane.
//Create one if it hasn't already been created
if (this->shadowOptimalPlane == 0)
this->shadowOptimalPlane = new MovablePlane("_shadowOptimalPlane");
//Update plane
*(Plane*)this->shadowOptimalPlane = optimalPlane;
return new PlaneOptimalShadowCameraSetup(this->shadowOptimalPlane);
}
StringUtil::StrStreamType errorMessage;
errorMessage << "Invalid shadow camera setup specified: " << type;
OGRE_EXCEPT
(
Exception::ERR_INVALIDPARAMS,
errorMessage.str(),
"OgreMaxScene::ParseShadowCameraSetup"
);
}
| [
"pablosn@06488772-1f9a-11de-8b5c-13accb87f508"
]
| [
[
[
1,
3146
]
]
]
|
773899abecc4a50ccd3a7cbe2a49a9d791af5876 | 5e0422794380a8f3bf06d0c37ac2354f4b91fefb | /fastnet/session_acceptor.h | e8f95852fa93805a5a298ae8d57e50ee5254d292 | []
| no_license | OrAlien/fastnetwork | 1d8fb757b855b1f23cc844cda4d8dc7a568bc38e | 792d28d8b5829c227aebe8378f60db17de4d6f14 | refs/heads/master | 2021-05-28T20:30:24.031458 | 2010-06-02T14:30:04 | 2010-06-02T14:30:04 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 701 | h | #pragma once
#include "net_io_service.h"
#include "session_type.h"
namespace fastnet
{
class session_accept_handler;
class session_acceptor;
typedef shared_ptr<session_acceptor> session_acceptor_ptr;
class session_acceptor :
public net_io_service, enable_shared_from_this<session_acceptor>
{
public:
session_acceptor(void);
virtual ~session_acceptor(void);
public:
virtual transport_type get_session_type() = 0;
virtual void bind( boost::asio::ip::udp::endpoint local_address ) = 0;
virtual void unbind( boost::asio::ip::udp::endpoint local_address ) = 0;
virtual void set_handler( session_accept_handler * handler ) = 0;
};
} // namespace fastnet | [
"everwanna@8b0bd7a0-72c1-11de-90d8-1fdda9445408"
]
| [
[
[
1,
27
]
]
]
|
d4b7543477a7455987ee9cbfb3ee50a879732e3c | 9c62af23e0a1faea5aaa8dd328ba1d82688823a5 | /rl/tags/v0-1/engine/rules/include/DsaDataLoader.h | c4fd0d4fa764ec4a825005f140dafb67c9b2d9bb | [
"ClArtistic",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain"
]
| permissive | jacmoe/dsa-hl-svn | 55b05b6f28b0b8b216eac7b0f9eedf650d116f85 | 97798e1f54df9d5785fb206c7165cd011c611560 | refs/heads/master | 2021-04-22T12:07:43.389214 | 2009-11-27T22:01:03 | 2009-11-27T22:01:03 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,769 | h | /* This source file is part of Rastullahs Lockenpracht.
* Copyright (C) 2003-2005 Team Pantheon. http://www.team-pantheon.de
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the Clarified Artistic License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* Clarified Artistic License for more details.
*
* You should have received a copy of the Clarified Artistic License
* along with this program; if not you can get it here
* http://www.jpaulmorrison.com/fbp/artistic2.htm.
*/
#ifndef __DsaDataLoader_H__
#define __DsaDataLoader_H__
#include <xercesc/dom/DOMDocument.hpp>
#include <xercesc/dom/DOMElement.hpp>
#include <string>
namespace rl {
class Talent;
class Person;
class Kampftechnik;
class DsaDataLoader
{
public:
static void loadData(std::string filename);
private:
static XERCES_CPP_NAMESPACE::DOMDocument* loadDataFile(std::string filename);
static int getEBeFromString(const std::string& eBeString);
static void initializeTalente(XERCES_CPP_NAMESPACE::DOMElement* rootTalente);
static Talent* processTalent(int gruppe, XERCES_CPP_NAMESPACE::DOMElement* talentXml);
static void initializePersonen(XERCES_CPP_NAMESPACE::DOMElement* rootPersonen);
static Person* processPerson(XERCES_CPP_NAMESPACE::DOMElement* talentXml);
static void initializeKampftechniken(XERCES_CPP_NAMESPACE::DOMElement* rootKampftechniken);
static Kampftechnik* processKampftechnik(XERCES_CPP_NAMESPACE::DOMElement* kampftechnikXml);
DsaDataLoader();
};
}
#endif
| [
"blakharaz@4c79e8ff-cfd4-0310-af45-a38c79f83013"
]
| [
[
[
1,
55
]
]
]
|
771e9d58fb6f67c08e514737b2edbf76205c240e | 91b964984762870246a2a71cb32187eb9e85d74e | /SRC/OFFI SRC!/boost_1_34_1/boost_1_34_1/libs/wave/samples/waveidl/idllexer/idl.re | 8eb632aeec945d1ac796ce99abc343673b532915 | [
"BSL-1.0",
"LicenseRef-scancode-unknown-license-reference"
]
| permissive | willrebuild/flyffsf | e5911fb412221e00a20a6867fd00c55afca593c7 | d38cc11790480d617b38bb5fc50729d676aef80d | refs/heads/master | 2021-01-19T20:27:35.200154 | 2011-02-10T12:34:43 | 2011-02-10T12:34:43 | 32,710,780 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 18,555 | re | /*=============================================================================
Boost.Wave: A Standard compliant C++ preprocessor library
Sample: IDL lexer
http://www.boost.org/
Copyright (c) 2001-2007 Hartmut Kaiser. Distributed under the Boost
Software License, Version 1.0. (See accompanying file
LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
=============================================================================*/
#include <ctime>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <boost/config.hpp>
#if defined(BOOST_HAS_UNISTD_H)
#include <unistd.h>
#else
#include <io.h>
#endif
#include <boost/assert.hpp>
#include <boost/detail/workaround.hpp>
// reuse the token ids and re2c helper functions from the default C++ lexer
#include <boost/wave/token_ids.hpp>
#include <boost/wave/cpplexer/re2clex/aq.hpp>
#include <boost/wave/cpplexer/re2clex/scanner.hpp>
#include "idl_re.hpp"
#if defined(_MSC_VER) && !defined(__COMO__)
#pragma warning (disable: 4101) // 'foo' : unreferenced local variable
#pragma warning (disable: 4102) // 'foo' : unreferenced label
#endif
#define BOOST_WAVE_BSIZE 196608
#define YYCTYPE uchar
#define YYCURSOR cursor
#define YYLIMIT s->lim
#define YYMARKER s->ptr
#define YYFILL(n) {cursor = fill(s, cursor);}
//#define BOOST_WAVE_RET(i) {s->cur = cursor; return (i);}
#define BOOST_WAVE_RET(i) \
{ \
s->line += count_backslash_newlines(s, cursor); \
s->cur = cursor; \
return (i); \
} \
/**/
///////////////////////////////////////////////////////////////////////////////
namespace boost {
namespace wave {
namespace idllexer {
namespace re2clex {
#define RE2C_ASSERT BOOST_ASSERT
int
get_one_char(boost::wave::cpplexer::re2clex::Scanner *s)
{
using namespace boost::wave::cpplexer::re2clex;
if (s->fd != -1) {
uchar val;
if (read(s->fd, &val, sizeof(val)))
return val;
}
else if (0 != s->act) {
RE2C_ASSERT(s->first != 0 && s->last != 0);
RE2C_ASSERT(s->first <= s->act && s->act <= s->last);
if (s->act < s->last)
return *(s->act)++;
}
return -1;
}
std::ptrdiff_t
rewind_stream (boost::wave::cpplexer::re2clex::Scanner *s, int cnt)
{
if (s->fd != -1) {
return lseek(s->fd, cnt, SEEK_CUR);
}
else if (0 != s->act) {
RE2C_ASSERT(s->first != 0 && s->last != 0);
s->act += cnt;
RE2C_ASSERT(s->first <= s->act && s->act <= s->last);
return s->act - s->first;
}
return 0;
}
std::size_t
get_first_eol_offset(boost::wave::cpplexer::re2clex::Scanner* s)
{
if (!AQ_EMPTY(s->eol_offsets))
{
return s->eol_offsets->queue[s->eol_offsets->head];
}
else
{
return (unsigned int)-1;
}
}
void
adjust_eol_offsets(boost::wave::cpplexer::re2clex::Scanner* s,
std::size_t adjustment)
{
boost::wave::cpplexer::re2clex::aq_queue q;
std::size_t i;
if (!s->eol_offsets)
s->eol_offsets = boost::wave::cpplexer::re2clex::aq_create();
q = s->eol_offsets;
if (AQ_EMPTY(q))
return;
i = q->head;
while (i != q->tail)
{
if (adjustment > q->queue[i])
q->queue[i] = 0;
else
q->queue[i] -= adjustment;
++i;
if (i == q->max_size)
i = 0;
}
if (adjustment > q->queue[i])
q->queue[i] = 0;
else
q->queue[i] -= adjustment;
}
int
count_backslash_newlines(boost::wave::cpplexer::re2clex::Scanner *s,
boost::wave::cpplexer::re2clex::uchar *cursor)
{
using namespace boost::wave::cpplexer::re2clex;
std::size_t diff, offset;
int skipped = 0;
/* figure out how many backslash-newlines skipped over unknowingly. */
diff = cursor - s->bot;
offset = get_first_eol_offset(s);
while (offset <= diff && offset != (unsigned int)-1)
{
skipped++;
boost::wave::cpplexer::re2clex::aq_pop(s->eol_offsets);
offset = get_first_eol_offset(s);
}
return skipped;
}
bool is_backslash(
boost::wave::cpplexer::re2clex::uchar *p,
boost::wave::cpplexer::re2clex::uchar *end, int &len)
{
if (*p == '\\') {
len = 1;
return true;
}
else if (*p == '?' && *(p+1) == '?' && (p+2 < end && *(p+2) == '/')) {
len = 3;
return true;
}
return false;
}
boost::wave::cpplexer::re2clex::uchar *
fill(boost::wave::cpplexer::re2clex::Scanner *s,
boost::wave::cpplexer::re2clex::uchar *cursor)
{
using namespace std; // some systems have memcpy etc. in namespace std
using namespace boost::wave::cpplexer::re2clex;
if(!s->eof)
{
uchar* p;
std::ptrdiff_t cnt = s->tok - s->bot;
if(cnt)
{
memcpy(s->bot, s->tok, s->lim - s->tok);
s->tok = s->bot;
s->ptr -= cnt;
cursor -= cnt;
s->lim -= cnt;
adjust_eol_offsets(s, cnt);
}
if((s->top - s->lim) < BOOST_WAVE_BSIZE)
{
uchar *buf = (uchar*) malloc(((s->lim - s->bot) + BOOST_WAVE_BSIZE)*sizeof(uchar));
if (buf == 0)
{
using namespace std; // some systems have printf in std
if (0 != s->error_proc)
(*s->error_proc)(s, "Out of memory!");
else
printf("Out of memory!\n");
/* get the scanner to stop */
*cursor = 0;
return cursor;
}
memcpy(buf, s->tok, s->lim - s->tok);
s->tok = buf;
s->ptr = &buf[s->ptr - s->bot];
cursor = &buf[cursor - s->bot];
s->lim = &buf[s->lim - s->bot];
s->top = &s->lim[BOOST_WAVE_BSIZE];
free(s->bot);
s->bot = buf;
}
if (s->fd != -1) {
if((cnt = read(s->fd, (char*) s->lim, BOOST_WAVE_BSIZE)) != BOOST_WAVE_BSIZE)
{
s->eof = &s->lim[cnt]; *(s->eof)++ = '\0';
}
}
else if (s->act != 0) {
cnt = s->last - s->act;
if (cnt > BOOST_WAVE_BSIZE)
cnt = BOOST_WAVE_BSIZE;
memcpy(s->lim, s->act, cnt);
s->act += cnt;
if (cnt != BOOST_WAVE_BSIZE)
{
s->eof = &s->lim[cnt]; *(s->eof)++ = '\0';
}
}
/* backslash-newline erasing time */
/* first scan for backslash-newline and erase them */
for (p = s->lim; p < s->lim + cnt - 2; ++p)
{
int len = 0;
if (is_backslash(p, s->lim + cnt, len))
{
if (*(p+len) == '\n')
{
int offset = len + 1;
memmove(p, p + offset, s->lim + cnt - p - offset);
cnt -= offset;
--p;
aq_enqueue(s->eol_offsets, p - s->bot + 1);
}
else if (*(p+len) == '\r')
{
if (*(p+len+1) == '\n')
{
int offset = len + 2;
memmove(p, p + offset, s->lim + cnt - p - offset);
cnt -= offset;
--p;
}
else
{
int offset = len + 1;
memmove(p, p + offset, s->lim + cnt - p - offset);
cnt -= offset;
--p;
}
aq_enqueue(s->eol_offsets, p - s->bot + 1);
}
}
}
/* FIXME: the following code should be fixed to recognize correctly the
trigraph backslash token */
/* check to see if what we just read ends in a backslash */
if (cnt >= 2)
{
uchar last = s->lim[cnt-1];
uchar last2 = s->lim[cnt-2];
/* check \ EOB */
if (last == '\\')
{
int next = get_one_char(s);
/* check for \ \n or \ \r or \ \r \n straddling the border */
if (next == '\n')
{
--cnt; /* chop the final \, we've already read the \n. */
boost::wave::cpplexer::re2clex::aq_enqueue(s->eol_offsets,
cnt + (s->lim - s->bot));
}
else if (next == '\r')
{
int next2 = get_one_char(s);
if (next2 == '\n')
{
--cnt; /* skip the backslash */
}
else
{
/* rewind one, and skip one char */
rewind_stream(s, -1);
--cnt;
}
boost::wave::cpplexer::re2clex::aq_enqueue(s->eol_offsets,
cnt + (s->lim - s->bot));
}
else if (next != -1) /* -1 means end of file */
{
/* next was something else, so rewind the stream */
lseek(s->fd, -1, SEEK_CUR);
}
}
/* check \ \r EOB */
else if (last == '\r' && last2 == '\\')
{
int next = get_one_char(s);
if (next == '\n')
{
cnt -= 2; /* skip the \ \r */
}
else
{
/* rewind one, and skip two chars */
rewind_stream(s, -1);
cnt -= 2;
}
boost::wave::cpplexer::re2clex::aq_enqueue(s->eol_offsets,
cnt + (s->lim - s->bot));
}
/* check \ \n EOB */
else if (last == '\n' && last2 == '\\')
{
cnt -= 2;
boost::wave::cpplexer::re2clex::aq_enqueue(s->eol_offsets,
cnt + (s->lim - s->bot));
}
}
s->lim += cnt;
if (s->eof) /* eof needs adjusting if we erased backslash-newlines */
{
s->eof = s->lim;
*(s->eof)++ = '\0';
}
}
return cursor;
}
boost::wave::token_id
scan(boost::wave::cpplexer::re2clex::Scanner *s)
{
using namespace boost::wave::cpplexer::re2clex;
uchar *cursor = s->tok = s->cur;
/*!re2c
any = [\t\v\f\r\n\040-\377];
OctalDigit = [0-7];
Digit = [0-9];
HexDigit = [a-fA-F0-9];
ExponentPart = [Ee] [+-]? Digit+;
FractionalConstant = (Digit* "." Digit+) | (Digit+ ".");
FloatingSuffix = [fF][lL]?|[lL][fF]?;
IntegerSuffix = [uU][lL]?|[lL][uU]?;
FixedPointSuffix = [dD];
Backslash = [\\]|"??/";
EscapeSequence = Backslash ([abfnrtv?'"] | Backslash | "x" HexDigit+ | OctalDigit OctalDigit? OctalDigit?);
HexQuad = HexDigit HexDigit HexDigit HexDigit;
UniversalChar = Backslash ("u" HexQuad | "U" HexQuad HexQuad);
Newline = "\r\n" | "\n" | "\r";
PPSpace = ([ \t]|("/*"(any\[*]|Newline|("*"+(any\[*/]|Newline)))*"*"+"/"))*;
Pound = "#" | "??=" | "%:";
*/
/*!re2c
"/*" { goto ccomment; }
"//" { goto cppcomment; }
"TRUE" { BOOST_WAVE_RET(T_TRUE); }
"FALSE" { BOOST_WAVE_RET(T_FALSE); }
"{" { BOOST_WAVE_RET(T_LEFTBRACE); }
"}" { BOOST_WAVE_RET(T_RIGHTBRACE); }
"[" { BOOST_WAVE_RET(T_LEFTBRACKET); }
"]" { BOOST_WAVE_RET(T_RIGHTBRACKET); }
"#" { BOOST_WAVE_RET(T_POUND); }
"##" { BOOST_WAVE_RET(T_POUND_POUND); }
"(" { BOOST_WAVE_RET(T_LEFTPAREN); }
")" { BOOST_WAVE_RET(T_RIGHTPAREN); }
";" { BOOST_WAVE_RET(T_SEMICOLON); }
":" { BOOST_WAVE_RET(T_COLON); }
"?" { BOOST_WAVE_RET(T_QUESTION_MARK); }
"." { BOOST_WAVE_RET(T_DOT); }
"+" { BOOST_WAVE_RET(T_PLUS); }
"-" { BOOST_WAVE_RET(T_MINUS); }
"*" { BOOST_WAVE_RET(T_STAR); }
"/" { BOOST_WAVE_RET(T_DIVIDE); }
"%" { BOOST_WAVE_RET(T_PERCENT); }
"^" { BOOST_WAVE_RET(T_XOR); }
"&" { BOOST_WAVE_RET(T_AND); }
"|" { BOOST_WAVE_RET(T_OR); }
"~" { BOOST_WAVE_RET(T_COMPL); }
"!" { BOOST_WAVE_RET(T_NOT); }
"=" { BOOST_WAVE_RET(T_ASSIGN); }
"<" { BOOST_WAVE_RET(T_LESS); }
">" { BOOST_WAVE_RET(T_GREATER); }
"<<" { BOOST_WAVE_RET(T_SHIFTLEFT); }
">>" { BOOST_WAVE_RET(T_SHIFTRIGHT); }
"==" { BOOST_WAVE_RET(T_EQUAL); }
"!=" { BOOST_WAVE_RET(T_NOTEQUAL); }
"<=" { BOOST_WAVE_RET(T_LESSEQUAL); }
">=" { BOOST_WAVE_RET(T_GREATEREQUAL); }
"&&" { BOOST_WAVE_RET(T_ANDAND); }
"||" { BOOST_WAVE_RET(T_OROR); }
"++" { BOOST_WAVE_RET(T_PLUSPLUS); }
"--" { BOOST_WAVE_RET(T_MINUSMINUS); }
"," { BOOST_WAVE_RET(T_COMMA); }
([a-zA-Z_] | UniversalChar) ([a-zA-Z_0-9] | UniversalChar)*
{ BOOST_WAVE_RET(T_IDENTIFIER); }
(("0" [xX] HexDigit+) | ("0" OctalDigit*) | ([1-9] Digit*)) IntegerSuffix?
{ BOOST_WAVE_RET(T_INTLIT); }
((FractionalConstant ExponentPart?) | (Digit+ ExponentPart)) FloatingSuffix?
{ BOOST_WAVE_RET(T_FLOATLIT); }
(FractionalConstant | Digit+) FixedPointSuffix
{ BOOST_WAVE_RET(T_FIXEDPOINTLIT); }
"L"? (['] (EscapeSequence|any\[\n\r\\']|UniversalChar)+ ['])
{ BOOST_WAVE_RET(T_CHARLIT); }
"L"? (["] (EscapeSequence|any\[\n\r\\"]|UniversalChar)* ["])
{ BOOST_WAVE_RET(T_STRINGLIT); }
Pound PPSpace "include" PPSpace "<" (any\[\n\r>])+ ">"
{ BOOST_WAVE_RET(T_PP_HHEADER); }
Pound PPSpace "include" PPSpace "\"" (any\[\n\r"])+ "\""
{ BOOST_WAVE_RET(T_PP_QHEADER); }
Pound PPSpace "include" PPSpace
{ BOOST_WAVE_RET(T_PP_INCLUDE); }
Pound PPSpace "if" { BOOST_WAVE_RET(T_PP_IF); }
Pound PPSpace "ifdef" { BOOST_WAVE_RET(T_PP_IFDEF); }
Pound PPSpace "ifndef" { BOOST_WAVE_RET(T_PP_IFNDEF); }
Pound PPSpace "else" { BOOST_WAVE_RET(T_PP_ELSE); }
Pound PPSpace "elif" { BOOST_WAVE_RET(T_PP_ELIF); }
Pound PPSpace "endif" { BOOST_WAVE_RET(T_PP_ENDIF); }
Pound PPSpace "define" { BOOST_WAVE_RET(T_PP_DEFINE); }
Pound PPSpace "undef" { BOOST_WAVE_RET(T_PP_UNDEF); }
Pound PPSpace "line" { BOOST_WAVE_RET(T_PP_LINE); }
Pound PPSpace "error" { BOOST_WAVE_RET(T_PP_ERROR); }
Pound PPSpace "pragma" { BOOST_WAVE_RET(T_PP_PRAGMA); }
Pound PPSpace "warning" { BOOST_WAVE_RET(T_PP_WARNING); }
[ \t\v\f]+
{ BOOST_WAVE_RET(T_SPACE); }
Newline
{
s->line++;
BOOST_WAVE_RET(T_NEWLINE);
}
"\000"
{
if(cursor != s->eof)
{
using namespace std; // some systems have printf in std
if (0 != s->error_proc)
(*s->error_proc)(s, "'\\000' in input stream");
else
printf("Error: 0 in file\n");
}
BOOST_WAVE_RET(T_EOF);
}
any
{
/* if (0 != s->error_proc)
(*s->error_proc)(s, "Unexpected character: '%c'", *s->tok);
else
printf("unexpected character: '%c'\n", *s->tok);
*/
BOOST_WAVE_RET(TOKEN_FROM_ID(*s->tok, UnknownTokenType));
}
*/
ccomment:
/*!re2c
"*/" { BOOST_WAVE_RET(T_CCOMMENT); }
Newline
{
/*if(cursor == s->eof) BOOST_WAVE_RET(T_EOF);*/
/*s->tok = cursor; */
s->line += count_backslash_newlines(s, cursor) +1;
goto ccomment;
}
any { goto ccomment; }
"\000"
{
using namespace std; // some systems have printf in std
if(cursor == s->eof)
{
if (s->error_proc)
(*s->error_proc)(s, "Unterminated comment");
else
printf("Error: Unterminated comment\n");
}
else
{
if (s->error_proc)
(*s->error_proc)(s, "'\\000' in input stream");
else
printf("Error: 0 in file");
}
/* adjust cursor such next call returns T_EOF */
--YYCURSOR;
/* the comment is unterminated, but nevertheless its a comment */
BOOST_WAVE_RET(T_CCOMMENT);
}
*/
cppcomment:
/*!re2c
Newline
{
/*if(cursor == s->eof) BOOST_WAVE_RET(T_EOF); */
/*s->tok = cursor; */
s->line++;
BOOST_WAVE_RET(T_CPPCOMMENT);
}
any { goto cppcomment; }
"\000"
{
using namespace std; // some systems have printf in std
if(cursor != s->eof)
{
if (s->error_proc)
(*s->error_proc)(s, "'\\000' in input stream");
else
printf("Error: 0 in file");
}
/* adjust cursor such next call returns T_EOF */
--YYCURSOR;
/* the comment is unterminated, but nevertheless its a comment */
BOOST_WAVE_RET(T_CPPCOMMENT);
}
*/
} /* end of scan */
#undef RE2C_ASSERT
///////////////////////////////////////////////////////////////////////////////
} // namespace re2clex
} // namespace idllexer
} // namespace wave
} // namespace boost
| [
"[email protected]@e2c90bd7-ee55-cca0-76d2-bbf4e3699278"
]
| [
[
[
1,
583
]
]
]
|
29071b28cdea5e70b024d0351b6c023e4d7569a6 | 559770fbf0654bc0aecc0f8eb33843cbfb5834d9 | /haina/codes/beluga/client/symbian/BelugaDb/inc/CppSQLite3.h | 9f6987dfc99e3344b7402f4cc0605a8bfb31526b | []
| no_license | CMGeorge/haina | 21126c70c8c143ca78b576e1ddf352c3d73ad525 | c68565d4bf43415c4542963cfcbd58922157c51a | refs/heads/master | 2021-01-11T07:07:16.089036 | 2010-08-18T09:25:07 | 2010-08-18T09:25:07 | 49,005,284 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 7,181 | h | ////////////////////////////////////////////////////////////////////////////////
// CppSQLite3 - A C++ wrapper around the SQLite3 embedded database library.
//
// Copyright (c) 2004 Rob Groves. All Rights Reserved. [email protected]
//
// Permission to use, copy, modify, and distribute this software and its
// documentation for any purpose, without fee, and without a written
// agreement, is hereby granted, provided that the above copyright notice,
// this paragraph and the following two paragraphs appear in all copies,
// modifications, and distributions.
//
// IN NO EVENT SHALL THE AUTHOR BE LIABLE TO ANY PARTY FOR DIRECT,
// INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST
// PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION,
// EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// THE AUTHOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
// PARTICULAR PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF
// ANY, PROVIDED HEREUNDER IS PROVIDED "AS IS". THE AUTHOR HAS NO OBLIGATION
// TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
//
// V3.0 03/08/2004 -Initial Version for sqlite3
//
// V3.1 16/09/2004 -Implemented getXXXXField using sqlite3 functions
// -Added CppSQLiteDB3::tableExists()
////////////////////////////////////////////////////////////////////////////////
#ifndef _CppSQLite3_H_
#define _CppSQLite3_H_
#include "sqlite3.h"
#include <stdio.h>
#include <string.h>
#define CPPSQLITE_ERROR 1000
class CppSQLite3Exception
{
public:
CppSQLite3Exception(const int nErrCode,
char* szErrMess,
bool bDeleteMsg=true);
CppSQLite3Exception(const CppSQLite3Exception& e);
virtual ~CppSQLite3Exception();
const int errorCode() { return mnErrCode; }
const char* errorMessage() { return mpszErrMess; }
static const char* errorCodeAsString(int nErrCode);
private:
int mnErrCode;
char* mpszErrMess;
};
class CppSQLite3Buffer
{
public:
CppSQLite3Buffer();
~CppSQLite3Buffer();
const char* format(const char* szFormat, ...);
operator const char*() { return mpBuf; }
void clear();
private:
char* mpBuf;
};
class CppSQLite3Binary
{
public:
CppSQLite3Binary();
~CppSQLite3Binary();
void setBinary(const unsigned char* pBuf, int nLen);
void setEncoded(const unsigned char* pBuf);
const unsigned char* getEncoded();
const unsigned char* getBinary();
int getBinaryLength();
unsigned char* allocBuffer(int nLen);
void clear();
private:
unsigned char* mpBuf;
int mnBinaryLen;
int mnBufferLen;
int mnEncodedLen;
bool mbEncoded;
};
class CppSQLite3Query
{
public:
CppSQLite3Query();
CppSQLite3Query(const CppSQLite3Query& rQuery);
CppSQLite3Query(sqlite3* pDB,
sqlite3_stmt* pVM,
bool bEof,
bool bOwnVM=true);
CppSQLite3Query& operator=(const CppSQLite3Query& rQuery);
virtual ~CppSQLite3Query();
int numFields();
int fieldIndex(const char* szField);
const char* fieldName(int nCol);
const char* fieldDeclType(int nCol);
int fieldDataType(int nCol);
const char* fieldValue(int nField);
const char* fieldValue(const char* szField);
int getIntField(int nField, int nNullValue=0);
int getIntField(const char* szField, int nNullValue=0);
double getFloatField(int nField, double fNullValue=0.0);
double getFloatField(const char* szField, double fNullValue=0.0);
const char* getStringField(int nField, const char* szNullValue="");
const char* getStringField(const char* szField, const char* szNullValue="");
const unsigned char* getBlobField(int nField, int& nLen);
const unsigned char* getBlobField(const char* szField, int& nLen);
bool fieldIsNull(int nField);
bool fieldIsNull(const char* szField);
bool eof();
void nextRow();
void finalize();
private:
void checkVM();
sqlite3* mpDB;
sqlite3_stmt* mpVM;
bool mbEof;
int mnCols;
bool mbOwnVM;
};
class CppSQLite3Table
{
public:
CppSQLite3Table();
CppSQLite3Table(const CppSQLite3Table& rTable);
CppSQLite3Table(char** paszResults, int nRows, int nCols);
virtual ~CppSQLite3Table();
CppSQLite3Table& operator=(const CppSQLite3Table& rTable);
int numFields();
int numRows();
const char* fieldName(int nCol);
const char* fieldValue(int nField);
const char* fieldValue(const char* szField);
int getIntField(int nField, int nNullValue=0);
int getIntField(const char* szField, int nNullValue=0);
double getFloatField(int nField, double fNullValue=0.0);
double getFloatField(const char* szField, double fNullValue=0.0);
const char* getStringField(int nField, const char* szNullValue="");
const char* getStringField(const char* szField, const char* szNullValue="");
bool fieldIsNull(int nField);
bool fieldIsNull(const char* szField);
void setRow(int nRow);
void finalize();
private:
void checkResults();
int mnCols;
int mnRows;
int mnCurrentRow;
char** mpaszResults;
};
class CppSQLite3Statement
{
public:
CppSQLite3Statement();
CppSQLite3Statement(const CppSQLite3Statement& rStatement);
CppSQLite3Statement(sqlite3* pDB, sqlite3_stmt* pVM);
virtual ~CppSQLite3Statement();
CppSQLite3Statement& operator=(const CppSQLite3Statement& rStatement);
int execDML();
CppSQLite3Query execQuery();
void bind(int nParam, const char* szValue);
void bind(int nParam, const int nValue);
void bind(int nParam, const double dwValue);
void bind(int nParam, const unsigned char* blobValue, int nLen);
void bindNull(int nParam);
void reset();
void finalize();
private:
void checkDB();
void checkVM();
sqlite3* mpDB;
sqlite3_stmt* mpVM;
};
class CppSQLite3DB
{
public:
CppSQLite3DB();
virtual ~CppSQLite3DB();
void open(const char* szFile);
void close();
bool tableExists(const char* szTable);
int execDML(const char* szSQL);
CppSQLite3Query execQuery(const char* szSQL);
int execScalar(const char* szSQL);
CppSQLite3Table getTable(const char* szSQL);
CppSQLite3Statement compileStatement(const char* szSQL);
sqlite_int64 lastRowId();
void interrupt() { sqlite3_interrupt(mpDB); }
void setBusyTimeout(int nMillisecs);
static const char* SQLiteVersion() { return SQLITE_VERSION; }
private:
CppSQLite3DB(const CppSQLite3DB& db);
CppSQLite3DB& operator=(const CppSQLite3DB& db);
sqlite3_stmt* compile(const char* szSQL);
void checkDB();
sqlite3* mpDB;
int mnBusyTimeoutMs;
};
#endif
| [
"shaochuan.yang@6c45ac76-16e4-11de-9d52-39b120432c5d"
]
| [
[
[
1,
306
]
]
]
|
c9eaea6f0003803cbe224443b5dde0cde1ecc31b | 478570cde911b8e8e39046de62d3b5966b850384 | /apicompatanamdw/bcdrivers/mw/appsupport/flash_viewer_framework_api/inc/saflash.h | 9f5fc5032ccea136f4ef6c50b14dff7bb46529e3 | []
| no_license | SymbianSource/oss.FCL.sftools.ana.compatanamdw | a6a8abf9ef7ad71021d43b7f2b2076b504d4445e | 1169475bbf82ebb763de36686d144336fcf9d93b | refs/heads/master | 2020-12-24T12:29:44.646072 | 2010-11-11T14:03:20 | 2010-11-11T14:03:20 | 72,994,432 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 837 | h | /*
* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description: Defines the stub application class
*
*/
#ifndef __FLASH_STUB__INCLUDE__
#define __FLASH_STUB__INCLUDE__
#include <aknapp.h>
#include <akndoc.h>
class CFlashStubApplication : public CAknApplication
{
public:
~CFlashStubApplication();
TUid AppDllUid() const;
protected:
CApaDocument* CreateDocumentL();
RLibrary iFlashLibrary;
};
#endif // __FLASH_STUB_INCLUDE__
| [
"none@none"
]
| [
[
[
1,
35
]
]
]
|
da36526e0532df82ed7e2fc22fae73c6618aa51d | bfe8eca44c0fca696a0031a98037f19a9938dd26 | /libjingle-0.4.0/talk/xmpp/xmppengineimpl.h | 866595510936681a19c1d010a7d472b603890eea | [
"BSD-3-Clause"
]
| permissive | luge/foolject | a190006bc0ed693f685f3a8287ea15b1fe631744 | 2f4f13a221a0fa2fecab2aaaf7e2af75c160d90c | refs/heads/master | 2021-01-10T07:41:06.726526 | 2011-01-21T10:25:22 | 2011-01-21T10:25:22 | 36,303,977 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 10,409 | h | /*
* libjingle
* Copyright 2004--2005, Google Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _xmppengineimpl_h_
#define _xmppengineimpl_h_
#include <sstream>
#include "talk/xmpp/xmppengine.h"
#include "talk/xmpp/xmppstanzaparser.h"
namespace buzz {
class XmppLoginTask;
class XmppEngine;
class XmppIqEntry;
class SaslHandler;
class SaslMechanism;
//! The XMPP connection engine.
//! This engine implements the client side of the 'core' XMPP protocol.
//! To use it, register an XmppOutputHandler to handle socket output
//! and pass socket input to HandleInput. Then application code can
//! set up the connection with a user, password, and other settings,
//! and then call Connect() to initiate the connection.
//! An application can listen for events and receive stanzas by
//! registering an XmppStanzaHandler via AddStanzaHandler().
class XmppEngineImpl : public XmppEngine {
public:
XmppEngineImpl();
virtual ~XmppEngineImpl();
// SOCKET INPUT AND OUTPUT ------------------------------------------------
//! Registers the handler for socket output
virtual XmppReturnStatus SetOutputHandler(XmppOutputHandler *pxoh);
//! Provides socket input to the engine
virtual XmppReturnStatus HandleInput(const char * bytes, size_t len);
//! Advises the engine that the socket has closed
virtual XmppReturnStatus ConnectionClosed(int subcode);
// SESSION SETUP ---------------------------------------------------------
//! Indicates the (bare) JID for the user to use.
virtual XmppReturnStatus SetUser(const Jid & jid);
//! Get the login (bare) JID.
virtual const Jid & GetUser();
//! Indicates the autentication to use. Takes ownership of the object.
virtual XmppReturnStatus SetSaslHandler(SaslHandler * sasl_handler);
//! Sets whether TLS will be used within the connection (default true).
virtual XmppReturnStatus SetUseTls(bool useTls);
//! Sets an alternate domain from which we allows TLS certificates.
//! This is for use in the case where a we want to allow a proxy to
//! serve up its own certificate rather than one owned by the underlying
//! domain.
virtual XmppReturnStatus SetTlsServer(const std::string & proxy_hostname,
const std::string & proxy_domain);
//! Gets whether TLS will be used within the connection.
virtual bool GetUseTls();
//! Sets the request resource name, if any (optional).
//! Note that the resource name may be overridden by the server; after
//! binding, the actual resource name is available as part of FullJid().
virtual XmppReturnStatus SetRequestedResource(const std::string& resource);
//! Gets the request resource name.
virtual const std::string & GetRequestedResource();
//! Sets language
virtual void SetLanguage(const std::string & lang) {
lang_ = lang;
}
// SESSION MANAGEMENT ---------------------------------------------------
//! Set callback for state changes.
virtual XmppReturnStatus SetSessionHandler(XmppSessionHandler* handler);
//! Initiates the XMPP connection.
//! After supplying connection settings, call this once to initiate,
//! (optionally) encrypt, authenticate, and bind the connection.
virtual XmppReturnStatus Connect();
//! The current engine state.
virtual State GetState() { return state_; }
//! Returns true if the connection is encrypted (under TLS)
virtual bool IsEncrypted() { return encrypted_; }
//! The error code.
//! Consult this after XmppOutputHandler.OnClose().
virtual Error GetError(int *subcode) {
if (subcode) {
*subcode = subcode_;
}
return error_code_;
}
//! The stream:error stanza, when the error is XmppEngine::ERROR_STREAM.
//! Notice the stanza returned is owned by the XmppEngine and
//! is deleted when the engine is destroyed.
virtual const XmlElement * GetStreamError() { return stream_error_.get(); }
//! Closes down the connection.
//! Sends CloseConnection to output, and disconnects and registered
//! session handlers. After Disconnect completes, it is guaranteed
//! that no further callbacks will be made.
virtual XmppReturnStatus Disconnect();
// APPLICATION USE -------------------------------------------------------
//! Adds a listener for session events.
//! Stanza delivery is chained to session handlers; the first to
//! return 'true' is the last to get each stanza.
virtual XmppReturnStatus AddStanzaHandler(XmppStanzaHandler* handler,
XmppEngine::HandlerLevel level);
//! Removes a listener for session events.
virtual XmppReturnStatus RemoveStanzaHandler(XmppStanzaHandler* handler);
//! Sends a stanza to the server.
virtual XmppReturnStatus SendStanza(const XmlElement * pelStanza);
//! Sends raw text to the server
virtual XmppReturnStatus SendRaw(const std::string & text);
//! Sends an iq to the server, and registers a callback for the result.
//! Returns the cookie passed to the result handler.
virtual XmppReturnStatus SendIq(const XmlElement* pelStanza,
XmppIqHandler* iq_handler,
XmppIqCookie* cookie);
//! Unregisters an iq callback handler given its cookie.
//! No callback will come to this handler after it's unregistered.
virtual XmppReturnStatus RemoveIqHandler(XmppIqCookie cookie,
XmppIqHandler** iq_handler);
//! Forms and sends an error in response to the given stanza.
//! Swaps to and from, sets type to "error", and adds error information
//! based on the passed code. Text is optional and may be STR_EMPTY.
virtual XmppReturnStatus SendStanzaError(const XmlElement * pelOriginal,
XmppStanzaError code,
const std::string & text);
//! The fullly bound JID.
//! This JID is only valid after binding has succeeded. If the value
//! is JID_NULL, the binding has not succeeded.
virtual const Jid & FullJid() { return bound_jid_; }
//! The next unused iq id for this connection.
//! Call this when building iq stanzas, to ensure that each iq
//! gets its own unique id.
virtual std::string NextId();
private:
friend class XmppLoginTask;
friend class XmppIqEntry;
void IncomingStanza(const XmlElement *pelStanza);
void IncomingStart(const XmlElement *pelStanza);
void IncomingEnd(bool isError);
void InternalSendStart(const std::string & domainName);
void InternalSendStanza(const XmlElement * pelStanza);
std::string ChooseBestSaslMechanism(const std::vector<std::string> & mechanisms, bool encrypted);
SaslMechanism * GetSaslMechanism(const std::string & name);
void SignalBound(const Jid & fullJid);
void SignalStreamError(const XmlElement * pelStreamError);
void SignalError(Error errorCode, int subCode);
bool HasError();
void DeleteIqCookies();
bool HandleIqResponse(const XmlElement * element);
void StartTls(const std::string & domain);
void RaiseReset() { raised_reset_ = true; }
class StanzaParseHandler : public XmppStanzaParseHandler {
public:
StanzaParseHandler(XmppEngineImpl * outer) : outer_(outer) {}
virtual void StartStream(const XmlElement * pelStream)
{ outer_->IncomingStart(pelStream); }
virtual void Stanza(const XmlElement * pelStanza)
{ outer_->IncomingStanza(pelStanza); }
virtual void EndStream()
{ outer_->IncomingEnd(false); }
virtual void XmlError()
{ outer_->IncomingEnd(true); }
private:
XmppEngineImpl * const outer_;
};
class EnterExit {
public:
EnterExit(XmppEngineImpl* engine);
~EnterExit();
private:
XmppEngineImpl* engine_;
State state_;
Error error_;
};
friend class StanzaParseHandler;
friend class EnterExit;
StanzaParseHandler stanzaParseHandler_;
XmppStanzaParser stanzaParser_;
// state
int engine_entered_;
Jid user_jid_;
std::string password_;
std::string requested_resource_;
bool tls_needed_;
std::string tls_server_hostname_;
std::string tls_server_domain_;
scoped_ptr<XmppLoginTask> login_task_;
std::string lang_;
int next_id_;
Jid bound_jid_;
State state_;
bool encrypted_;
Error error_code_;
int subcode_;
scoped_ptr<XmlElement> stream_error_;
bool raised_reset_;
XmppOutputHandler* output_handler_;
XmppSessionHandler* session_handler_;
typedef STD_VECTOR(XmppStanzaHandler*) StanzaHandlerVector;
scoped_ptr<StanzaHandlerVector> stanza_handlers_[HL_COUNT];
typedef STD_VECTOR(XmppIqEntry*) IqEntryVector;
scoped_ptr<IqEntryVector> iq_entries_;
scoped_ptr<SaslHandler> sasl_handler_;
scoped_ptr<std::stringstream> output_;
};
}
#endif
| [
"[email protected]@756bb6b0-a119-0410-8338-473b6f1ccd30"
]
| [
[
[
1,
276
]
]
]
|
a40bb25633303232f3d7100c3b028625fe64fcce | 073dfce42b384c9438734daa8ee2b575ff100cc9 | /RCF/src/RCF/Heap.cpp | 7b76d70bee04e0fc069b2c347a7c94717f115405 | []
| no_license | r0ssar00/iTunesSpeechBridge | a489426bbe30ac9bf9c7ca09a0b1acd624c1d9bf | 71a27a52e66f90ade339b2b8a7572b53577e2aaf | refs/heads/master | 2020-12-24T17:45:17.838301 | 2009-08-24T22:04:48 | 2009-08-24T22:04:48 | 285,393 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 398 | cpp |
//******************************************************************************
// RCF - Remote Call Framework
// Copyright (c) 2005 - 2009, Jarl Lindrud. All rights reserved.
// Consult your license for conditions of use.
// Version: 1.1
// Contact: jarl.lindrud <at> gmail.com
//******************************************************************************
#include <RCF/Heap.hpp>
| [
"[email protected]"
]
| [
[
[
1,
10
]
]
]
|
e0f6429ad4d79848fb3bcef05e82b1823bd1284a | 7d6597b8619a63f65b8a6cfcae721da7592b92aa | /spiral-core/include/spiral/internet/boostreactor/SocketCloser.h | 8a12c74f29a22b07f66bb5d139e6ab4c599ae30d | [
"MIT"
]
| permissive | RangelReale/spiral-io | 51eb976a1def7959d364a57921cab527d30ea428 | cf8dbdfcfbef5dc8092fd7ea0ce8d052edf2f35d | refs/heads/master | 2023-07-06T22:39:19.708949 | 2009-12-10T21:00:22 | 2009-12-10T21:00:22 | 37,156,634 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 525 | h | #ifndef _SPIRAL_INTERNET_BOOSTREACTOR_SOCKETCLOSER_H__
#define _SPIRAL_INTERNET_BOOSTREACTOR_SOCKETCLOSER_H__
#include <boost/asio.hpp>
namespace spiral {
namespace internet {
namespace boostreactor {
namespace ba=boost::asio;
namespace bs=boost::system;
using ba::ip::tcp;
class SocketCloser
{
public:
void closeSocket()
{
getSocket().close();
}
virtual tcp::socket &getSocket() = 0;
};
}}} // spiral::internet::boostreactor
#endif // _SPIRAL_INTERNET_BOOSTREACTOR_SOCKETCLOSER_H__
| [
"hitnrun@6cb40615-3296-4dc8-bcc4-269c24c2e8c1"
]
| [
[
[
1,
28
]
]
]
|
652a90e8e1ab17b02e687cd48de72db0e5e8dedc | da47cbee4935d18bfdc9e5150a5a71bd3b1a77fd | /acb2xml.cpp | c2d642c34a956ab0b84f1c40bc9b9036530cc636 | []
| no_license | atesgoral/acb2xml | 21863621e6533aa8f72915554f6d2a1619957e5f | f45173682c573bec7a77f8710ae2980f2bdb245a | refs/heads/master | 2020-05-24T12:14:57.206267 | 2010-08-08T05:34:56 | 2015-04-22T05:27:49 | 34,370,704 | 4 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 9,053 | cpp | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <stdio.h>
#include <tchar.h>
#include "stdlib.h"
#include "math.h"
#define COLOR_BOOK_HEADER "8BCB"
/* Color space IDs */
#define COLOR_SPACE_RGB 0
#define COLOR_SPACE_HSB 1
#define COLOR_SPACE_CMYK 2
#define COLOR_SPACE_Pantone 3
#define COLOR_SPACE_Focoltone 4
#define COLOR_SPACE_Trumatch 5
#define COLOR_SPACE_Toyo 6
#define COLOR_SPACE_Lab 7
#define COLOR_SPACE_Grayscale 8
#define COLOR_SPACE_HKS 10
#define OUTPUT_XML
//#define OUTPUT_SQL
#ifdef OUTPUT_XML
#define xmlprint printf
#else
#define xmlprint noop
#endif
void noop(...)
{
}
typedef struct _XMLSCOPE {
_XMLSCOPE *pParent;
const char *tag;
int indent;
} XS, *PXS;
/* Color space component quantizers */
int Quant_CMYK(unsigned char component)
{
return floor((1 - component / 255.0) * 100 + 0.5);
}
int Quant_Lab_L(unsigned char component)
{
return floor(component / 255.0 * 100 + 0.5);
}
int Quant_Lab_ab(unsigned char component)
{
return component - 128;
}
/* Read utils */
short ReadShort(FILE *pFile)
{
short i;
if (fread(&i, 1, 2, pFile) != 2)
throw "Cannot read short integer.";
return _byteswap_ushort(i);
}
long ReadLong(FILE *pFile)
{
long i;
if (fread(&i, 1, 4, pFile) != 4)
throw "Cannot read long integer.";
return _byteswap_ulong(i);
}
wchar_t *ReadString(FILE *pFile)
{
wchar_t *s = NULL;
try
{
int length = ReadLong(pFile);
int bufsize = (length + 1) << 1;
s = (wchar_t *)malloc(bufsize);
for (int i = 0; i < length; i++)
s[i] = ReadShort(pFile);
s[length] = 0;
return s;
}
catch (...)
{
if (s)
free(s);
throw;
}
}
PXS CreateXML(const char *version, const char *encoding)
{
xmlprint("<?xml version=\"%s\" encoding=\"%s\"?>", version, encoding);
PXS pXS = new XS;
pXS->indent = 0;
pXS->pParent = NULL;
pXS->tag = NULL;
return pXS;
}
// DestroyXML
void Indent(PXS pXS) // Quick and dirty. Fix later.
{
for (int i = 0; i < pXS->indent; i++)
xmlprint(" ");
}
void OpenTag(PXS *ppXS, const char *tag)
{
PXS pNewXS = new XS;
pNewXS->indent = (*ppXS)->indent + 4;
pNewXS->pParent = *ppXS;
pNewXS->tag = strdup(tag);
xmlprint("\n");
Indent(*ppXS);
// Hack!!!
if (strcmp(tag, "color-book") == 0)
{
xmlprint("<color-book version=\"1.0\" xmlns=\"http://magnetiq.com/ns/2007/05/colorbook\">");
}
else
{
xmlprint("<%s>", pNewXS->tag);
}
*ppXS = pNewXS;
}
void CloseTag(PXS *ppXS, bool bIndent = false)
{
if (bIndent)
{
xmlprint("\n");
(*ppXS)->indent -= 4; // Hacky
Indent(*ppXS);
}
xmlprint("</%s>", (*ppXS)->tag);
//free(const_cast<void *>((*ppXS)->tag));
PXS pParentXS = (*ppXS)->pParent;
delete *ppXS;
*ppXS = pParentXS;
}
bool ConvertACB(const char *filename)
{
bool ret = true;
FILE *pFile = NULL;
try
{
pFile = fopen(filename, "rb");
if (!pFile)
throw "Cannot open file.";
char header[4];
if (fread(header, 1, 4, pFile) != 4)
throw "Cannot read header.";
if (strncmp(header, COLOR_BOOK_HEADER, 4))
throw "Invalid header. Probably not a valid Photoshop Color Book file.";
int version = ReadShort(pFile);
if (version != 1)
throw "Invalid color book version.";
PXS pXS = CreateXML("1.0", "UTF-8");
OpenTag(&pXS, "color-book");
OpenTag(&pXS, "version");
xmlprint("%d", version);
CloseTag(&pXS);
short id = ReadShort(pFile);
OpenTag(&pXS, "id");
xmlprint("%.4x", id);
CloseTag(&pXS);
wchar_t *s;
OpenTag(&pXS, "title");
xmlprint("<![CDATA[%S]]>", ReadString(pFile));
CloseTag(&pXS);
OpenTag(&pXS, "prefix");
xmlprint("<![CDATA[%S]]>", ReadString(pFile));
CloseTag(&pXS);
OpenTag(&pXS, "postfix");
xmlprint("<![CDATA[%S]]>", ReadString(pFile));
CloseTag(&pXS);
OpenTag(&pXS, "description");
xmlprint("<![CDATA[%S]]>", ReadString(pFile));
CloseTag(&pXS);
int colors = ReadShort(pFile);
OpenTag(&pXS, "colors");
xmlprint("%d", colors);
CloseTag(&pXS);
fprintf(stderr, "Found %d colors\n", colors);
OpenTag(&pXS, "page-size");
xmlprint("%d", ReadShort(pFile));
CloseTag(&pXS);
OpenTag(&pXS, "page-offset");
xmlprint("%d", ReadShort(pFile));
CloseTag(&pXS);
int colorspace = ReadShort(pFile);
OpenTag(&pXS, "color-space");
switch (colorspace)
{
case COLOR_SPACE_RGB:
xmlprint("RGB");
break;
case COLOR_SPACE_HSB:
xmlprint("HSB");
break;
case COLOR_SPACE_CMYK:
xmlprint("CMYK");
break;
case COLOR_SPACE_Lab:
xmlprint("Lab");
break;
case COLOR_SPACE_Grayscale:
xmlprint("Grayscale");
break;
default:
xmlprint("Unknown");
}
CloseTag(&pXS);
char code[7];
code[6] = 0;
//colors = 2;
for (int i = 0; i < colors; i++)
{
if (!(s = ReadString(pFile)))
throw "Cannot read color name.";
OpenTag(&pXS, "color");
OpenTag(&pXS, "name");
xmlprint("%S", s);
CloseTag(&pXS);
if (fread(code, 1, 6, pFile) != 6)
throw "Cannot read code";
OpenTag(&pXS, "alias");
xmlprint("<![CDATA[%s]]>", code);
CloseTag(&pXS);
unsigned char components[4];
#ifdef OUTPUT_SQL
int sqlcomps[4];
#endif
switch (colorspace)
{
case COLOR_SPACE_RGB:
if (fread(components, 1, 3, pFile) != 3)
throw "Cannot read RGB components.";
OpenTag(&pXS, "red");
xmlprint("%d", components[0]);
CloseTag(&pXS);
OpenTag(&pXS, "green");
xmlprint("%d", components[1]);
CloseTag(&pXS);
OpenTag(&pXS, "blue");
xmlprint("%d", components[2]);
CloseTag(&pXS);
#ifdef OUTPUT_SQL
sqlcomps[0] = components[0];
sqlcomps[1] = components[1];
sqlcomps[2] = components[2];
sqlcomps[3] = 0;
#endif
break;
case COLOR_SPACE_CMYK:
if (fread(components, 1, 4, pFile) != 4)
throw "Cannot read CMYK components.";
OpenTag(&pXS, "cyan");
xmlprint("%d", Quant_CMYK(components[0]));
CloseTag(&pXS);
OpenTag(&pXS, "magenta");
xmlprint("%d", Quant_CMYK(components[1]));
CloseTag(&pXS);
OpenTag(&pXS, "yellow");
xmlprint("%d", Quant_CMYK(components[2]));
CloseTag(&pXS);
OpenTag(&pXS, "black");
xmlprint("%d", Quant_CMYK(components[3]));
CloseTag(&pXS);
#ifdef OUTPUT_SQL
sqlcomps[0] = Quant_CMYK(components[0]);
sqlcomps[1] = Quant_CMYK(components[1]);
sqlcomps[2] = Quant_CMYK(components[2]);
sqlcomps[3] = Quant_CMYK(components[3]);
#endif
break;
case COLOR_SPACE_Lab:
if (fread(components, 1, 3, pFile) != 3)
throw "Cannot read Lab components.";
OpenTag(&pXS, "lightness");
xmlprint("%d", Quant_Lab_L(components[0]));
CloseTag(&pXS);
OpenTag(&pXS, "a-chrominance");
xmlprint("%d", Quant_Lab_ab(components[1]));
CloseTag(&pXS);
OpenTag(&pXS, "b-chrominance");
xmlprint("%d", Quant_Lab_ab(components[2]));
CloseTag(&pXS);
#ifdef OUTPUT_SQL
sqlcomps[0] = Quant_Lab_L(components[0]);
sqlcomps[1] = Quant_Lab_ab(components[1]);
sqlcomps[2] = Quant_Lab_ab(components[2]);
sqlcomps[3] = 0;
#endif
break;
default:
throw "Unsupported color space.";
}
#ifdef OUTPUT_SQL
printf("UPDATE Colors SET Component1 = %d, Component2 = %d, Component3 = %d, Component4 = %d WHERE ColorCatalogID = $ccid AND Color = '%S';\n", sqlcomps[0], sqlcomps[1], sqlcomps[2], sqlcomps[3], s);
#endif
CloseTag(&pXS, true);
}
CloseTag(&pXS, true);
fprintf(stderr, "Done.\n");
}
catch (char *errstr)
{
fprintf(stderr, "ERROR: %s\n", errstr);
ret = false;
}
if (pFile)
fclose(pFile);
return ret;
}
int _tmain(int argc, _TCHAR* argv[])
{
fprintf(stderr, "ACB2XML v2.0 beta, 2007-05-08\n");
fprintf(stderr, "by Ates Goral\n");
fprintf(stderr, "http://magnetiq.com/\n\n");
if (argc > 1)
{
if (!ConvertACB(argv[1]))
fprintf(stderr, "Conversion error.\n");
}
else
{
fprintf(stderr, "Usage:\n acb2xml <acb filename>\n\n");
}
return 0;
}
| [
"[email protected]"
]
| [
[
[
1,
426
]
]
]
|
e5c5527420755823bd7016e88619cf7c0e20480f | 8f5d0d23e857e58ad88494806bc60c5c6e13f33d | /Models/cKeyFrameModel.cpp | 17f96032e1b7315fe5c9b4a64cd0cf9879b6844a | []
| no_license | markglenn/projectlife | edb14754118ec7b0f7d83bd4c92b2e13070dca4f | a6fd3502f2c2713a8a1a919659c775db5309f366 | refs/heads/master | 2021-01-01T15:31:30.087632 | 2011-01-30T16:03:41 | 2011-01-30T16:03:41 | 1,704,290 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 218 | cpp | #include "ckeyframemodel.h"
cKeyFrameModel::cKeyFrameModel(void)
{
m_t = 0;
m_currFrame = 0;
m_currVertex = 0;
}
cKeyFrameModel::~cKeyFrameModel(void)
{
if (m_currVertex)
delete[] m_currVertex;
}
| [
"[email protected]"
]
| [
[
[
1,
14
]
]
]
|
c687badcc3f1760cfe882511b2fe68df2304765a | 33f59b1ba6b12c2dd3080b24830331c37bba9fe2 | /Depend/Foundation/Intersection/Wm4Intersector1.cpp | eb593b31fd794d748895016a53785397d6794e3f | []
| no_license | daleaddink/flagship3d | 4835c223fe1b6429c12e325770c14679c42ae3c6 | 6cce5b1ff7e7a2d5d0df7aa0594a70d795c7979a | refs/heads/master | 2021-01-15T16:29:12.196094 | 2009-11-01T10:18:11 | 2009-11-01T10:18:11 | 37,734,654 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 9,104 | cpp | // Geometric Tools, Inc.
// http://www.geometrictools.com
// Copyright (c) 1998-2006. All Rights Reserved
//
// The Wild Magic Version 4 Foundation Library source code is supplied
// under the terms of the license agreement
// http://www.geometrictools.com/License/Wm4FoundationLicense.pdf
// and may not be copied or disclosed except in accordance with the terms
// of that agreement.
#include "Wm4FoundationPCH.h"
#include "Wm4Intersector1.h"
namespace Wm4
{
//----------------------------------------------------------------------------
template <class Real>
Intersector1<Real>::Intersector1 (Real fU0, Real fU1, Real fV0, Real fV1)
{
assert(fU0 <= fU1 && fV0 <= fV1);
m_afU[0] = fU0;
m_afU[1] = fU1;
m_afV[0] = fV0;
m_afV[1] = fV1;
m_fFirstTime = (Real)0.0;
m_fLastTime = (Real)0.0;
m_iQuantity = 0;
}
//----------------------------------------------------------------------------
template <class Real>
Intersector1<Real>::Intersector1 (Real afU[2], Real afV[2])
{
assert(afU[0] <= afU[1] && afV[0] <= afV[1]);
for (int i = 0; i < 2; i++)
{
m_afU[i] = afU[i];
m_afV[i] = afV[i];
}
m_fFirstTime = (Real)0.0;
m_fLastTime = (Real)0.0;
m_iQuantity = 0;
}
//----------------------------------------------------------------------------
template <class Real>
Intersector1<Real>::~Intersector1 ()
{
}
//----------------------------------------------------------------------------
template <class Real>
Real Intersector1<Real>::GetU (int i) const
{
assert(0 <= i && i < 2);
return m_afU[i];
}
//----------------------------------------------------------------------------
template <class Real>
Real Intersector1<Real>::GetV (int i) const
{
assert(0 <= i && i < 2);
return m_afV[i];
}
//----------------------------------------------------------------------------
template <class Real>
bool Intersector1<Real>::Test ()
{
return m_afU[0] <= m_afV[1] && m_afU[1] >= m_afV[0];
}
//----------------------------------------------------------------------------
template <class Real>
bool Intersector1<Real>::Find ()
{
if (m_afU[1] < m_afV[0] || m_afU[0] > m_afV[1])
{
m_iQuantity = 0;
}
else if (m_afU[1] > m_afV[0])
{
if (m_afU[0] < m_afV[1])
{
m_iQuantity = 2;
m_afOverlap[0] = (m_afU[0] < m_afV[0] ? m_afV[0] : m_afU[0]);
m_afOverlap[1] = (m_afU[1] > m_afV[1] ? m_afV[1] : m_afU[1]);
if (m_afOverlap[0] == m_afOverlap[1])
{
m_iQuantity = 1;
}
}
else // m_afU[0] == m_afV[1]
{
m_iQuantity = 1;
m_afOverlap[0] = m_afU[0];
}
}
else // m_afU[1] == m_afV[0]
{
m_iQuantity = 1;
m_afOverlap[0] = m_afU[1];
}
return m_iQuantity > 0;
}
//----------------------------------------------------------------------------
template <class Real>
bool Intersector1<Real>::Test (Real fTMax, Real fSpeedU, Real fSpeedV)
{
Real fDiffSpeed, fInvDiffSpeed, fDiffPos;
if (m_afU[1] < m_afV[0])
{
// [u0,u1] initially to the left of [v0,v1]
fDiffSpeed = fSpeedU - fSpeedV;
if (fDiffSpeed > (Real)0.0)
{
// the intervals must move towards each other
fDiffPos = m_afV[0] - m_afU[1];
if (fDiffPos <= fTMax*fDiffSpeed)
{
// the intervals intersect within the specified time
fInvDiffSpeed = ((Real)1.0)/fDiffSpeed;
m_fFirstTime = fDiffPos*fInvDiffSpeed;
m_fLastTime = (m_afV[1] - m_afU[0])*fInvDiffSpeed;
return true;
}
}
}
else if (m_afU[0] > m_afV[1])
{
// [u0,u1] initially to the right of [v0,v1]
fDiffSpeed = fSpeedV - fSpeedU;
if ( fDiffSpeed > (Real)0.0 )
{
// the intervals must move towards each other
fDiffPos = m_afU[0] - m_afV[1];
if (fDiffPos <= fTMax*fDiffSpeed)
{
// the intervals intersect within the specified time
fInvDiffSpeed = ((Real)1.0)/fDiffSpeed;
m_fFirstTime = fDiffPos*fInvDiffSpeed;
m_fLastTime = (m_afU[1] - m_afV[0])*fInvDiffSpeed;
return true;
}
}
}
else
{
// the intervals are initially intersecting
m_fFirstTime = 0.0f;
if (fSpeedV > fSpeedU)
{
m_fLastTime = (m_afU[1] - m_afV[0])/(fSpeedV - fSpeedU);
}
else if (fSpeedV < fSpeedU)
{
m_fLastTime = (m_afV[1] - m_afU[0])/(fSpeedU - fSpeedV);
}
else
{
m_fLastTime = Math<Real>::MAX_REAL;
}
return true;
}
return false;
}
//----------------------------------------------------------------------------
template <class Real>
bool Intersector1<Real>::Find (Real fTMax, Real fSpeedU, Real fSpeedV)
{
Real fDiffSpeed, fInvDiffSpeed, fDiffPos;
if (m_afU[1] < m_afV[0])
{
// [u0,u1] initially to the left of [v0,v1]
fDiffSpeed = fSpeedU - fSpeedV;
if (fDiffSpeed > (Real)0.0)
{
// the intervals must move towards each other
fDiffPos = m_afV[0] - m_afU[1];
if (fDiffPos <= fTMax*fDiffSpeed)
{
// the intervals intersect within the specified time
fInvDiffSpeed = ((Real)1.0)/fDiffSpeed;
m_fFirstTime = fDiffPos*fInvDiffSpeed;
m_fLastTime = (m_afV[1] - m_afU[0])*fInvDiffSpeed;
m_iQuantity = 1;
m_afOverlap[0] = m_afU[0] + m_fFirstTime*fSpeedU;
return true;
}
}
}
else if (m_afU[0] > m_afV[1])
{
// [u0,u1] initially to the right of [v0,v1]
fDiffSpeed = fSpeedV - fSpeedU;
if (fDiffSpeed > (Real)0.0)
{
// the intervals must move towards each other
fDiffPos = m_afU[0] - m_afV[1];
if (fDiffPos <= fTMax*fDiffSpeed)
{
// the intervals intersect within the specified time
fInvDiffSpeed = ((Real)1.0)/fDiffSpeed;
m_fFirstTime = fDiffPos*fInvDiffSpeed;
m_fLastTime = (m_afU[1] - m_afV[0])*fInvDiffSpeed;
m_iQuantity = 1;
m_afOverlap[0] = m_afV[1] + m_fFirstTime*fSpeedV;
return true;
}
}
}
else
{
// the intervals are initially intersecting
m_fFirstTime = 0.0f;
if (fSpeedV > fSpeedU)
{
m_fLastTime = (m_afU[1] - m_afV[0])/(fSpeedV - fSpeedU);
}
else if (fSpeedV < fSpeedU)
{
m_fLastTime = (m_afV[1] - m_afU[0])/(fSpeedU - fSpeedV);
}
else
{
m_fLastTime = Math<Real>::MAX_REAL;
}
if (m_afU[1] > m_afV[0])
{
if (m_afU[0] < m_afV[1])
{
m_iQuantity = 2;
m_afOverlap[0] = (m_afU[0] < m_afV[0] ? m_afV[0] : m_afU[0]);
m_afOverlap[1] = (m_afU[1] > m_afV[1] ? m_afV[1] : m_afU[1]);
}
else // m_afU[0] == m_afV[1]
{
m_iQuantity = 1;
m_afOverlap[0] = m_afU[0];
}
}
else // m_afU[1] == m_afV[0]
{
m_iQuantity = 1;
m_afOverlap[0] = m_afU[1];
}
return true;
}
m_iQuantity = 0;
return false;
}
//----------------------------------------------------------------------------
template <class Real>
Real Intersector1<Real>::GetFirstTime () const
{
return m_fFirstTime;
}
//----------------------------------------------------------------------------
template <class Real>
Real Intersector1<Real>::GetLastTime () const
{
return m_fLastTime;
}
//----------------------------------------------------------------------------
template <class Real>
int Intersector1<Real>::GetQuantity () const
{
return m_iQuantity;
}
//----------------------------------------------------------------------------
template <class Real>
Real Intersector1<Real>::GetOverlap (int i) const
{
assert(0 <= i && i < m_iQuantity);
return m_afOverlap[i];
}
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
// explicit instantiation
//----------------------------------------------------------------------------
template WM4_FOUNDATION_ITEM
class Intersector1<float>;
template WM4_FOUNDATION_ITEM
class Intersector1<double>;
//----------------------------------------------------------------------------
}
| [
"yf.flagship@e79fdf7c-a9d8-11de-b950-3d5b5f4ea0aa"
]
| [
[
[
1,
290
]
]
]
|
c2f824791392af74faf307bf524f1c9a98ef4200 | 03d1f3dd8c9284b93890648d65a1589276ef505f | /VisualSPH/Render/For_Color.cpp | 1e4bb769b497d21d01cae9e00782eeef8fab315b | []
| no_license | shadercoder/photonray | 18271358ca7f20a3c4a6326164d292774bfc3f53 | e0bbad33bc9c03e094036748f965100023aa0287 | refs/heads/master | 2021-01-10T04:20:14.592834 | 2011-05-07T21:09:43 | 2011-05-07T21:09:43 | 45,577,179 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,254 | cpp | #include "DXUT.h"
#include "For_Color.h"
int For_color::InitSpectr(char* filename)
{
FILE *input;
fopen_s(&input, filename,"r");
D3DXCOLOR first[10];
D3DXCOLOR last[10];
fscanf_s(input, "%d\n", &N);
int i = 0;
while ( i < N )
{
fscanf_s(input,"%f %f %f %f %f %f %f %f\n", &this->start[i], &this->end[i], &this->first->b, &this->first->g, &this->first->r, &this->last->b, &this->last->g, &this->last->r );
++i;
}
fclose(input);
return N;
}
D3DXCOLOR For_color::GetColor(const Particle* temp)
{
float conformity;
int i = 0;
for (; i < N; ++i)
{
if (temp->density >= start[i] && temp->density < end[i])
break;
}
D3DXCOLOR result = BLACK;
if (i == N)
{
if ( !(temp->density >= start[i] && temp->density < end[i]) )
{
return result;
}
}
conformity = (temp->density - start[i]) / (end[i] - start[i]);
result.b = first[i].b + ( last[i].b - first[i].b ) * conformity ;
result.g = first[i].g + ( last[i].g - first[i].g ) * conformity ;
result.r = first[i].r + ( last[i].r - first[i].r ) * conformity ;
result.a = 1.0f;
//std::cout<<result.b;
//std::cout<<'\t';
//std::cout<<result.g;
//std::cout<<'\t';
//std::cout<<result.r<<std::endl;
return result;
} | [
"[email protected]",
"IlyaKrukov@f2d442f5-4fb6-3e1e-f2a6-32ff9b5dcf3a",
"ilyakrukov@f2d442f5-4fb6-3e1e-f2a6-32ff9b5dcf3a"
]
| [
[
[
1,
6
],
[
9,
10
],
[
14,
14
],
[
16,
17
],
[
20,
21
],
[
23,
23
],
[
27,
27
],
[
29,
30
],
[
32,
34
],
[
36,
40
],
[
42,
44
],
[
51,
52
]
],
[
[
7,
8
],
[
11,
11
],
[
15,
15
],
[
19,
19
]
],
[
[
12,
13
],
[
18,
18
],
[
22,
22
],
[
24,
26
],
[
28,
28
],
[
31,
31
],
[
35,
35
],
[
41,
41
],
[
45,
50
]
]
]
|
e7051bf1bbbaf22a5f8be8762305d9b78388d9f7 | e7c45d18fa1e4285e5227e5984e07c47f8867d1d | /SMDK/Kenwalt/KW_SMDK1/ExampleTankDyn.cpp | 50a8140e4cd85f7e0993d762cfc2c6bd049ba019 | []
| no_license | abcweizhuo/Test3 | 0f3379e528a543c0d43aad09489b2444a2e0f86d | 128a4edcf9a93d36a45e5585b70dee75e4502db4 | refs/heads/master | 2021-01-17T01:59:39.357645 | 2008-08-20T00:00:29 | 2008-08-20T00:00:29 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,173 | cpp | //================== SysCAD - Copyright Kenwalt (Pty) Ltd ===================
// $Nokeywords: $
//===========================================================================
#include "stdafx.h"
#define __EXAMPLETANKDYN_CPP
#include "exampletankdyn.h"
//====================================================================================
//define connection ids for convenience
const int idIn = 0;
const int idOut = 1;
//define Input/Output connections
static MInOutDefStruct s_IODefs[]=
{
// Desc; Name; Id; Rqd; Max; CnId, FracHgt; Options;
{ "Input", "Input", idIn, 0, 10, 0, 1.0f, MIO_InOut|MIO_Material|MIO_PipeEntry|MIO_ApertureHoriz },
{ "Output", "Output", idOut, 0, 10, 0, 0.5f, MIO_InOut|MIO_Material|MIO_PipeEntry },
{ NULL },
};
//define default drawing symbol
static double TankDraw[] = { MDrw_Poly, -9,8, -7,-8, 7,-8, 9,8,
MDrw_End};
//---------------------------------------------------------------------------
//macro to declare and add the model to the system
DEFINE_SURGE_UNIT(Tank, "Tank", DLL_GroupName)
void Tank_UnitDef::GetOptions()
{
SetDefaultTag("TK", true);
SetDrawing("Tank", TankDraw);
SetTreeDescription("Demo:Tank");
SetDescription("Example Dynamic Tank");
SetModelSolveMode(MSolveMode_Probal|MSolveMode_DynamicFlow);
SetModelGroup(MGroup_General);
SetModelLicense(MLicense_Standard);
};
//---------------------------------------------------------------------------
Tank::Tank(MUnitDefBase * pUnitDef, TaggedObject * pNd) : MBaseMethod(pUnitDef, pNd)
{
//default values...
dFeedQm = 0.0;
dProdQm0 = 0.0;
dProdQm1 = 0.0;
}
//---------------------------------------------------------------------------
void Tank::Init()
{
SetIODefinition(s_IODefs);
}
//---------------------------------------------------------------------------
void Tank::BuildDataFields()
{
DD.Text("Requirements...");
DD.Text("");
DD.Text("Results...");
DD.Double("FeedQm", "", &dFeedQm, MF_RESULT|MF_NO_FILING, MC_Qm);
DD.Double("ProdQm0", "", &dProdQm0, MF_RESULT|MF_NO_FILING, MC_Qm);
DD.Double("ProdQm1", "", &dProdQm1, MF_RESULT|MF_NO_FILING, MC_Qm);
}
//---------------------------------------------------------------------------
bool Tank::PreStartCheck(CString & ErrMsg)
{
return true;
}
//---------------------------------------------------------------------------
void Tank::EvalProducts()
{
//get handles to input and output streams...
if (IsSolveDirect)
{
// Get Inputs
MStreamI QI;
FlwIOs.AddMixtureIn_Id(QI, idIn); //sum all inputs
// Total Estimated Out
double FT=0;
for (int o=FlwIOs.First_Out; o>=0; o=FlwIOs.Next_Out[o])
FT+=FlwIOs[o].EstFlwOut;
FT=GTZ(FT);
// Divide Inputs between Outputs
for (o=FlwIOs.First_Out; o>=0; o=FlwIOs.Next_Out[o])
{
MStream & QO = FlwIOs[o].Stream;
QO = QI;
QO *= FlwIOs[o].EstFlwOut/FT;
}
//get display values...
dFeedQm = QI.MassFlow(); //or dFeedQm = QI.getQm();
}
else
{
// Get Inputs
MStreamI QI;
FlwIOs.AddMixtureIn_Id(QI, idIn); //sum all inputs
// Total Estimated Out
double FT=0;
for (int o=FlwIOs.First_Out; o>=0; o=FlwIOs.Next_Out[o])
FT+=FlwIOs[o].EstFlwOut;
FT=GTZ(FT);
// Divide Inputs between Outputs
for (o=FlwIOs.First_Out; o>=0; o=FlwIOs.Next_Out[o])
{
MStream & QO = FlwIOs[o].Stream;
QO = QI;
QO *= FlwIOs[o].EstFlwOut/FT;
}
//get display values...
dFeedQm = QI.MassFlow(); //or dFeedQm = QI.getQm();
}
}
//---------------------------------------------------------------------------
void Tank::EvalDerivs(double StepSize)
{
};
//---------------------------------------------------------------------------
void Tank::EvalIntegral(double StepSize)
{
};
//====================================================================================
| [
"[email protected]",
"[email protected]"
]
| [
[
[
1,
9
],
[
14,
17
],
[
20,
22
],
[
43,
43
],
[
45,
65
],
[
69,
83
],
[
85,
86
],
[
89,
109
],
[
112,
144
]
],
[
[
10,
13
],
[
18,
19
],
[
23,
42
],
[
44,
44
],
[
66,
68
],
[
84,
84
],
[
87,
88
],
[
110,
111
]
]
]
|
7a565c7faacd8cc8c32d91b9ed35490cd66ea040 | e09dfcc817c731587fd756f7611aacb19b17018a | /inc/AnaLogDoc.h | 054fe9aa5f8438660912db19198ca3b87e1de977 | []
| no_license | jweitzen/analogqct | cb77f50f2682ee46325cafd738fcf1299d2710aa | 535bcf32fd615815d640b06c860cfec9acb7f983 | refs/heads/master | 2021-01-10T09:31:14.808743 | 2009-06-12T16:46:03 | 2009-06-12T16:46:03 | 50,674,838 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,798 | h | // AnaLogDoc.h : interface of the CAnaLogDoc class
//
/////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_ANALOGDOC_H__B79C8CCA_79AC_4520_A6B7_DB18DD203414__INCLUDED_)
#define AFX_ANALOGDOC_H__B79C8CCA_79AC_4520_A6B7_DB18DD203414__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define StringLength 1000
#define MAC_DIM 6
class CAnaLogDoc : public CDocument
{
protected: // create from serialization only
CAnaLogDoc();
DECLARE_DYNCREATE(CAnaLogDoc)
// Attributes
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAnaLogDoc)
public:
virtual BOOL OnNewDocument();
virtual void Serialize(CArchive& ar);
//}}AFX_VIRTUAL
// Implementation
public:
CString QCATVersion;
CString ShowConfirmMsg;
int FrameSplit;
CString FilterFolder;
CString PrefferedHTML;
CString Extension;
bool DisableProgram;
CString DayOfExpiry;
CTime Today;
CString ExecutablePath;
bool StartUp;
CString CurrentFilePathName;
virtual ~CAnaLogDoc();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
// Generated message map functions
protected:
//{{AFX_MSG(CAnaLogDoc)
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_ANALOGDOC_H__B79C8CCA_79AC_4520_A6B7_DB18DD203414__INCLUDED_)
| [
"giulio.inbox@6d061dfa-575b-11de-9a1b-6103e4980ab8"
]
| [
[
[
1,
72
]
]
]
|
50e9af260c120db4be9fe2393e814fc4b31dd3a2 | b411e4861bc1478147bfc289c868b961a6136ead | /tags/DownhillRacingMapCreator/Main.cpp | 7e88f9aac64105d644bbce96904ad304340102e8 | []
| no_license | mvm9289/downhill-racing | d05df2e12384d8012d5216bc0b976bc7df9ff345 | 038ec4875db17a7898282d6ced057d813a0243dc | refs/heads/master | 2021-01-20T12:20:31.383595 | 2010-12-19T23:29:02 | 2010-12-19T23:29:02 | 32,334,476 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,177 | cpp | #include <windows.h>
#include <gl\glut.h>
#include <iostream>
#include <vector>
#include "Point.h"
using namespace std;
bool finish = false;
vector<Point> input;
int wheigth = 600;
Point Bezier(Point p0, Point p1, Point p2, double t)
{
double t1 = 1 - t;
return (t1*t1*p0 + 2*t*t1*p1 + t*t*p2);
}
void computeBezier()
{
vector<Point> output;
for (int i = 0; i < input.size() - 2; i+=3)
{
for (double t = 0; t <= 1; t+=0.05)
output.push_back(Bezier(input[i], input[i + 1], input[i + 2], t));
}
input = output;
}
void saveMap()
{
for (int i = 0; i < input.size(); i++)
cout << input[i].x << " " << input[i].y << " ";
}
void AppRender()
{
glClear ( GL_COLOR_BUFFER_BIT );
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glColor3f(1, 0, 0);
glPointSize(5);
glBegin(GL_POINTS);
for (int i = 0; i < input.size(); i++)
glVertex2d(input[i].x, input[i].y);
glEnd();
if (input.size() > 1)
{
glColor3f(0, 0, 1);
glBegin(GL_LINES);
for (int i = 0; i < input.size() - 1; i++)
{
glVertex2d(input[i].x, input[i].y);
glVertex2d(input[i + 1].x, input[i + 1].y);
}
glEnd();
}
glutSwapBuffers();
}
void AppReshape(int width, int height)
{
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0, width, 0, height);
wheigth = height;
}
void AppKeyboardUp(unsigned char key, int x, int y)
{
if (key == 27) finish = true;
else if (key == 98) computeBezier();
else if (key == 115) saveMap();
}
void AppMouse(int button, int state, int x, int y)
{
if (button == GLUT_LEFT_BUTTON && state == GLUT_DOWN)
input.push_back(Point(x, wheigth-y));
}
void AppIdle()
{
if(finish) exit(0);
else AppRender();
}
void main(int argc, char** argv)
{
int res_x,res_y,pos_x,pos_y;
cerr << "Usage:" << endl;
cerr << "\t 1. Make a line like a saw in horizontal direction" << endl;
cerr << "\t 2. Define only maximums and minimums with three points" << endl;
cerr << "\t 3. Press B to make the curves" << endl;
cerr << "\t 4. Press S to save file" << endl;
cerr << "\t 5. File has been created on Map creator path with name map.txt" << endl;
cerr << "\t 6. Update map coordinates in one of level file with map.txt content" << endl;
cerr << "\t 7. You have created your own map!" << endl << endl;
// GLUT initialization
glutInit(&argc, argv);
// RGBA with double buffer
glutInitDisplayMode(GLUT_RGBA | GLUT_ALPHA | GLUT_DOUBLE);
// Create centered window
res_x = glutGet(GLUT_SCREEN_WIDTH);
res_y = glutGet(GLUT_SCREEN_HEIGHT);
pos_x = (res_x>>1)-(800>>1);
pos_y = (res_y>>1)-(600>>1);
glutInitWindowPosition(pos_x, pos_y);
glutInitWindowSize(800,600);
glutCreateWindow("DownhillRacing Map Creator!");
/*glutGameModeString("800x600:32");
glutEnterGameMode();*/
// Make the default cursor disappear
//glutSetCursor(GLUT_CURSOR_NONE);
// Register callback functions
glutDisplayFunc(AppRender);
glutReshapeFunc(AppReshape);
glutKeyboardUpFunc(AppKeyboardUp);
glutMouseFunc(AppMouse);
glutIdleFunc(AppIdle);
// Application loop
glutMainLoop();
}
| [
"mvm9289@06676c28-b993-0703-7cf1-698017e0e3c1"
]
| [
[
[
1,
132
]
]
]
|
35be3cd1d4fc84ae38f7456d015ccca6c2dec435 | cd0987589d3815de1dea8529a7705caac479e7e9 | /webkit/WebKit/gtk/webkit/webkitwebwindowfeatures.cpp | 495d7ee115b6377b8ccae8246e2ea32a0b00ccab | [
"BSD-2-Clause"
]
| permissive | azrul2202/WebKit-Smartphone | 0aab1ff641d74f15c0623f00c56806dbc9b59fc1 | 023d6fe819445369134dee793b69de36748e71d7 | refs/heads/master | 2021-01-15T09:24:31.288774 | 2011-07-11T11:12:44 | 2011-07-11T11:12:44 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 16,472 | cpp | /*
* Copyright (C) 2008 Gustavo Noronha Silva <[email protected]>
* Copyright (C) 2008 Holger Hans Peter Freyther
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include "config.h"
#include "WindowFeatures.h"
#include "webkitwebwindowfeatures.h"
#include "webkitprivate.h"
/**
* SECTION:webkitwebwindowfeatures
* @short_description: Window properties of a #WebKitWebView
* @see_also: #WebKitWebView::web-view-ready
*
* The content of a #WebKitWebView can request to change certain
* properties of a #WebKitWebView. This can include the x, y position
* of the window, the width and height but also if a toolbar,
* scrollbar, statusbar, locationbar should be visible to the user,
* the request to show the #WebKitWebView fullscreen.
*
* In the normal case one will use #webkit_web_view_get_window_features
* to get the #WebKitWebWindowFeatures and then monitor the property
* changes. Be aware that the #WebKitWebWindowFeatures might change
* change before #WebKitWebView::web-view-ready signal is emitted.
* To be safe listen to the notify::window-features signal of the #WebKitWebView
* and reconnect the signals whenever the #WebKitWebWindowFeatures of
* a #WebKitWebView changes.
*
* <informalexample><programlisting>
* /<!-- -->* Get the current WebKitWebWindowFeatures *<!-- -->/
* WebKitWebWindowFeatures *features = webkit_web_view_get_window_features (my_webview);
*
* /<!-- -->* Connect to the property changes *<!-- -->/
* g_signal_connect (G_OBJECT(features), "notify::menubar-visible", G_CALLBACK(make_menu_bar_visible), NULL);
* g_signal_connect (G_OBJECT(features), "notify::statusbar-visible", G_CALLBACK(make_status_bar_visible), NULL);
*
* </programlisting></informalexample>
*/
enum {
PROP_0,
PROP_X,
PROP_Y,
PROP_WIDTH,
PROP_HEIGHT,
PROP_TOOLBAR_VISIBLE,
PROP_STATUSBAR_VISIBLE,
PROP_SCROLLBAR_VISIBLE,
PROP_MENUBAR_VISIBLE,
PROP_LOCATIONBAR_VISIBLE,
PROP_FULLSCREEN,
};
G_DEFINE_TYPE(WebKitWebWindowFeatures, webkit_web_window_features, G_TYPE_OBJECT)
struct _WebKitWebWindowFeaturesPrivate {
gint x;
gint y;
gint width;
gint height;
gboolean toolbar_visible;
gboolean statusbar_visible;
gboolean scrollbar_visible;
gboolean menubar_visible;
gboolean locationbar_visible;
gboolean fullscreen;
};
#define WEBKIT_WEB_WINDOW_FEATURES_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), WEBKIT_TYPE_WEB_WINDOW_FEATURES, WebKitWebWindowFeaturesPrivate))
static void webkit_web_window_features_set_property(GObject* object, guint prop_id, const GValue* value, GParamSpec* pspec);
static void webkit_web_window_features_get_property(GObject* object, guint prop_id, GValue* value, GParamSpec* pspec);
static void webkit_web_window_features_class_init(WebKitWebWindowFeaturesClass* klass)
{
GObjectClass* gobject_class = G_OBJECT_CLASS(klass);
gobject_class->set_property = webkit_web_window_features_set_property;
gobject_class->get_property = webkit_web_window_features_get_property;
GParamFlags flags = (GParamFlags)(WEBKIT_PARAM_READWRITE | G_PARAM_CONSTRUCT);
webkit_init();
/**
* WebKitWebWindowFeatures:x:
*
* The starting x position of the window on the screen.
*
* Since: 1.0.3
*/
g_object_class_install_property(gobject_class,
PROP_X,
g_param_spec_int(
"x",
"x",
"The starting x position of the window on the screen.",
-1,
G_MAXINT,
-1,
flags));
/**
* WebKitWebWindowFeatures:y:
*
* The starting y position of the window on the screen.
*
* Since: 1.0.3
*/
g_object_class_install_property(gobject_class,
PROP_Y,
g_param_spec_int(
"y",
"y",
"The starting y position of the window on the screen.",
-1,
G_MAXINT,
-1,
flags));
/**
* WebKitWebWindowFeatures:width:
*
* The width of the window on the screen.
*
* Since: 1.0.3
*/
g_object_class_install_property(gobject_class,
PROP_WIDTH,
g_param_spec_int(
"width",
"Width",
"The width of the window on the screen.",
-1,
G_MAXINT,
-1,
flags));
/**
* WebKitWebWindowFeatures:height:
*
* The height of the window on the screen.
*
* Since: 1.0.3
*/
g_object_class_install_property(gobject_class,
PROP_HEIGHT,
g_param_spec_int(
"height",
"Height",
"The height of the window on the screen.",
-1,
G_MAXINT,
-1,
flags));
/**
* WebKitWebWindowFeatures:toolbar-visible:
*
* Controls whether the toolbar should be visible for the window.
*
* Since: 1.0.3
*/
g_object_class_install_property(gobject_class,
PROP_TOOLBAR_VISIBLE,
g_param_spec_boolean(
"toolbar-visible",
"Toolbar Visible",
"Controls whether the toolbar should be visible for the window.",
TRUE,
flags));
/**
* WebKitWebWindowFeatures:statusbar-visible:
*
* Controls whether the statusbar should be visible for the window.
*
* Since: 1.0.3
*/
g_object_class_install_property(gobject_class,
PROP_STATUSBAR_VISIBLE,
g_param_spec_boolean(
"statusbar-visible",
"Statusbar Visible",
"Controls whether the statusbar should be visible for the window.",
TRUE,
flags));
/**
* WebKitWebWindowFeatures:scrollbar-visible:
*
* Controls whether the scrollbars should be visible for the window.
*
* Since: 1.0.3
*/
g_object_class_install_property(gobject_class,
PROP_SCROLLBAR_VISIBLE,
g_param_spec_boolean(
"scrollbar-visible",
"Scrollbar Visible",
"Controls whether the scrollbars should be visible for the window.",
TRUE,
flags));
/**
* WebKitWebWindowFeatures:menubar-visible:
*
* Controls whether the menubar should be visible for the window.
*
* Since: 1.0.3
*/
g_object_class_install_property(gobject_class,
PROP_MENUBAR_VISIBLE,
g_param_spec_boolean(
"menubar-visible",
"Menubar Visible",
"Controls whether the menubar should be visible for the window.",
TRUE,
flags));
/**
* WebKitWebWindowFeatures:locationbar-visible:
*
* Controls whether the locationbar should be visible for the window.
*
* Since: 1.0.3
*/
g_object_class_install_property(gobject_class,
PROP_LOCATIONBAR_VISIBLE,
g_param_spec_boolean(
"locationbar-visible",
"Locationbar Visible",
"Controls whether the locationbar should be visible for the window.",
TRUE,
flags));
/**
* WebKitWebWindowFeatures:fullscreen:
*
* Controls whether window will be displayed fullscreen.
*
* Since: 1.0.3
*/
g_object_class_install_property(gobject_class,
PROP_FULLSCREEN,
g_param_spec_boolean(
"fullscreen",
"Fullscreen",
"Controls whether window will be displayed fullscreen.",
FALSE,
flags));
g_type_class_add_private(klass, sizeof(WebKitWebWindowFeaturesPrivate));
}
static void webkit_web_window_features_init(WebKitWebWindowFeatures* web_window_features)
{
web_window_features->priv = WEBKIT_WEB_WINDOW_FEATURES_GET_PRIVATE(web_window_features);
}
static void webkit_web_window_features_set_property(GObject* object, guint prop_id, const GValue* value, GParamSpec* pspec)
{
WebKitWebWindowFeatures* web_window_features = WEBKIT_WEB_WINDOW_FEATURES(object);
WebKitWebWindowFeaturesPrivate* priv = web_window_features->priv;
switch(prop_id) {
case PROP_X:
priv->x = g_value_get_int(value);
break;
case PROP_Y:
priv->y = g_value_get_int(value);
break;
case PROP_WIDTH:
priv->width = g_value_get_int(value);
break;
case PROP_HEIGHT:
priv->height = g_value_get_int(value);
break;
case PROP_TOOLBAR_VISIBLE:
priv->toolbar_visible = g_value_get_boolean(value);
break;
case PROP_STATUSBAR_VISIBLE:
priv->statusbar_visible = g_value_get_boolean(value);
break;
case PROP_SCROLLBAR_VISIBLE:
priv->scrollbar_visible = g_value_get_boolean(value);
break;
case PROP_MENUBAR_VISIBLE:
priv->menubar_visible = g_value_get_boolean(value);
break;
case PROP_LOCATIONBAR_VISIBLE:
priv->locationbar_visible = g_value_get_boolean(value);
break;
case PROP_FULLSCREEN:
priv->fullscreen = g_value_get_boolean(value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
break;
}
}
static void webkit_web_window_features_get_property(GObject* object, guint prop_id, GValue* value, GParamSpec* pspec)
{
WebKitWebWindowFeatures* web_window_features = WEBKIT_WEB_WINDOW_FEATURES(object);
WebKitWebWindowFeaturesPrivate* priv = web_window_features->priv;
switch (prop_id) {
case PROP_X:
g_value_set_int(value, priv->x);
break;
case PROP_Y:
g_value_set_int(value, priv->y);
break;
case PROP_WIDTH:
g_value_set_int(value, priv->width);
break;
case PROP_HEIGHT:
g_value_set_int(value, priv->height);
break;
case PROP_TOOLBAR_VISIBLE:
g_value_set_boolean(value, priv->toolbar_visible);
break;
case PROP_STATUSBAR_VISIBLE:
g_value_set_boolean(value, priv->statusbar_visible);
break;
case PROP_SCROLLBAR_VISIBLE:
g_value_set_boolean(value, priv->scrollbar_visible);
break;
case PROP_MENUBAR_VISIBLE:
g_value_set_boolean(value, priv->menubar_visible);
break;
case PROP_LOCATIONBAR_VISIBLE:
g_value_set_boolean(value, priv->locationbar_visible);
break;
case PROP_FULLSCREEN:
g_value_set_boolean(value, priv->fullscreen);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
break;
}
}
/**
* webkit_web_window_features_new:
*
* Creates a new #WebKitWebWindowFeatures instance with default values. It must
* be manually attached to a WebView.
*
* Returns: a new #WebKitWebWindowFeatures instance
*
* Since: 1.0.3
*/
WebKitWebWindowFeatures* webkit_web_window_features_new()
{
return WEBKIT_WEB_WINDOW_FEATURES(g_object_new(WEBKIT_TYPE_WEB_WINDOW_FEATURES, NULL));
}
// for internal use only
WebKitWebWindowFeatures* webkit_web_window_features_new_from_core_features(const WebCore::WindowFeatures& features)
{
WebKitWebWindowFeatures *webWindowFeatures = webkit_web_window_features_new();
if(features.xSet)
g_object_set(webWindowFeatures, "x", static_cast<int>(features.x), NULL);
if(features.ySet)
g_object_set(webWindowFeatures, "y", static_cast<int>(features.y), NULL);
if(features.widthSet)
g_object_set(webWindowFeatures, "width", static_cast<int>(features.width), NULL);
if(features.heightSet)
g_object_set(webWindowFeatures, "height", static_cast<int>(features.height), NULL);
g_object_set(webWindowFeatures,
"toolbar-visible", features.toolBarVisible,
"statusbar-visible", features.statusBarVisible,
"scrollbar-visible", features.scrollbarsVisible,
"menubar-visible", features.menuBarVisible,
"locationbar-visible", features.locationBarVisible,
"fullscreen", features.fullscreen,
NULL);
return webWindowFeatures;
}
/**
* webkit_web_window_features_equal:
* @features1: a #WebKitWebWindowFeatures instance
* @features2: another #WebKitWebWindowFeatures instance
*
* Decides if a #WebKitWebWindowFeatures instance equals another, as
* in has the same values.
*
* Returns: %TRUE if the instances have the same values, %FALSE
* otherwise
*
* Since: 1.0.3
*/
gboolean webkit_web_window_features_equal(WebKitWebWindowFeatures* features1, WebKitWebWindowFeatures* features2)
{
if (features1 == features2)
return TRUE;
if (!features1 || !features2)
return FALSE;
WebKitWebWindowFeaturesPrivate* priv1 = features1->priv;
WebKitWebWindowFeaturesPrivate* priv2 = features2->priv;
if ((priv1->x == priv2->x)
&& (priv1->y == priv2->y)
&& (priv1->width == priv2->width)
&& (priv1->height == priv2->height)
&& (priv1->toolbar_visible == priv2->toolbar_visible)
&& (priv1->statusbar_visible == priv2->statusbar_visible)
&& (priv1->scrollbar_visible == priv2->scrollbar_visible)
&& (priv1->menubar_visible == priv2->menubar_visible)
&& (priv1->locationbar_visible == priv2->locationbar_visible)
&& (priv1->fullscreen == priv2->fullscreen))
return TRUE;
return FALSE;
}
| [
"[email protected]"
]
| [
[
[
1,
445
]
]
]
|
3ae2b535ea2305f325e236a7eef2fe719f2bb5c9 | e2e49023f5a82922cb9b134e93ae926ed69675a1 | /tools/aoslcpp/source/aosl/box.cpp | 7d007a5cd2ef3795b7b4b7b4fba2d8520aa722eb | []
| no_license | invy/mjklaim-freewindows | c93c867e93f0e2fe1d33f207306c0b9538ac61d6 | 30de8e3dfcde4e81a57e9059dfaf54c98cc1135b | refs/heads/master | 2021-01-10T10:21:51.579762 | 2011-12-12T18:56:43 | 2011-12-12T18:56:43 | 54,794,395 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 7,653 | cpp | // Copyright (C) 2005-2010 Code Synthesis Tools CC
//
// This program was generated by CodeSynthesis XSD, an XML Schema
// to C++ data binding compiler, in the Proprietary License mode.
// You should have received a proprietary license from Code Synthesis
// Tools CC prior to generating this code. See the license text for
// conditions.
//
// Begin prologue.
//
#define AOSLCPP_SOURCE
//
// End prologue.
#include <xsd/cxx/pre.hxx>
#include "aosl/box.hpp"
#include <xsd/cxx/xml/dom/wildcard-source.hxx>
#include <xsd/cxx/xml/dom/parsing-source.hxx>
#include <xsd/cxx/tree/type-factory-map.hxx>
#include <xsd/cxx/tree/comparison-map.hxx>
namespace _xsd
{
static
const ::xsd::cxx::tree::type_factory_plate< 0, char >
type_factory_plate_init;
static
const ::xsd::cxx::tree::comparison_plate< 0, char >
comparison_plate_init;
}
namespace aosl
{
// Box
//
Box::
Box (const PositionType& position,
const SizeType& size,
const CenterType& center,
const OrientationType& orientation)
: ::xml_schema::Type (),
position_ (position, ::xml_schema::Flags (), this),
size_ (size, ::xml_schema::Flags (), this),
center_ (center, ::xml_schema::Flags (), this),
orientation_ (orientation, ::xml_schema::Flags (), this)
{
}
Box::
Box (::std::auto_ptr< PositionType >& position,
::std::auto_ptr< SizeType >& size,
::std::auto_ptr< CenterType >& center,
::std::auto_ptr< OrientationType >& orientation)
: ::xml_schema::Type (),
position_ (position, ::xml_schema::Flags (), this),
size_ (size, ::xml_schema::Flags (), this),
center_ (center, ::xml_schema::Flags (), this),
orientation_ (orientation, ::xml_schema::Flags (), this)
{
}
Box::
Box (const Box& x,
::xml_schema::Flags f,
::xml_schema::Container* c)
: ::xml_schema::Type (x, f, c),
position_ (x.position_, f, this),
size_ (x.size_, f, this),
center_ (x.center_, f, this),
orientation_ (x.orientation_, f, this)
{
}
Box::
Box (const ::xercesc::DOMElement& e,
::xml_schema::Flags f,
::xml_schema::Container* c)
: ::xml_schema::Type (e, f | ::xml_schema::Flags::base, c),
position_ (f, this),
size_ (f, this),
center_ (f, this),
orientation_ (f, this)
{
if ((f & ::xml_schema::Flags::base) == 0)
{
::xsd::cxx::xml::dom::parser< char > p (e, true, false);
this->parse (p, f);
}
}
void Box::
parse (::xsd::cxx::xml::dom::parser< char >& p,
::xml_schema::Flags f)
{
for (; p.more_elements (); p.next_element ())
{
const ::xercesc::DOMElement& i (p.cur_element ());
const ::xsd::cxx::xml::qualified_name< char > n (
::xsd::cxx::xml::dom::name< char > (i));
// position
//
if (n.name () == "position" && n.namespace_ () == "artofsequence.org/aosl/1.0")
{
::std::auto_ptr< PositionType > r (
PositionTraits::create (i, f, this));
if (!position_.present ())
{
this->position_.set (r);
continue;
}
}
// size
//
if (n.name () == "size" && n.namespace_ () == "artofsequence.org/aosl/1.0")
{
::std::auto_ptr< SizeType > r (
SizeTraits::create (i, f, this));
if (!size_.present ())
{
this->size_.set (r);
continue;
}
}
// center
//
if (n.name () == "center" && n.namespace_ () == "artofsequence.org/aosl/1.0")
{
::std::auto_ptr< CenterType > r (
CenterTraits::create (i, f, this));
if (!center_.present ())
{
this->center_.set (r);
continue;
}
}
// orientation
//
if (n.name () == "orientation" && n.namespace_ () == "artofsequence.org/aosl/1.0")
{
::std::auto_ptr< OrientationType > r (
OrientationTraits::create (i, f, this));
if (!orientation_.present ())
{
this->orientation_.set (r);
continue;
}
}
break;
}
if (!position_.present ())
{
throw ::xsd::cxx::tree::expected_element< char > (
"position",
"artofsequence.org/aosl/1.0");
}
if (!size_.present ())
{
throw ::xsd::cxx::tree::expected_element< char > (
"size",
"artofsequence.org/aosl/1.0");
}
if (!center_.present ())
{
throw ::xsd::cxx::tree::expected_element< char > (
"center",
"artofsequence.org/aosl/1.0");
}
if (!orientation_.present ())
{
throw ::xsd::cxx::tree::expected_element< char > (
"orientation",
"artofsequence.org/aosl/1.0");
}
}
Box* Box::
_clone (::xml_schema::Flags f,
::xml_schema::Container* c) const
{
return new class Box (*this, f, c);
}
Box::
~Box ()
{
}
bool
operator== (const Box& x, const Box& y)
{
if (!(x.position () == y.position ()))
return false;
if (!(x.size () == y.size ()))
return false;
if (!(x.center () == y.center ()))
return false;
if (!(x.orientation () == y.orientation ()))
return false;
return true;
}
bool
operator!= (const Box& x, const Box& y)
{
return !(x == y);
}
}
#include <ostream>
#include <xsd/cxx/tree/std-ostream-map.hxx>
namespace _xsd
{
static
const ::xsd::cxx::tree::std_ostream_plate< 0, char >
std_ostream_plate_init;
}
namespace aosl
{
::std::ostream&
operator<< (::std::ostream& o, const Box& i)
{
o << ::std::endl << "position: " << i.position ();
o << ::std::endl << "size: " << i.size ();
o << ::std::endl << "center: " << i.center ();
o << ::std::endl << "orientation: " << i.orientation ();
return o;
}
}
#include <istream>
#include <xsd/cxx/xml/sax/std-input-source.hxx>
#include <xsd/cxx/tree/error-handler.hxx>
namespace aosl
{
}
#include <ostream>
#include <xsd/cxx/tree/error-handler.hxx>
#include <xsd/cxx/xml/dom/serialization-source.hxx>
#include <xsd/cxx/tree/type-serializer-map.hxx>
namespace _xsd
{
static
const ::xsd::cxx::tree::type_serializer_plate< 0, char >
type_serializer_plate_init;
}
namespace aosl
{
void
operator<< (::xercesc::DOMElement& e, const Box& i)
{
e << static_cast< const ::xml_schema::Type& > (i);
// position
//
{
::xercesc::DOMElement& s (
::xsd::cxx::xml::dom::create_element (
"position",
"artofsequence.org/aosl/1.0",
e));
s << i.position ();
}
// size
//
{
::xercesc::DOMElement& s (
::xsd::cxx::xml::dom::create_element (
"size",
"artofsequence.org/aosl/1.0",
e));
s << i.size ();
}
// center
//
{
::xercesc::DOMElement& s (
::xsd::cxx::xml::dom::create_element (
"center",
"artofsequence.org/aosl/1.0",
e));
s << i.center ();
}
// orientation
//
{
::xercesc::DOMElement& s (
::xsd::cxx::xml::dom::create_element (
"orientation",
"artofsequence.org/aosl/1.0",
e));
s << i.orientation ();
}
}
}
#include <xsd/cxx/post.hxx>
// Begin epilogue.
//
//
// End epilogue.
| [
"klaim@localhost"
]
| [
[
[
1,
344
]
]
]
|
7191d619e917203fe6fd9ef29a11567e66277da6 | bc9e5f6ea5f873951814e4da5c06c329e661f59b | /server/socket.cpp | 0824ed305a1909d13513b7213d6fd168f456117d | []
| no_license | maxnovak/hfoss-retrieve | 4a0bfbeb7a8e46ba78bb01e2870291707f97d867 | 23dba87e987592a557bf187f94639668e288a3e7 | refs/heads/master | 2020-04-05T23:03:51.463978 | 2011-07-28T19:43:13 | 2011-07-28T19:43:13 | 33,632,700 | 0 | 0 | null | null | null | null | WINDOWS-1250 | C++ | false | false | 5,838 | cpp | /*
Socket.cpp
Copyright (C) 2002-2004 René Nyffenegger
This source code is provided 'as-is', without any express or implied
warranty. In no event will the author be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this source code must not be misrepresented; you must not
claim that you wrote the original source code. If you use this source code
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original source code.
3. This notice may not be removed or altered from any source distribution.
René Nyffenegger [email protected]
*/
#include <iostream>
#include <errno.h>
#include "Socket.h"
using namespace std;
int Socket::nofSockets_= 0;
void Socket::Start() {
if (!nofSockets_) {
WSADATA info;
if (WSAStartup(MAKEWORD(2,0), &info)) {
throw "Could not start WSA";
}
}
++nofSockets_;
}
void Socket::End() {
WSACleanup();
}
Socket::Socket() : s_(0) {
Start();
// UDP: use SOCK_DGRAM instead of SOCK_STREAM
s_ = socket(AF_INET,SOCK_STREAM,0);
if (s_ == INVALID_SOCKET) {
throw "INVALID_SOCKET";
}
refCounter_ = new int(1);
}
Socket::Socket(SOCKET s) : s_(s) {
Start();
refCounter_ = new int(1);
};
Socket::~Socket() {
if (! --(*refCounter_)) {
Close();
delete refCounter_;
}
--nofSockets_;
if (!nofSockets_) End();
}
Socket::Socket(const Socket& o) {
refCounter_=o.refCounter_;
(*refCounter_)++;
s_ =o.s_;
nofSockets_++;
}
Socket& Socket::operator =(Socket& o) {
(*o.refCounter_)++;
refCounter_=o.refCounter_;
s_ =o.s_;
nofSockets_++;
return *this;
}
void Socket::Close() {
closesocket(s_);
}
/*std::string Socket::ReceiveBytes() {
std::string ret;
char buf[1024];
for ( ; ; ) {
u_long arg = 0;
if (ioctlsocket(s_, FIONREAD, &arg) != 0)
break;
if (arg == 0)
break;
if (arg > 1024)
arg = 1024;
int rv = recv (s_, buf, arg, 0);
if (rv <= 0)
break;
std::string t;
t.assign (buf, rv);
ret += t;
}
return ret;
}*/
int Socket::ReceiveBytes(char * buf, int max_bytes) {
std::string ret;
int total_bytes = 0;
for ( ; ; ) {
u_long arg = 0;
if (ioctlsocket(s_, FIONREAD, &arg) != 0)
break;
if (arg == 0)
break;
if (arg > 1024)
arg = 1024;
int rv = recv (s_, &buf[total_bytes], max_bytes, 0);
if (rv <= 0)
break;
total_bytes += rv;
if (total_bytes >= max_bytes)
break;
}
return total_bytes;
}
std::string Socket::ReceiveLine() {
std::string ret;
while (1) {
char r;
switch(recv(s_, &r, 1, 0)) {
case 0: // not connected anymore;
return "";
case -1:
if (errno == EAGAIN) {
return ret;
} else {
// not connected anymore*/
return "";
}
}
ret += r;
if (r == '\n') return ret;
}
}
void Socket::SendLine(std::string s) {
s += '\n';
send(s_,s.c_str(),s.length(),0);
}
void Socket::SendBytes(const std::string& s) {
send(s_,s.c_str(),s.length(),0);
}
SocketServer::SocketServer(int port, int connections, TypeSocket type) {
sockaddr_in sa;
memset(&sa, 0, sizeof(sa));
sa.sin_family = PF_INET;
sa.sin_port = htons(port);
s_ = socket(AF_INET, SOCK_STREAM, 0);
if (s_ == INVALID_SOCKET) {
throw "INVALID_SOCKET";
}
if(type==NonBlockingSocket) {
u_long arg = 1;
ioctlsocket(s_, FIONBIO, &arg);
}
/* bind the socket to the internet address */
if (bind(s_, (sockaddr *)&sa, sizeof(sockaddr_in)) == SOCKET_ERROR) {
closesocket(s_);
throw "INVALID_SOCKET";
}
listen(s_, connections);
}
Socket* SocketServer::Accept() {
SOCKET new_sock = accept(s_, 0, 0);
if (new_sock == INVALID_SOCKET) {
int rc = WSAGetLastError();
if(rc==WSAEWOULDBLOCK) {
return 0; // non-blocking call, no request pending
}
else {
throw "Invalid Socket";
}
}
Socket* r = new Socket(new_sock);
return r;
}
SocketClient::SocketClient(const std::string& host, int port) : Socket() {
std::string error;
hostent *he;
if ((he = gethostbyname(host.c_str())) == 0) {
error = strerror(errno);
throw error;
}
sockaddr_in addr;
addr.sin_family = AF_INET;
addr.sin_port = htons(port);
addr.sin_addr = *((in_addr *)he->h_addr);
memset(&(addr.sin_zero), 0, 8);
if (::connect(s_, (sockaddr *) &addr, sizeof(sockaddr))) {
error = strerror(WSAGetLastError());
throw error;
}
}
SocketSelect::SocketSelect(Socket const * const s1, Socket const * const s2, TypeSocket type) {
FD_ZERO(&fds_);
FD_SET(const_cast<Socket*>(s1)->s_,&fds_);
if(s2) {
FD_SET(const_cast<Socket*>(s2)->s_,&fds_);
}
TIMEVAL tval;
tval.tv_sec = 0;
tval.tv_usec = 1;
TIMEVAL *ptval;
if(type==NonBlockingSocket) {
ptval = &tval;
}
else {
ptval = 0;
}
if (select (0, &fds_, (fd_set*) 0, (fd_set*) 0, ptval)
== SOCKET_ERROR) throw "Error in select";
}
bool SocketSelect::Readable(Socket const * const s) {
if (FD_ISSET(s->s_,&fds_)) return true;
return false;
}
| [
"[email protected]"
]
| [
[
[
1,
278
]
]
]
|
944d453603bedb7947c5e2a6bafa7d72b42ba443 | 12ea67a9bd20cbeed3ed839e036187e3d5437504 | /tpl/codemodel/src/CodeParameter.cpp | efa1caaa6bd98227d4a4a183028d76860692e78b | []
| no_license | cnsuhao/winxgui | e0025edec44b9c93e13a6c2884692da3773f9103 | 348bb48994f56bf55e96e040d561ec25642d0e46 | refs/heads/master | 2021-05-28T21:33:54.407837 | 2008-09-13T19:43:38 | 2008-09-13T19:43:38 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 212 | cpp | // src\CodeParameter.cpp : Implementation of CCodeParameter
#include "stdafx.h"
#include "CodeParameter.h"
/////////////////////////////////////////////////////////////////////////////
// CCodeParameter
| [
"xushiweizh@86f14454-5125-0410-a45d-e989635d7e98"
]
| [
[
[
1,
7
]
]
]
|
b0173133996a264c01e8c7f3a39f3fb66b63fcb4 | 0dbad0e8b4c67526d985d2e57a714132e8faeb36 | /src/Tiles.cpp | ba5bb579b04a195dd76348c1cef59d6a2eb89578 | []
| no_license | kenjasi75202/libegl | 272834ab37bf77d46adeee95ee988019626cbf7d | b266a89036e7b4f3bdbaedba2fea41155020ec33 | refs/heads/master | 2021-01-10T08:52:15.146443 | 2009-06-26T13:43:02 | 2009-06-26T13:43:02 | 45,255,022 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 697 | cpp | #include <iostream>
#include <string>
#include <sstream>
#include "engcomp_glib.h"
using namespace std;
#include "TileEngine.h"
Tiles::Tiles(void)
{
inOpen = false;
inClosed = false;
cost = 0;
}
Tiles::~Tiles(void)
{
}
void Tiles::setTile(int num_tile, int largura, int altura)
{
sprite = num_tile;
lar = largura;
alt = altura;
}
void Tiles::setWalk(bool bw)
{
walkable = bw;
}
void Tiles::setInfo(int inf)
{
info = inf;
}
int Tiles::getInfo()
{
return info;
}
bool Tiles::getWalk()
{
return walkable;
}
int Tiles::getTileN()
{
return sprite;
}
int Tiles::getX()
{
return posx;
}
int Tiles::getY()
{
return posy;
} | [
"farleih@38162229-2249-0410-8976-db8ea7608f86"
]
| [
[
[
1,
60
]
]
]
|
4a82600cb9938fcf515543e8d0fe80620bc3be8b | cd69369374074a7b4c4f42e970ee95847558e9f0 | /Versao FIX/Exame.h | e4bf56b8d9a50161ba586e387933bf7f3de3f4f6 | []
| no_license | miaosun/aeda-trab1 | 4e6b8ce3de8bb7e85e13670595012a5977258a2a | 1ec5e2edec383572c452545ed52e45fb26df6097 | refs/heads/master | 2021-01-25T03:40:21.146657 | 2010-12-25T03:35:28 | 2010-12-25T03:35:28 | 33,734,306 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 810 | h | ///////////////////////////////////////////////////////////
// Exame.h
// Implementation of the Class Exame
// Created on: 24-Out-2010 20:04:10
// Original author: Answer
///////////////////////////////////////////////////////////
#if !defined(EA_C770FA25_5477_45dd_BD95_171CA4C42559__INCLUDED_)
#define EA_C770FA25_5477_45dd_BD95_171CA4C42559__INCLUDED_
#include "Marcacao.h"
class Exame : public Marcacao
{
public:
Exame();
virtual ~Exame();
Exame(string data, string hora, string tipo, Pessoa * medico, Pessoa * doente, string sala);
string getSala();
void setSala(string sala);
string toString();
vector<string> imprime();
vector<string> editMarcacao();
private:
string sala;
};
#endif // !defined(EA_C770FA25_5477_45dd_BD95_171CA4C42559__INCLUDED_)
| [
"gasparlafurtado@9ca0f86a-2074-76d8-43a5-19cf18205b40",
"miaosun88@9ca0f86a-2074-76d8-43a5-19cf18205b40"
]
| [
[
[
1,
19
],
[
21,
31
]
],
[
[
20,
20
]
]
]
|
ede1e1a365903e0e9b4865658de2c601da59fd23 | 36d0ddb69764f39c440089ecebd10d7df14f75f3 | /プログラム/Game/Object/GameScene/AI/NormalAI.cpp | 127b4872293f6476ab0b2c4cbcd8749621fe375d | []
| no_license | weimingtom/tanuki-mo-issyo | 3f57518b4e59f684db642bf064a30fc5cc4715b3 | ab57362f3228354179927f58b14fa76b3d334472 | refs/heads/master | 2021-01-10T01:36:32.162752 | 2009-04-19T10:37:37 | 2009-04-19T10:37:37 | 48,733,344 | 0 | 0 | null | null | null | null | SHIFT_JIS | C++ | false | false | 1,914 | cpp | /*******************************************************************************/
/*
* @file NormalAI.cpp.
*
* @brief com.ノーマルクラス定義.
*
* @date 2009/04/17.
*
* @version 1.00.
*
* @author Thubasa Uragami.
*/
/*******************************************************************************/
/*===== インクルード ==========================================================*/
#include "Object/GameScene/AI/NormalAI.h"
#include "Object/GameScene/Player.h"
#include "Define/GameDefine.h"
#include "IGameDevice.h"
/*=============================================================================*/
/**
* @brief コンストラクタ.
*
*/
NormalAI::NormalAI(IGameDevice &device, Player &player, KeyInfo &keyinfo):m_device(device), m_player(player), m_keyinfo(keyinfo)
{
}
/*=============================================================================*/
/**
* @brief デストラクタ.
*
*/
NormalAI::~NormalAI()
{
}
/*=============================================================================*/
/**
* @brief .
*
*/
void NormalAI::Update(float frameTimer)
{
if(m_player.GetAI().GetIsThinking()==true)
{
FieldMatrix* field;
bool findBlock = false;
m_player.GetPuzzleScreen().GetBlockManager().GetField().GetFieldBlockMatrix(field);
for(int i=1; i<FIELD_WIDTH; i++)
{
if(field->matrix[i][FIELD_HEIGHT-2]!=0)
{
findBlock = true;
break;
}
}
if(findBlock==false)
{
m_player.GetAI().SetTargetAngle(Random.randi(0,3));
int i=1,j=FIELD_WIDTH-2;
if(m_player.GetAI().GetTargetAngle() == 1)
{
j--;
}
if(m_player.GetAI().GetTargetAngle() == 3)
{
i++;
}
m_player.GetAI().SetTargetPosition(Random.randi(i,j));
m_player.GetAI().SetIsThinking(false);
}
}
else
{
}
}
/*===== EOF ===================================================================*/
| [
"rs.drip@aa49b5b2-a402-11dd-98aa-2b35b7097d33"
]
| [
[
[
1,
81
]
]
]
|
d1e3338a20d1a5d9fd8aaa1951bd0fe610fd6e9b | 6dac9369d44799e368d866638433fbd17873dcf7 | /src/branches/01032005/include/maths/Quaternion.h | f39dc09aa8600203597afb6c4535441bd5c36533 | []
| no_license | christhomas/fusionengine | 286b33f2c6a7df785398ffbe7eea1c367e512b8d | 95422685027bb19986ba64c612049faa5899690e | refs/heads/master | 2020-04-05T22:52:07.491706 | 2006-10-24T11:21:28 | 2006-10-24T11:21:28 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,488 | h | #ifndef _QUATERNION_H_
#define _QUATERNION_H_
#if defined (WIN32)
#pragma warning (disable:4244) // disable conversion warnings (dbl -> fl)
#endif
namespace Maths{
#define M(x, y) m_matrix[ x + y * 4 ] // Accessing a matrix element
/** @ingroup Maths_Helper_Group
* @brief Class to deal with Quaternions and their manipulation
*/
class Quaternion{
protected:
/** @var float m_matrix[16]
* @brief An array of floats representing a matrix for the quaternion
*/
float m_matrix[16];
/** @var float m_x
* @brief The X component of the quaternion */
float m_x;
/** @var float m_y
* @brief The Y Component of the quaternion */
float m_y;
/** @var float m_z
* @brief The Z Component of the quaternion */
float m_z;
/** @var float m_w
* @brief The W component of the quaternion */
float m_w;
public:
Quaternion ();
Quaternion (Quaternion &q);
Quaternion (float a, float x, float y, float z);
~Quaternion ();
void LoadIdentity (void);
void Rotate (float a, float x, float y, float z);
void Rotate (float x, float y, float z);
void Normalise (void);
float * GetMatrix (void);
void GetMatrix (float **matrix);
Quaternion & operator = (const Quaternion &q);
Quaternion operator * (const Quaternion &q) const;
Quaternion & operator *= (Quaternion &q);
};
}; // namespace Maths
#endif // #ifndef _QUATERNION_H_
| [
"chris_a_thomas@1bf15c89-c11e-0410-aefd-b6ca7aeaabe7"
]
| [
[
[
1,
55
]
]
]
|
d946cc5cd8ef6902c72f7bc150335e6bbfd39ac3 | 55720ae980772088614509c3ede9a5d88069366c | /hoge.cpp | a9cce6363d0ce68e5af998c4776457c97388f04f | []
| no_license | imagire/TDDBC1.6CPP | 86cdbd7f9a9da75d5bcc8ddea435aff23f90d1b0 | 627628fa39afc379e9ce85b951250e2060f80f6e | refs/heads/master | 2020-05-30T15:07:19.775763 | 2011-07-31T07:50:09 | 2011-07-31T07:50:09 | 2,130,922 | 0 | 0 | null | null | null | null | SHIFT_JIS | C++ | false | false | 4,682 | cpp | #include <gtest/gtest.h>
typedef struct {
int key;
int value;
} KeyValue;
class CKeyValue{
private:
int m_count;
KeyValue* values;
public:
CKeyValue():m_count(0){
values = NULL;
}
~CKeyValue() {
if(values != NULL)
delete[] (values);
}
KeyValue *find(int key){
for(int i = 0; i < m_count; i++){
if(values[i].key == key) return &values[i];
}
return NULL;
}
void put(int key, int value) {
// すでにkeyが存在していたら、追加しないで、valueを上書き
KeyValue *p = find(key);
if(NULL != p){
p->value = value;
return;
}
KeyValue* tmp;
tmp = new KeyValue[m_count+1];
memcpy(tmp, values, sizeof(KeyValue)*m_count);
delete[] (values);
values = tmp;
values[m_count].key = key;
values[m_count].value = value;
m_count++;
}
void puts(const KeyValue* v, int n) {
for(int i=0; i < n; i++){
put((v+i)->key, (v+i)->value);
}
}
int get(int key) {
KeyValue *p = find(key);
return (p == NULL) ? -1 : p->value;
}
int remove(int key){
for(int i = 0; i < m_count; i++){
if(values[i].key == key){
values[i].key = values[m_count-1].key;
values[i].value = values[m_count-1].value;
m_count--;
return 0;
}
}
return -1;
}
int dump(const KeyValue* &v) {
v = reinterpret_cast<const KeyValue*>(&values[0]);
return count();
}
int count() {
return m_count;
}
};
TEST(GetValue, ValueNotSet)
{
CKeyValue kv;
EXPECT_EQ(-1, kv.get(2));
}
TEST(GetValue, key2)
{
CKeyValue kv;
kv.put(2,2);
EXPECT_EQ(2, kv.get(2));
}
TEST(GetValue, key3)
{
CKeyValue kv;
kv.put(2,3);
kv.put(3,4);
EXPECT_EQ(3, kv.get(2));
EXPECT_EQ(4, kv.get(3));
}
TEST(put, Override)
{
CKeyValue kv;
kv.put(1,2);
kv.put(1,1);
EXPECT_EQ(1, kv.get(1));
}
TEST(put, CountInOverride)
{
CKeyValue kv;
kv.put(1,2);
kv.put(1,1);
EXPECT_EQ(1, kv.count());
}
TEST(put, OverrideAfterOtherKeys)
{
CKeyValue kv;
kv.put(1,2);
kv.put(2,3);
kv.put(4,5);
kv.put(6,7);
kv.put(1,8);
EXPECT_EQ(8, kv.get(1));
EXPECT_EQ(3, kv.get(2));
EXPECT_EQ(5, kv.get(4));
EXPECT_EQ(7, kv.get(6));
}
TEST(puts, Simple)
{
CKeyValue kv;
KeyValue v[]={
{1,2},
{3,4}
};
kv.puts(v, 2);
EXPECT_EQ(2, kv.count());
EXPECT_EQ(2, kv.get(1));
EXPECT_EQ(4, kv.get(3));
}
TEST(puts, DuplicatedKey)
{
CKeyValue kv;
KeyValue v[]={
{1,2},
{1,4}
};
kv.puts(v, 2);
EXPECT_EQ(1, kv.count());
EXPECT_EQ(4, kv.get(1));
}
TEST(puts, OverWrite)
{
CKeyValue kv;
KeyValue v[]={
{1,2},
{3,4},
{1,4}
};
kv.put(1, 1);
kv.puts(v, 3);
EXPECT_EQ(2, kv.count());
EXPECT_EQ(4, kv.get(1));
}
TEST(puts, SetNull)
{
CKeyValue kv;
kv.puts(NULL, 0);
EXPECT_EQ(0, kv.count());
}
TEST(find, NotPut)
{
CKeyValue kv;
EXPECT_EQ(NULL, kv.find(0));
}
TEST(find, Simple)
{
CKeyValue kv;
kv.put(1, 2);
KeyValue *p = kv.find(1);
EXPECT_EQ(1, p->key);
EXPECT_EQ(2, p->value);
}
TEST(Dump, DumpCount)
{
CKeyValue kv;
int n;
const KeyValue *v;
n = kv.dump(v);
EXPECT_EQ(0, n);
kv.put(2,3);
kv.put(3,4);
n = kv.dump(v);
EXPECT_EQ(2, n);
}
TEST(Dump, DumpValue)
{
CKeyValue kv;
kv.put(2,3);
kv.put(3,4);
int n;
const KeyValue *v;
n = kv.dump(v);
int n2 = 0;
int n3 = 0;
for(int i = 0; i < n; i++){
if(v[i].key == 2){ EXPECT_EQ(3, v[i].value);n2++;}
if(v[i].key == 3){ EXPECT_EQ(4, v[i].value);n3++;}
}
EXPECT_EQ(1, n2);
EXPECT_EQ(1, n3);
}
TEST(Delete, SimpleDelete)
{
CKeyValue kv;
kv.put(1,2);
int ret = kv.remove(1);
EXPECT_EQ(0, ret);
}
TEST(Delete, NotExist)
{
CKeyValue kv;
kv.put(1,2);
int ret0 = kv.remove(0);
ASSERT_NE(0, ret0);
}
TEST(GetCount, NotSet) {
int ret;
CKeyValue kv;
ret = kv.count();
EXPECT_EQ(0, ret);
}
TEST(GetCount, SimpleReturn) {
int ret;
CKeyValue kv;
kv.put(1,2);
ret = kv.count();
EXPECT_EQ(1, ret);
}
TEST(Delete, DeleteDeletedKey)
{
CKeyValue kv;
int ret0;
kv.put(1,2);
ret0 = kv.remove(1);
EXPECT_EQ(0, ret0);
ret0 = kv.remove(1);
ASSERT_NE(0, ret0);
}
TEST(Delete, MultipleItem)
{
CKeyValue kv;
kv.put(1,2);
kv.put(2,4);
int ret;
ret = kv.remove(1);
EXPECT_EQ(0, ret);
ret = kv.remove(2);
EXPECT_EQ(0, ret);
EXPECT_EQ(0, kv.count());
}
int main(int argc, char* argv[])
{
::testing::InitGoogleTest(&argc, argv);
int ret = RUN_ALL_TESTS();
return ret;
}
| [
"[email protected]",
"[email protected]"
]
| [
[
[
1,
2
],
[
12,
13
],
[
24,
30
],
[
32,
38
],
[
58,
58
],
[
60,
60
],
[
63,
63
],
[
65,
65
],
[
69,
75
],
[
85,
85
],
[
96,
96
],
[
100,
101
],
[
104,
104
],
[
110,
118
],
[
120,
128
],
[
130,
141
],
[
146,
147
],
[
208,
211
],
[
213,
223
],
[
225,
226
],
[
228,
228
],
[
265,
266
],
[
279,
285
],
[
287,
287
],
[
296,
297
],
[
312,
314
],
[
317,
318
],
[
322,
323
],
[
330,
330
],
[
338,
338
],
[
343,
355
]
],
[
[
3,
11
],
[
14,
23
],
[
31,
31
],
[
39,
57
],
[
59,
59
],
[
61,
62
],
[
64,
64
],
[
66,
68
],
[
76,
84
],
[
86,
95
],
[
97,
99
],
[
102,
103
],
[
105,
109
],
[
119,
119
],
[
129,
129
],
[
142,
145
],
[
148,
207
],
[
212,
212
],
[
224,
224
],
[
227,
227
],
[
229,
264
],
[
267,
278
],
[
286,
286
],
[
288,
295
],
[
298,
311
],
[
315,
316
],
[
319,
321
],
[
324,
329
],
[
331,
337
],
[
339,
342
]
]
]
|
e73fea4e7bb066151ccf14323c69df5c859771f4 | f7d8a85f9d0c1956d64efbe96d056e338b0e0641 | /Src/LanguageManager.h | a64e683cbf290f2cef3fd115d9188f7ad6bc4449 | []
| no_license | thennequin/dlfm | 6183dfeb485f860396573eda125fd61dcd497660 | 0b122e7042ec3b48660722e2b41ef0a0551a70a9 | refs/heads/master | 2020-04-11T03:53:12.856319 | 2008-07-06T10:17:29 | 2008-07-06T10:17:29 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,640 | h | #include "Config.h"
#ifndef _LANGUAGEMANAGER_
#define _LANGUAGEMANAGER_
#define LAGNUAGEMANAGERVAR _Language_
#define DECLARE_SETUP_LOC void SetupLocalisationCaption();
#define BEGIN_SETUP_LOC extern LanguageManager *LAGNUAGEMANAGERVAR = new LanguageManager(); \
void LanguageManager::SetupLocalisationCaption() { Values.Clear();
#define ADD_CAPTION(Name,Default) Values.Add(new ValueSlot(Name,Default,false));
#define END_SETUP_LOC }
#define SETLANGUAGE(Language) (LAGNUAGEMANAGERVAR!=NULL ? LAGNUAGEMANAGERVAR->LoadLanguage(Language) :;)
#define GETLOCALISATION(Value) (LAGNUAGEMANAGERVAR!=NULL ? LAGNUAGEMANAGERVAR->GetValue(Value) : "")
#define GETLANGUAGEAVAILABLE (LAGNUAGEMANAGERVAR!=NULL ? LAGNUAGEMANAGERVAR->AvailableLanguage() : wxArrayString())
#define ADDDOWNLOAD GETLOCALISATION("AddDownload")
#define STARTDOWNLOAD GETLOCALISATION("StartDownload")
#define STOPDOWNLOAD GETLOCALISATION("StopDownload")
#define DELETEDOWNLOAD GETLOCALISATION("DeleteDownload")
#define FILENAME GETLOCALISATION("Filename")
#define SIZE GETLOCALISATION("Size")
#define DOWNLOADED GETLOCALISATION("Downloaded")
#define STATUS GETLOCALISATION("Status")
#define SPEED GETLOCALISATION("Speed")
#define TIMEREMAINING GETLOCALISATION("TimeRemaining")
#define DOWNLOADSLIST GETLOCALISATION("DownloadsList")
class LanguageManager
{
public:
LanguageManager::LanguageManager();
wxArrayString AvailableLanguage();
bool LoadLanguage(wxString Language);
wxString GetValue(wxString Name);
DECLARE_SETUP_LOC
private:
wxArrayValueSlot Values;
};
extern LanguageManager *LAGNUAGEMANAGERVAR;
#endif | [
"CameleonTH@0c2b0ced-2a4c-0410-b056-e1a948518b24"
]
| [
[
[
1,
48
]
]
]
|
8c0a012906ad67c83122d41ab3e3b5f273442d6d | 3fb88529ec63d45506d159bee677695698e690ee | /rrdinfo.cpp | abd5b52eb025be4e42478d42a6f9a654fbe599c2 | []
| no_license | cristifalcas/qt-rrd | 588f1d51555b146590dd84d969052123700a5217 | 249c1cb702020bcfe79465381053430e9e6f4e80 | refs/heads/master | 2021-01-14T13:20:53.669503 | 2009-11-12T22:16:08 | 2009-11-12T22:16:08 | 34,001,301 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 9,069 | cpp | #include "rrdinfo.h"
#define RELATIVE_HEARTBEAT 3
RRDInfo *RRDInfo::m_instance = 0;
//normal, 10 minutes. 1 hour, 12 hours, 1 day, weekly
const unsigned int nr_rra = 6;
RRDInfo::RRDInfo()
{
MY_DEBUG;
rra = new typeRRA[nr_rra];
datasource = NULL;
datasourcesize = 0;
overwritedb = false;
stringDatabasePath = stringDirCurrent + "/database";
period["minute"] = spMinute;
period["minutes"] = spMinute;
period["hour"] = spHour;
period["hours"] = spHour;
period["day"] = spDay;
period["days"] = spDay;
period["week"] = spWeek;
period["weeks"] = spWeek;
period["month"] = spMonth;
period["months"] = spMonth;
period["year"] = spYear;
period["years"] = spYear;
}
void RRDInfo::setRRAXFileFactor(double val)
{
MY_DEBUG;
rra[0].xfilefactor = val;
}
void RRDInfo::setRRASteps(quint64 val)
{
MY_DEBUG;
rra[0].steps = val;
}
void RRDInfo::setDatabasePath(QString val)
{
MY_DEBUG;
if ( val != stringDatabasePath ){
stringDatabasePath = val;
overwritedb = false;
}
}
void RRDInfo::setRRAConsolidationFunction(QString val)
{
MY_DEBUG;
for ( unsigned int i = 0; i < nr_rra; i++){
rra[i].consolidationfunction = val.toUpper();
}
}
void RRDInfo::printInfo(QString dsname)
{
MY_DEBUG;
for (unsigned int i=0;i<datasourcesize;i++){
if ( datasource[i].name == dsname || dsname.isEmpty() ){
MY_WARN << "DataSource name" << datasource[i].name;
MY_WARN << "\tHeartBeat" << datasource[i].heartbeat;
//MY_WARN << "\tMax" << datasource[i].max;
//MY_WARN << "\tMin" << datasource[i].min;
MY_WARN << "\tType" << datasource[i].type;
// QMap<quint64, double>::const_iterator it = datasource[i].values.constBegin();
// while (it != datasource[i].values.constEnd()) {
// MY_WARN << "\t\t" << it.key() << ": " << it.value();
// ++it;
// }
}
}
}
void RRDInfo::setDSValues(QString dsname, quint64 time, double value)
{
//MY_DEBUG;
mutex.lock();
for (unsigned int i=0;i<datasourcesize;i++){
if ( datasource[i].name == dsname ){
datasource[i].values.insert(time,value);
}
}
mutex.unlock();
}
/*
in map we have datasource name (somekey, somevalue)
*/
void RRDInfo::setDataFromStatsConfig(const QMap<QString,QMap<QString,QString> > data)
{
MY_DEBUG;
//keep rra, because it will only be updated from config widgets and only re-do datasource
if ( !datasource ){
delete datasource;
}
int i = 0;
datasource = new typeDS[data.count()];
QMapIterator<QString, QMap<QString, QString> > it(data);
while ( it.hasNext() ){
it.next();
datasource[i].name = it.key();
datasource[i].type = it.value().value(stringStatsKeys[xDATASOURCETYPE]).toUpper();
datasource[i].heartbeat = it.value().value(stringStatsKeys[xINTERVAL]).toInt() * RELATIVE_HEARTBEAT;
datasource[i].min = 'U';
datasource[i].max = 'U';
i++;
}
datasourcesize = i;
createRRA();
}
void RRDInfo::clear(int nr)
{
MY_DEBUG;
mutex.lock();
if ( nr < 0 ){
for (unsigned int i=0;i<datasourcesize;i++){
datasource[i].values.clear();
}
}else if ( nr < (int)datasourcesize ){
datasource[nr].values.clear();
}else{
MY_WARN << "Can't delete datasource" << QString::number(nr) <<
"because we have only" << QString::number(datasourcesize-1) << "datasources.";
}
mutex.unlock();
}
bool RRDInfo::isEmptyValues()
{
MY_DEBUG;
bool ret = true;
for (unsigned int i=0;i<datasourcesize;i++){
if ( !datasource[i].values.isEmpty() ){
ret = false;
break;
}
}
return ret;
}
quint64 RRDInfo::getDBStep()
{
MY_DEBUG;
quint64 max = 1;
for (unsigned int i=0;i<datasourcesize;i++){
if ( datasource[i].heartbeat > max ){
max = datasource[i].heartbeat;
}
}
return max / RELATIVE_HEARTBEAT;
}
const QString RRDInfo::getDatabasePath()
{
MY_DEBUG;
return stringDatabasePath;
}
quint64 RRDInfo::getMinTime()
{
MY_DEBUG;
quint64 min = MAX_QUINT64;
for (unsigned int i=0;i<datasourcesize;i++){
if ( datasource[i].values.begin().key() < min ){
min = datasource[i].values.begin().key();
}
}
return min;
}
quint64 RRDInfo::getDatasourcesNumber()
{
MY_DEBUG;
return datasourcesize;
}
const typeDS RRDInfo::getDatasource(unsigned int i)
{
//MY_DEBUG;
if ( i > datasourcesize ){
typeDS invalid;
invalid.heartbeat=0;
invalid.name="";
invalid.type="invalid";
invalid.values[-1]=-1;
return invalid;
}else{
return datasource[i];
}
}
/*
we have 3 times that matter:
- step from database: Specifies the base interval in seconds with which data will be fed into the RRD.
- heartbeat from datasource : defines the maximum number of seconds that may pass between two updates
of this data source before the value of the data source is assumed to be *UNKNOWN*
- steps from rra (NUMBER): defines how many of these primary data points are used to build a consolidated data point
which then goes into the archive.
*/
void RRDInfo::createRRA()
{
MY_DEBUG;
int dbstep = getDBStep();
int x = 0, y = 0;
//every x time for y period
//formula for step after first rra: transform the x time in seconds and divide by db step
//formula for rows: transform the y period in seconds and divide by x time in seconds
//those should be already set
// rra[0].consolidationfunction = ;
// rra[0].steps = ;
// rra[0].xfilefactor = ;
//we build 1 point from STEPS values, each every STEP
//STEP is max of interval
//STEPS will come from the rrd widget
//ex: interval is 5, step will be 5, steps is 2: we keep 1 point every 10s, we will have 267840 rows
//every interval for 3 months
x = rra[0].steps * dbstep;
y = timeinseconds(3, "months");
rra[0].rows = (int)(y/x);
//after this, we presume each pdp is exact and correct
//we set fxx minimum
//we set steps for the period we need
//cf is the same for all
//ex: we have STEP=5, so we need to average 600/STEP points = 120, we will have (10min*6)hours * 24*31*6 rows
//every 5 min for 6 months
x = timeinseconds(5, "minutes");
y = timeinseconds(6,"months");
rra[1].steps = (int)(x/dbstep);
rra[1].rows = (int)(y/x);
rra[1].xfilefactor = 0.2;
//15 minutes for 1 year
x = timeinseconds(15, "minutes");
y = timeinseconds(1,"year");
rra[2].steps = (int)(x/dbstep);
rra[2].rows = (int)(y/x);
rra[2].xfilefactor = 0.1;
//30 minutes for 2 years
x = timeinseconds(30,"minutes");
y = timeinseconds(2,"years");
rra[3].steps = (int)(x/dbstep);
rra[3].rows = (int)(y/x);
rra[3].xfilefactor = 0.01;
//1 hour for 5 years
x = timeinseconds(1, "hour");
y = timeinseconds(5, "years");
rra[4].steps = (int)(x/dbstep);
rra[4].rows = (int)(y/x);
rra[4].xfilefactor = 0.01;
//4 hours for 10 years
x = timeinseconds(4, "hours");
y = timeinseconds(10, "years");
rra[5].steps = (int)(x/dbstep);
rra[5].rows = (int)(y/x);
rra[5].xfilefactor = 0.01;
}
int RRDInfo::timeinseconds(int nr, QString time)
{
int minute = 60;
int hour = 60 * minute;
int day = 24 * hour;
int week = 7 * day;
int month = 31 * day;
int year = 12 * month;
switch (period.value(time)){
case spMinute:
return nr * minute;
break;
case spHour:
return nr * hour;
break;
case spDay:
return nr * day;
break;
case spWeek:
return nr * week;
break;
case spMonth:
return nr * month;
break;
case spYear:
return nr * year;
break;
default:
return 0;
break;
}
}
const typeRRA RRDInfo::getRRA(unsigned int i)
{
MY_DEBUG;
if ( i > nr_rra ){
typeRRA invalid;
invalid.consolidationfunction="invalid";
invalid.xfilefactor=100;
invalid.rows=-1;
invalid.steps=-1;
return invalid;
}else{
return rra[i];
}
}
quint64 RRDInfo::getRRAsNumber()
{
MY_DEBUG;
return nr_rra;
}
void RRDInfo::setDatabaseOverwrite(bool val)
{
MY_DEBUG;
overwritedb = val;
}
bool RRDInfo::isOverwrite()
{
MY_DEBUG;
return overwritedb;
}
| [
"[email protected]"
]
| [
[
[
1,
365
]
]
]
|
8486100400dcbcac3f619d32f7fb1fbae4f01ded | 3643bb671f78a0669c8e08935476551a297ce996 | /W_Sector_Render.cpp | 72a61ff76d59c08e7466c02630bbd64f8610d9aa | []
| no_license | mattfischer/3dportal | 44b3b9fb2331650fc406596b941f6228f37ff14b | e00f7d601138f5cf72aac35f4d15bdf230c518d9 | refs/heads/master | 2020-12-25T10:36:51.991814 | 2010-08-29T22:53:06 | 2010-08-29T22:53:06 | 65,869,788 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,753 | cpp | #include "W_Sector.h"
#include "W_Surface.h"
#include "W_Thing.h"
#include "R_Frame.h"
#include "R_Model.h"
#include "JK_Flags.h"
#include "JK_Level.h"
#include <gl/gl.h>
#include <gl/glu.h>
extern bool updateThings;
extern bool drawThings;
namespace World
{
void Sector::Draw( Render::Frustum frustum, Surface *ignore )
{
int i;
Render::Frustum newFrustum;
Poly clipped;
Math::Plane plane;
shared_ptr<Thing> thing;
if( drawing ) return;
drawing = true;
for( i = 0 ; i < numSurfaces ; i++ )
{
if( ignore != NULL && surfaces[i] == ignore ) continue;
plane = surfaces[i]->GetPoly().GetPlane();
if( (plane.point - currentLevel.player->GetEyePosition() ) * plane.normal > 0) continue;
if( surfaces[i]->Adjoined() )
{
if( renderAdjoins && surfaces[i]->GetAdjoinFlags() & JK_ADJOIN_RENDER_PAST )
{
clipped = surfaces[i]->GetPoly();
clipped.Clip( frustum );
if( clipped.NumVertices() == 0 ) continue;
newFrustum = clipped.CreateFrustum();
if( newFrustum.x0 >= newFrustum.x1 || newFrustum.y0 >= newFrustum.y1 )
continue;
surfaces[i]->GetAdjoin()->Draw( newFrustum, surfaces[i]->GetMirror() );
}
surfaces[i]->Draw( tint, extraLight );
}
else
surfaces[i]->Draw( tint, extraLight );
}
drawing = false;
if( drawThings )
{
if( things.size() > 0 )
{
for( i = 0 ; i < things.size() ; i++ )
{
things[i]->Draw( frustum, extraLight + ambientLight, tint );
}
}
}
}
} | [
"devnull@localhost"
]
| [
[
[
1,
73
]
]
]
|
f43a2f8fe8f0b427520040558cd2cd1f1bb41073 | c2a70374051ef8f96105d65c84023d97c90f4806 | /bin/src/loadBmp/common/Filter/plfilterresizebilinear.cpp | 59c0c823a8d6a008a5a76fecf152ccfa6bb93706 | []
| no_license | haselab-net/SpringheadOne | dcf6f10cb1144b17790a782f519ae25cbe522bb2 | 004335b64ec7bea748ae65a85463c0e85b98edbd | refs/heads/master | 2023-08-04T20:27:17.158435 | 2006-04-15T16:49:35 | 2006-04-15T16:49:35 | 407,701,182 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,403 | cpp | /*
/--------------------------------------------------------------------
|
| $Id: plfilterresizebilinear.cpp,v 1.9 2004/06/15 10:26:13 uzadow Exp $
|
| Copyright (c) 1996-2002 Ulrich von Zadow
|
\--------------------------------------------------------------------
*/
#include "plstdpch.h"
#include "plfilterresizebilinear.h"
#include "pl2passscale.h"
#include "plbitmap.h"
PLFilterResizeBilinear::PLFilterResizeBilinear (int NewXSize, int NewYSize)
: PLFilterResize (NewXSize, NewYSize)
{
}
void PLFilterResizeBilinear::Apply(PLBmpBase * pBmpSource, PLBmp * pBmpDest) const
{
PLASSERT(pBmpSource->GetBitsPerPixel()==32);
// Create a new Bitmap
pBmpDest->Create(m_NewXSize,
m_NewYSize,
pBmpSource->GetBitsPerPixel(),
pBmpSource->HasAlpha(),
pBmpSource->IsGreyscale(),
NULL, 0,
pBmpSource->GetResolution());
// Create a Filter Class from template
PLBilinearContribDef f(0.64);
C2PassScale <CDataRGBA_UBYTE> sS(f);
sS.Scale ((CDataRGBA_UBYTE::_RowType *) pBmpSource->GetLineArray(),
pBmpSource->GetWidth(),
pBmpSource->GetHeight(),
(CDataRGBA_UBYTE::_RowType *) pBmpDest->GetLineArray(),
pBmpDest->GetWidth(),
pBmpDest->GetHeight());
}
/*
/--------------------------------------------------------------------
|
| $Log: /Project/Springhead/bin/src/loadBmp/common/Filter/plfilterresizebilinear.cpp $
*
* 1 04/07/12 13:34 Hase
| Revision 1.9 2004/06/15 10:26:13 uzadow
| Initial nonfunctioning version of plbmpbase.
|
| Revision 1.8 2003/11/05 15:17:26 artcom
| Added ability to specify initial data in PLBitmap::Create()
|
| Revision 1.7 2002/08/04 20:08:01 uzadow
| Added PLBmpInfo class, ability to extract metainformation from images without loading the whole image and proper greyscale support.
|
| Revision 1.6 2002/03/31 13:36:42 uzadow
| Updated copyright.
|
| Revision 1.5 2001/10/16 17:12:27 uzadow
| Added support for resolution information (Luca Piergentili)
|
| Revision 1.4 2001/10/03 14:00:29 uzadow
| Much improved quality in FilterResizeBilinear.
|
| Revision 1.3 2001/09/30 16:57:25 uzadow
| Improved speed of 2passfilter.h, code readability changes.
|
| Revision 1.2 2001/09/16 20:57:17 uzadow
| Linux version name prefix changes
|
| Revision 1.1 2001/09/16 19:03:23 uzadow
| Added global name prefix PL, changed most filenames.
|
| Revision 1.5 2001/01/15 15:05:31 uzadow
| Added PLBmp::ApplyFilter() and PLBmp::CreateFilteredCopy()
|
| Revision 1.4 2000/01/16 20:43:15 anonymous
| Removed MFC dependencies
|
| Revision 1.3 1999/12/08 16:31:40 Ulrich von Zadow
| Unix compatibility
|
| Revision 1.2 1999/12/08 15:39:46 Ulrich von Zadow
| Unix compatibility changes
|
| Revision 1.1 1999/10/21 16:05:18 Ulrich von Zadow
| Moved filters to separate directory. Added Crop, Grayscale and
| GetAlpha filters.
|
| Revision 1.1 1999/10/19 21:29:45 Ulrich von Zadow
| Added filters.
|
|
\--------------------------------------------------------------------
*/
| [
"jumius@05cee5c3-a2e9-0310-9523-9dfc2f93dbe1"
]
| [
[
[
1,
100
]
]
]
|
82f45df4818a9f1469c41afe8679341a73316b7a | a36d7a42310a8351aa0d427fe38b4c6eece305ea | /core_billiard/MouseEventListenerNull.hpp | 5f819a64d2790d32397417c81457e28ee36a5662 | []
| no_license | newpolaris/mybilliard01 | ca92888373c97606033c16c84a423de54146386a | dc3b21c63b5bfc762d6b1741b550021b347432e8 | refs/heads/master | 2020-04-21T06:08:04.412207 | 2009-09-21T15:18:27 | 2009-09-21T15:18:27 | 39,947,400 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 354 | hpp | #pragma once
namespace my_render {
NULL_OBJECT( MouseEventListener ) {
virtual void onMouseEvent(
int xPos,
int yPos,
bool bLeftButton,
bool bRightButton,
bool bMiddleButton,
bool bSideButton1,
bool bSideButton2,
int nMouseWheelDelta ) OVERRIDE
{}
};
}
| [
"wrice127@af801a76-7f76-11de-8b9f-9be6f49bd635"
]
| [
[
[
1,
20
]
]
]
|
489ee397d45f49d41bc32f65d0ebe9b7496f7b00 | b822313f0e48cf146b4ebc6e4548b9ad9da9a78e | /KylinSdk/Core/Source/NpcObject.h | ae09f13627859bf98343619d58fbd085bfd18b9e | []
| no_license | dzw/kylin001v | 5cca7318301931bbb9ede9a06a24a6adfe5a8d48 | 6cec2ed2e44cea42957301ec5013d264be03ea3e | refs/heads/master | 2021-01-10T12:27:26.074650 | 2011-05-30T07:11:36 | 2011-05-30T07:11:36 | 46,501,473 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 634 | h | #pragma once
#include "AI.h"
#include "Character.h"
namespace Kylin
{
class NpcObject : public Character
{
public:
BtDeclareRTTI
Declare_Event_Handler(NpcObject, Character)
Declare_Entity_Creator(NpcObject)
NpcObject();
virtual KBOOL Init(const PropertySet& kProp);
virtual KVOID Tick(KFLOAT fElapsed);
virtual KVOID PostSpawn();
virtual KVOID PostDestroy();
public:
BaseAI* GetAIHandler();
KVOID SetAIHandler(BaseAI* pAI);
KUINT GetMasterWorldID();
KVOID SetMaster(const Character* pChar);
protected:
BaseAI* m_pAIHandler;
KUINT m_uMasterID;
};
}
| [
"[email protected]",
"apayaccount@5fe9e158-c84b-58b7-3744-914c3a81fc4f"
]
| [
[
[
1,
26
],
[
30,
32
],
[
34,
36
]
],
[
[
27,
29
],
[
33,
33
]
]
]
|
768fd3f5c5e1e4b45e5dee543b2ca8c0eaa1019c | 1c9f99b2b2e3835038aba7ec0abc3a228e24a558 | /Projects/elastix/elastix_sources_v4/src/Components/ImageSamplers/RandomSparseMask/elxRandomSamplerSparseMask.cxx | be9d152c8e81b7af21e8eb4f3d2ad48f2ba8b301 | []
| no_license | mijc/Diploma | 95fa1b04801ba9afb6493b24b53383d0fbd00b33 | bae131ed74f1b344b219c0ffe0fffcd90306aeb8 | refs/heads/master | 2021-01-18T13:57:42.223466 | 2011-02-15T14:19:49 | 2011-02-15T14:19:49 | 1,369,569 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 666 | cxx | /*======================================================================
This file is part of the elastix software.
Copyright (c) University Medical Center Utrecht. All rights reserved.
See src/CopyrightElastix.txt or http://elastix.isi.uu.nl/legal.php for
details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
======================================================================*/
#include "elxRandomSamplerSparseMask.h"
elxInstallMacro( RandomSamplerSparseMask );
| [
"[email protected]"
]
| [
[
[
1,
18
]
]
]
|
a61cfadf66ff8debc81f1c2cee8264330935beee | ef25bd96604141839b178a2db2c008c7da20c535 | /src/src/CrockRising/Levels/LevelVictory.h | 7d9d1816a30660fb8f0098fd81837bf469cf5101 | []
| no_license | OtterOrder/crock-rising | fddd471971477c397e783dc6dd1a81efb5dc852c | 543dc542bb313e1f5e34866bd58985775acf375a | refs/heads/master | 2020-12-24T14:57:06.743092 | 2009-07-15T17:15:24 | 2009-07-15T17:15:24 | 32,115,272 | 0 | 0 | null | null | null | null | WINDOWS-1252 | C++ | false | false | 872 | h | #ifndef _LevelVictory_H_
#define _LevelVictory_H_
//******************************************************************
#include <Game/Level.h>
#include <Core/Math.h>
//******************************************************************
#define LEVEL_victory 0x70bb005a
//******************************************************************
class Camera;
class Sprite;
class LevelVictory : public Level
{
public:
LevelVictory ( crc32 levelID ); // Constructeur
virtual ~LevelVictory ( void ); // Destructeur
virtual void Init ( void ); // Initialisation
virtual void Update ( void ); // Update du niveau
protected:
Sprite *m_pLogo; // Logo à la fraise
float m_LogoTimer;
Camera *m_pCamera;
};
//******************************************************************
#endif //_LevelVictory_H_
| [
"mathieu.chabanon@7c6770cc-a6a4-11dd-91bf-632da8b6e10b",
"berenger.mantoue@7c6770cc-a6a4-11dd-91bf-632da8b6e10b"
]
| [
[
[
1,
6
],
[
8,
15
],
[
17,
30
],
[
33,
38
]
],
[
[
7,
7
],
[
16,
16
],
[
31,
32
]
]
]
|
ff65fdcbe8e66177138d40e85f644f4da17927b0 | df238aa31eb8c74e2c208188109813272472beec | /BCGInclude/BCGPPropList.h | 6e980d2564147a52bd4766b2c0a16cf76c8bd46a | []
| no_license | myme5261314/plugin-system | d3166f36972c73f74768faae00ac9b6e0d58d862 | be490acba46c7f0d561adc373acd840201c0570c | refs/heads/master | 2020-03-29T20:00:01.155206 | 2011-06-27T15:23:30 | 2011-06-27T15:23:30 | 39,724,191 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 27,046 | h | #if !defined(AFX_BCGPPROPLIST_H__F6054FED_0317_4829_B7BF_4EBBDC27DF01__INCLUDED_)
#define AFX_BCGPPROPLIST_H__F6054FED_0317_4829_B7BF_4EBBDC27DF01__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
//*******************************************************************************
// COPYRIGHT NOTES
// ---------------
// This is a part of the BCGControlBar Library
// Copyright (C) 1998-2008 BCGSoft Ltd.
// All rights reserved.
//
// This source code can be used, distributed or modified
// only under terms and conditions
// of the accompanying license agreement.
//*******************************************************************************
//
// BCGPPropList.h : header file
//
#ifndef __AFXTEMPL_H__
#include "afxtempl.h"
#endif
#include "comdef.h"
#include "BCGCBPro.h"
#ifndef BCGP_EXCLUDE_PROP_LIST
#include "BCGGlobals.h"
#ifndef _BCGPGRID_STANDALONE
#include "ColorPopup.h"
#include "BCGPHeaderCtrl.h"
#include "BCGPDateTimeCtrl.h"
#define PROP_HEADER_CTRL_CLASS CBCGPHeaderCtrl
#else
#define PROP_HEADER_CTRL_CLASS CHeaderCtrl
#endif
#include "BCGPInplaceToolTipCtrl.h"
#include "BCGPScrollBar.h"
/////////////////////////////////////////////////////////////////////////////
// CBCGPProp object
class BCGCBPRODLLEXPORT CBCGPProp : public CObject
{
DECLARE_DYNAMIC(CBCGPProp)
friend class CBCGPPropList;
// Construction
public:
// Group constructor
CBCGPProp(const CString& strGroupName, DWORD_PTR dwData = 0,
BOOL bIsValueList = FALSE);
// Simple property
CBCGPProp(const CString& strName, const _variant_t& varValue,
LPCTSTR lpszDescr = NULL, DWORD_PTR dwData = 0,
LPCTSTR lpszEditMask = NULL, LPCTSTR lpszEditTemplate = NULL,
LPCTSTR lpszValidChars = NULL);
virtual ~CBCGPProp();
enum ClickArea
{
ClickExpandBox,
ClickName,
ClickValue,
ClickDescription
};
// Operations:
public:
int GetExpandedSubItems (BOOL bIncludeHidden = TRUE) const;
BOOL AddSubItem (CBCGPProp* pProp);
BOOL RemoveSubItem (CBCGPProp*& pProp, BOOL bDelete = TRUE);
BOOL AddOption (LPCTSTR lpszOption, BOOL bInsertUnique = TRUE);
void RemoveAllOptions ();
int GetOptionCount () const;
LPCTSTR GetOption (int nIndex) const;
CBCGPProp* HitTest (CPoint point, CBCGPProp::ClickArea* pnArea = NULL);
void Expand (BOOL bExpand = TRUE);
void Redraw ();
void EnableSpinControl (BOOL bEnable = TRUE, int nMin = 0, int nMax = 0);
virtual void ResetOriginalValue ();
virtual void CommitModifiedValue ();
void Show (BOOL bShow = TRUE, BOOL bAdjustLayout = TRUE);
protected:
void Init ();
void SetFlags ();
void SetOwnerList (CBCGPPropList* pWndList);
void Repos (int& y);
void AddTerminalProp (CList<CBCGPProp*, CBCGPProp*>& lstProps);
BOOL IsSubItem (CBCGPProp* pProp) const;
CBCGPProp* FindSubItemByData (DWORD_PTR dwData) const;
void ExpandDeep (BOOL bExpand = TRUE);
void SetModifiedFlag ();
// Overrides
public:
virtual void OnDrawName (CDC* pDC, CRect rect);
virtual void OnDrawValue (CDC* pDC, CRect rect);
virtual void OnDrawExpandBox (CDC* pDC, CRect rectExpand);
virtual void OnDrawButton (CDC* pDC, CRect rectButton);
virtual void OnDrawDescription (CDC* pDC, CRect rect);
virtual CString FormatProperty ();
virtual BOOL OnUpdateValue ();
virtual BOOL OnEdit (LPPOINT lptClick);
virtual CWnd* CreateInPlaceEdit (CRect rectEdit, BOOL& bDefaultFormat);
virtual CSpinButtonCtrl* CreateSpinControl (CRect rectSpin);
virtual BOOL OnEndEdit ();
virtual void OnClickButton (CPoint point);
virtual BOOL OnClickValue (UINT uiMsg, CPoint point);
virtual BOOL OnDblClick (CPoint point);
virtual void OnSelectCombo ();
virtual void OnCloseCombo();
virtual BOOL OnSetCursor () const;
virtual BOOL PushChar (UINT nChar);
virtual CString GetNameTooltip ();
virtual CString GetValueTooltip ();
virtual void OnClickName (CPoint /*point*/) {}
virtual void OnRClickName (CPoint /*point*/) {}
virtual void OnRClickValue (CPoint /*point*/, BOOL /*bSelChanged*/) {}
virtual void OnPosSizeChanged (CRect /*rectOld*/) {}
virtual void OnSetSelection (CBCGPProp* /*pOldSel*/) {}
virtual void OnKillSelection (CBCGPProp* /*pNewSel*/) {}
virtual void AdjustButtonRect ();
virtual void AdjustInPlaceEditRect (CRect& rectEdit, CRect& rectSpin);
virtual BOOL SetACCData (CWnd* pParent, CBCGPAccessibilityData& data);
protected:
virtual HBRUSH OnCtlColor(CDC* pDC, UINT nCtlColor);
virtual CComboBox* CreateCombo (CWnd* pWndParent, CRect rect);
virtual void OnDestroyWindow ();
virtual BOOL OnKillFocus (CWnd* /*pNewWnd*/)
{
return TRUE;
}
virtual BOOL OnEditKillFocus ()
{
return TRUE;
}
virtual BOOL HasButton () const;
virtual BOOL IsProcessFirstClick () const
{
return TRUE;
}
virtual BOOL HasValueField () const
{
return TRUE;
}
virtual BOOL TextToVar (const CString& strText);
virtual BOOL IsValueChanged () const;
virtual BOOL OnActivateByTab ();
virtual BOOL OnRotateListValue (BOOL bForward);
virtual BOOL OnCommand (WPARAM /*wParam*/)
{
return FALSE;
}
// Attributes
public:
LPCTSTR GetName () const
{
return m_strName;
}
void SetName (LPCTSTR lpszName, BOOL bRedraw = TRUE);
virtual const _variant_t& GetValue () const
{
return m_varValue;
}
virtual void SetValue (const _variant_t& varValue);
const _variant_t& GetOrgiginalValue () const
{
return m_varValueOrig;
}
void SetOriginalValue (const _variant_t& varValue);
const CString& GetDescription () const
{
return m_strDescr;
}
void SetDescription (const CString& strDescr)
{
m_strDescr = strDescr;
}
DWORD_PTR GetData () const
{
return m_dwData;
}
void SetData (DWORD_PTR dwData)
{
m_dwData = dwData;
}
BOOL IsGroup () const
{
return m_bGroup;
}
BOOL IsExpanded () const
{
return m_bExpanded;
}
BOOL IsParentExpanded () const;
virtual BOOL IsSelected () const;
int GetHierarchyLevel () const;
void Enable (BOOL bEnable = TRUE);
BOOL IsEnabled () const
{
return m_bEnabled;
}
void AllowEdit (BOOL bAllow = TRUE)
{
ASSERT (m_varValue.vt != VT_BOOL);
m_bAllowEdit = bAllow;
}
BOOL IsAllowEdit () const
{
return m_bAllowEdit;
}
CRect GetRect () const
{
return m_Rect;
}
int GetSubItemsCount () const
{
return (int) m_lstSubItems.GetCount ();
}
CBCGPProp* GetSubItem (int nIndex) const;
CBCGPProp* GetParent () const
{
return m_pParent;
}
BOOL IsInPlaceEditing () const
{
return m_bInPlaceEdit;
}
BOOL IsModified () const
{
return m_bIsModified;
}
BOOL IsVisible () const
{
return m_bIsVisible;
}
public:
// Data formats
static CString m_strFormatChar;
static CString m_strFormatShort;
static CString m_strFormatLong;
static CString m_strFormatUShort;
static CString m_strFormatULong;
static CString m_strFormatFloat;
static CString m_strFormatDouble;
protected:
CString m_strName; // Property name
_variant_t m_varValue; // Property value
_variant_t m_varValueOrig; // Property original value
CBCGPPropList* m_pWndList; // Pointer to the PropertyList window
DWORD_PTR m_dwData; // User-defined data
CString m_strDescr; // Property description
CString m_strEditMask; // Property edit mask (see CBCGPMaskEdit for description)
CString m_strEditTempl; // Property edit template (see CBCGPMaskEdit for description)
CString m_strValidChars;// Property edit valid chars (see CBCGPMaskEdit for description)
CStringList m_lstOptions; // List of combobox items
BOOL m_bInPlaceEdit; // Is in InPalce editing mode
CWnd* m_pWndInPlace; // Pointer to InPlace editing window
CComboBox* m_pWndCombo; // Pointer to combbox
CSpinButtonCtrl* m_pWndSpin; // Pointer to spin button
CRect m_Rect; // Property rectangle (in the prop.list coordinates)
CRect m_rectButton; // Drop down/open button rectangle
BOOL m_bButtonIsDown;// Is button pressed?
BOOL m_bButtonIsFocused; // Is button focused?
BOOL m_bGroup; // Is property group?
BOOL m_bExpanded; // Is property expanded (for groups only)
BOOL m_bEnabled; // Is propperty enabled?
BOOL m_bAllowEdit; // Is property editable?
BOOL m_bIsValueList; // This is a value list group?
DWORD m_dwFlags; // Property flags
CBCGPProp* m_pParent; // Parent property (NULL for top-level properties)
CList<CBCGPProp*, CBCGPProp*> m_lstSubItems; // Sub-properies list
BOOL m_bNameIsTrancated;
BOOL m_bValueIsTrancated;
int m_nMinValue;
int m_nMaxValue;
BOOL m_bIsModified; // Is property modified
BOOL m_bIsVisible; // Is property visible
};
#ifndef _BCGPGRID_STANDALONE
/////////////////////////////////////////////////////////////////////////////
// CBCGPColorProp object
class BCGCBPRODLLEXPORT CBCGPColorProp : public CBCGPProp
{
friend class CBCGPPropList;
DECLARE_DYNAMIC(CBCGPColorProp)
// Construction
public:
CBCGPColorProp(const CString& strName, const COLORREF& color,
CPalette* pPalette = NULL, LPCTSTR lpszDescr = NULL, DWORD_PTR dwData = 0);
virtual ~CBCGPColorProp();
// Overrides
public:
virtual void OnDrawValue (CDC* pDC, CRect rect);
virtual void OnClickButton (CPoint point);
virtual BOOL OnEdit (LPPOINT lptClick);
virtual BOOL OnUpdateValue ();
virtual CString FormatProperty ();
protected:
virtual BOOL OnKillFocus (CWnd* pNewWnd)
{
return pNewWnd->GetSafeHwnd () != m_pPopup->GetSafeHwnd ();
}
virtual BOOL OnEditKillFocus ()
{
return m_pPopup == NULL;
}
virtual BOOL IsValueChanged () const
{
return m_Color != m_ColorOrig;
}
virtual void AdjustInPlaceEditRect (CRect& rectEdit, CRect& rectSpin);
virtual void ResetOriginalValue ();
virtual void CommitModifiedValue ();
// Attributes
public:
COLORREF GetColor () const
{
return m_Color;
}
void SetColor (COLORREF color);
// Color popup attributes:
void EnableAutomaticButton (LPCTSTR lpszLabel, COLORREF colorAutomatic, BOOL bEnable = TRUE);
void EnableOtherButton (LPCTSTR lpszLabel, BOOL bAltColorDlg = TRUE, BOOL bEnable = TRUE);
void SetColumnsNumber (int nColumnsNumber);
// Attributes
protected:
COLORREF m_Color; // Color value
COLORREF m_ColorOrig; // Original color value
COLORREF m_ColorAutomatic; // Automatic (default) color value
CString m_strAutoColor; // Atomatic color label
BOOL m_bStdColorDlg; // Use standard Windows color dialog
CString m_strOtherColor; // Alternative color label
CColorPopup* m_pPopup;
CArray<COLORREF, COLORREF> m_Colors;
int m_nColumnsNumber; // Number of columns in dropped-down colors list
};
#endif
/////////////////////////////////////////////////////////////////////////////
// CBCGPFileProp object
class BCGCBPRODLLEXPORT CBCGPFileProp : public CBCGPProp
{
DECLARE_DYNAMIC(CBCGPFileProp)
// Construction
public:
#ifndef _BCGPGRID_STANDALONE
CBCGPFileProp(const CString& strName, const CString& strFolderName, DWORD_PTR dwData = 0, LPCTSTR lpszDescr = NULL);
#endif
CBCGPFileProp(const CString& strName, BOOL bOpenFileDialog, const CString& strFileName,
LPCTSTR lpszDefExt = NULL,
DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
LPCTSTR lpszFilter = NULL,
LPCTSTR lpszDescr = NULL, DWORD_PTR dwData = 0);
virtual ~CBCGPFileProp();
// Overrides
public:
virtual void OnClickButton (CPoint point);
// Attributes
protected:
#ifndef _BCGPGRID_STANDALONE
BOOL m_bIsFolder;
#endif
// File open dialog atributes:
BOOL m_bOpenFileDialog; // TRUE - use "File Open/Save" diaog; otherwise - folder selection dialog
DWORD m_dwFileOpenFlags;
CString m_strDefExt;
CString m_strFilter;
};
/////////////////////////////////////////////////////////////////////////////
// CBCGPFontProp object
class BCGCBPRODLLEXPORT CBCGPFontProp : public CBCGPProp
{
DECLARE_DYNAMIC(CBCGPFontProp)
// Construction
public:
CBCGPFontProp( const CString& strName, LOGFONT& lf,
DWORD dwFontDialogFlags = CF_EFFECTS | CF_SCREENFONTS,
LPCTSTR lpszDescr = NULL, DWORD_PTR dwData = 0,
COLORREF color = (COLORREF)-1);
virtual ~CBCGPFontProp();
// Overrides
public:
virtual void OnClickButton (CPoint point);
virtual CString FormatProperty ();
// Attributes
public:
LPLOGFONT GetLogFont ()
{
return &m_lf;
}
COLORREF GetColor () const
{
return m_Color;
}
protected:
LOGFONT m_lf;
LOGFONT m_lfOrig;
DWORD_PTR m_dwFontDialogFlags;
COLORREF m_Color;
virtual BOOL IsValueChanged () const
{
return memcmp (&m_lf, &m_lfOrig, sizeof (LOGFONT)) != 0 ||
lstrcmp (m_lf.lfFaceName, m_lfOrig.lfFaceName) != 0;
}
virtual void ResetOriginalValue ();
virtual void CommitModifiedValue ();
};
#ifndef _BCGPGRID_STANDALONE
/////////////////////////////////////////////////////////////////////////////
// CBCGPDateTimeProp object
class BCGCBPRODLLEXPORT CBCGPDateTimeProp : public CBCGPProp
{
DECLARE_DYNAMIC(CBCGPDateTimeProp)
// Construction
public:
CBCGPDateTimeProp(const CString& strName, const COleDateTime& date,
LPCTSTR lpszDescr = NULL, DWORD_PTR dwData = 0,
UINT nFlags = CBCGPDateTimeCtrl::DTM_DATE | CBCGPDateTimeCtrl::DTM_TIME);
virtual ~CBCGPDateTimeProp();
// Overrides
public:
virtual void OnDrawValue (CDC* pDC, CRect rect);
virtual CWnd* CreateInPlaceEdit (CRect rectEdit, BOOL& bDefaultFormat);
virtual void OnPosSizeChanged (CRect rectOld);
virtual BOOL OnUpdateValue ();
virtual void OnSetSelection (CBCGPProp* pOldSel);
virtual void OnKillSelection (CBCGPProp* pNewSel);
virtual BOOL PushChar (UINT nChar);
virtual CString FormatProperty ();
virtual BOOL IsValueChanged () const;
virtual void AdjustInPlaceEditRect (CRect& rectEdit, CRect& rectSpin);
virtual BOOL OnCommand (WPARAM /*wParam*/);
virtual void ResetOriginalValue ();
// Attributes
public:
void SetDate (COleDateTime date);
COleDateTime GetDate () const
{
return (COleDateTime) (DATE) m_varValue;
}
protected:
UINT m_nFlags;
CBCGPDateTimeCtrl m_wndDateTime;
void SetState (CBCGPDateTimeCtrl& wnd);
};
#endif
/////////////////////////////////////////////////////////////////////////////
// CBCGPPropList window
#define BCGPROPLIST_ID_INPLACE 3
BCGCBPRODLLEXPORT extern UINT BCGM_PROPERTY_CHANGED;
class BCGCBPRODLLEXPORT CBCGPPropList : public CBCGPWnd
{
DECLARE_DYNAMIC(CBCGPPropList)
friend class CBCGPProp;
friend class CBCGPColorProp;
friend class CBCGPDateTimeProp;
// Construction
public:
CBCGPPropList();
// Attributes
public:
void EnableHeaderCtrl (BOOL bEnable = TRUE,
LPCTSTR lpszLeftColumn = _T("Property"),
LPCTSTR lpszRightColumn = _T("Value"));
BOOL IsHeaderCtrl () const
{
return m_bHeaderCtrl;
}
void EnableDescriptionArea (BOOL bEnable = TRUE);
BOOL IsDescriptionArea () const
{
return m_bDescriptionArea;
}
int GetDescriptionHeight () const
{
return m_nDescrHeight;
}
int GetDescriptionRows () const
{
return m_nDescrRows;
}
void SetDescriptionRows (int nDescRows);
void SetAlphabeticMode (BOOL bSet = TRUE);
BOOL IsAlphabeticMode () const
{
return m_bAlphabeticMode;
}
void SetVSDotNetLook (BOOL bSet = TRUE);
BOOL IsVSDotNetLook () const
{
return m_bVSDotNetLook;
}
void MarkModifiedProperties (BOOL bMark = TRUE, BOOL bRedraw = TRUE);
BOOL IsMarkModifiedProperties () const
{
return m_bMarkModifiedProperties;
}
void ResetOriginalValues (BOOL bRedraw = TRUE);
void CommitModifiedValues (BOOL bRedraw = TRUE);
void SetBoolLabels (LPCTSTR lpszTrue, LPCTSTR lpszFalse);
void SetListDelimiter (TCHAR c);
CRect GetListRect () const
{
return m_rectList;
}
int GetPropertyColumnWidth () const
{
return m_nLeftColumnWidth;
}
void SetPropertyColumnWidth (int nWidth)
{
m_nLeftColumnWidth = nWidth;
}
int GetHeaderHeight () const
{
return m_nHeaderHeight;
}
int GetRowHeight () const
{
return m_nRowHeight;
}
virtual PROP_HEADER_CTRL_CLASS& GetHeaderCtrl ()
{
return m_wndHeader;
}
int GetLeftColumnWidth () const
{
return m_nLeftColumnWidth;
}
BOOL IsGroupNameFullWidth () const
{
return m_bGroupNameFullWidth;
}
void SetGroupNameFullWidth (BOOL bGroupNameFullWidth = TRUE, BOOL bRedraw = TRUE);
BOOL IsShowDragContext () const
{
return m_bShowDragContext;
}
void SetShowDragContext (BOOL bShowDragContext = TRUE)
{
m_bShowDragContext = bShowDragContext;
}
void SetCustomColors ( // Use (COLORREF)-1 for the default color
COLORREF clrBackground,
COLORREF clrText,
COLORREF clrGroupBackground,
COLORREF clrGroupText,
COLORREF clrDescriptionBackground,
COLORREF clrDescriptionText,
COLORREF clrLine);
void GetCustomColors (
COLORREF& clrBackground,
COLORREF& clrText,
COLORREF& clrGroupBackground,
COLORREF& clrGroupText,
COLORREF& clrDescriptionBackground,
COLORREF& clrDescriptionText,
COLORREF& clrLine);
COLORREF GetTextColor () const
{
return m_clrText == (COLORREF)-1 ?
globalData.clrWindowText : m_clrText;
}
COLORREF GetBkColor () const
{
return m_clrBackground == (COLORREF)-1 ?
globalData.clrWindow : m_clrBackground;
}
CFont& GetBoldFont ()
{
return m_fontBold;
}
BOOL IsAlwaysShowUserToolTip () const
{
return m_bAlwaysShowUserTT;
}
void AlwaysShowUserToolTip (BOOL bShow = TRUE)
{
m_bAlwaysShowUserTT = bShow;
}
BOOL DrawControlBarColors () const
{
return m_bVisualManagerStyle || m_bControlBarColors;
}
void SetScrollBarsStyle (CBCGPScrollBar::BCGPSB_STYLE style)
{
m_ScrollBarStyle = style;
m_wndScrollVert.SetVisualStyle (style);
}
CBCGPScrollBar::BCGPSB_STYLE GetScrollBarsStyle () const
{
return m_ScrollBarStyle;
}
protected:
PROP_HEADER_CTRL_CLASS m_wndHeader; // Property list header control
BOOL m_bHeaderCtrl; // Is header control visible?
BOOL m_bDescriptionArea; // Does description area enabled?
int m_nDescrHeight; // Description area height
int m_nDescrRows; // Number of rows in description area
CToolTipCtrl m_ToolTip; // Tooltip control
int m_nTooltipsCount; // Number of tooltip items
CBCGPInplaceToolTipCtrl m_IPToolTip; // Inplace tooltip control
BOOL m_bAlwaysShowUserTT; // Always show user tooltips, even if in-place TT should be activated
BOOL m_bAlphabeticMode; // Use property list in alphabetic (non-"tree") mode
BOOL m_bVSDotNetLook; // Provide MS Visual Studio.NET look (gray groups, flat look)
CString m_strTrue; // Customized boolean value (e.g. "Yes")
CString m_strFalse; // Customized boolean value (e.g. "No")
TCHAR m_cListDelimeter; // Customized list delimeter character
CBCGPScrollBar m_wndScrollVert; // Vertical scroll bar
CBCGPScrollBar::BCGPSB_STYLE
m_ScrollBarStyle; // Scroll bars style
HFONT m_hFont; // Property list regular font
CFont m_fontBold; // Property list bold font
int m_nEditLeftMargin; // Edit control left margin
int m_nBoldEditLeftMargin; // Edit control left margin (bold font)
int m_nBorderSize; // Control border size
int m_nHeaderHeight; // Header control height
CRect m_rectList; // Properies area
int m_nRowHeight; // Height of the single row
int m_nLeftColumnWidth; // Width of the left ("Name") column
int m_nVertScrollOffset; // In rows
int m_nVertScrollTotal;
int m_nVertScrollPage;
BOOL m_bMarkModifiedProperties; // Draw modified properties with bold
//-----------------------------------------------------------
// Tracking attributes: used for the vertical and description
// area splitters tracking:
//-----------------------------------------------------------
CRect m_rectTrackHeader;
CRect m_rectTrackDescr;
BOOL m_bTracking;
BOOL m_bTrackingDescr;
CList<CBCGPProp*, CBCGPProp*> m_lstProps; // List of top-level properties
CList<CBCGPProp*, CBCGPProp*> m_lstTerminalProps; // List of terminal properties
CBCGPProp* m_pSel; // Current selection
BOOL m_bFocused; // Control has focus
COLORREF m_clrGray; // Special gray color
BOOL m_bControlBarColors; // Use colors of tye parent control bar
BOOL m_bGroupNameFullWidth; // Display group name in the whole row
BOOL m_bShowDragContext; // Show context while dragging spliters
//---------------
// Custom colors:
//---------------
COLORREF m_clrBackground; // Control background color
COLORREF m_clrText; // Control foreground color
COLORREF m_clrGroupBackground; // Group background text
COLORREF m_clrGroupText; // Group foreground text
COLORREF m_clrDescriptionBackground; // Description background text
COLORREF m_clrDescriptionText; // Description foreground text
COLORREF m_clrLine; // Color of the grid lines
CBrush m_brBackground;
// Operations
public:
int AddProperty (CBCGPProp* pProp, BOOL bRedraw = TRUE, BOOL bAdjustLayout = TRUE);
BOOL DeleteProperty (CBCGPProp*& pProp, BOOL bRedraw = TRUE, BOOL bAdjustLayout = TRUE);
void RemoveAll ();
CBCGPProp* GetProperty (int nIndex) const;
int GetPropertyCount () const
{
return (int) m_lstProps.GetCount ();
}
CBCGPProp* FindItemByData (DWORD_PTR dwData, BOOL bSearchSubItems = TRUE) const;
CBCGPProp* HitTest (CPoint pt, CBCGPProp::ClickArea* pnArea = NULL, BOOL bPropsOnly = FALSE) const;
void SetCurSel (CBCGPProp* pProp, BOOL bRedraw = TRUE);
CBCGPProp* GetCurSel () const
{
return m_pSel;
}
void EnsureVisible (CBCGPProp* pProp, BOOL bExpandParents = FALSE);
void ExpandAll (BOOL bExapand = TRUE);
#ifndef _BCGPGRID_STANDALONE
virtual void CloseColorPopup ();
virtual void UpdateColor (COLORREF color);
#endif
virtual void AdjustLayout ();
// Overrides
virtual void OnPropertyChanged (CBCGPProp* pProp) const;
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CBCGPPropList)
public:
virtual BOOL Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID);
virtual BOOL PreTranslateMessage(MSG* pMsg);
virtual CScrollBar* GetScrollBarCtrl(int nBar) const;
protected:
virtual void PreSubclassWindow();
virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult);
virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
//}}AFX_VIRTUAL
public:
virtual void OnChangeSelection (CBCGPProp* /*pNewSel*/, CBCGPProp* /*pOldSel*/) {}
virtual BOOL EditItem (CBCGPProp* pProp, LPPOINT lptClick = NULL);
virtual void OnClickButton (CPoint point);
virtual BOOL EndEditItem (BOOL bUpdateData = TRUE);
virtual BOOL ValidateItemData (CBCGPProp* /*pProp*/)
{
return TRUE;
}
virtual int OnDrawProperty (CDC* pDC, CBCGPProp* pProp) const;
virtual void InitHeader ();
virtual BOOL OnSetAccData (long lVal);
virtual BOOL IsAccessibilityCompatible () { return TRUE; }
virtual HRESULT get_accRole(VARIANT varChild, VARIANT *pvarRole);
protected:
virtual void Init ();
virtual void OnFillBackground (CDC* pDC, CRect rectClient);
virtual void OnDrawBorder (CDC* pDC);
virtual void OnDrawList (CDC* pDC);
virtual void OnDrawDescription (CDC* pDC, CRect rect);
virtual BOOL ProcessClipboardAccelerators (UINT nChar);
virtual int CompareProps (const CBCGPProp* pProp1, const CBCGPProp* pProp2) const;
virtual void NotifyAccessibility (CBCGPProp* pProp);
// Implementation
public:
virtual ~CBCGPPropList();
// Generated message map functions
protected:
//{{AFX_MSG(CBCGPPropList)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnSettingChange(UINT uFlags, LPCTSTR lpszSection);
afx_msg void OnPaint();
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnCancelMode();
afx_msg void OnKillFocus(CWnd* pNewWnd);
afx_msg UINT OnGetDlgCode();
afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
afx_msg void OnSetFocus(CWnd* pOldWnd);
afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
afx_msg void OnDestroy();
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
afx_msg void OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS FAR* lpncsp);
afx_msg void OnNcPaint();
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
//}}AFX_MSG
afx_msg LRESULT OnSetFont (WPARAM, LPARAM);
afx_msg LRESULT OnGetFont (WPARAM, LPARAM);
afx_msg void OnHeaderItemChanged(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnHeaderTrack(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnHeaderEndTrack(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnSpinDeltaPos(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg LRESULT OnUpdateSpin (WPARAM, LPARAM);
afx_msg void OnStyleChanged(int nStyleType, LPSTYLESTRUCT lpStyleStruct);
afx_msg void OnSelectCombo();
afx_msg void OnCloseCombo();
afx_msg void OnEditKillFocus();
afx_msg void OnComboKillFocus();
afx_msg BOOL OnNeedTipText(UINT id, NMHDR* pNMH, LRESULT* pResult);
afx_msg LRESULT OnGetObject (WPARAM wParam, LPARAM lParam);
DECLARE_MESSAGE_MAP()
//------------------
// Internal helpres:
//------------------
HFONT SetCurrFont (CDC* pDC);
void TrackHeader (int nOffset);
void TrackDescr (int nOffset);
void TrackToolTip (CPoint pt);
void SetScrollSizes ();
int GetTotalItems (BOOL bIncludeHidden = TRUE) const;
void ReposProperties ();
void CreateBoldFont ();
void CalcEditMargin ();
};
#define GetDesciption GetDescription
#define SetDesciption SetDescription
#define m_bDesciptionArea m_bDescriptionArea
#define GetDesciptionHeight GetDescriptionHeight
#define OnDrawDesciption OnDrawDescription
#define EnableDesciptionArea EnableDescriptionArea
#define IsDesciptionArea IsDescriptionArea
#define GetDesciptionHeight GetDescriptionHeight
#endif // BCGP_EXCLUDE_PROP_LIST
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_BCGPPROPLIST_H__F6054FED_0317_4829_B7BF_4EBBDC27DF01__INCLUDED_)
| [
"myme5261314@ec588229-7da7-b333-41f6-0e1ebc3afda5"
]
| [
[
[
1,
996
]
]
]
|
0e07dd2873f724d4b3a6725cabca34e7d4a2a7a9 | 382b459563be90227848e5125f0d37f83c1e2a4f | /Schedule/include/obsolete/typeid.h | edc07dd5bc9525e79e01dde7a2470ca9173e792b | []
| no_license | Maciej-Poleski/SchoolTools | 516c9758dfa153440a816a96e3f05c7f290daf6c | e55099f77eb0f65b75a871d577cc4054221b9802 | refs/heads/master | 2023-07-02T09:07:31.185410 | 2010-07-11T20:56:59 | 2010-07-11T20:56:59 | 392,391,718 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 235 | h | #ifndef TYPEID_H
#define TYPEID_H
#include "abstractreservedid.h"
namespace obsolete
{
/** Klasa reprezentująca identyfikator typu wydarzenia **/
class TypeID : public AbstractReservedID
{
};
}
#endif // TYPEID_H
| [
"[email protected]"
]
| [
[
[
1,
16
]
]
]
|
568069a8e161810283032b45f59fa6471705f144 | f2b4a9d938244916aa4377d4d15e0e2a6f65a345 | /gxlib/gxl.input.cpp | 07d6d6e72c1127bf9726f4ff72561fbf3b088b7e | [
"Apache-2.0"
]
| permissive | notpushkin/palm-heroes | d4523798c813b6d1f872be2c88282161cb9bee0b | 9313ea9a2948526eaed7a4d0c8ed2292a90a4966 | refs/heads/master | 2021-05-31T19:10:39.270939 | 2010-07-25T12:25:00 | 2010-07-25T12:25:00 | 62,046,865 | 2 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 10,059 | cpp | /*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
#include "gxl.inc.h"
#ifdef OS_WINCE
#include <gx.h>
#endif //OS_WINCE
#include "gxl.window.h"
#include "gxl.ctr.cbuff.h"
#include "gxl.input.h"
#ifdef OS_WINCE
// TODO:: Make just one instance of it!!!
#include "gxl.gxdyn.h"
extern iGAPILoader gapi;
/////////////////////////
#endif
// from winuserm.h
#define VK_TSOFT1 VK_F1 // Softkey 1
#define VK_TSOFT2 VK_F2 // Softkey 2
#define VK_TTALK VK_F3 // Talk
#define VK_TEND VK_F4 // End
#define VK_THOME VK_LWIN // Home
#define VK_TBACK VK_ESCAPE // Back
#define VK_TACTION VK_RETURN // Action
#define VK_TRECORD VK_F10 // Record
#define VK_TFLIP VK_F17 // Flip
#define VK_TPOWER VK_F18 // Power
#define VK_TVOLUMEUP VK_F6 // Volume Up
#define VK_TVOLUMEDOWN VK_F7 // Volume Down
#define VK_TUP VK_UP // Up
#define VK_TDOWN VK_DOWN // Down
#define VK_TLEFT VK_LEFT // Left
#define VK_TRIGHT VK_RIGHT // Right
#define VK_T0 L'0' // 0 .. 9 keys
#define VK_T1 L'1'
#define VK_T2 L'2'
#define VK_T3 L'3'
#define VK_T4 L'4'
#define VK_T5 L'5'
#define VK_T6 L'6'
#define VK_T7 L'7'
#define VK_T8 L'8'
#define VK_T9 L'9'
#define VK_TSTAR VK_F8 // *
#define VK_TPOUND VK_F9 // #
#define VK_SYMBOL VK_F11 // Symbol (SYM) key
#define VK_REDKEY VK_F19 // Sent by a keypad that has a special red function key
#define VK_ROCKER VK_F20 // Arrow keys came from a Rocker
#define VK_DPAD VK_F21 // Arrow keys came from a DPAD
#define VK_ACTION VK_F23 // Sent with VK_RETURN when doing Action on PPC rockers
// Chorded keys. DONE is VK_RWIN + VK_F6 and MOJI is VK_RWIN + VK_F7
#define VK_DONE VK_F6 // <OK/Close> hotkey code
#define MOD_DONE (MOD_WIN | MOD_KEYUP) // <OK/Close> hotkey modifiers
#define VK_MOJI VK_F7 // Key used to switch between FE language layouts
#define MOD_MOJI (MOD_WIN | MOD_KEYUP) //Modifiers so MOJI goes to the shell
// App keys
#define VK_APP1 0xC1
#define VK_APP2 0xC2
#define VK_APP3 0xC3
#define VK_APP4 0xC4
#define VK_APP5 0xC5
#define VK_APP6 0xC6
//////////////////////////////////////////////////////////////////////////
iInput::iInput() : m_bInited(false)
{
ClearKeyState();
}
iInput::~iInput()
{
check(!m_bInited);
}
void iInput::ClearKeyState()
{
memset(m_KeysState,0,sizeof(m_KeysState));
}
bool iInput::Init(const iSize& scr_siz, uint32 flags)
{
check(!m_bInited);
m_dimScreen = scr_siz;
m_Flags = flags;
#ifdef OS_WINCE
if ( !gGapi.Init(false) ) return false;
if (!gGapi.GXOpenInput()) return false;
m_KeyList = gGapi.GXGetDefaultKeys(GX_NORMALKEYS);
SetOrientation( (flags & GXLF_LANDSCAPE) != 0, (flags & GXLF_LHANDER) != 0);
#endif //OS_WINCE
return m_bInited = true;
}
void iInput::Destroy()
{
check(m_bInited);
#ifdef OS_WINCE
gGapi.GXCloseInput();
#endif //OS_WINCE
m_Entries.Reset();
m_bInited = false;
}
void iInput::SetOrientation(bool bLandscape, bool bLeftHander)
{
if (bLandscape && (m_Flags & GXLF_LANDSCAPE) == 0) m_Flags |= GXLF_LANDSCAPE;
else if (!bLandscape && (m_Flags & GXLF_LANDSCAPE) != 0) m_Flags ^= GXLF_LANDSCAPE;
if (bLeftHander && (m_Flags & GXLF_LHANDER) == 0) m_Flags |= GXLF_LHANDER;
else if (!bLeftHander && (m_Flags & GXLF_LHANDER) != 0) m_Flags ^= GXLF_LHANDER;
if (m_Flags & GXLF_LANDSCAPE) {
if ( (m_Flags & GXLF_DEV_LANDSCAPE) || (m_Flags & GXLF_LHANDER)) {
m_mo = (sint16)(m_dimScreen.w) - 1;
} else {
m_mo = (sint16)(m_dimScreen.h) - 1;
}
} else {
m_mo = 0;
}
// now prepare translate key map
#ifdef OS_WINCE
#define RIDX( kcode, kofs ) ((kcode+kofs)&0x03)
size_t rotateKeys = 0;
#if !defined(HPC_JORNADA)
if ( m_Flags & GXLF_LANDSCAPE ) {
if ( m_Flags & GXLF_LHANDER ) {
rotateKeys = 3;
} else {
rotateKeys = 1;
}
}
#endif
m_Translate[ RIDX( 0, rotateKeys ) ].vk = m_KeyList.vkUp;
m_Translate[ RIDX( 1, rotateKeys ) ].vk = m_KeyList.vkRight;
m_Translate[ RIDX( 2, rotateKeys ) ].vk = m_KeyList.vkDown;
m_Translate[ RIDX( 3, rotateKeys ) ].vk = m_KeyList.vkLeft;
m_Translate[ 0 ].kc = KEY_UP;
m_Translate[ 1 ].kc = KEY_RIGHT;
m_Translate[ 2 ].kc = KEY_DOWN;
m_Translate[ 3 ].kc = KEY_LEFT;
m_Translate[ 4 ].vk = 0x86; // VK_ACTION m_KeyList.vkStart;
m_Translate[ 4 ].kc = KEY_ENTER;
m_Translate[ 5 ].vk = m_KeyList.vkA; // VK_APP1
m_Translate[ 5 ].kc = KEY_VKA;
m_Translate[ 6 ].vk = m_KeyList.vkB; // VK_APP2
m_Translate[ 6 ].kc = KEY_VKB;
m_Translate[ 7 ].vk = m_KeyList.vkC; // VK_APP3
m_Translate[ 7 ].kc = KEY_VKC;
// patch for asus (and co)
m_Translate[ 8 ].vk = VK_RETURN;
m_Translate[ 8 ].kc = KEY_ENTER;
// find fourth hardware key
// TODO:: refactor to the separate proc
uint32 foundKey4 = VK_F15; // unused by default
uint32 fourKeys[4] = { VK_APP1, VK_APP2, VK_APP3, VK_APP4 };
for( size_t nk = 5; nk != 8; nk++ ) {
uint32 passedCode = m_Translate[nk].vk;
if ( passedCode >= VK_APP1 && passedCode <= VK_APP4 ) {
fourKeys[ passedCode - VK_APP1 ] = 0; // mark as used
}
}
for( size_t nk = 0; nk !=4; nk++ ) {
if ( fourKeys[nk] != 0 ) {
foundKey4=fourKeys[nk];
break;
}
}
m_Translate[ 9 ].vk = foundKey4; //FindFourthHWKey();
m_Translate[ 9 ].kc = KEY_VKD;
// m_Translate[ 9 ].vk = VK_APP4;
// m_Translate[ 9 ].kc = KEY_VKD;
m_Translate[10 ].vk = VK_APP5;
m_Translate[10 ].kc = KEY_VKE;
m_Translate[11 ].vk = VK_APP6;
m_Translate[11 ].kc = KEY_VKF;
// record key (if any)
m_Translate[12 ].vk = VK_TRECORD;
m_Translate[12 ].kc = KEY_REC;
// smartphone specific keys
m_Translate[13 ].vk = VK_TTALK;
m_Translate[13 ].kc = KEY_TALK;
m_Translate[14 ].vk = VK_TEND;
m_Translate[14 ].kc = KEY_END;
m_Translate[15 ].vk = VK_TBACK;
m_Translate[15 ].kc = KEY_BACK;
// - this scan code sent on every now and then for now apparent reason
// ( The VK_APP keys will only be recognized by the system if they are wrapped with VK_LWIN. The following code snippet demonstrates how to do this programmatically. )
// keybd_event(VK_LWIN, 0, KEYEVENTF_SILENT, 0);
// GenKeyEvent(VK_APP1);
// keybd_event(VK_LWIN, 0, KEYEVENTF_SILENT | KEYEVENTF_KEYUP, 0);
m_Translate[16 ].vk = 0x99ff; //VK_THOME;
m_Translate[16 ].kc = KEY_HOME;
m_Translate[17 ].vk = VK_TSOFT1;
m_Translate[17 ].kc = KEY_SOFT1;
m_Translate[18 ].vk = VK_TSOFT2;
m_Translate[18 ].kc = KEY_SOFT2;
m_TranslateSize = 19;
#undef RIDX
#endif //OS_WINCE
}
iKbdKey iInput::KeyCode2Key(sint16 key_code)
{
// following keys also should be assigned to their
// system-default actions (on Smartphone platform)
// VK_TTALK - none or user action
// VK_TEND - quit application
// VK_TBACK - switch to previous application (or minimize)
// VK_THOME - switch to the desktop (or minimize)
#ifdef OS_WINCE
for( size_t n = 0; n != m_TranslateSize; ++n ) {
if ( key_code == m_Translate[n].vk )
return (iKbdKey)m_Translate[n].kc;
}
return KEY_INVALID;
#endif //OS_WINCE
#ifdef OS_WIN32
if (key_code == VK_RETURN ) return KEY_ENTER;
else if (key_code == VK_UP ) return KEY_UP;
else if (key_code == VK_DOWN ) return KEY_DOWN;
else if (key_code == VK_LEFT ) return KEY_LEFT;
else if (key_code == VK_RIGHT ) return KEY_RIGHT;
else if (key_code == (unsigned char)'Q') return KEY_VKA;
else if (key_code == (unsigned char)'W') return KEY_VKB;
else if (key_code == (unsigned char)'E') return KEY_VKC;
return KEY_INVALID;
#endif // OS_WIN32
}
void iInput::msg_OnKeyDown(sint16 key)
{
iKbdKey kkey = KeyCode2Key(key);
if (kkey != KEY_INVALID && !m_KeysState[kkey]){
m_KeysState[kkey] = true;
m_Entries.Put(iEntry(iEntry::KeyDown,kkey));
} else {
}
}
void iInput::msg_OnKeyUp(sint16 key)
{
iKbdKey kkey = KeyCode2Key(key);
if (kkey != KEY_INVALID && m_KeysState[kkey]){
m_KeysState[kkey] = false;
m_Entries.Put(iEntry(iEntry::KeyUp,kkey));
} else {
}
}
void iInput::CvtScrCoor(sint16& px, sint16& py)
{
sint16 npx = px;
sint16 npy = py;
#if defined HPC_JORNADA
// px -= 160;
#elif defined OS_WINCE
if (m_Flags & GXLF_LANDSCAPE) {
if (m_Flags & GXLF_LHANDER) {
npx = py;
npy = m_mo - px;
} else {
npx = m_mo-py;
npy = px;
}
}
#endif //OS_WINCE
if (m_Flags & GXLF_DOUBLESIZE) { npx /= 2; npy /= 2; }
px = npx;
py = npy;
}
void iInput::msg_OnMouseMove(sint16 px, sint16 py)
{
CvtScrCoor(px,py);
m_Entries.Put(iEntry(iEntry::MouseMove,px,py));
}
void iInput::msg_OnMouseDown(sint16 px, sint16 py)
{
CvtScrCoor(px,py);
m_Entries.Put(iEntry(iEntry::MouseDown,px,py));
}
void iInput::msg_OnMouseUp(sint16 px, sint16 py)
{
CvtScrCoor(px,py);
m_Entries.Put(iEntry(iEntry::MouseUp,px,py));
}
| [
"palmheroesteam@2c21ad19-eed7-4c86-9350-8a7669309276"
]
| [
[
[
1,
336
]
]
]
|
578087cb0cd3184c836448053b998b1fc99b0fc1 | ccc3e2995bc64d09b9e88fea8c1c7e2029a60ed8 | /SE1/workplace/code/src/include/iomanip.h | a05a4cef5bff20d1e1cb984796b4806bd4fb56a0 | []
| no_license | masterzdran/semestre5 | e559e93017f5e40c29e9f28466ae1c5822fe336e | 148d65349073f8ae2f510b5659b94ddf47adc2c7 | refs/heads/master | 2021-01-25T10:05:42.513229 | 2011-02-20T17:46:14 | 2011-02-20T17:46:14 | 35,061,115 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,994 | h | #ifndef IOMANIP_H
#define IOMANIP_H
#include <iostream.h>
template <class T> class smanip {
ios & (* f)(ios &, T);
T a;
public:
smanip(ios & (* ff)(ios &, T), T aa)
: f(ff), a(aa) { }
friend istream & operator>>(istream & is, const smanip<T> & m)
{ m.f(is, m.a); return is; }
friend ostream & operator<<(ostream & os, const smanip<T> & m)
{ m.f(os, m.a); return os; }
};
/*
template<class T>
ostream & operator<<(ostream & os, const smanip<T> & m)
{ m.f(os, m.a); return os; }
*/
template <class T> class imanip {
istream & (*f)(istream &, T);
T a;
public:
imanip(ios & (* ff)(istream &, T), T aa)
: f(ff), a(aa) { }
friend istream & operator>>(istream & is, const imanip<T> & m)
{ return m.f(is, m.a); }
};
template <class T> class omanip {
ostream & (* f)(ostream &, T);
T a;
public:
omanip(ostream & (* ff)(ostream &, T), T aa)
: f(ff), a(aa) { }
friend ostream & operator<<(ostream & os, const omanip<T> & m)
{ return m.f(os, m.a); }
};
/*
template <class T>
ostream & operator<<(ostream & os, const omanip<T> & m)
{ return m.f(os, m.a); }
*/
template <class T> class iomanip {
ios & (* f)(ios &, T);
T a;
public:
iomanip(ios & (* ff)(ios &, T), T aa)
: f(ff), a(aa) { }
friend istream & operator>>(iostream & s, const iomanip<T> & m)
{ return m.f(s, m.a); }
friend ostream & operator<<(iostream & s, const iomanip<T> & m)
{ return m.f(s, m.a); }
};
// set the conversion base to 0, 8, 10, or 16
smanip<int> setbase(int _b);
// clear the flags bitvector according to the bits set in b
smanip<long> resetiosflags(long _b);
// set the flags bitvector according to the bits set in b
smanip<long> setiosflags(long _b);
// set fill character for padding a field
smanip<int> setfill(int _f);
// set the floating-point precision to n digits
smanip<int> setprecision(int _n);
// set the field width to n
smanip<int> setw(int _n);
#endif
| [
"nuno.cancelo@b139f23c-5e1e-54d6-eab5-85b03e268133"
]
| [
[
[
1,
79
]
]
]
|
22a3856194fff6092b19140fbee3874b7a3279f3 | 341177e66545bcf17545e3b9a655183cdb689a30 | /CONSOLE.CPP | ff079b9fbb7b0ff39172fb1f3a33b1a9c10f29a6 | []
| no_license | pnedunuri/Swings | e4964d2b29753f883a08a2526d3bc126e19c861c | 3d6d589da01205005efc33c33f0347bfacca91c1 | refs/heads/master | 2021-01-18T10:15:26.341013 | 2011-07-30T03:46:12 | 2011-07-30T03:46:12 | null | 0 | 0 | null | null | null | null | ISO-8859-1 | C++ | false | false | 12,015 | cpp | //Console.cpp - Definição das funções de console
#include "console.h"
/*----------------------------------------------------------------------------*\
| clrscr |
| |
| Descrição: |
| Limpa a tela do console. |
| |
| Parâmetros: |
| atributos->qualquer combinação dos seguintes valores: |
| FOREGROUND_BLUE, FOREGROUND_GREEN, FOREGROUND_RED, |
| FOREGROUND_YELLOW, FOREGROUND_CYAN, FOREGROUND_WHITE |
| FOREGROUND_INTENSITY, |
| BACKGROUND_BLUE, BACKGROUND_GREEN, BACKGROUND_RED, |
| BACKGROUND_WHITE, BACKGROUND_CYAN |
| BACKGROUND_INTENSITY |
| |
| Exemplos: |
| //Limpa a tela com letras brancas em fundo preto |
| clrscr(FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED); |
| |
| //Limpa a tela com letras pretas em fundo branco |
| clrscr(BACKGROUND_BLUE | BACKGROUND_GREEN | BACKGROUND_RED); |
| |
| Retorno: |
| |
\*----------------------------------------------------------------------------*/
void clrscr( WORD atributos)
{
#define MY_BUFSIZE 1024 // Tamanho do buffer para o título da janela
COORD coordScreen = { 0, 0 }; // Posição do cursor
BOOL bSuccess; // Auxiliar para armazenamento do retorno das funções
DWORD cCharsWritten,
dwConSize; // Número de caracteres atuais da janela
CONSOLE_SCREEN_BUFFER_INFO csbi;// Informações sobre a janela
HANDLE hConsole; // Handle para a janela
//Recupera o handle da janela de console
hConsole=GetStdHandle(STD_OUTPUT_HANDLE);
//Recupera informações sobre a janela
bSuccess = GetConsoleScreenBufferInfo( hConsole, &csbi );
//Calcula número de caracteres
dwConSize = csbi.dwSize.X * csbi.dwSize.Y;
//Preenche janela com brancos
bSuccess = FillConsoleOutputCharacter( hConsole, (TCHAR) ' ',
dwConSize, coordScreen, &cCharsWritten );
//Preenche janela com o atributo escolhido
bSuccess = FillConsoleOutputAttribute( hConsole, atributos,
dwConSize, coordScreen, &cCharsWritten );
//Posiciona o cursor no canto superior esquerdo
bSuccess = SetConsoleCursorPosition( hConsole, coordScreen );
}
/*----------------------------------------------------------------------------*\
| gotoxy |
| |
| Descrição: |
| Posiciona o cursor em determinado local |
| |
| Parâmetros: |
| x -> coordenada horizontal. |
| y -> coordenada vertical. |
| |
| Retorno: |
| |
\*----------------------------------------------------------------------------*/
void gotoxy (int x, int y)
{
HANDLE hConsole; // Handle para a janela
COORD coord = { x, y }; // Posição do cursor
//Recupera o handle da janela de console
hConsole=GetStdHandle(STD_OUTPUT_HANDLE);
//Posiciona o cursor no canto superior esquerdo
SetConsoleCursorPosition( hConsole, coord );
}
/*----------------------------------------------------------------------------*\
| mostratexto |
| |
| Descrição: |
| Mostra uma string em determinada posição da tela com cores diferentes. |
| |
| Parâmetros: |
| x -> coordenada horizontal. |
| y -> coordenada vertical. |
| texto -> texto a ser mostrado |
| atributos->qualquer combinação dos seguintes valores: |
| FOREGROUND_BLUE, FOREGROUND_GREEN, FOREGROUND_RED, |
| FOREGROUND_YELLOW, FOREGROUND_CYAN, FOREGROUND_WHITE |
| FOREGROUND_INTENSITY, |
| BACKGROUND_BLUE, BACKGROUND_GREEN, BACKGROUND_RED, |
| BACKGROUND_WHITE, BACKGROUND_CYAN |
| BACKGROUND_INTENSITY |
| |
| Exemplos: |
| //Mostra a frase em letras amarelas e fundo branco |
| mostratexto(5,5,"Oi", FOREGROUND_YELLOW | BACKGROUND_WHITE); |
| |
| Retorno: |
| |
\*----------------------------------------------------------------------------*/
void mostratexto ( int x, int y, char *texto, WORD atributos )
{
HANDLE hConsole; // Handle para a janela
COORD coord = { x, y }; // Posição do cursor
DWORD dChar; // Número de caracteres impressos
//Recupera o handle da janela de console
hConsole=GetStdHandle(STD_OUTPUT_HANDLE);
//Altera os atributos da janela
SetConsoleTextAttribute (hConsole, atributos);
//Posiciona o cursor na posição indicada
SetConsoleCursorPosition( hConsole, coord );
//Imprime frase
WriteConsole (hConsole, texto, strlen(texto), &dChar, NULL);
}
/*----------------------------------------------------------------------------*\
| mostrar |
| |
| Descrição: |
| Mostra uma string em determinada posição da tela com cores diferentes. |
| |
| Parâmetros: |
| x -> coordenada horizontal. |
| y -> coordenada vertical. |
| texto -> texto a ser mostrado |
| atributos->qualquer combinação dos seguintes valores: |
| FOREGROUND_BLUE, FOREGROUND_GREEN, FOREGROUND_RED, |
| FOREGROUND_YELLOW, FOREGROUND_CYAN, FOREGROUND_WHITE |
| FOREGROUND_INTENSITY, |
| BACKGROUND_BLUE, BACKGROUND_GREEN, BACKGROUND_RED, |
| BACKGROUND_WHITE, BACKGROUND_CYAN |
| BACKGROUND_INTENSITY |
| |
| Exemplos: |
| //Mostra a frase em letras amarelas e fundo branco |
| mostratexto(5,5,"Oi", FOREGROUND_YELLOW | BACKGROUND_WHITE); |
| |
| Retorno: |
| |
\*----------------------------------------------------------------------------*/
void mostrar ( int x, int y, WORD atributos, char *texto )
{
HANDLE hConsole; // Handle para a janela
COORD coord = { x, y }; // Posição do cursor
DWORD dChar; // Número de caracteres impressos
//Recupera o handle da janela de console
hConsole=GetStdHandle(STD_OUTPUT_HANDLE);
//Altera os atributos da janela
SetConsoleTextAttribute (hConsole, atributos);
//Posiciona o cursor na posição indicada
SetConsoleCursorPosition( hConsole, coord );
//Imprime frase
WriteConsole (hConsole, texto, strlen(texto), &dChar, NULL);
}
/*----------------------------------------------------------------------------*\
| mostrar |
| |
| Descrição: |
| Mostra um long em determinada posição da tela com cores diferentes. |
| |
| Parâmetros: |
| x -> coordenada horizontal. |
| y -> coordenada vertical. |
| valor -> número a ser mostrado |
| atributos->qualquer combinação dos seguintes valores: |
| FOREGROUND_BLUE, FOREGROUND_GREEN, FOREGROUND_RED, |
| FOREGROUND_YELLOW, FOREGROUND_CYAN, FOREGROUND_WHITE |
| FOREGROUND_INTENSITY, |
| BACKGROUND_BLUE, BACKGROUND_GREEN, BACKGROUND_RED, |
| BACKGROUND_WHITE, BACKGROUND_CYAN |
| BACKGROUND_INTENSITY |
| |
| Exemplos: |
| //Mostra a frase em letras amarelas e fundo branco |
| mostratexto(5,5,"Oi", FOREGROUND_YELLOW | BACKGROUND_WHITE); |
| |
| Retorno: |
| |
\*----------------------------------------------------------------------------*/
void mostrar ( int x, int y, WORD atributos, long valor )
{
HANDLE hConsole; // Handle para a janela
COORD coord = { x, y }; // Posição do cursor
DWORD dChar; // Número de caracteres impressos
//Recupera o handle da janela de console
hConsole=GetStdHandle(STD_OUTPUT_HANDLE);
//Altera os atributos da janela
SetConsoleTextAttribute (hConsole, atributos);
//Posiciona o cursor na posição indicada
SetConsoleCursorPosition( hConsole, coord );
//Monta string
char texto[10];
ltoa(valor, texto, 10);
//Imprime frase
WriteConsole (hConsole, texto, strlen(texto), &dChar, NULL);
} | [
"[email protected]"
]
| [
[
[
1,
223
]
]
]
|
706ae0555095d9d678750bdf103b02bbad3942c4 | 12732dc8a5dd518f35c8af3f2a805806f5e91e28 | /trunk/CodeLite/calltip.h | 1121665db66b05d6d7a6f79750fd6645487d6020 | []
| no_license | BackupTheBerlios/codelite-svn | 5acd9ac51fdd0663742f69084fc91a213b24ae5c | c9efd7873960706a8ce23cde31a701520bad8861 | refs/heads/master | 2020-05-20T13:22:34.635394 | 2007-08-02T21:35:35 | 2007-08-02T21:35:35 | 40,669,327 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,677 | h | #ifndef CODELITE_CALLTIP_H
#define CODELITE_CALLTIP_H
#include "tokenizer.h"
#include "smart_ptr.h"
#ifdef WXMAKINGDLL_CODELITE
# define WXDLLIMPEXP_CL WXEXPORT
#elif defined(WXUSINGDLL_CODELITE)
# define WXDLLIMPEXP_CL WXIMPORT
#else /* not making nor using FNB as DLL */
# define WXDLLIMPEXP_CL
#endif // WXMAKINGDLL_CODELITE
/**
* A call tip function that wraps a tip strings for function prototypes.
*
* \ingroup CodeLite
* \version 1.0
* first version
*
* \date 09-18-2006
* \author Eran
*/
class WXDLLIMPEXP_CL clCallTip
{
std::vector<wxString> m_tips;
int m_curr;
public:
/**
* Constructor
* \param tips input tips
*/
clCallTip(const std::vector<wxString> & tips );
/**
* default constructor
*/
clCallTip() {}
/**
* Copy constructor
*/
clCallTip(const clCallTip& rhs);
/**
* Assignment operator
* \param rhs right hand side
* \return this
*/
clCallTip& operator=(const clCallTip& rhs);
/**
* Destructor
* \return
*/
virtual ~clCallTip(){}
/**
* Show next tip, if we are at last tip, return the first tip or empty string if no tips exists
* \return next tip
*/
wxString Next() ;
/**
* Show previous tip, if we are at first tip, return the last tip or empty string if no tips exists
* \return previous tip
*/
wxString Prev() ;
/**
* return the first tip
*/
wxString First();
/**
* Return number of tips stored in this object
* \return number of tips
*/
int Count() const;
private:
wxString TipAt(int at);
};
typedef SmartPtr<clCallTip> clCallTipPtr;
#endif // CODELITE_CALLTIP_H
| [
"eranif@b1f272c1-3a1e-0410-8d64-bdc0ffbdec4b"
]
| [
[
[
1,
87
]
]
]
|
8eb441c710634a2d96598cb68c5122bd84b33866 | f2cbdee1dfdcad7b77c597e1af5f40ad83bad4aa | /MyC++/hardwareId/test.cpp | 1cb41858cf260dd0e0a968d060c7b841471cfce0 | []
| no_license | jdouglas71/Examples | d03d9effc414965991ca5b46fbcf808a9dd6fe6d | b7829b131581ea3a62cebb2ae35571ec8263fd61 | refs/heads/master | 2021-01-18T14:23:56.900005 | 2011-04-07T19:34:04 | 2011-04-07T19:34:04 | 1,578,581 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,404 | cpp | #include <iostream.h>
#include <fstream.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <time.h>
long GetHardwareId(char* id_string);
int main(int argc, char* argv[])
{
long hardwareId = 0;
if( argc > 1 )
{
hardwareId = GetHardwareId(argv[1]);
cout << "Before converting to long: " << argv[1] << endl;
cout << "After converting: " << hex << hardwareId << endl;
}
return 0;
}
/**
* Extract the hardware Id long from the input string.
*/
long GetHardwareId(char* id_string)
{
long retval = 0;
char* hardwareIdString = 0;
//The hardware Id string must begin with "0x" since it's a hex number
//so we add it if it's not already there
if( strstr(id_string,"0x") != NULL )
{
hardwareIdString = id_string;
}
else
{
int len = strlen(id_string) + 3; //One for the terminator and two for the 0x
hardwareIdString = new char[len];
if( hardwareIdString != NULL )
{
memset( hardwareIdString, 0, len );
strcpy( hardwareIdString, "0x" );
strcat( hardwareIdString, id_string );
}
else
{
//Paranoia check
cout << "Error allocating memory. Exiting..." << endl;
return -1;
}
}
//DEBUG
//cout << "hardwareIdString: " << hardwareIdString << endl;
//DEBUG
retval = strtoul( hardwareIdString, NULL, 16 );
return retval;
}
| [
"[email protected]"
]
| [
[
[
1,
65
]
]
]
|
916386cd620d003c0973adcac584fceea28f4151 | 4b0f51aeecddecf3f57a29ffa7a184ae48f1dc61 | /CleanProject/MyGUI/include/MyGUI_Guid.h | 46befd6acca1ae076394be198ec34dc325d3d91e | []
| no_license | bahao247/apeengine2 | 56560dbf6d262364fbc0f9f96ba4231e5e4ed301 | f2617b2a42bdf2907c6d56e334c0d027fb62062d | refs/heads/master | 2021-01-10T14:04:02.319337 | 2009-08-26T08:23:33 | 2009-08-26T08:23:33 | 45,979,392 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 3,491 | h | /*!
@file
@author Albert Semenov
@date 09/2008
@module
*//*
This file is part of MyGUI.
MyGUI is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
MyGUI is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with MyGUI. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __MYGUI_GUID_H__
#define __MYGUI_GUID_H__
#include "MyGUI_Prerequest.h"
#include "MyGUI_Types.h"
namespace MyGUI
{
class MYGUI_EXPORT Guid
{
public:
Guid() { fast._data1 = fast._data2 = fast._data3 = fast._data4 = 0; }
Guid( Guid const & _value ) { *this = _value; }
explicit Guid(const std::string& _value) { *this = parse(_value); }
explicit Guid(unsigned char(&_id)[16]) { ::memcpy((void*)&vec._data1[0], (void*)&_id[0], 16); }
bool operator == (Guid const & _comp) const
{
return _comp.fast._data1 == fast._data1
&& _comp.fast._data2 == fast._data2
&& _comp.fast._data3 == fast._data3
&& _comp.fast._data4 == fast._data4;
}
bool operator != ( Guid const & _comp ) const
{
return ! (*this == _comp);
}
bool operator < ( Guid const & _comp ) const
{
if (_comp.fast._data1 < fast._data1) return true;
else if (_comp.fast._data1 > fast._data1) return false;
if (_comp.fast._data2 < fast._data2) return true;
else if (_comp.fast._data2 > fast._data2) return false;
if (_comp.fast._data3 < fast._data3) return true;
else if (_comp.fast._data3 > fast._data3) return false;
if (_comp.fast._data4 < fast._data4) return true;
return false;
}
Guid & operator = (Guid const & _rvalue)
{
fast._data1 = _rvalue.fast._data1;
fast._data2 = _rvalue.fast._data2;
fast._data3 = _rvalue.fast._data3;
fast._data4 = _rvalue.fast._data4;
return *this;
}
bool empty() const
{
return fast._data1 == 0
&& fast._data2 == 0
&& fast._data3 == 0
&& fast._data4 == 0;
}
void clear()
{
fast._data1 = fast._data2 = fast._data3 = fast._data4 = 0;
}
std::string print() const;
static Guid parse(const std::string& _value);
static Guid generate();
friend std::ostream& operator << ( std::ostream& _stream, const Guid & _value )
{
_stream << _value.print();
return _stream;
}
friend std::istream& operator >> ( std::istream& _stream, Guid & _value )
{
std::string value;
_stream >> value;
if (_stream.fail()) _value.clear();
else _value = Guid::parse(value);
return _stream;
}
private:
// массив для быстрой конвертации
static const char convert_hex[64];
struct _original {
uint32 data1;
uint16 data2, data3;
uint8 data4[8];
};
struct _fast {
uint32 _data1, _data2, _data3, _data4;
};
struct _vec {
unsigned char _data1[16];
};
union {
_original original;
_fast fast;
_vec vec;
};
};
} // namespace MyGUI
#endif // __MYGUI_GUID_H__
| [
"pablosn@06488772-1f9a-11de-8b5c-13accb87f508"
]
| [
[
[
1,
131
]
]
]
|
b6c1f3813b913d4eeb6c89d5cb475037868f2147 | 9ef88cf6a334c82c92164c3f8d9f232d07c37fc3 | /Libraries/RakNet/include/ReliabilityLayer.h | 85b22886a3d0330cbb228eff7428819659beea8e | []
| no_license | Gussoh/bismuthengine | eba4f1d6c2647d4b73d22512405da9d7f4bde88a | 4a35e7ae880cebde7c557bd8c8f853a9a96f5c53 | refs/heads/master | 2016-09-05T11:28:11.194130 | 2010-01-10T14:09:24 | 2010-01-10T14:09:24 | 33,263,368 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 23,877 | h | /// \file
/// \brief \b [Internal] Datagram reliable, ordered, unordered and sequenced sends. Flow control. Message splitting, reassembly, and coalescence.
///
/// This file is part of RakNet Copyright 2003 Jenkins Software LLC
///
/// Usage of RakNet is subject to the appropriate license agreement.
/// Creative Commons Licensees are subject to the
/// license found at
/// http://creativecommons.org/licenses/by-nc/2.5/
/// Single application licensees are subject to the license found at
/// http://www.jenkinssoftware.com/SingleApplicationLicense.html
/// Custom license users are subject to the terms therein.
/// GPL license users are subject to the GNU General Public
/// License as published by the Free
/// Software Foundation; either version 2 of the License, or (at your
/// option) any later version.
#ifndef __RELIABILITY_LAYER_H
#define __RELIABILITY_LAYER_H
#include "RakMemoryOverride.h"
#include "MTUSize.h"
#include "DS_LinkedList.h"
#include "DS_List.h"
#include "SocketLayer.h"
#include "PacketPriority.h"
#include "DS_Queue.h"
#include "BitStream.h"
#include "InternalPacket.h"
#include "DataBlockEncryptor.h"
#include "RakNetStatistics.h"
#include "SHA1.h"
#include "DS_OrderedList.h"
#include "DS_RangeList.h"
#include "DS_BPlusTree.h"
#include "DS_MemoryPool.h"
#include "CCRakNetUDT.h"
#include "DS_Multilist.h"
#include "RakNetDefines.h"
#include "DS_Heap.h"
class PluginInterface2;
class RakNetRandom;
typedef uint64_t reliabilityHeapWeightType;
/// Number of ordered streams available. You can use up to 32 ordered streams
#define NUMBER_OF_ORDERED_STREAMS 32 // 2^5
#define RESEND_TREE_ORDER 32
#include "BitStream.h"
// int SplitPacketIndexComp( SplitPacketIndexType const &key, InternalPacket* const &data );
struct SplitPacketChannel//<SplitPacketChannel>
{
CCTimeType lastUpdateTime;
// This is here for progress notifications, since progress notifications return the first packet data, if available
InternalPacket *firstPacket;
// DataStructures::OrderedList<SplitPacketIndexType, InternalPacket*, SplitPacketIndexComp> splitPacketList;
DataStructures::List<InternalPacket*> splitPacketList;
};
int RAK_DLL_EXPORT SplitPacketChannelComp( SplitPacketIdType const &key, SplitPacketChannel* const &data );
/// Datagram reliable, ordered, unordered and sequenced sends. Flow control. Message splitting, reassembly, and coalescence.
class ReliabilityLayer//<ReliabilityLayer>
{
public:
// Constructor
ReliabilityLayer();
// Destructor
~ReliabilityLayer();
/// Resets the layer for reuse
void Reset( bool resetVariables, int MTUSize );
///Sets the encryption key. Doing so will activate secure connections
/// \param[in] key Byte stream for the encryption key
void SetEncryptionKey( const unsigned char *key );
/// Set the time, in MS, to use before considering ourselves disconnected after not being able to deliver a reliable packet
/// Default time is 10,000 or 10 seconds in release and 30,000 or 30 seconds in debug.
/// \param[in] time Time, in MS
void SetTimeoutTime( RakNetTimeMS time );
/// Returns the value passed to SetTimeoutTime. or the default if it was never called
/// \param[out] the value passed to SetTimeoutTime
RakNetTimeMS GetTimeoutTime(void);
/// Packets are read directly from the socket layer and skip the reliability layer because unconnected players do not use the reliability layer
/// This function takes packet data after a player has been confirmed as connected.
/// \param[in] buffer The socket data
/// \param[in] length The length of the socket data
/// \param[in] systemAddress The player that this data is from
/// \param[in] messageHandlerList A list of registered plugins
/// \param[in] MTUSize maximum datagram size
/// \retval true Success
/// \retval false Modified packet
bool HandleSocketReceiveFromConnectedPlayer(
const char *buffer, unsigned int length, SystemAddress systemAddress, DataStructures::List<PluginInterface2*> &messageHandlerList, int MTUSize,
SOCKET s, RakNetRandom *rnr, unsigned short remotePortRakNetWasStartedOn_PS3, CCTimeType timeRead);
/// This allocates bytes and writes a user-level message to those bytes.
/// \param[out] data The message
/// \return Returns number of BITS put into the buffer
BitSize_t Receive( unsigned char**data );
/// Puts data on the send queue
/// \param[in] data The data to send
/// \param[in] numberOfBitsToSend The length of \a data in bits
/// \param[in] priority The priority level for the send
/// \param[in] reliability The reliability type for the send
/// \param[in] orderingChannel 0 to 31. Specifies what channel to use, for relational ordering and sequencing of packets.
/// \param[in] makeDataCopy If true \a data will be copied. Otherwise, only a pointer will be stored.
/// \param[in] MTUSize maximum datagram size
/// \param[in] currentTime Current time, as per RakNet::GetTime()
/// \return True or false for success or failure.
bool Send( char *data, BitSize_t numberOfBitsToSend, PacketPriority priority, PacketReliability reliability, unsigned char orderingChannel, bool makeDataCopy, int MTUSize, CCTimeType currentTime );
/// Call once per game cycle. Handles internal lists and actually does the send.
/// \param[in] s the communication end point
/// \param[in] systemAddress The Unique Player Identifier who shouldhave sent some packets
/// \param[in] MTUSize maximum datagram size
/// \param[in] time current system time
/// \param[in] maxBitsPerSecond if non-zero, enforces that outgoing bandwidth does not exceed this amount
/// \param[in] messageHandlerList A list of registered plugins
void Update( SOCKET s, SystemAddress systemAddress, int MTUSize, CCTimeType time,
unsigned bitsPerSecondLimit,
DataStructures::List<PluginInterface2*> &messageHandlerList,
RakNetRandom *rnr, unsigned short remotePortRakNetWasStartedOn_PS3);
/// If Read returns -1 and this returns true then a modified packetwas detected
/// \return true when a modified packet is detected
bool IsCheater( void ) const;
/// Were you ever unable to deliver a packet despite retries?
/// \return true means the connection has been lost. Otherwise not.
bool IsDeadConnection( void ) const;
/// Causes IsDeadConnection to return true
void KillConnection(void);
/// Get Statistics
/// \return A pointer to a static struct, filled out with current statistical information.
RakNetStatistics * const GetStatistics( RakNetStatistics *rns );
///Are we waiting for any data to be sent out or be processed by the player?
bool IsOutgoingDataWaiting(void);
bool AreAcksWaiting(void);
// Set outgoing lag and packet loss properties
void ApplyNetworkSimulator( double _maxSendBPS, RakNetTime _minExtraPing, RakNetTime _extraPingVariance );
/// Returns if you previously called ApplyNetworkSimulator
/// \return If you previously called ApplyNetworkSimulator
bool IsNetworkSimulatorActive( void );
void SetSplitMessageProgressInterval(int interval);
void SetUnreliableTimeout(RakNetTimeMS timeoutMS);
/// Has a lot of time passed since the last ack
bool AckTimeout(RakNetTimeMS curTime);
CCTimeType GetNextSendTime(void) const;
CCTimeType GetTimeBetweenPackets(void) const;
CCTimeType GetAckPing(void) const;
// If true, will update time between packets quickly based on ping calculations
//void SetDoFastThroughputReactions(bool fast);
// Encoded as numMessages[unsigned int], message1BitLength[unsigned int], message1Data (aligned), ...
//void GetUndeliveredMessages(RakNet::BitStream *messages, int MTUSize);
private:
/// Send the contents of a bitstream to the socket
/// \param[in] s The socket used for sending data
/// \param[in] systemAddress The address and port to send to
/// \param[in] bitStream The data to send.
void SendBitStream( SOCKET s, SystemAddress systemAddress, RakNet::BitStream *bitStream, RakNetRandom *rnr, unsigned short remotePortRakNetWasStartedOn_PS3);
///Parse an internalPacket and create a bitstream to represent this data
/// \return Returns number of bits used
BitSize_t WriteToBitStreamFromInternalPacket( RakNet::BitStream *bitStream, const InternalPacket *const internalPacket, CCTimeType curTime );
/// Parse a bitstream and create an internal packet to represent this data
InternalPacket* CreateInternalPacketFromBitStream( RakNet::BitStream *bitStream, CCTimeType time );
/// Does what the function name says
unsigned RemovePacketFromResendListAndDeleteOlderReliableSequenced( const MessageNumberType messageNumber, CCTimeType time, DataStructures::List<PluginInterface2*> &messageHandlerList, SystemAddress systemAddress );
/// Acknowledge receipt of the packet with the specified messageNumber
void SendAcknowledgementPacket( const DatagramSequenceNumberType messageNumber, CCTimeType time);
/// This will return true if we should not send at this time
bool IsSendThrottled( int MTUSize );
/// We lost a packet
void UpdateWindowFromPacketloss( CCTimeType time );
/// Increase the window size
void UpdateWindowFromAck( CCTimeType time );
/// Parse an internalPacket and figure out how many header bits would be written. Returns that number
BitSize_t GetMaxMessageHeaderLengthBits( void );
BitSize_t GetMessageHeaderLengthBits( const InternalPacket *const internalPacket );
/// Get the SHA1 code
void GetSHA1( unsigned char * const buffer, unsigned int nbytes, char code[ SHA1_LENGTH ] );
/// Check the SHA1 code
bool CheckSHA1( char code[ SHA1_LENGTH ], unsigned char * const buffer, unsigned int nbytes );
/// Search the specified list for sequenced packets on the specified ordering channel, optionally skipping those with splitPacketId, and delete them
void DeleteSequencedPacketsInList( unsigned char orderingChannel, DataStructures::List<InternalPacket*>&theList, int splitPacketId = -1 );
/// Search the specified list for sequenced packets with a value less than orderingIndex and delete them
void DeleteSequencedPacketsInList( unsigned char orderingChannel, DataStructures::Queue<InternalPacket*>&theList );
/// Returns true if newPacketOrderingIndex is older than the waitingForPacketOrderingIndex
bool IsOlderOrderedPacket( OrderingIndexType newPacketOrderingIndex, OrderingIndexType waitingForPacketOrderingIndex );
/// Split the passed packet into chunks under MTU_SIZE bytes (including headers) and save those new chunks
void SplitPacket( InternalPacket *internalPacket );
/// Insert a packet into the split packet list
void InsertIntoSplitPacketList( InternalPacket * internalPacket, CCTimeType time );
/// Take all split chunks with the specified splitPacketId and try to reconstruct a packet. If we can, allocate and return it. Otherwise return 0
InternalPacket * BuildPacketFromSplitPacketList( SplitPacketIdType splitPacketId, CCTimeType time,
SOCKET s, SystemAddress systemAddress, RakNetRandom *rnr, unsigned short remotePortRakNetWasStartedOn_PS3);
InternalPacket * BuildPacketFromSplitPacketList( SplitPacketChannel *splitPacketChannel, CCTimeType time );
/// Delete any unreliable split packets that have long since expired
//void DeleteOldUnreliableSplitPackets( CCTimeType time );
/// Creates a copy of the specified internal packet with data copied from the original starting at dataByteOffset for dataByteLength bytes.
/// Does not copy any split data parameters as that information is always generated does not have any reason to be copied
InternalPacket * CreateInternalPacketCopy( InternalPacket *original, int dataByteOffset, int dataByteLength, CCTimeType time );
/// Get the specified ordering list
DataStructures::LinkedList<InternalPacket*> *GetOrderingListAtOrderingStream( unsigned char orderingChannel );
/// Add the internal packet to the ordering list in order based on order index
void AddToOrderingList( InternalPacket * internalPacket );
/// Inserts a packet into the resend list in order
void InsertPacketIntoResendList( InternalPacket *internalPacket, CCTimeType time, bool firstResend, bool modifyUnacknowledgedBytes );
/// Memory handling
void FreeMemory( bool freeAllImmediately );
/// Memory handling
void FreeThreadedMemory( void );
/// Memory handling
void FreeThreadSafeMemory( void );
// Initialize the variables
void InitializeVariables( int MTUSize );
/// Given the current time, is this time so old that we should consider it a timeout?
bool IsExpiredTime(unsigned int input, CCTimeType currentTime) const;
// Make it so we don't do resends within a minimum threshold of time
void UpdateNextActionTime(void);
/// Does this packet number represent a packet that was skipped (out of order?)
//unsigned int IsReceivedPacketHole(unsigned int input, RakNetTime currentTime) const;
/// Skip an element in the received packets list
//unsigned int MakeReceivedPacketHole(unsigned int input) const;
/// How many elements are waiting to be resent?
unsigned int GetResendListDataSize(void) const;
/// Update all memory which is not threadsafe
void UpdateThreadedMemory(void);
void CalculateHistogramAckSize(void);
// Used ONLY for RELIABLE_ORDERED
// RELIABLE_SEQUENCED just returns the newest one
DataStructures::List<DataStructures::LinkedList<InternalPacket*>*> orderingList;
DataStructures::Queue<InternalPacket*> outputQueue;
int splitMessageProgressInterval;
CCTimeType unreliableTimeout;
struct MessageNumberNode
{
DatagramSequenceNumberType messageNumber;
MessageNumberNode *next;
};
struct DatagramHistoryNode
{
DatagramHistoryNode() {}
DatagramHistoryNode(MessageNumberNode *_head) :
head(_head) {}
MessageNumberNode *head;
};
// Queue length is programmatically restricted to DATAGRAM_MESSAGE_ID_ARRAY_LENGTH
// This is essentially an O(1) lookup to get a DatagramHistoryNode given an index
DataStructures::Queue<DatagramHistoryNode> datagramHistory;
DataStructures::MemoryPool<MessageNumberNode> datagramHistoryMessagePool;
void RemoveFromDatagramHistory(DatagramSequenceNumberType index);
MessageNumberNode* GetMessageNumberNodeByDatagramIndex(DatagramSequenceNumberType index);
void AddFirstToDatagramHistory(DatagramSequenceNumberType datagramNumber);
MessageNumberNode* AddFirstToDatagramHistory(DatagramSequenceNumberType datagramNumber, DatagramSequenceNumberType messageNumber);
MessageNumberNode* AddSubsequentToDatagramHistory(MessageNumberNode *messageNumberNode, DatagramSequenceNumberType messageNumber);
DatagramSequenceNumberType datagramHistoryPopCount;
DataStructures::MemoryPool<InternalPacket> internalPacketPool;
// DataStructures::BPlusTree<DatagramSequenceNumberType, InternalPacket*, RESEND_TREE_ORDER> resendTree;
InternalPacket *resendBuffer[RESEND_BUFFER_ARRAY_LENGTH];
InternalPacket *resendLinkedListHead;
InternalPacket *unreliableLinkedListHead;
void RemoveFromUnreliableLinkedList(InternalPacket *internalPacket);
void AddToUnreliableLinkedList(InternalPacket *internalPacket);
unsigned int numPacketsOnResendBuffer;
//unsigned int blockWindowIncreaseUntilTime;
// DataStructures::RangeList<DatagramSequenceNumberType> acknowlegements;
// Resend list is a tree of packets we need to resend
// Set to the current time when the resend queue is no longer empty
// Set to zero when it becomes empty
// Set to the current time if it is not zero, and we get incoming data
// If the current time - timeResendQueueNonEmpty is greater than a threshold, we are disconnected
CCTimeType timeResendQueueNonEmpty;
// If we backoff due to packetloss, don't remeasure until all waiting resends have gone out or else we overcount
// bool packetlossThisSample;
// int backoffThisSample;
// unsigned packetlossThisSampleResendCount;
// CCTimeType lastPacketlossTime;
//DataStructures::Queue<InternalPacket*> sendPacketSet[ NUMBER_OF_PRIORITIES ];
DataStructures::Heap<reliabilityHeapWeightType, InternalPacket*, false> outgoingPacketBuffer;
reliabilityHeapWeightType outgoingPacketBufferNextWeights[NUMBER_OF_PRIORITIES];
void InitHeapWeights(void);
reliabilityHeapWeightType GetNextWeight(int priorityLevel);
unsigned int messageInSendBuffer[NUMBER_OF_PRIORITIES];
DataStructures::OrderedList<SplitPacketIdType, SplitPacketChannel*, SplitPacketChannelComp> splitPacketChannelList;
MessageNumberType sendReliableMessageNumberIndex, internalOrderIndex;
//unsigned int windowSize;
RakNet::BitStream updateBitStream;
OrderingIndexType waitingForOrderedPacketWriteIndex[ NUMBER_OF_ORDERED_STREAMS ], waitingForSequencedPacketWriteIndex[ NUMBER_OF_ORDERED_STREAMS ];
// STUFF TO NOT MUTEX HERE (called from non-conflicting threads, or value is not important)
OrderingIndexType waitingForOrderedPacketReadIndex[ NUMBER_OF_ORDERED_STREAMS ], waitingForSequencedPacketReadIndex[ NUMBER_OF_ORDERED_STREAMS ];
bool deadConnection, cheater;
// unsigned int lastPacketSendTime,retransmittedFrames, sentPackets, sentFrames, receivedPacketsCount, bytesSent, bytesReceived,lastPacketReceivedTime;
SplitPacketIdType splitPacketId;
RakNetTimeMS timeoutTime; // How long to wait in MS before timing someone out
//int MAX_AVERAGE_PACKETS_PER_SECOND; // Name says it all
// int RECEIVED_PACKET_LOG_LENGTH, requestedReceivedPacketLogLength; // How big the receivedPackets array is
// unsigned int *receivedPackets;
RakNetStatistics statistics;
// CCTimeType histogramStart;
// unsigned histogramBitsSent;
/// Memory-efficient receivedPackets algorithm:
/// receivedPacketsBaseIndex is the packet number we are expecting
/// Everything under receivedPacketsBaseIndex is a packet we already got
/// Everything over receivedPacketsBaseIndex is stored in hasReceivedPacketQueue
/// It stores the time to stop waiting for a particular packet number, where the packet number is receivedPacketsBaseIndex + the index into the queue
/// If 0, we got got that packet. Otherwise, the time to give up waiting for that packet.
/// If we get a packet number where (receivedPacketsBaseIndex-packetNumber) is less than half the range of receivedPacketsBaseIndex then it is a duplicate
/// Otherwise, it is a duplicate packet (and ignore it).
// DataStructures::Queue<CCTimeType> hasReceivedPacketQueue;
DataStructures::Queue<bool> hasReceivedPacketQueue;
DatagramSequenceNumberType receivedPacketsBaseIndex;
bool resetReceivedPackets;
CCTimeType lastUpdateTime;
CCTimeType timeBetweenPackets, nextSendTime, ackPing;
// CCTimeType ackPingSamples[ACK_PING_SAMPLES_SIZE]; // Must be range of unsigned char to wrap ackPingIndex properly
CCTimeType ackPingSum;
unsigned char ackPingIndex;
//CCTimeType nextLowestPingReset;
RemoteSystemTimeType remoteSystemTime;
// bool continuousSend;
// CCTimeType lastTimeBetweenPacketsIncrease,lastTimeBetweenPacketsDecrease;
// Limit changes in throughput to once per ping - otherwise even if lag starts we don't know about it
// In the meantime the connection is flooded and overrun.
CCTimeType nextAllowedThroughputSample;
bool bandwidthExceededStatistic;
// If Update::maxBitsPerSecond > 0, then throughputCapCountdown is used as a timer to prevent sends for some amount of time after each send, depending on
// the amount of data sent
long long throughputCapCountdown;
DataBlockEncryptor encryptor;
unsigned receivePacketCount;
///This variable is so that free memory can be called by only the update thread so we don't have to mutex things so much
bool freeThreadedMemoryOnNextUpdate;
//long double timeBetweenPacketsIncreaseMultiplier, timeBetweenPacketsDecreaseMultiplier;
#ifdef _DEBUG
struct DataAndTime//<InternalPacket>
{
SOCKET s;
char data[ MAXIMUM_MTU_SIZE ];
unsigned int length;
RakNetTimeMS sendTime;
SystemAddress systemAddress;
unsigned short remotePortRakNetWasStartedOn_PS3;
};
DataStructures::Queue<DataAndTime*> delayList;
// Internet simulator
double packetloss;
RakNetTimeMS minExtraPing, extraPingVariance;
#endif
CCTimeType elapsedTimeSinceLastUpdate;
CCTimeType nextAckTimeToSend;
RakNet::CCRakNetUDT congestionManager;
uint32_t unacknowledgedBytes;
CCTimeType resetHistogramTime;
uint32_t bytesReceivedThisHistogram, bytesSentThisHistogram, bytesReceivedLastHistogram, bytesSentLastHistogram;
bool ResendBufferOverflow(void) const;
void ValidateResendList(void) const;
void ResetPacketsAndDatagrams(void);
void PushPacket(CCTimeType time, InternalPacket *internalPacket, bool isReliable);
void PushDatagram(void);
bool TagMostRecentPushAsSecondOfPacketPair(void);
void ClearPacketsAndDatagrams(void);
void MoveToListHead(InternalPacket *internalPacket);
void RemoveFromList(InternalPacket *internalPacket, bool modifyUnacknowledgedBytes);
void AddToListTail(InternalPacket *internalPacket, bool modifyUnacknowledgedBytes);
void PopListHead(bool modifyUnacknowledgedBytes);
bool IsResendQueueEmpty(void) const;
void SortSplitPacketList(DataStructures::List<InternalPacket*> &data, unsigned int leftEdge, unsigned int rightEdge) const;
void SendACKs(SOCKET s, SystemAddress systemAddress, CCTimeType time, RakNetRandom *rnr, unsigned short remotePortRakNetWasStartedOn_PS3);
DataStructures::List<InternalPacket*> packetsToSendThisUpdate;
DataStructures::List<bool> packetsToDeallocThisUpdate;
// boundary is in packetsToSendThisUpdate, inclusive
DataStructures::List<unsigned int> packetsToSendThisUpdateDatagramBoundaries;
DataStructures::List<bool> datagramsToSendThisUpdateIsPair;
DataStructures::List<unsigned int> datagramSizesInBytes;
BitSize_t datagramSizeSoFar;
BitSize_t allDatagramSizesSoFar;
double totalUserDataBytesAcked;
CCTimeType timeOfLastContinualSend;
CCTimeType timeToNextUnreliableCull;
// This doesn't need to be a member, but I do it to avoid reallocations
DataStructures::RangeList<DatagramSequenceNumberType> incomingAcks;
// Every 16 datagrams, we make sure the 17th datagram goes out the same update tick, and is the same size as the 16th
int countdownToNextPacketPair;
InternalPacket* AllocateFromInternalPacketPool(void);
void ReleaseToInternalPacketPool(InternalPacket *ip);
DataStructures::RangeList<DatagramSequenceNumberType> acknowlegements;
DataStructures::RangeList<DatagramSequenceNumberType> NAKs;
unsigned int GetMaxDatagramSizeExcludingMessageHeaderBytes(void);
BitSize_t GetMaxDatagramSizeExcludingMessageHeaderBits(void);
// ourOffset refers to a section within externallyAllocatedPtr. Do not deallocate externallyAllocatedPtr until all references are lost
void AllocInternalPacketData(InternalPacket *internalPacket, InternalPacketRefCountedData **refCounter, unsigned char *externallyAllocatedPtr, unsigned char *ourOffset);
// Set the data pointer to externallyAllocatedPtr, do not allocate
void AllocInternalPacketData(InternalPacket *internalPacket, unsigned char *externallyAllocatedPtr);
// Allocate new
void AllocInternalPacketData(InternalPacket *internalPacket, unsigned int numBytes, const char *file, unsigned int line);
void FreeInternalPacketData(InternalPacket *internalPacket, const char *file, unsigned int line);
DataStructures::MemoryPool<InternalPacketRefCountedData> refCountedDataPool;
void InitPacketlossTracker(void);
void AddToBitsRecentlySent(int b);
void AddToBitsRecentlyResent(int b);
float GetContinuousPacketloss(void);
// Positive = sent, negative = resent
int bitsRecentlySent[512];
unsigned short bitTrackerWriteIndex;
BitSize_t bitsRecentlySentSum;
BitSize_t bitsRecentlyResentSum;
};
#endif
| [
"[email protected]@aefdbfa2-c794-11de-8410-e5b1e99fc78e"
]
| [
[
[
1,
500
]
]
]
|
153623e4be3aa0ceef33589a193093dcf63574a9 | 05869e5d7a32845b306353bdf45d2eab70d5eddc | /soft/application/thirdpartylibs/jwidgets/src/jddex_image.cpp | 670494664098a1069f4ddd6d15fb075709ae4c3e | []
| no_license | shenfahsu/sc-fix | beb9dc8034f2a8fd9feb384155fa01d52f3a4b6a | ccc96bfaa3c18f68c38036cf68d3cb34ca5b40cd | refs/heads/master | 2020-07-14T16:13:47.424654 | 2011-07-22T16:46:45 | 2011-07-22T16:46:45 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,964 | cpp | /***************************************************************************
*
* File Name : jdd_image.cpp
*
* IMPORTANT NOTICE
*
* Please note that any and all title and/or intellectual property rights
* in and to this Software or any part of this (including without limitation
* any images, photographs, animations, video, audio, music, text and/or
* "applets," incorporated into the Software), herein mentioned to as
* "Software", the accompanying printed materials, and any copies of the
* Software, are owned by Jataayu Software (P) Ltd., Bangalore ("Jataayu")
* or Jataayu's suppliers as the case may be. The Software is protected by
* copyright, including without limitation by applicable copyright laws,
* international treaty provisions, other intellectual property laws and
* applicable laws in the country in which the Software is being used.
* You shall not modify, adapt or translate the Software, without prior
* express written consent from Jataayu. You shall not reverse engineer,
* decompile, disassemble or otherwise alter the Software, except and
* only to the extent that such activity is expressly permitted by
* applicable law notwithstanding this limitation. Unauthorized reproduction
* or redistribution of this program or any portion of it may result in severe
* civil and criminal penalties and will be prosecuted to the maximum extent
* possible under the law. Jataayu reserves all rights not expressly granted.
*
* THIS SOFTWARE IS PROVIDED TO YOU "AS IS" WITHOUT WARRANTY OF ANY KIND
* AND ANY AND ALL REPRESENTATION
*
***************************************************************************
*
*
* File Description
* ----------------
*
* Purpose : Implimentation for image control
*
* Created By :
* Created Date :
*
*
*
* Current Revision :
*
***************************************************************************
*
*
* Revision Details
* ----------------
*
* 1. Modified By :
* Modified Date :
* Purpose :
*
*
*
*
***************************************************************************/
#include "jddex_platformdefines.h"
#include "jddex_image.h"
#include "jddex_platform.h"
#include "jddex_int.h"
#include "jddex_wnddefaults.h"
#include "jddex_platform.h"
#include <jddex_animationinterface.h>
#include "jddex_wingtech.h"
/**
* @brief default constructor
* @retval None
* initliazes the class members
*/
jddex_image::jddex_image()
{
}
/**
* @brief constructor
* @param[in] poParentHwnd Handle of parent window
* @param[in] pstRect control co-ordinates
* @param[in] pstCtrlProperty pointer to JC_CONTROL_PROPERTIES
* @retval None
*
* Calls the base class (widget class) constructor and initliazes
* class members
*/
jddex_image::jddex_image(jddex_widget *poParentHwnd,JC_RECT *pstRect,
JC_CONTROL_PROPERTIES* pstCtrlProperty,JC_BOOLEAN* pIsSucess,
JC_CHAR* pmTempImageFile)
:jddex_widget(poParentHwnd,pstRect, pstCtrlProperty)
{
m_eControlType = E_IMAGE;
m_uiAnimHnd = 0;
m_pvGifFrameBuff = NULL;
m_uiAnimPlayInitiated = E_FALSE;
JC_RECT stAbsRect;
JC_RETCODE rCode = JC_OK;
GetAbsRect(&stAbsRect);
jc_memcpy(&m_stObjectInfo, &pstCtrlProperty->typeOfControl.object,sizeof(JC_OBJECT_INFO));
m_pvDecodedBuff = NULL;
m_eImageProperty = E_IMAGE_NORMAL;
if(rCode == JC_OK)
{
*pIsSucess = E_TRUE;
}
else
{
*pIsSucess = E_FALSE;
}
m_pmTempImageFile = pmTempImageFile;
}
/**
* @brief constructor
* @param[in] poParentHwnd Handle of parent window
* @param[in] pstRect control co-ordinates
* @param[in] pstImageInfo pointer to object
* @retval None
*
* Calls the base class (widget class) constructor and initliazes
* class members
*/
jddex_image::jddex_image(jddex_widget *poParentHwnd,JC_RECT *pstRect,
JC_OBJECT_INFO* pstImageInfo, EImageProperty eImageProperty,
JC_BOOLEAN* pIsSucess,JC_CHAR* pmTempImageFile )
:jddex_widget(poParentHwnd,pstRect)
{
JC_RECT stAbsRect;
JC_RETCODE rCode = JC_OK;
m_eControlType = E_IMAGE;
jc_memcpy(&m_stObjectInfo, pstImageInfo ,sizeof(JC_OBJECT_INFO));
m_pvDecodedBuff = NULL;
m_uiAnimHnd = 0;
m_pvGifFrameBuff = NULL;
m_uiAnimPlayInitiated = E_FALSE;
GetAbsRect(&stAbsRect);
m_eImageProperty = eImageProperty;
if(rCode == JC_OK)
{
*pIsSucess = E_TRUE;
}
else
{
*pIsSucess = E_FALSE;
}
m_pmTempImageFile = pmTempImageFile;
}
/**
* @brief destructor
* @retval None
* frees all the resources allocated
*/
jddex_image::~jddex_image()
{
if ( JC_NULL != m_pvDecodedBuff )
{
jdd_MemFree(m_pvDecodedBuff) ;
m_pvDecodedBuff = JC_NULL;
}
if(m_pmTempImageFile)
{
jdd_FSDelete(NULL, m_pmTempImageFile);
jdd_MemFree(m_pmTempImageFile);
}
if(m_uiAnimHnd)
{
gdi_image_stop_animation((gdi_handle)m_uiAnimHnd);
m_uiAnimHnd = 0;
}
}
/**
* @brief dispalys a image control
* @retval None
* displays the image based on its state
*/
void jddex_image::Show()
{
JC_RECT stAbsRect;
JC_RECT stTempRect;
GetAbsRect(&stAbsRect);
mmi_trace(1,(PCSTR)"jddex_image::Show x[%d]y[%d]w[%d]h[%d] ", \
stAbsRect.iLeft,stAbsRect.iTop,
stAbsRect.uiWidth,stAbsRect.uiHeight);
if(m_bIsSelectable && m_bIsFocussed)
{
stTempRect = stAbsRect ;
stTempRect.iLeft -= 1 ;
stTempRect.iTop -= 1 ;
stTempRect.uiWidth += 2 ;
stTempRect.uiHeight += 2 ;
jddex_DrawFormattedRect(&stTempRect,JDDEX_DEFAULT_BLUE,
JDDEX_DEFAULT_WHITE,JDDEX_IMAGE_BORDER_WIDTH );
}
jddex_DrawFormattedImage(m_stObjectInfo, &stAbsRect, E_IMAGE_NORMAL, \
m_pmTempImageFile, &m_uiAnimHnd);
}
/**
* @brief returns the image property
* @retval None
* returns the image property set while creating image control
*/
EImageProperty jddex_image::GetImageProperty()
{
return m_eImageProperty;
}
| [
"windyin@2490691b-6763-96f4-2dba-14a298306784"
]
| [
[
[
1,
220
]
]
]
|
a28c876fbeb63aa85d02c914f51baa951e208ff3 | 8bbbcc2bd210d5608613c5c591a4c0025ac1f06b | /nes/mapper/100.cpp | adfc8eecaddb5d86bb1518c4f845fd327a094489 | []
| no_license | PSP-Archive/NesterJ-takka | 140786083b1676aaf91d608882e5f3aaa4d2c53d | 41c90388a777c63c731beb185e924820ffd05f93 | refs/heads/master | 2023-04-16T11:36:56.127438 | 2008-12-07T01:39:17 | 2008-12-07T01:39:17 | 357,617,280 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,768 | cpp |
/////////////////////////////////////////////////////////////////////
// Mapper 100
void NES_mapper100_Init()
{
g_NESmapper.Reset = NES_mapper100_Reset;
g_NESmapper.MemoryWrite = NES_mapper100_MemoryWrite;
g_NESmapper.HSync = NES_mapper100_HSync;
}
void NES_mapper100_Reset()
{
int i;
// clear registers FIRST!!!
for(i = 0; i < 8; i++) g_NESmapper.Mapper100.regs[i] = 0x00;
// set CPU bank pointers
g_NESmapper.Mapper100.prg0 = 0;
g_NESmapper.Mapper100.prg1 = 1;
g_NESmapper.Mapper100.prg2 = g_NESmapper.num_8k_ROM_banks - 2;
g_NESmapper.Mapper100.prg3 = g_NESmapper.num_8k_ROM_banks - 1;
NES_mapper100_MMC3_set_CPU_banks();
// set VROM banks
if(g_NESmapper.num_1k_VROM_banks)
{
g_NESmapper.Mapper100.chr0 = 0;
g_NESmapper.Mapper100.chr1 = 1;
g_NESmapper.Mapper100.chr2 = 2;
g_NESmapper.Mapper100.chr3 = 3;
g_NESmapper.Mapper100.chr4 = 4;
g_NESmapper.Mapper100.chr5 = 5;
g_NESmapper.Mapper100.chr6 = 6;
g_NESmapper.Mapper100.chr7 = 7;
NES_mapper100_MMC3_set_PPU_banks();
}
else
{
g_NESmapper.Mapper100.chr0 = g_NESmapper.Mapper100.chr2 = g_NESmapper.Mapper100.chr4 = g_NESmapper.Mapper100.chr5 = g_NESmapper.Mapper100.chr6 = g_NESmapper.Mapper100.chr7 = 0;
g_NESmapper.Mapper100.chr1 = g_NESmapper.Mapper100.chr3 = 1;
}
g_NESmapper.Mapper100.irq_enabled = 0;
g_NESmapper.Mapper100.irq_counter = 0;
g_NESmapper.Mapper100.irq_latch = 0;
}
void NES_mapper100_MemoryWrite(uint32 addr, uint8 data)
{
switch(addr & 0xE001)
{
case 0x8000:
{
g_NESmapper.Mapper100.regs[0] = data;
}
break;
case 0x8001:
{
uint32 bank_num;
g_NESmapper.Mapper100.regs[1] = data;
bank_num = g_NESmapper.Mapper100.regs[1];
switch(g_NESmapper.Mapper100.regs[0] & 0xC7)
{
case 0x00:
{
if(g_NESmapper.num_1k_VROM_banks)
{
bank_num &= 0xfe;
g_NESmapper.Mapper100.chr0 = bank_num;
g_NESmapper.Mapper100.chr1 = bank_num + 1;
NES_mapper100_MMC3_set_PPU_banks();
}
}
break;
case 0x01:
{
if(g_NESmapper.num_1k_VROM_banks)
{
bank_num &= 0xfe;
g_NESmapper.Mapper100.chr2 = bank_num;
g_NESmapper.Mapper100.chr3 = bank_num + 1;
NES_mapper100_MMC3_set_PPU_banks();
}
}
break;
case 0x02:
{
if(g_NESmapper.num_1k_VROM_banks)
{
g_NESmapper.Mapper100.chr4 = bank_num;
NES_mapper100_MMC3_set_PPU_banks();
}
}
break;
case 0x03:
{
if(g_NESmapper.num_1k_VROM_banks)
{
g_NESmapper.Mapper100.chr5 = bank_num;
NES_mapper100_MMC3_set_PPU_banks();
}
}
break;
case 0x04:
{
if(g_NESmapper.num_1k_VROM_banks)
{
g_NESmapper.Mapper100.chr6 = bank_num;
NES_mapper100_MMC3_set_PPU_banks();
}
}
break;
case 0x05:
{
if(g_NESmapper.num_1k_VROM_banks)
{
g_NESmapper.Mapper100.chr7 = bank_num;
NES_mapper100_MMC3_set_PPU_banks();
}
}
break;
case 0x06:
{
g_NESmapper.Mapper100.prg0 = bank_num;
NES_mapper100_MMC3_set_CPU_banks();
}
break;
case 0x07:
{
g_NESmapper.Mapper100.prg1 = bank_num;
NES_mapper100_MMC3_set_CPU_banks();
}
break;
case 0x46:
{
g_NESmapper.Mapper100.prg2 = bank_num;
NES_mapper100_MMC3_set_CPU_banks();
}
break;
case 0x47:
{
g_NESmapper.Mapper100.prg3 = bank_num;
NES_mapper100_MMC3_set_CPU_banks();
}
break;
case 0x80:
{
if(g_NESmapper.num_1k_VROM_banks)
{
bank_num &= 0xfe;
g_NESmapper.Mapper100.chr4 = bank_num;
g_NESmapper.Mapper100.chr5 = bank_num + 1;
NES_mapper100_MMC3_set_PPU_banks();
}
}
break;
case 0x81:
{
if(g_NESmapper.num_1k_VROM_banks)
{
bank_num &= 0xfe;
g_NESmapper.Mapper100.chr6 = bank_num;
g_NESmapper.Mapper100.chr7 = bank_num + 1;
NES_mapper100_MMC3_set_PPU_banks();
}
}
break;
case 0x82:
{
if(g_NESmapper.num_1k_VROM_banks)
{
g_NESmapper.Mapper100.chr0 = bank_num;
NES_mapper100_MMC3_set_PPU_banks();
}
}
break;
case 0x83:
{
if(g_NESmapper.num_1k_VROM_banks)
{
g_NESmapper.Mapper100.chr1 = bank_num;
NES_mapper100_MMC3_set_PPU_banks();
}
}
break;
case 0x84:
{
if(g_NESmapper.num_1k_VROM_banks)
{
g_NESmapper.Mapper100.chr2 = bank_num;
NES_mapper100_MMC3_set_PPU_banks();
}
}
break;
case 0x85:
{
if(g_NESmapper.num_1k_VROM_banks)
{
g_NESmapper.Mapper100.chr3 = bank_num;
NES_mapper100_MMC3_set_PPU_banks();
}
}
break;
}
}
break;
case 0xA000:
{
g_NESmapper.Mapper100.regs[2] = data;
if(NES_ROM_get_mirroring() != NES_PPU_MIRROR_FOUR_SCREEN)
{
if(data & 0x01)
{
g_NESmapper.set_mirroring2(NES_PPU_MIRROR_HORIZ);
}
else
{
g_NESmapper.set_mirroring2(NES_PPU_MIRROR_VERT);
}
}
}
break;
case 0xA001:
{
g_NESmapper.Mapper100.regs[3] = data;
}
break;
case 0xC000:
g_NESmapper.Mapper100.regs[4] = data;
g_NESmapper.Mapper100.irq_counter = g_NESmapper.Mapper100.regs[4];
break;
case 0xC001:
g_NESmapper.Mapper100.regs[5] = data;
g_NESmapper.Mapper100.irq_latch = g_NESmapper.Mapper100.regs[5];
break;
case 0xE000:
g_NESmapper.Mapper100.regs[6] = data;
g_NESmapper.Mapper100.irq_enabled = 0;
break;
case 0xE001:
g_NESmapper.Mapper100.regs[7] = data;
g_NESmapper.Mapper100.irq_enabled = 1;
break;
}
}
void NES_mapper100_MMC3_set_CPU_banks()
{
g_NESmapper.set_CPU_banks4(g_NESmapper.Mapper100.prg0,g_NESmapper.Mapper100.prg1,g_NESmapper.Mapper100.prg2,g_NESmapper.Mapper100.prg3);
}
void NES_mapper100_MMC3_set_PPU_banks()
{
if(g_NESmapper.num_1k_VROM_banks)
{
g_NESmapper.set_PPU_banks8(g_NESmapper.Mapper100.chr0,g_NESmapper.Mapper100.chr1,g_NESmapper.Mapper100.chr2,g_NESmapper.Mapper100.chr3,g_NESmapper.Mapper100.chr4,g_NESmapper.Mapper100.chr5,g_NESmapper.Mapper100.chr6,g_NESmapper.Mapper100.chr7);
}
}
void NES_mapper100_HSync(uint32 scanline)
{
if(g_NESmapper.Mapper100.irq_enabled)
{
if((scanline >= 0) && (scanline <= 239))
{
if(NES_PPU_spr_enabled() || NES_PPU_bg_enabled())
{
if(!(g_NESmapper.Mapper100.irq_counter--))
{
g_NESmapper.Mapper100.irq_counter = g_NESmapper.Mapper100.irq_latch;
NES6502_DoIRQ();
}
}
}
}
}
/////////////////////////////////////////////////////////////////////
| [
"takka@e750ed6d-7236-0410-a570-cc313d6b6496"
]
| [
[
[
1,
302
]
]
]
|
f1e5c5c778d95db4874eb742b18d5cd62070f886 | 74e7667ad65cbdaa869c6e384fdd8dc7e94aca34 | /MicroFrameworkPK_v4_1/BuildOutput/public/debug/Client/stubs/corlib_native_System_Reflection_PropertyInfo.cpp | 348f888ff675f497cfe2e71c8539fce516c379fe | [
"BSD-3-Clause",
"OpenSSL",
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
]
| permissive | gezidan/NETMF-LPC | 5093ab223eb9d7f42396344ea316cbe50a2f784b | db1880a03108db6c7f611e6de6dbc45ce9b9adce | refs/heads/master | 2021-01-18T10:59:42.467549 | 2011-06-28T08:11:24 | 2011-06-28T08:11:24 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,011 | cpp | //-----------------------------------------------------------------------------
//
// ** WARNING! **
// This file was generated automatically by a tool.
// Re-running the tool will overwrite this file.
// You should copy this file to a custom location
// before adding any customization in the copy to
// prevent loss of your changes when the tool is
// re-run.
//
//-----------------------------------------------------------------------------
#include "corlib_native.h"
#include "corlib_native_System_Reflection_PropertyInfo.h"
using namespace System::Reflection;
UNSUPPORTED_TYPE PropertyInfo::GetValue( CLR_RT_HeapBlock* pMngObj, UNSUPPORTED_TYPE param0, CLR_RT_TypedArray_UNSUPPORTED_TYPE param1, HRESULT &hr )
{
UNSUPPORTED_TYPE retVal = 0;
return retVal;
}
void PropertyInfo::SetValue( CLR_RT_HeapBlock* pMngObj, UNSUPPORTED_TYPE param0, UNSUPPORTED_TYPE param1, CLR_RT_TypedArray_UNSUPPORTED_TYPE param2, HRESULT &hr )
{
}
| [
"[email protected]"
]
| [
[
[
1,
28
]
]
]
|
63ea2209d79d2dddf789677d3a415fcfd10a71c9 | fac8de123987842827a68da1b580f1361926ab67 | /inc/physics/Physics/Utilities/VisualDebugger/Viewer/Dynamics/Constraint/Drawer/hkpLimitedHingeDrawer.h | 159f67d5a7dfc77b2ecab804cd5fbe285983ce87 | []
| no_license | blockspacer/transporter-game | 23496e1651b3c19f6727712a5652f8e49c45c076 | 083ae2ee48fcab2c7d8a68670a71be4d09954428 | refs/heads/master | 2021-05-31T04:06:07.101459 | 2009-02-19T20:59:59 | 2009-02-19T20:59:59 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,856 | h | /*
*
* Confidential Information of Telekinesys Research Limited (t/a Havok). Not for disclosure or distribution without Havok's
* prior written consent.This software contains code, techniques and know-how which is confidential and proprietary to Havok.
* Level 2 and Level 3 source code contains trade secrets of Havok. Havok Software (C) Copyright 1999-2008 Telekinesys Research Limited t/a Havok. All Rights Reserved. Use of this software is subject to the terms of an end user license agreement.
*
*/
#ifndef HK_LIMITEDHINGEDRAWER_H
#define HK_LIMITEDHINGEDRAWER_H
#include <Physics/Utilities/VisualDebugger/Viewer/Dynamics/Constraint/Drawer/hkpConstraintDrawer.h>
#include <Common/Visualize/Shape/hkDisplaySemiCircle.h>
#include <Common/Base/hkBase.h>
/// Displays information about the ballSocket constraint.
class hkpLimitedHingeDrawer : public hkpConstraintDrawer
{
public:
HK_DECLARE_NONVIRTUAL_CLASS_ALLOCATOR( HK_MEMORY_CLASS_VDB, hkpLimitedHingeDrawer );
void drawConstraint(hkpConstraintInstance* constraint, hkDebugDisplayHandler* displayHandler, int tag);
protected:
hkDisplaySemiCircle m_angularLimit;
};
#endif //HK_LIMITEDHINGEDRAWER_H
/*
* Havok SDK - NO SOURCE PC DOWNLOAD, BUILD(#20080529)
*
* Confidential Information of Havok. (C) Copyright 1999-2008
* Telekinesys Research Limited t/a Havok. All Rights Reserved. The Havok
* Logo, and the Havok buzzsaw logo are trademarks of Havok. Title, ownership
* rights, and intellectual property rights in the Havok software remain in
* Havok and/or its suppliers.
*
* Use of this software for evaluation purposes is subject to and indicates
* acceptance of the End User licence Agreement for this product. A copy of
* the license is included with this software and is also available at
* www.havok.com/tryhavok
*
*/
| [
"uraymeiviar@bb790a93-564d-0410-8b31-212e73dc95e4"
]
| [
[
[
1,
45
]
]
]
|
662e64402242ffb355fdcd1d3f50963747abd290 | 5dd0d48b279823c791ba070e1db53f0137055c29 | /BTDialog.cpp | 717927e84d38cea60b80285c13a451f30cbae8ec | []
| no_license | ralex1975/pstviewtool | 4b93349cf54ac7d93abbe199462f7eada44c752e | 52f59893ad4390358053541b0257b4a7f2767024 | refs/heads/master | 2020-05-22T01:53:13.553501 | 2010-02-16T22:52:47 | 2010-02-16T22:52:47 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,679 | cpp | // BTDialog.cpp : implementation file
//
#include "stdafx.h"
#include "NDBView.h"
#include "BTDialog.h"
// CBTDialog dialog
IMPLEMENT_DYNAMIC(CBTDialog, CDialog)
CBTDialog::CBTDialog(NDBViewer * pNDBViewer, CNDBViewDlg * pNDBViewDlg, CWnd* pParent /*=NULL*/)
: CNDBViewChildDlg(pNDBViewDlg, CBTDialog::IDD, pParent)
{
m_pNDBViewer = pNDBViewer;
m_pNDBViewDlg = pNDBViewDlg;
if(m_pNDBViewer)
m_pBTMap = m_pNDBViewer->GetCachedBTBitmap();
m_fDoModal = false;
}
CBTDialog::~CBTDialog()
{
}
void CBTDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CBTDialog, CDialog)
ON_WM_PAINT()
ON_WM_CREATE()
END_MESSAGE_MAP()
// CBTDialog message handlers
int CBTDialog::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
RECT client;
int numPixel;
int numPixelNeeded;
int extraLines;
CB cbPixel;
int retVal;
WCHAR windowTitle[255];
retVal = CDialog::OnCreate(lpCreateStruct);
if(m_pNDBViewer)
{
GetClientRect(&client);
numPixel = client.right * client.bottom;
cbPixel = (m_pNDBViewer->GetHeader().root.ibFileEof / numPixel) + 1;
wsprintf(windowTitle, L"BT Page Locations (1 pixel = %I64u bytes)", cbPixel);
SetWindowText(windowTitle);
// The visual effects of the above integer rounding can be dramatic
// on small files
numPixelNeeded = (int)(m_pNDBViewer->GetHeader().root.ibFileEof / cbPixel);
extraLines = (numPixel - numPixelNeeded) / client.right;
if(extraLines > 0)
{
RECT r;
GetWindowRect(&r);
SetWindowPos(NULL, 0, 0, r.right - r.left, r.bottom - r.top - extraLines, SWP_NOMOVE | SWP_NOZORDER);
}
}
return retVal;
}
struct FEINFO {
BYTE * space;
CB cbPixel;
};
#define feBBT 0x1
#define feNBT 0x2
void MarkPageIB(BYTE * space, CB cbPixel, IB ib, PTYPE ptype)
{
IB start, end;
start = ib / cbPixel;
end = (ib + 512) / cbPixel;
for(; start <= end; start++)
{
space[start] |= (ptype == ptypeNBT ? feNBT : feBBT);
}
}
bool PageExistsAt(BTPAGE* pBtpage, PAGETRAILER* pt, IB, void* pv)
{
FEINFO * pFeInfo = (FEINFO*)pv;
BTENTRY *pbte = (BTENTRY*)(pBtpage->rgbte);
for(int i = 0; i < pBtpage->cEnt; i++, pbte++)
{
MarkPageIB(pFeInfo->space, pFeInfo->cbPixel, pbte->bref.ib, pt->ptype);
}
return true;
}
void CBTDialog::OnPaint()
{
CPaintDC dc(this);
CDC dcMem;
RECT client;
CBitmap * pOld = NULL;
GetClientRect(&client);
if(!m_pNDBViewer)
return CDialog::OnPaint();
dcMem.CreateCompatibleDC(&dc);
if(!m_pBTMap)
{
// First paint, we need to walk the AMaps and create the bitmap.
CWaitCursor wait;
CPen p;
int numPixel = client.right * client.bottom;
BYTE * space = new BYTE[numPixel];
CB cbPixel = (m_pNDBViewer->GetHeader().root.ibFileEof / numPixel) + 1; // round up
FEINFO feI;
feI.space = space;
feI.cbPixel = cbPixel;
for(int i = 0; i < numPixel; i++)
space[i] = BYTE(0);
// Iterate over BT's
MarkPageIB(space, cbPixel, m_pNDBViewer->GetHeader().root.brefBBT.ib, ptypeBBT);
m_pNDBViewer->ForEachBTPage(ptypeBBT, &PageExistsAt, feNonLeaf, &feI);
MarkPageIB(space, cbPixel, m_pNDBViewer->GetHeader().root.brefNBT.ib, ptypeNBT);
m_pNDBViewer->ForEachBTPage(ptypeNBT, &PageExistsAt, feNonLeaf, &feI);
// allocate the bitmap
m_pBTMap = new CBitmap();
m_pBTMap->CreateCompatibleBitmap(&dc, client.right, client.bottom);
pOld = dcMem.SelectObject(m_pBTMap);
for(int j = 0; j < client.bottom; j++)
{
for(int i = 0; i < client.right; i++)
{
// if this pixel extends past eof, just draw the eof pixel
// the confusing +1 is because we want the end of the region mapped
// by this pixel, which is the start of the region mapped by the next
// pixel
if((j * client.right + i + 1) * cbPixel <= m_pNDBViewer->GetHeader().root.ibFileEof)
{
BYTE b = space[j * client.right + i];
// does it contain both?
if((b & feBBT) && (b & feNBT))
{
dcMem.SetPixel(i, j, c_BothPage);
}
// just a BBT page?
else if(b & feBBT)
{
dcMem.SetPixel(i, j, c_BBTPage);
}
// just a NBT page?
else if(b & feNBT)
{
dcMem.SetPixel(i, j, c_NBTPage);
}
else
{
dcMem.SetPixel(i, j, c_Empty);
}
}
else
{
dcMem.SetPixel(i, j, c_BTPastEOF);
}
}
}
delete [] space;
m_pNDBViewer->CacheBTBitmap(m_pBTMap);
}
else
{
pOld = dcMem.SelectObject(m_pBTMap);
}
dc.BitBlt(client.left, client.top, client.right, client.bottom, &dcMem, 0, 0, SRCCOPY);
dcMem.SelectObject(pOld);
}
| [
"terrymah@localhost"
]
| [
[
[
1,
195
]
]
]
|
e639c0fabe74e1f1697a12450572d9436c5c4482 | 91b964984762870246a2a71cb32187eb9e85d74e | /SRC/OFFI SRC!/boost_1_34_1/boost_1_34_1/libs/dynamic_bitset/example/timing_tests.cpp | 29c5a1cf88d9d2e58468d373b95a1f58f8149799 | [
"BSL-1.0",
"LicenseRef-scancode-unknown-license-reference"
]
| permissive | willrebuild/flyffsf | e5911fb412221e00a20a6867fd00c55afca593c7 | d38cc11790480d617b38bb5fc50729d676aef80d | refs/heads/master | 2021-01-19T20:27:35.200154 | 2011-02-10T12:34:43 | 2011-02-10T12:34:43 | 32,710,780 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,732 | cpp | // -----------------------------------------------------------
// boost::dynamic_bitset timing tests
// (C) Copyright Gennaro Prota 2003 - 2004.
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// -----------------------------------------------------------
// NOTE:
// ~~~~~
// This is a preliminary, incomplete version.
//
// If you are interested in having more benchmarks please make a
// request on the boost list, which could encourage me to continue
// this work.
// Also, if you use boost::dynamic_bitset on a platform where
// CHAR_BIT >= 9 I suggest experimenting with the size of the count
// table in detail/dynamic_bitset.hpp and report any interesting
// discovery on the list as well.
//
//
// -----------------------------------------------------------------------//
#include "boost/config.hpp"
#if defined (__STL_CONFIG_H) && !defined (__STL_USE_NEW_IOSTREAMS)
// for pre 3.0 versions of libstdc++
# define BOOST_OLD_IOSTREAMS
#endif
// ------------------------------------------------- //
#include <typeinfo>
#include <iostream>
#if !defined(BOOST_OLD_IOSTREAMS)
# include <ostream>
#endif
#include "boost/cstdlib.hpp"
#include "boost/version.hpp"
#include "boost/timer.hpp"
#include "boost/dynamic_bitset.hpp"
namespace {
// the m_ prefixes, below, are mainly to avoid problems with g++:
// see http://gcc.gnu.org/ml/gcc-bugs/1999-03n/msg00884.html
//
class boost_version {
const int m_major;
const int m_minor;
const int m_subminor;
public:
boost_version(unsigned long v = BOOST_VERSION):
m_major(v / 100000), m_minor(v / 100 % 1000), m_subminor(v % 100) {}
friend std::ostream & operator<<(std::ostream &, const boost_version &);
};
// give up using basic_ostream, to avoid headaches with old libraries
std::ostream& operator<<(std::ostream& os, const boost_version & v) {
return os << v.m_major << '.' << v.m_minor << '.' << v.m_subminor;
}
}
void prologue()
{
std::cout << '\n';
std::cout << "Compiler: " << BOOST_COMPILER << '\n';
std::cout << "Std lib : " << BOOST_STDLIB << '\n';
std::cout << "Boost v.: " << boost_version() << '\n';
std::cout << '\n';
}
template <typename T>
void timing_test(T* = 0) // dummy parameter to workaround VC6
{
const unsigned long num = 100000;
// This variable is printed at the end of the test,
// to prevent the optimizer eliminating the call to
// count() in the loop below.
typename boost::dynamic_bitset<T>::size_type dummy = 0;
std::cout << "\nTimings for dynamic_bitset<" << typeid(T).name()
<< "> [" << num << " iterations]\n";
std::cout << "--------------------------------------------------\n";
{
boost::timer time;
const typename boost::dynamic_bitset<T>::size_type sz = 5000;
for (unsigned long i = 0; i < num; ++i) {
boost::dynamic_bitset<T> bs(sz, i);
dummy += bs.count();
}
const double elaps = time.elapsed();
std::cout << "Elapsed: " << elaps << '\n';
}
std::cout << "(total count: " << dummy << ")\n\n";
}
int main()
{
prologue();
timing_test<unsigned char>();
timing_test<unsigned short>();
timing_test<unsigned int>();
timing_test<unsigned long>();
# ifdef BOOST_HAS_LONG_LONG
timing_test< ::boost::ulong_long_type>();
# endif
return boost::exit_success;
}
| [
"[email protected]@e2c90bd7-ee55-cca0-76d2-bbf4e3699278"
]
| [
[
[
1,
137
]
]
]
|
d88ca8482716b8414171d151205e4623cae78c4a | c1a2953285f2a6ac7d903059b7ea6480a7e2228e | /deitel/ch21/Fig21_19/fig22_19.cpp | fe7607c383f3f42ebb52b029985a3e12f55e1dd0 | []
| no_license | tecmilenio/computacion2 | 728ac47299c1a4066b6140cebc9668bf1121053a | a1387e0f7f11c767574fcba608d94e5d61b7f36c | refs/heads/master | 2016-09-06T19:17:29.842053 | 2008-09-28T04:27:56 | 2008-09-28T04:27:56 | 50,540 | 4 | 3 | null | null | null | null | UTF-8 | C++ | false | false | 2,597 | cpp | // Fig. 21.19: fig21_19.cpp
// Using functions islower, isupper, tolower and toupper.
#include <iostream>
using std::cout;
using std::endl;
#include <cctype> // character-handling function prototypes
using std::islower;
using std::isupper;
using std::tolower;
using std::toupper;
int main()
{
cout << "According to islower:\n"
<< ( islower( 'p' ) ? "p is a" : "p is not a" )
<< " lowercase letter\n"
<< ( islower( 'P' ) ? "P is a" : "P is not a" )
<< " lowercase letter\n"
<< ( islower( '5' ) ? "5 is a" : "5 is not a" )
<< " lowercase letter\n"
<< ( islower( '!' ) ? "! is a" : "! is not a" )
<< " lowercase letter\n";
cout << "\nAccording to isupper:\n"
<< ( isupper( 'D' ) ? "D is an" : "D is not an" )
<< " uppercase letter\n"
<< ( isupper( 'd' ) ? "d is an" : "d is not an" )
<< " uppercase letter\n"
<< ( isupper( '8' ) ? "8 is an" : "8 is not an" )
<< " uppercase letter\n"
<< ( isupper('$') ? "$ is an" : "$ is not an" )
<< " uppercase letter\n";
cout << "\nu converted to uppercase is "
<< static_cast< char >( toupper( 'u' ) )
<< "\n7 converted to uppercase is "
<< static_cast< char >( toupper( '7' ) )
<< "\n$ converted to uppercase is "
<< static_cast< char >( toupper( '$' ) )
<< "\nL converted to lowercase is "
<< static_cast< char >( tolower( 'L' ) ) << endl;
return 0;
} // end main
/**************************************************************************
* (C) Copyright 1992-2008 by Deitel & Associates, Inc. and *
* Pearson Education, Inc. All Rights Reserved. *
* *
* DISCLAIMER: The authors and publisher of this book have used their *
* best efforts in preparing the book. These efforts include the *
* development, research, and testing of the theories and programs *
* to determine their effectiveness. The authors and publisher make *
* no warranty of any kind, expressed or implied, with regard to these *
* programs or to the documentation contained in these books. The authors *
* and publisher shall not be liable in any event for incidental or *
* consequential damages in connection with, or arising out of, the *
* furnishing, performance, or use of these programs. *
**************************************************************************/
| [
"[email protected]"
]
| [
[
[
1,
59
]
]
]
|
f67d13fe30477178651b3189ea72088c81c87d4e | 88b55445b6b4779563cfe98ceee1dcc9fe7b0d9b | /modtools/CI BTW AI Source Pack/Cossacks_I_BTW_AI_Source/AI_0995/AI/Vengria/Vengria.cpp | 2be7e6575b9a60931e3e1c2a72a74581a342d56d | []
| no_license | Avatarchik/1cb-cossacks-gow-mod | 88bc5497459a46062b82a62d65ae3d461558a0b0 | 5a066dfc24a532a359f8e597625a70e4710abd57 | refs/heads/master | 2021-01-13T00:55:57.671554 | 2011-06-21T03:03:48 | 2011-06-21T03:03:48 | 50,180,899 | 0 | 0 | null | null | null | null | WINDOWS-1251 | C++ | false | false | 13,624 | cpp | #include "..\Ai.h"
#include "..\Europe.h"
#include "..\Script.h"
#include "..\Processes.h"
#include "..\Scripts.h"
// Registration upgrades, units and buildings for Austria AI
void RegisterAustria(){
int v=GetRandomIndex();
if(v&1){
strcpy(MainUnit, "Pikiner_evro(VG)"); //"Rundashir_Avstria(VG)"
}else{
strcpy(MainUnit, "Pikiner_evro(VG)");
};
if(((v>>1)&3)==1){
strcpy(MainHorse,"VngKPnd(VG)"); //"Kavalerist_avstrii(VG)"
}else{
strcpy(MainHorse,"VngKPnd(VG)");
};
if(((v>>3)&3)==1){
strcpy(MainXVIII,"Mushketer(VG)"); //"Mushketer(VG)"
}else{
strcpy(MainXVIII,"VngPnd(VG)");
};
// MILL
RegisterUnitType(&MELN,"Melnica(VG)");
// STORAGE PIT
RegisterUnitType(&SKLAD,"Sclad1(VG)");
// MARKET
RegisterUnitType(&CHURCH,"VngHra(VG)");
RegisterUnitType(&KAZ18,"VngK18(VG)");
RegisterUnitType(&DIPCENTER,"VngDip(VG)");
RegisterUnitType(&ARTDEPO,"VngArt(VG)");
RegisterUnitType(&RINOK,"Rinok(VG)");
RegisterUnitType(&TOWER,"Bashnia(VG)");
RegisterUnitType(&PORT,"PorE(VG)");
// TOWN HALL
RegisterUnitType(&CENTER,"VngCen(VG)");
AssignPeasant("Kreposnoi_pruss(VG)");
RegisterUnitType(&PEASANT,"Kreposnoi_pruss(VG)");
// BLACKSMITH
RegisterUnitType(&KUZNICA,"VngKuz(VG)");
RegisterUpgrade(&GRENPIKA2, "KUZ04VG");
// ACADEMIA
RegisterUnitType(&AKADEMIA,"VngAka(VG)");
RegisterUpgrade(&GRENPIKA1, "AKA35VG");
RegisterUpgrade(&GRENPIKA3, "AKA36VG");
RegisterUpgrade(&MUSHCOST, "AKA32VG");
// BARRACK
RegisterUnitType(&KAZ17,"VngK17(VG)");
// cold infantry 17
RegisterUnitType(&INFANTRY,MainUnit);
// rifle infantry 17
RegisterUnitType(&STREL17,"VngSer(VG)");
// officer 17
RegisterUnitType(&OFFICER,"Officer_evro(VG)");
RegisterUpgrade(&OFFATTACK,"Officer_evro(VG)ATTACK");
RegisterUpgrade(&OFFSHIELD,"Officer_evro(VG)SHIELD");
// drumers 17
RegisterUnitType(&BARABAN,"Barabanshik_ev1(VG)");
RegisterUpgrade(&BARSHIELD, "Barabanshik_ev1(VG)SHIELD");
// STABLE
RegisterUnitType(&STABLE,"VngKon(VG)");
// rider
RegisterUnitType(&RICAR,MainHorse);
// dragun 17
RegisterUnitType(&DRAGUN17, "Dragun(VG)");
RegisterUpgrade(&DRAGUN17_UA0, "Dragun(VG)ATTACK");
RegisterUpgrade(&DRAGUN17_UA1, "Dragun(VG)ATTACK3");
RegisterUpgrade(&DRAGUN17_UA2, "Dragun(VG)ATTACK4");
RegisterUpgrade(&DRAGUN17_UA3, "Dragun(VG)ATTACK5");
RegisterUpgrade(&DRAGUN17_UA4, "Dragun(VG)ATTACK6");
RegisterUpgrade(&DRAGUN17_UA5, "Dragun(VG)ATTACK7");
RegisterUpgrade(&DRAGUN17_US0, "Dragun(VG)SHIELD");
RegisterUpgrade(&DRAGUN17_US1, "Dragun(VG)SHIELD3");
RegisterUpgrade(&DRAGUN17_US2, "Dragun(VG)SHIELD4");
RegisterUpgrade(&DRAGUN17_US3, "Dragun(VG)SHIELD5");
RegisterUpgrade(&DRAGUN17_US4, "Dragun(VG)SHIELD6");
RegisterUpgrade(&DRAGUN17_US5, "Dragun(VG)SHIELD7");
RegisterUpgrade(&DRAGUN17_UA0, "Dragun(VG)ATTACK");
RegisterUpgrade(&DRAGUN17_UA1, "Dragun(VG)ATTACK3");
RegisterUpgrade(&DRAGUN17_UA2, "Dragun(VG)ATTACK4");
RegisterUpgrade(&DRAGUN17_UA3, "Dragun(VG)ATTACK5");
RegisterUpgrade(&DRAGUN17_UA4, "Dragun(VG)ATTACK6");
RegisterUpgrade(&DRAGUN17_UA5, "Dragun(VG)ATTACK7");
RegisterUpgrade(&DRAGUN17_US0, "Dragun(VG)SHIELD");
RegisterUpgrade(&DRAGUN17_US1, "Dragun(VG)SHIELD3");
RegisterUpgrade(&DRAGUN17_US2, "Dragun(VG)SHIELD4");
RegisterUpgrade(&DRAGUN17_US3, "Dragun(VG)SHIELD5");
RegisterUpgrade(&DRAGUN17_US4, "Dragun(VG)SHIELD6");
RegisterUpgrade(&DRAGUN17_US5, "Dragun(VG)SHIELD7");
// kirasir
RegisterUnitType(&KIRASIR,"Kirasir(VG)");
// dragun 18
RegisterUnitType(&DRAGUN18, "Dragun_18(VG)");
RegisterUpgrade(&DRAGUN18_UA0, "Dragun_18(VG)ATTACK");
RegisterUpgrade(&DRAGUN18_UA1, "Dragun_18(VG)ATTACK3");
RegisterUpgrade(&DRAGUN18_UA2, "Dragun_18(VG)ATTACK4");
RegisterUpgrade(&DRAGUN18_UA3, "Dragun_18(VG)ATTACK5");
RegisterUpgrade(&DRAGUN18_UA4, "Dragun_18(VG)ATTACK6");
RegisterUpgrade(&DRAGUN18_UA5, "Dragun_18(VG)ATTACK7");
RegisterUpgrade(&DRAGUN18_US0, "Dragun_18(VG)SHIELD");
RegisterUpgrade(&DRAGUN18_US1, "Dragun_18(VG)SHIELD3");
RegisterUpgrade(&DRAGUN18_US2, "Dragun_18(VG)SHIELD4");
RegisterUpgrade(&DRAGUN18_US3, "Dragun_18(VG)SHIELD5");
RegisterUpgrade(&DRAGUN18_US4, "Dragun_18(VG)SHIELD6");
RegisterUpgrade(&DRAGUN18_US5, "Dragun_18(VG)SHIELD7");
RegisterUpgrade(&DRAGUN18_UA0, "Dragun_18(VG)ATTACK");
RegisterUpgrade(&DRAGUN18_UA1, "Dragun_18(VG)ATTACK3");
RegisterUpgrade(&DRAGUN18_UA2, "Dragun_18(VG)ATTACK4");
RegisterUpgrade(&DRAGUN18_UA3, "Dragun_18(VG)ATTACK5");
RegisterUpgrade(&DRAGUN18_UA4, "Dragun_18(VG)ATTACK6");
RegisterUpgrade(&DRAGUN18_UA5, "Dragun_18(VG)ATTACK7");
RegisterUpgrade(&DRAGUN18_US0, "Dragun_18(VG)SHIELD");
RegisterUpgrade(&DRAGUN18_US1, "Dragun_18(VG)SHIELD3");
RegisterUpgrade(&DRAGUN18_US2, "Dragun_18(VG)SHIELD4");
RegisterUpgrade(&DRAGUN18_US3, "Dragun_18(VG)SHIELD5");
RegisterUpgrade(&DRAGUN18_US4, "Dragun_18(VG)SHIELD6");
RegisterUpgrade(&DRAGUN18_US5, "Dragun_18(VG)SHIELD7");
// DIPLOMATIC CENTER
RegisterUnitType(&ARCHER,"Strelec_Algir_DIP(VG)");
RegisterUnitType(&GRENDIP,"Grenader_DIP(VG)");
RegisterUnitType(&KAZAK,"Kozak_loshad_DIP(VG)");
RegisterUnitType(&DIPDRAGUN,"Dragun_18_DIP(VG)");
// CHURCH
// priest
RegisterUnitType(&PRIEST, "Sveshenik_evro(VG)");
/////////////////////////////////////////////////////////////////
RegisterUnitType(&GREN18,MainUnit);
RegisterUnitType(&PUSHKA,"Pushka(VG)");
RegisterUnitType(&GAUB,"Mortira(VG)");
RegisterUnitType(&MORTIRA,"Mortira_b(VG)");
RegisterUnitType(&LODKA,"Lodka(VG)");
RegisterUnitType(&FASTUNIT,"VngKPnd(VG)");
//2.Buildings
//2a.Flot
RegisterUnitType(&FREGAT,"Fregat(VG)");
RegisterUnitType(&GALLEY,"GALERA(VG)");
RegisterUnitType(&LINKOR,"Linkor(VG)");
RegisterUnitType(&YAHTA,"Yahta(VG)");
RegisterUnitType(&PAROM,"PERES_KOR(VG)");
//3.Upgrades
RegisterUpgrade(&MELN_U,"Melnica(VG)GETRES");
RegisterUpgrade(&MELN_U1,"Melnica(VG)GETRES2");
RegisterUpgrade(&KUZ_FIELD,"KUZ01VG");
RegisterUpgrade(&SINFANTRY_UA0,"Pikiner_evro(VG)ATTACK");
RegisterUpgrade(&SINFANTRY_UA1,"Pikiner_evro(VG)ATTACK3");
RegisterUpgrade(&SINFANTRY_UA2,"Pikiner_evro(VG)ATTACK4");
RegisterUpgrade(&SINFANTRY_US0,"Pikiner_evro(VG)SHIELD");
RegisterUpgrade(&SINFANTRY_US1,"Pikiner_evro(VG)SHIELD3");
RegisterUpgrade(&SINFANTRY_US2,"Pikiner_evro(VG)SHIELD4");
/*
SafeRegisterUpgrade(&INFANTRY_UA0,"Rundashir_Avstria(VG)ATTACK");
SafeRegisterUpgrade(&INFANTRY_UA1,"Rundashir_Avstria(VG)ATTACK3");
SafeRegisterUpgrade(&INFANTRY_UA2,"Rundashir_Avstria(VG)ATTACK4");
SafeRegisterUpgrade(&INFANTRY_UA3,"Pikiner_evro(VG)ATTACK5");
SafeRegisterUpgrade(&INFANTRY_UA4,"Pikiner_evro(VG)ATTACK6");
SafeRegisterUpgrade(&INFANTRY_US0,"Rundashir_Avstria(VG)SHIELD");
SafeRegisterUpgrade(&INFANTRY_US1,"Rundashir_Avstria(VG)SHIELD3");
SafeRegisterUpgrade(&INFANTRY_US2,"Rundashir_Avstria(VG)SHIELD4");
SafeRegisterUpgrade(&INFANTRY_US3,"Pikiner_evro(VG)SHIELD5");
SafeRegisterUpgrade(&INFANTRY_US4,"Pikiner_evro(VG)SHIELD6");
*/
SafeRegisterUpgrade(&INFANTRY_UA0,"Pikiner_evro(VG)ATTACK");
SafeRegisterUpgrade(&INFANTRY_UA1,"Pikiner_evro(VG)ATTACK3");
SafeRegisterUpgrade(&INFANTRY_UA2,"Pikiner_evro(VG)ATTACK4");
SafeRegisterUpgrade(&INFANTRY_UA3,"Pikiner_evro(VG)ATTACK5");
SafeRegisterUpgrade(&INFANTRY_UA4,"Pikiner_evro(VG)ATTACK6");
SafeRegisterUpgrade(&INFANTRY_US0,"Pikiner_evro(VG)SHIELD");
SafeRegisterUpgrade(&INFANTRY_US1,"Pikiner_evro(VG)SHIELD3");
SafeRegisterUpgrade(&INFANTRY_US2,"Pikiner_evro(VG)SHIELD4");
SafeRegisterUpgrade(&INFANTRY_US3,"Pikiner_evro(VG)SHIELD5");
SafeRegisterUpgrade(&INFANTRY_US4,"Pikiner_evro(VG)SHIELD6");
RegisterUpgrade(&STREL17_UA0,"VngSer(VG)ATTACK");
RegisterUpgrade(&STREL17_UA1,"VngSer(VG)ATTACK3");
RegisterUpgrade(&STREL17_UA2,"VngSer(VG)ATTACK4");
RegisterUpgrade(&STREL17_US0,"VngSer(VG)SHIELD");
RegisterUpgrade(&STREL17_US1,"VngSer(VG)SHIELD3");
RegisterUpgrade(&STREL17_US2,"VngSer(VG)SHIELD4");
SafeRegisterUpgrade(&RICAR_UA0,SCM(MainHorse,"ATTACK"));
SafeRegisterUpgrade(&RICAR_UA1,SCM(MainHorse,"ATTACK3"));
SafeRegisterUpgrade(&RICAR_UA2,SCM(MainHorse,"ATTACK4"));
SafeRegisterUpgrade(&RICAR_UA3,SCM(MainHorse,"ATTACK5"));
SafeRegisterUpgrade(&RICAR_UA4,SCM(MainHorse,"ATTACK6"));
SafeRegisterUpgrade(&RICAR_UA5,SCM(MainHorse,"ATTACK7"));
SafeRegisterUpgrade(&RICAR_US0,SCM(MainHorse,"SHIELD"));
SafeRegisterUpgrade(&RICAR_US1,SCM(MainHorse,"SHIELD3"));
SafeRegisterUpgrade(&RICAR_US2,SCM(MainHorse,"SHIELD4"));
SafeRegisterUpgrade(&RICAR_US3,SCM(MainHorse,"SHIELD5"));
SafeRegisterUpgrade(&RICAR_US4,SCM(MainHorse,"SHIELD6"));
SafeRegisterUpgrade(&RICAR_US5,SCM(MainHorse,"SHIELD7"));
RegisterUpgrade(&KIRASIR_UA0,"Kirasir(VG)ATTACK");
RegisterUpgrade(&KIRASIR_UA1,"Kirasir(VG)ATTACK3");
RegisterUpgrade(&KIRASIR_UA2,"Kirasir(VG)ATTACK4");
RegisterUpgrade(&KIRASIR_UA3,"Kirasir(VG)ATTACK5");
RegisterUpgrade(&KIRASIR_UA4,"Kirasir(VG)ATTACK6");
RegisterUpgrade(&KIRASIR_UA5,"Kirasir(VG)ATTACK7");
RegisterUpgrade(&KIRASIR_US0,"Kirasir(VG)SHIELD");
RegisterUpgrade(&KIRASIR_US1,"Kirasir(VG)SHIELD3");
RegisterUpgrade(&KIRASIR_US2,"Kirasir(VG)SHIELD4");
RegisterUpgrade(&KIRASIR_US3,"Kirasir(VG)SHIELD5");
RegisterUpgrade(&KIRASIR_US4,"Kirasir(VG)SHIELD6");
RegisterUpgrade(&KIRASIR_US5,"Kirasir(VG)SHIELD7");
SafeRegisterUpgrade(&GREN18_UA0,SCM(MainXVIII,"ATTACK"));
SafeRegisterUpgrade(&GREN18_UA1,SCM(MainXVIII,"ATTACK3"));
SafeRegisterUpgrade(&GREN18_UA2,SCM(MainXVIII,"ATTACK4"));
SafeRegisterUpgrade(&GREN18_UA3,SCM(MainXVIII,"ATTACK5"));
SafeRegisterUpgrade(&GREN18_UA4,SCM(MainXVIII,"ATTACK6"));
SafeRegisterUpgrade(&GREN18_UA5,SCM(MainXVIII,"ATTACK7"));
SafeRegisterUpgrade(&GREN18_US0,SCM(MainXVIII,"SHIELD"));
SafeRegisterUpgrade(&GREN18_US1,SCM(MainXVIII,"SHIELD3"));
SafeRegisterUpgrade(&GREN18_US2,SCM(MainXVIII,"SHIELD4"));
SafeRegisterUpgrade(&GREN18_US3,SCM(MainXVIII,"SHIELD5"));
SafeRegisterUpgrade(&GREN18_US4,SCM(MainXVIII,"SHIELD6"));
SafeRegisterUpgrade(&GREN18_US5,SCM(MainXVIII,"SHIELD7"));
RegisterUpgrade(&PUSHKA_UB0,"Pushka(VG)BUILD");
RegisterUpgrade(&PUSHKA_UB1,"Pushka(VG)BUILD3");
RegisterUpgrade(&PUSHKA_UB2,"Pushka(VG)BUILD4");
RegisterUpgrade(&PUSHKA_UB3,"Pushka(VG)BUILD5");
RegisterUpgrade(&PUSHKA_UB4,"Pushka(VG)BUILD6");
RegisterUpgrade(&GAUB_UB0,"Mortira(VG)BUILD");
RegisterUpgrade(&GAUB_UB1,"Mortira(VG)BUILD3");
RegisterUpgrade(&GAUB_UB2,"Mortira(VG)BUILD4");
RegisterUpgrade(&GAUB_UB3,"Mortira(VG)BUILD5");
RegisterUpgrade(&FASTHORSE,"KUZ03VG");
RegisterUpgrade(&XVIII,"Melnica(VG)GETRES");
RegisterUpgrade(&ENABLE_FREGAT,"AKA06VG");
RegisterUpgrade(&AKAFOOD1,"AKA01VG");
RegisterUpgrade(&AKAFOOD2,"AKA02VG");
RegisterUpgrade(&AKAFOOD3,"AKA03VG");
RegisterUpgrade(&AKAFOOD4,"AKA04VG");
RegisterUpgrade(&AKAWOOD, "AKA08VG");
RegisterUpgrade(&AKASTN1, "AKA23VG");
RegisterUpgrade(&AKASTN2, "AKA24VG");
RegisterUpgrade(&ATTPAUS1,"AKA31VG");
RegisterUpgrade(&ATTPAUS2,"AKA33VG");
RegisterUpgrade(&AKASTR1, "AKA12VG");
RegisterUpgrade(&AKASTR2, "AKA13VG");
RegisterUpgrade(&AKASTR3, "AKA14VG");
RegisterUpgrade(&AKASTR4, "AKA15VG");
RegisterUpgrade(&AKASWALL,"AKA11VG");
RegisterUpgrade(&AKASBUIL,"AKA10VG");
RegisterUpgrade(&FLOT, "AKA30VG");
RegisterUpgrade(&CHIPFISH,"AKA07VG");
RegisterUpgrade(&AKARAZBROS,"AKA20VG");
RegisterUpgrade(&B_SHIELD1,"KUZ02VG");
RegisterUpgrade(&B_SHIELD2,"AKA09VG");
RegisterUpgrade(&FASTFISH,"AKA05VG");
RegisterUpgrade(&FASTFLOT,"AKA28VG");
RegisterUpgrade(&DOLINKOR,"AKA29VG");
RegisterUpgrade(&STRONGPIKA,"KUZ05VG");
RegisterUpgrade(&STRONGSHIELD,"KUZ06VG");
RegisterUpgrade(&AKASHIELD,"AKA34VG");
RegisterUpgrade(&TOWERUP1,"Bashnia(VG)PAUSE");
RegisterUpgrade(&TOWERUP2,"Bashnia(VG)PAUSE3");
RegisterUpgrade(&TOWERUP3,"Bashnia(VG)PAUSE4");
RegisterUpgrade(&TOWERUP4,"Bashnia(VG)PAUSE5");
RegisterUpgrade(&TOWERUP5,"Bashnia(VG)PAUSE6");
RegisterUpgrade(&TOWERUP6,"Bashnia(VG)PAUSE7");
//My addition:
RegisterUpgrade(&AKAMUSKETCOST,"AKA32VG");
RegisterUpgrade(&EN_FREG18,"NEWFREG(VG)");
RegisterUpgrade(&EN_KETC18,"NEWKECH(VG)");
RegisterUnitType(&KETC18,"KECH(VG)");
RegisterUnitType(&FREG18,"FregatNEW(VG)");
AssignAmountOfMineUpgrades(6);
AssignMineUpgrade(0,"shahta(VG)INSIDE" ,90);
AssignMineUpgrade(1,"shahta(VG)INSIDE3",50);
AssignMineUpgrade(2,"shahta(VG)INSIDE4",50);
AssignMineUpgrade(3,"shahta(VG)INSIDE5",50);
AssignMineUpgrade(4,"shahta(VG)INSIDE6",50);
AssignMineUpgrade(5,"shahta(VG)INSIDE7",50);
AssignFormUnit(MainUnit);
AssignMine("shahta(VG)");
AssignHouse("VngDom(VG)");
AssignWall("WALL_EV(VG)");
};
DLLEXPORT
void InitAI(){
AiNat = GetAINation();
RegisterAustria();
SET_MINE_CAPTURE_RADIUS(290);
SET_MINE_UPGRADE1_RADIUS(90); // вместимость до второго уровня
SET_MINE_UPGRADE2_RADIUS(90);
SET_DEFAULT_MAX_WORKERS(1000);
SET_MIN_PEASANT_BRIGADE(5);
objs[AiNat].MAXUPG = 0;
objs[AiNat].MAXUNT = 0;
DGS[AiNat] = 128&GetRandomIndex();
};
DLLEXPORT
void ProcessAI(){
AiNat = GetAINation();
MainScript();
};
| [
"[email protected]"
]
| [
[
[
1,
350
]
]
]
|
dd3193f57840d3d25f2b39f97883965f7b0c6a43 | 33f59b1ba6b12c2dd3080b24830331c37bba9fe2 | /Depend/Foundation/Interpolation/Wm4IntpBSplineUniform3.cpp | 133f11a870787ace124c6cfe2d762a95a2b086f9 | []
| no_license | daleaddink/flagship3d | 4835c223fe1b6429c12e325770c14679c42ae3c6 | 6cce5b1ff7e7a2d5d0df7aa0594a70d795c7979a | refs/heads/master | 2021-01-15T16:29:12.196094 | 2009-11-01T10:18:11 | 2009-11-01T10:18:11 | 37,734,654 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 7,152 | cpp | // Geometric Tools, Inc.
// http://www.geometrictools.com
// Copyright (c) 1998-2006. All Rights Reserved
//
// The Wild Magic Version 4 Foundation Library source code is supplied
// under the terms of the license agreement
// http://www.geometrictools.com/License/Wm4FoundationLicense.pdf
// and may not be copied or disclosed except in accordance with the terms
// of that agreement.
#include "Wm4FoundationPCH.h"
#include "Wm4IntpBSplineUniform3.h"
#include "Wm4Math.h"
namespace Wm4
{
//----------------------------------------------------------------------------
template <class Real>
IntpBSplineUniform3<Real>::IntpBSplineUniform3 (int iDegree, const int* aiDim,
Real* afData)
:
IntpBSplineUniform<Real>(3,iDegree,aiDim,afData)
{
}
//----------------------------------------------------------------------------
template <class Real>
int IntpBSplineUniform3<Real>::Index (int iX, int iY, int iZ) const
{
return iX + m_aiDim[0]*(iY + m_aiDim[1]*iZ);
}
//----------------------------------------------------------------------------
template <class Real>
Real IntpBSplineUniform3<Real>::operator() (Real* afX)
{
return (*this)(afX[0],afX[1],afX[2]);
}
//----------------------------------------------------------------------------
template <class Real>
Real IntpBSplineUniform3<Real>::operator() (int* aiDx, Real* afX)
{
return (*this)(aiDx[0],aiDx[1],aiDx[2],afX[0],afX[1],afX[2]);
}
//----------------------------------------------------------------------------
template <class Real>
Real IntpBSplineUniform3<Real>::operator() (Real fX, Real fY, Real fZ)
{
m_aiBase[0] = (int)Math<Real>::Floor(fX);
m_aiBase[1] = (int)Math<Real>::Floor(fY);
m_aiBase[2] = (int)Math<Real>::Floor(fZ);
for (int iDim = 0; iDim < 3; iDim++)
{
if (m_aiOldBase[iDim] != m_aiBase[iDim])
{
// switch to new local grid
for (int k = 0; k < 3; k++)
{
m_aiOldBase[k] = m_aiBase[k];
m_aiGridMin[k] = m_aiBase[k] - 1;
m_aiGridMax[k] = m_aiGridMin[k] + m_iDegree;
}
// fill in missing grid data if necessary
if (m_oEvaluateCallback)
{
EvaluateUnknownData();
}
ComputeIntermediate();
break;
}
}
SetPolynomial(0,fX-m_aiBase[0],m_aafPoly[0]);
SetPolynomial(0,fY-m_aiBase[1],m_aafPoly[1]);
SetPolynomial(0,fZ-m_aiBase[2],m_aafPoly[2]);
int aiI[3] = { 0, 0, 0 };
Real fResult = (Real)0.0;
for (int k = 0; k < m_iDp1ToN; k++)
{
fResult += m_aafPoly[0][aiI[0]]*m_aafPoly[1][aiI[1]]*
m_aafPoly[2][aiI[2]]*m_afInter[k];
if (++aiI[0] <= m_iDegree)
{
continue;
}
aiI[0] = 0;
if (++aiI[1] <= m_iDegree)
{
continue;
}
aiI[1] = 0;
aiI[2]++;
}
return fResult;
}
//----------------------------------------------------------------------------
template <class Real>
Real IntpBSplineUniform3<Real>::operator() (int iDx, int iDy, int iDz,
Real fX, Real fY, Real fZ)
{
m_aiBase[0] = (int)Math<Real>::Floor(fX);
m_aiBase[1] = (int)Math<Real>::Floor(fY);
m_aiBase[2] = (int)Math<Real>::Floor(fZ);
for (int d = 0; d < 3; d++)
{
if (m_aiOldBase[d] != m_aiBase[d])
{
// switch to new local grid
for (int k = 0; k < 3; k++)
{
m_aiOldBase[k] = m_aiBase[k];
m_aiGridMin[k] = m_aiBase[k] - 1;
m_aiGridMax[k] = m_aiGridMin[k] + m_iDegree;
}
// fill in missing grid data if necessary
if (m_oEvaluateCallback)
{
EvaluateUnknownData();
}
ComputeIntermediate();
break;
}
}
SetPolynomial(iDx,fX-m_aiBase[0],m_aafPoly[0]);
SetPolynomial(iDy,fY-m_aiBase[1],m_aafPoly[1]);
SetPolynomial(iDz,fZ-m_aiBase[2],m_aafPoly[2]);
int aiI[3] = { iDx, iDy, iDz };
int aiDelta[2] = { iDx, m_iDp1*iDy };
Real fResult = (Real)0.0;
for (int k = aiI[0]+m_iDp1*(aiI[1]+m_iDp1*aiI[2]); k < m_iDp1ToN; k++)
{
fResult += m_aafPoly[0][aiI[0]]*m_aafPoly[1][aiI[1]]*
m_aafPoly[2][aiI[2]]*m_afInter[k];
if (++aiI[0] <= m_iDegree)
{
continue;
}
aiI[0] = iDx;
k += aiDelta[0];
if (++aiI[1] <= m_iDegree)
{
continue;
}
aiI[1] = iDy;
k += aiDelta[1];
aiI[2]++;
}
return fResult;
}
//----------------------------------------------------------------------------
template <class Real>
void IntpBSplineUniform3<Real>::EvaluateUnknownData ()
{
for (int k2 = m_aiGridMin[2]; k2 <= m_aiGridMax[2]; k2++)
{
for (int k1 = m_aiGridMin[1]; k1 <= m_aiGridMax[1]; k1++)
{
for (int k0 = m_aiGridMin[0]; k0 <= m_aiGridMax[0]; k0++)
{
int iIndex = Index(k0,k1,k2);
if (m_afData[iIndex] == Math<Real>::MAX_REAL)
{
m_afData[iIndex] = m_oEvaluateCallback(iIndex);
}
}
}
}
}
//----------------------------------------------------------------------------
template <class Real>
void IntpBSplineUniform3<Real>::ComputeIntermediate ()
{
// fetch subblock of data to cache
int aiDelta[2] = { m_aiDim[0]-m_iDp1, m_aiDim[0]*(m_aiDim[1]-m_iDp1) };
int aiLoop[3];
for (int iDim = 0; iDim < 3; iDim++)
{
aiLoop[iDim] = m_aiGridMin[iDim];
}
int iIndex = Index(aiLoop[0],aiLoop[1],aiLoop[2]);
int k;
for (k = 0; k < m_iDp1ToN; k++, iIndex++)
{
m_afCache[k] = m_afData[iIndex];
if (++aiLoop[0] <= m_aiGridMax[0])
{
continue;
}
aiLoop[0] = m_aiGridMin[0];
iIndex += aiDelta[0];
if (++aiLoop[1] <= m_aiGridMax[1])
{
continue;
}
aiLoop[1] = m_aiGridMin[1];
iIndex += aiDelta[1];
aiLoop[2]++;
}
// compute and save the intermediate product
for (int i = 0, j = 0; i < m_iDp1ToN; i++)
{
Real fSum = (Real)0.0;
for (k = 0; k < m_iDp1ToN; k += m_aiSkip[j], j += m_aiSkip[j])
{
fSum += m_afProduct[j]*m_afCache[k];
}
m_afInter[i] = fSum;
}
}
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
// explicit instantiation
//----------------------------------------------------------------------------
template WM4_FOUNDATION_ITEM
class IntpBSplineUniform3<float>;
template WM4_FOUNDATION_ITEM
class IntpBSplineUniform3<double>;
//----------------------------------------------------------------------------
}
| [
"yf.flagship@e79fdf7c-a9d8-11de-b950-3d5b5f4ea0aa"
]
| [
[
[
1,
236
]
]
]
|
d6c6a7eccd561248ff855385c249c7b78cabb66f | 0ce35229d1698224907e00f1fdfb34cfac5db1a2 | /Conducteur.cpp | 4ca283fd736e6d03d87ee0dce14d4e41efa83bc2 | []
| no_license | manudss/efreiloca | f7b1089b6ba74ff26e6320044f66f9401ebca21b | 54e8c4af1aace11f35846e63880a893e412b3309 | refs/heads/master | 2020-06-05T17:34:02.234617 | 2007-06-04T19:12:15 | 2007-06-04T19:12:15 | 32,325,713 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,673 | cpp | #include "StdAfx.h"
#include "Conducteur.h"
Conducteur::Conducteur(void)
{
this->nom = "";
this->prenom = "";
this->permis_moto = false;
this->permis_voiture = false;
this->num_permis = "";
}
Conducteur::~Conducteur(void)
{
}
//Setteurs :
void Conducteur::set_nom (std::string chaine)
{
nom=chaine ;
}
void Conducteur::set_prenom (std::string chaine)
{
prenom=chaine ;
}
void Conducteur::set_date_naissance (std::string chaine)
{
date_naissance.set(chaine);
}
void Conducteur::set_permis_voiture (std::string chaine)
{
permis_voiture = atoi (chaine.c_str());
}
void Conducteur::set_num_permis (std::string chaine)
{
num_permis= chaine;
}
void Conducteur::set_delivrance_permis (std::string chaine)
{
delivrance_permis.set(chaine);
}
void Conducteur::set_expiration_permis (std::string chaine)
{
expiration_permis.set(chaine);
}
void Conducteur::set_permis_moto (std::string chaine)
{
permis_moto = atoi (chaine.c_str());
}
//Getteurs
std::string Conducteur::get_nom()
{
return nom;
}
std::string Conducteur::get_prenom()
{
return prenom;
}
std::string Conducteur::get_date_naissance()
{
return date_naissance.get();
}
std::string Conducteur::get_permis_voiture()
{
if (permis_voiture)return "1";
else return "0";
}
std::string Conducteur::get_num_permis()
{
return num_permis;
}
std::string Conducteur::get_delivrance_permis()
{
return delivrance_permis.get();
}
std::string Conducteur::get_expiration_permis()
{
return expiration_permis.get();
}
std::string Conducteur::get_permis_moto()
{
if (permis_moto)return "1";
else return "0";
}
| [
"manu.dss@65b228c9-682f-0410-abd1-c3b8cf015911",
"pootoonet@65b228c9-682f-0410-abd1-c3b8cf015911"
]
| [
[
[
1,
14
]
],
[
[
15,
96
]
]
]
|
6446728e6675ba07ae674918ad4994211fb44bbc | 0f8559dad8e89d112362f9770a4551149d4e738f | /Wall_Destruction/Havok/Source/Physics/Utilities/Dynamics/SaveContactPoints/hkpSaveContactPointsEndianUtil.h | 5463f1128fb8e290535697a74049029737fc28d9 | []
| no_license | TheProjecter/olafurabertaymsc | 9360ad4c988d921e55b8cef9b8dcf1959e92d814 | 456d4d87699342c5459534a7992f04669e75d2e1 | refs/heads/master | 2021-01-10T15:15:49.289873 | 2010-09-20T12:58:48 | 2010-09-20T12:58:48 | 45,933,002 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,531 | h | /*
*
* Confidential Information of Telekinesys Research Limited (t/a Havok). Not for disclosure or distribution without Havok's
* prior written consent. This software contains code, techniques and know-how which is confidential and proprietary to Havok.
* Level 2 and Level 3 source code contains trade secrets of Havok. Havok Software (C) Copyright 1999-2009 Telekinesys Research Limited t/a Havok. All Rights Reserved. Use of this software is subject to the terms of an end user license agreement.
*
*/
#ifndef HK_UTILITIES2_SAVE_CONTACT_POINTS_ENDIAN_UTIL_H
#define HK_UTILITIES2_SAVE_CONTACT_POINTS_ENDIAN_UTIL_H
#include <Common/Base/hkBase.h>
#include <Common/Base/hkBase.h>
struct hkpAgentEntry;
struct hkpProcessCollisionInput;
struct hkpSerializedAgentNnEntry;
struct hkpSerializedTrack1nInfo;
struct hkpAgentNnMachineTimEntry;
struct hkpAgentNnMachinePaddedEntry;
struct hkpAgent1nMachineTimEntry;
struct hkpAgent1nMachinePaddedEntry;
class hkpBoxBoxManifold;
struct hkpCapsuleTriangleCache3;
class hkpGskCache;
struct hkpGskManifold;
class hkpContactPointProperties;
class hkpSaveContactPointsEndianUtil
{
public:
// Swap endianness in a collision entry, including all recursive subtracks.
static void HK_CALL swapEndianTypeInCollisionEntry( const hkpProcessCollisionInput* input, hkpSerializedAgentNnEntry& serializedEntry );
static void HK_CALL swapEndianTypeInEntry( const hkpProcessCollisionInput* input, hkpAgentEntry* entry, hkpSerializedTrack1nInfo& serializedTrack, hkBool isNnEntry, int& sizeOfThisEntryOut, bool& trackUsedOut);
static void HK_CALL swapEndianTypeIn1nTrack( const hkpProcessCollisionInput* input, hkpSerializedTrack1nInfo& serializedTrack );
//
// Helper functions
//
// Base endian swapping func
static inline void reverseBytes(void* start, int count);
// Basic types swapping
static inline void swapEndianType(hkUint16& uint16);
static inline void swapEndianType(hkUint32& uint32);
static inline void swapEndianType(hkReal& real);
static inline void swapEndianType(hkVector4& vec4);
// Agent entry swapping
static inline void swapEndianType(hkpAgentNnMachineTimEntry* entry);
static inline void swapEndianType(hkpAgentNnMachinePaddedEntry* entry);
static inline void swapEndianType(hkpAgent1nMachineTimEntry* entry);
static inline void swapEndianType(hkpAgent1nMachinePaddedEntry* entry);
// Agent data swaping
static inline void swapEndianType(hkpBoxBoxManifold* manifold);
static inline void swapEndianType(hkpCapsuleTriangleCache3* cache);
static inline void swapEndianType(hkpGskCache* cache);
static inline void swapEndianType(hkpGskManifold* manifold);
static inline void swapEndianType(hkpContactPointProperties* p);
};
#endif // HK_UTILITIES2_SAVE_CONTACT_POINTS_ENDIAN_UTIL_H
/*
* Havok SDK - NO SOURCE PC DOWNLOAD, BUILD(#20091222)
*
* Confidential Information of Havok. (C) Copyright 1999-2009
* Telekinesys Research Limited t/a Havok. All Rights Reserved. The Havok
* Logo, and the Havok buzzsaw logo are trademarks of Havok. Title, ownership
* rights, and intellectual property rights in the Havok software remain in
* Havok and/or its suppliers.
*
* Use of this software for evaluation purposes is subject to and indicates
* acceptance of the End User licence Agreement for this product. A copy of
* the license is included with this software and is also available at www.havok.com/tryhavok.
*
*/
| [
"[email protected]"
]
| [
[
[
1,
89
]
]
]
|
1d6fd8becea948d3898e94230f46875bbdbc3f0d | 744e9a2bf1d0aee245c42ee145392d1f6a6f65c9 | /branches/remove_qt3_support_branch/common/ttcut.cpp | 65ebbed3ab6135edb114b5e2a28097296ef7e93d | []
| no_license | BackupTheBerlios/ttcut-svn | 2b5d00c3c6d16aa118b4a58c7d0702cfcc0b051a | 958032e74e8bb144a96b6eb7e1d63bc8ae762096 | refs/heads/master | 2020-04-22T12:08:57.640316 | 2009-02-08T16:14:00 | 2009-02-08T16:14:00 | 40,747,642 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 7,576 | cpp | /*----------------------------------------------------------------------------*/
/* COPYRIGHT: TriTime (c) 2003/2005 / www.tritime.org */
/*----------------------------------------------------------------------------*/
/* PROJEKT : TTCUT 2005 */
/* FILE : ttcut.cpp */
/*----------------------------------------------------------------------------*/
/* AUTHOR : b. altendorf (E-Mail: [email protected]) DATE: 03/01/2005 */
/* MODIFIED: b. altendorf DATE: 03/19/2005 */
/* MODIFIED: b. altendorf DATE: 03/23/2005 */
/* MODIFIED: b. altendorf DATE: 03/31/2005 */
/* MODIFIED: DATE: */
/*----------------------------------------------------------------------------*/
// ----------------------------------------------------------------------------
// TTCUT
// ----------------------------------------------------------------------------
/*----------------------------------------------------------------------------*/
/* This program is free software; you can redistribute it and/or modify it */
/* under the terms of the GNU General Public License as published by the Free */
/* Software Foundation; */
/* either version 2 of the License, or (at your option) any later version. */
/* */
/* This program is distributed in the hope that it will be useful, but WITHOUT*/
/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
/* FITNESS FOR A PARTICULAR PURPOSE. */
/* See the GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License along */
/* with this program; if not, write to the Free Software Foundation, */
/* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */
/*----------------------------------------------------------------------------*/
#include "ttcut.h"
#include <QWidget>
#include <QDir>
#include <QCoreApplication>
#include <QString>
// /////////////////////////////////////////////////////////////////////////////
// -----------------------------------------------------------------------------
// Initialize static TTCut class members
// -----------------------------------------------------------------------------
// /////////////////////////////////////////////////////////////////////////////
// -----------------------------------------------------------------------------
// Pixmaps
// -----------------------------------------------------------------------------
QPixmap* TTCut::imgDownArrow = NULL;
QPixmap* TTCut::imgUpArrow = NULL;
QPixmap* TTCut::imgDelete = NULL;
QPixmap* TTCut::imgFileOpen24 = NULL;
QPixmap* TTCut::imgFileNew = NULL;
QPixmap* TTCut::imgFileOpen = NULL;
QPixmap* TTCut::imgFileSave = NULL;
QPixmap* TTCut::imgFileSaveAs = NULL;
QPixmap* TTCut::imgSaveImage = NULL;
QPixmap* TTCut::imgSettings = NULL;
QPixmap* TTCut::imgSettings18 = NULL;
QPixmap* TTCut::imgExit = NULL;
QPixmap* TTCut::imgPlay = NULL;
QPixmap* TTCut::imgStop = NULL;
QPixmap* TTCut::imgSearch = NULL;
QPixmap* TTCut::imgChapter = NULL;
QPixmap* TTCut::imgPreview = NULL;
QPixmap* TTCut::imgCutAV = NULL;
QPixmap* TTCut::imgCutAudio = NULL;
QPixmap* TTCut::imgGoTo = NULL;
QPixmap* TTCut::imgMarker = NULL;
QPixmap* TTCut::imgClock = NULL;
QPixmap* TTCut::imgApply = NULL;
QPixmap* TTCut::imgAddToList = NULL;
QPixmap* TTCut::imgFileClose = NULL;
QPixmap* TTCut::imgIFrame = NULL;
QPixmap* TTCut::imgPFrame = NULL;
QPixmap* TTCut::imgBFrame = NULL;
// --------------------------------------------------------------
// common settings
// --------------------------------------------------------------
// Options
bool TTCut::fastSlider = false;
QString TTCut::tempDirPath = QDir::tempPath();
QString TTCut::lastDirPath = QDir::homePath();
QString TTCut::projectFileName = "";
// Preview
int TTCut::cutPreviewSeconds = 25;
int TTCut::playSkipFrames = 0;
// Frame search
int TTCut::searchLength = 45;
int TTCut::searchAccuracy = 1;
// Navigation
int TTCut::stepSliderClick = 40;
int TTCut::stepPgUpDown = 80;
int TTCut::stepArrowKeys = 1;
int TTCut::stepPlusAlt = 100;
int TTCut::stepPlusCtrl = 200;
int TTCut::stepPlusShift = 200;
int TTCut::stepQuickJump = 25;
int TTCut::stepMouseWheel = 120;
// Index files
bool TTCut::createVideoIDD = false;
bool TTCut::createAudioIDD = false;
bool TTCut::createPrevIDD = false;
bool TTCut::createD2V = false;
bool TTCut::readVideoIDD = false;
bool TTCut::readAudioIDD = false;
bool TTCut::readPrevIDD = false;
// Logfile
bool TTCut::createLogFile = true;
bool TTCut::logModeConsole = false;
bool TTCut::logModeExtended = true;
bool TTCut::logVideoIndexInfo = false;
bool TTCut::logAudioIndexInfo = false;
// --------------------------------------------------------------
// encoder settings
// --------------------------------------------------------------
// Version
QString TTCut::versionString = "TTCut - 0.12.0-preview";
// Options
bool TTCut::encoderMode = false;
// --------------------------------------------------------------
// muxer settings
// --------------------------------------------------------------
// Options
int TTCut::muxMode = 2;
int TTCut::mpeg2Target = 2;
QString TTCut::muxProg = "mplex";
QString TTCut::muxProgPath = "/usr/local/bin/";
QString TTCut::muxProgCmd = "-f 8";
QString TTCut::muxOutputPath = "/var/tmp";
// --------------------------------------------------------------
// chapter settings
// --------------------------------------------------------------
// Options
bool TTCut::spumuxChapter = false;
// -----------------------------------------------------------------------------
// Status
// -----------------------------------------------------------------------------
bool TTCut::isVideoOpen = false;
int TTCut::numAudioTracks = 0;
bool TTCut::isProjektModified = false;
bool TTCut::isPlaying = false;
bool TTCut::isWorking = false;
// --------------------------------------------------------------
// Cut settings
// --------------------------------------------------------------
// cut option
QString TTCut::cutDirPath = QDir::currentPath();
QString TTCut::cutVideoName = "_cut.m2v";
bool TTCut::cutWriteMaxBitrate = false;
bool TTCut::cutWriteSeqEnd = false;
bool TTCut::correctCutTimeCode = false;
bool TTCut::correctCutBitRate = false;
bool TTCut::createCutIDD = false;
bool TTCut::readCutIDD = false;
// --------------------------------------------------------------
// Global properties
// --------------------------------------------------------------
float TTCut::frameRate = 25.0;
QWidget* TTCut::mainWindow = NULL;
TTCut::TTCut()
{
}
TTCut::~TTCut()
{
}
| [
"tritime@7763a927-590e-0410-8f7f-dbc853b76eaa"
]
| [
[
[
1,
188
]
]
]
|
dd81e8535c1ac1777bd97f6d409318dfafecf019 | 17083b919f058848c3eb038eae37effd1a5b0759 | /SimpleGL/sgl/GL/GLRasterizerState.h | 241b480f773394734bf763128c1d162ed41210a4 | []
| no_license | BackupTheBerlios/sgl | e1ce68dfc2daa011bdcf018ddce744698cc7bc5f | 2ab6e770dfaf5268c1afa41a77c04ad7774a70ed | refs/heads/master | 2021-01-21T12:39:59.048415 | 2011-10-28T16:14:29 | 2011-10-28T16:14:29 | 39,894,148 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 642 | h | #ifndef SIMPLE_GL_GL_RASTERIZER_STATE_H
#define SIMPLE_GL_GL_RASTERIZER_STATE_H
#include "GLForward.h"
#include "../RasterizerState.h"
namespace sgl {
class GLRasterizerState :
public ReferencedImpl<RasterizerState>
{
public:
GLRasterizerState(GLDevice* device, const DESC& desc);
~GLRasterizerState();
// Override RasterizerState
const DESC& SGL_DLLCALL Desc() const { return desc; }
void SGL_DLLCALL Bind() const;
private:
GLDevice* device;
DESC desc;
// gl primitives
unsigned glCullMode;
unsigned glFillMode;
};
} // namespace sgl
#endif // SIMPLE_GL_GL_RASTERIZER_STATE_H
| [
"devnull@localhost"
]
| [
[
[
1,
31
]
]
]
|
a466f1b3ed384efee6d61f2471489012c0e09fd0 | a30b091525dc3f07cd7e12c80b8d168a0ee4f808 | /EngineAll/Math/GeometryAlgorithms.h | 058a72511b298858d48ea030953702daea7ed35f | []
| no_license | ghsoftco/basecode14 | f50dc049b8f2f8d284fece4ee72f9d2f3f59a700 | 57de2a24c01cec6dc3312cbfe200f2b15d923419 | refs/heads/master | 2021-01-10T11:18:29.585561 | 2011-01-23T02:25:21 | 2011-01-23T02:25:21 | 47,255,927 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 403 | h | /*
GeometryAlgorithms.h
Written by Matthew Fisher
Geometric algorithms that do not fit anywhere else.
*/
#pragma once
namespace GeometryAlgorithms
{
struct RigidCorrespondenceEntry
{
Vec3f Source, Target;
float Weight;
};
void ComputeRigidCorrespondenceTransform(Matrix4 &SourceToTargetTransform, const Vector<RigidCorrespondenceEntry> &Correspondences);
}; | [
"zhaodongmpii@7e7f00ea-7cf8-66b5-cf80-f378872134d2"
]
| [
[
[
1,
18
]
]
]
|
e88f97929a5810726ab33c556dc8fb31cbf8508f | b26957d6f3a64b19cda1d76b265d93047c114891 | /StudentDetection/StudentDetection/vector_space.cpp | fb4d2300a6c9abd8de2072578386d855ba2121b1 | []
| no_license | SachinTS/khoa-luan-tot-nghiep | 58e7efbd51d5f807f08b62a641672b4fc62f7990 | 7200721aded827731232c49aeade804febfba086 | refs/heads/master | 2016-09-06T13:46:12.228528 | 2010-08-07T06:47:45 | 2010-08-07T06:47:45 | 33,529,631 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,095 | cpp | #include "StdAfx.h"
#include "vector_space.h"
VectorSpace::VectorSpace(void) {
}
VectorSpace::VectorSpace(Snake *init)
{
this->origin_snake = init;
}
VectorSpace::~VectorSpace(void)
{
if (this->snakes.size()) {
for (vector<Snake*>::iterator it = this->snakes.begin();
it != this->snakes.end();
it++) {
delete (*it);
}
}
if (this->origin_snake != NULL) {
delete this->origin_snake;
}
}
void VectorSpace::GenerateSnake() {
// check if already generated
if (snakes.size() > 0) {
return;
}
vector<CvPoint> ctrl_points = this->origin_snake->ctrl_points;
int size = ctrl_points.size();
// (Qx Qy)^T
CvMat *Q0_mat = cvCreateMat(size*2, 1, CV_32FC1);
vector<CvPoint>::iterator ctrl_it = ctrl_points.begin();
for (int i = 0; i < size; i++) {
CV_MAT_ELEM(*Q0_mat, float, i, 0) = ctrl_it->x;
CV_MAT_ELEM(*Q0_mat, float, i+size, 0) = ctrl_it->y;
ctrl_it++;
}
CvMat *W_mat = cvCreateMat(size*2, 6, CV_32FC1);
CvMat *result_mat = cvCreateMat(size*2, 1, CV_32FC1);
CvMat *X_mat = cvCreateMat(6, 1, CV_32FC1);
CV_MAT_ELEM(*X_mat, float, 0, 0) = 0;
CV_MAT_ELEM(*X_mat, float, 1, 0) = 0;
CV_MAT_ELEM(*X_mat, float, 2, 0) = 0;
CV_MAT_ELEM(*X_mat, float, 3, 0) = 0;
CV_MAT_ELEM(*X_mat, float, 4, 0) = 0;
CV_MAT_ELEM(*X_mat, float, 5, 0) = 0;
//////////////////////////////////////////////////////////
// result
// translate Ox
for (int i = -12; i <= 18; i+=3) {
// translate Oy
for (int j = -21; j <= 12; j+=3) {
// scale
for (float k = 0.9; k <= 1.1; k += 0.1) {
// rotate
for (float r = -5; r <= 5; r += 5) {
ctrl_it = ctrl_points.begin();
for (int ii = 0; ii < size; ii++) {
CV_MAT_ELEM(*W_mat, float, ii, 0) = 1;
CV_MAT_ELEM(*W_mat, float, ii, 1) = 0;
CV_MAT_ELEM(*W_mat, float, ii, 2) = ctrl_it->x;
CV_MAT_ELEM(*W_mat, float, ii, 3) = 0;
CV_MAT_ELEM(*W_mat, float, ii, 4) = 0;
CV_MAT_ELEM(*W_mat, float, ii, 5) = ctrl_it->y;
CV_MAT_ELEM(*W_mat, float, ii+size, 0) = 0;
CV_MAT_ELEM(*W_mat, float, ii+size, 1) = 1;
CV_MAT_ELEM(*W_mat, float, ii+size, 2) = 0;
CV_MAT_ELEM(*W_mat, float, ii+size, 3) = ctrl_it->y;
CV_MAT_ELEM(*W_mat, float, ii+size, 4) = ctrl_it->x;
CV_MAT_ELEM(*W_mat, float, ii+size, 5) = 0;
ctrl_it++;
}
// tinh tien ve tam
CV_MAT_ELEM(*X_mat, float, 0, 0) = -this->origin_snake->center.x;
CV_MAT_ELEM(*X_mat, float, 1, 0) = -this->origin_snake->center.y;
CV_MAT_ELEM(*X_mat, float, 2, 0) = 0;
CV_MAT_ELEM(*X_mat, float, 3, 0) = 0;
CV_MAT_ELEM(*X_mat, float, 4, 0) = 0;
CV_MAT_ELEM(*X_mat, float, 5, 0) = 0;
// (2Mx6 * 6x1 = 2Mx1) + 2Mx1 = 2Mx1
cvMatMulAdd(W_mat, X_mat, Q0_mat, result_mat);
CV_MAT_ELEM(*X_mat, float, 0, 0) = i;
CV_MAT_ELEM(*X_mat, float, 1, 0) = j;
CV_MAT_ELEM(*X_mat, float, 2, 0) = k*cos(r*PI/180)-1;
CV_MAT_ELEM(*X_mat, float, 3, 0) = k*cos(r*PI/180)-1;
CV_MAT_ELEM(*X_mat, float, 4, 0) = k*-sin(r*PI/180);
CV_MAT_ELEM(*X_mat, float, 5, 0) = k*sin(r*PI/180);
// change W mat
for (int q = 0; q < size; q++) {
CV_MAT_ELEM(*W_mat, float, q, 2) = CV_MAT_ELEM(*result_mat, float, q, 0);
CV_MAT_ELEM(*W_mat, float, q, 5) = CV_MAT_ELEM(*result_mat, float, q+size, 0);
CV_MAT_ELEM(*W_mat, float, q+size, 3) = CV_MAT_ELEM(*result_mat, float, q+size, 0);
CV_MAT_ELEM(*W_mat, float, q+size, 4) = CV_MAT_ELEM(*result_mat, float, q, 0);
}
cvMatMulAdd(W_mat, X_mat, result_mat, result_mat);
// tinh tien tro lai vi tri cu
CV_MAT_ELEM(*X_mat, float, 0, 0) = this->origin_snake->center.x;
CV_MAT_ELEM(*X_mat, float, 1, 0) = this->origin_snake->center.y;
CV_MAT_ELEM(*X_mat, float, 2, 0) = 0;
CV_MAT_ELEM(*X_mat, float, 3, 0) = 0;
CV_MAT_ELEM(*X_mat, float, 4, 0) = 0;
CV_MAT_ELEM(*X_mat, float, 5, 0) = 0;
// change W mat
for (int q = 0; q < size; q++) {
CV_MAT_ELEM(*W_mat, float, q, 2) = CV_MAT_ELEM(*result_mat, float, q, 0);
CV_MAT_ELEM(*W_mat, float, q, 5) = CV_MAT_ELEM(*result_mat, float, q+size, 0);
CV_MAT_ELEM(*W_mat, float, q+size, 3) = CV_MAT_ELEM(*result_mat, float, q+size, 0);
CV_MAT_ELEM(*W_mat, float, q+size, 4) = CV_MAT_ELEM(*result_mat, float, q, 0);
}
cvMatMulAdd(W_mat, X_mat, result_mat, result_mat);
vector<CvPoint> vect;
vect.clear();
for (int ii = 0; ii < size; ii++) {
CvPoint pt;
pt.x = CV_MAT_ELEM(*result_mat, float, ii, 0);
pt.y = CV_MAT_ELEM(*result_mat, float, ii+size, 0);
vect.push_back(pt);
}
Snake *s = new Snake(vect, false);
snakes.push_back(s);
}
}
}
}
cvReleaseMat(&result_mat);
cvReleaseMat(&Q0_mat);
cvReleaseMat(&X_mat);
cvReleaseMat(&W_mat);
}
void VectorSpace::DrawSnakes(IplImage *img) {
for (vector<Snake*>::iterator it = this->snakes.begin();
it != this->snakes.end();
it++) {
(*it)->DrawCurve(img);
}
} | [
"hvu.nguyen2007@b0713345-de22-efb3-841d-461946120171"
]
| [
[
[
1,
165
]
]
]
|
108608688ad074dd5aa68faefbe3f35ee80f56da | 5ac13fa1746046451f1989b5b8734f40d6445322 | /minimangalore/Nebula2/code/nebula2/src/microtcl/tclHash.cc | 7f367ffb797af03ac521d9178c94daa354b30d86 | []
| no_license | moltenguy1/minimangalore | 9f2edf7901e7392490cc22486a7cf13c1790008d | 4d849672a6f25d8e441245d374b6bde4b59cbd48 | refs/heads/master | 2020-04-23T08:57:16.492734 | 2009-08-01T09:13:33 | 2009-08-01T09:13:33 | 35,933,330 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 34,104 | cc | /*
* tclHash.c --
*
* Implementation of in-memory hash tables for Tcl and Tcl-based
* applications.
*
* Copyright (c) 1991-1993 The Regents of the University of California.
* Copyright (c) 1994 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
*/
#include "microtcl/tclInt.h"
/*
* Prevent macros from clashing with function definitions.
*/
#if TCL_PRESERVE_BINARY_COMPATABILITY
# undef Tcl_FindHashEntry
# undef Tcl_CreateHashEntry
#endif
/*
* When there are this many entries per bucket, on average, rebuild
* the hash table to make it larger.
*/
#define REBUILD_MULTIPLIER 3
/*
* The following macro takes a preliminary integer hash value and
* produces an index into a hash tables bucket list. The idea is
* to make it so that preliminary values that are arbitrarily similar
* will end up in different buckets. The hash function was taken
* from a random-number generator.
*/
#define RANDOM_INDEX(tablePtr, i) \
(((((long) (i))*1103515245) >> (tablePtr)->downShift) & (tablePtr)->mask)
/*
* Prototypes for the array hash key methods.
*/
static Tcl_HashEntry * AllocArrayEntry _ANSI_ARGS_((
Tcl_HashTable *tablePtr,
VOID *keyPtr));
static int CompareArrayKeys _ANSI_ARGS_((
VOID *keyPtr, Tcl_HashEntry *hPtr));
static unsigned int HashArrayKey _ANSI_ARGS_((
Tcl_HashTable *tablePtr,
VOID *keyPtr));
/*
* Prototypes for the one word hash key methods.
*/
#if 0
static Tcl_HashEntry * AllocOneWordEntry _ANSI_ARGS_((
Tcl_HashTable *tablePtr,
VOID *keyPtr));
static int CompareOneWordKeys _ANSI_ARGS_((
VOID *keyPtr, Tcl_HashEntry *hPtr));
static unsigned int HashOneWordKey _ANSI_ARGS_((
Tcl_HashTable *tablePtr,
VOID *keyPtr));
#endif
/*
* Prototypes for the string hash key methods.
*/
static Tcl_HashEntry * AllocStringEntry _ANSI_ARGS_((
Tcl_HashTable *tablePtr,
VOID *keyPtr));
static int CompareStringKeys _ANSI_ARGS_((
VOID *keyPtr, Tcl_HashEntry *hPtr));
static unsigned int HashStringKey _ANSI_ARGS_((
Tcl_HashTable *tablePtr,
VOID *keyPtr));
/*
* Procedure prototypes for static procedures in this file:
*/
#if TCL_PRESERVE_BINARY_COMPATABILITY
static Tcl_HashEntry * BogusFind _ANSI_ARGS_((Tcl_HashTable *tablePtr,
CONST char *key));
static Tcl_HashEntry * BogusCreate _ANSI_ARGS_((Tcl_HashTable *tablePtr,
CONST char *key, int *newPtr));
#endif
static void RebuildTable _ANSI_ARGS_((Tcl_HashTable *tablePtr));
Tcl_HashKeyType tclArrayHashKeyType = {
TCL_HASH_KEY_TYPE_VERSION, /* version */
TCL_HASH_KEY_RANDOMIZE_HASH, /* flags */
HashArrayKey, /* hashKeyProc */
CompareArrayKeys, /* compareKeysProc */
AllocArrayEntry, /* allocEntryProc */
NULL /* freeEntryProc */
};
Tcl_HashKeyType tclOneWordHashKeyType = {
TCL_HASH_KEY_TYPE_VERSION, /* version */
0, /* flags */
NULL, /* HashOneWordKey, */ /* hashProc */
NULL, /* CompareOneWordKey, */ /* compareProc */
NULL, /* AllocOneWordKey, */ /* allocEntryProc */
NULL /* FreeOneWordKey, */ /* freeEntryProc */
};
Tcl_HashKeyType tclStringHashKeyType = {
TCL_HASH_KEY_TYPE_VERSION, /* version */
0, /* flags */
HashStringKey, /* hashKeyProc */
CompareStringKeys, /* compareKeysProc */
AllocStringEntry, /* allocEntryProc */
NULL /* freeEntryProc */
};
/*
*----------------------------------------------------------------------
*
* Tcl_InitHashTable --
*
* Given storage for a hash table, set up the fields to prepare
* the hash table for use.
*
* Results:
* None.
*
* Side effects:
* TablePtr is now ready to be passed to Tcl_FindHashEntry and
* Tcl_CreateHashEntry.
*
*----------------------------------------------------------------------
*/
#undef Tcl_InitHashTable
void
Tcl_InitHashTable(tablePtr, keyType)
register Tcl_HashTable *tablePtr; /* Pointer to table record, which
* is supplied by the caller. */
int keyType; /* Type of keys to use in table:
* TCL_STRING_KEYS, TCL_ONE_WORD_KEYS,
* or an integer >= 2. */
{
/*
* Use a special value to inform the extended version that it must
* not access any of the new fields in the Tcl_HashTable. If an
* extension is rebuilt then any calls to this function will be
* redirected to the extended version by a macro.
*/
Tcl_InitHashTableEx(tablePtr, keyType, (Tcl_HashKeyType *) -1);
}
/*
*----------------------------------------------------------------------
*
* Tcl_InitHashTableEx --
*
* Given storage for a hash table, set up the fields to prepare
* the hash table for use. This is an extended version of
* Tcl_InitHashTableEx which supports user defined keys.
*
* Results:
* None.
*
* Side effects:
* TablePtr is now ready to be passed to Tcl_FindHashEntry and
* Tcl_CreateHashEntry.
*
*----------------------------------------------------------------------
*/
void
Tcl_InitHashTableEx(tablePtr, keyType, typePtr)
register Tcl_HashTable *tablePtr; /* Pointer to table record, which
* is supplied by the caller. */
int keyType; /* Type of keys to use in table:
* TCL_STRING_KEYS, TCL_ONE_WORD_KEYS,
* TCL_CUSTOM_TYPE_KEYS,
* TCL_CUSTOM_PTR_KEYS, or an
* integer >= 2. */
Tcl_HashKeyType *typePtr; /* Pointer to structure which defines
* the behavior of this table. */
{
#if (TCL_SMALL_HASH_TABLE != 4)
panic("Tcl_InitHashTableEx: TCL_SMALL_HASH_TABLE is %d, not 4\n",
TCL_SMALL_HASH_TABLE);
#endif
tablePtr->buckets = tablePtr->staticBuckets;
tablePtr->staticBuckets[0] = tablePtr->staticBuckets[1] = 0;
tablePtr->staticBuckets[2] = tablePtr->staticBuckets[3] = 0;
tablePtr->numBuckets = TCL_SMALL_HASH_TABLE;
tablePtr->numEntries = 0;
tablePtr->rebuildSize = TCL_SMALL_HASH_TABLE*REBUILD_MULTIPLIER;
tablePtr->downShift = 28;
tablePtr->mask = 3;
tablePtr->keyType = keyType;
#if TCL_PRESERVE_BINARY_COMPATABILITY
tablePtr->findProc = Tcl_FindHashEntry;
tablePtr->createProc = Tcl_CreateHashEntry;
if (typePtr == NULL) {
/*
* The caller has been rebuilt so the hash table is an extended
* version.
*/
} else if (typePtr != (Tcl_HashKeyType *) -1) {
/*
* The caller is requesting a customized hash table so it must be
* an extended version.
*/
tablePtr->typePtr = typePtr;
} else {
/*
* The caller has not been rebuilt so the hash table is not
* extended.
*/
}
#else
if (typePtr == NULL) {
/*
* Use the key type to decide which key type is needed.
*/
if (keyType == TCL_STRING_KEYS) {
typePtr = &tclStringHashKeyType;
} else if (keyType == TCL_ONE_WORD_KEYS) {
typePtr = &tclOneWordHashKeyType;
} else if (keyType == TCL_CUSTOM_TYPE_KEYS) {
Tcl_Panic ("No type structure specified for TCL_CUSTOM_TYPE_KEYS");
} else if (keyType == TCL_CUSTOM_PTR_KEYS) {
Tcl_Panic ("No type structure specified for TCL_CUSTOM_PTR_KEYS");
} else {
typePtr = &tclArrayHashKeyType;
}
} else if (typePtr == (Tcl_HashKeyType *) -1) {
/*
* If the caller has not been rebuilt then we cannot continue as
* the hash table is not an extended version.
*/
Tcl_Panic ("Hash table is not compatible");
}
tablePtr->typePtr = typePtr;
#endif
}
/*
*----------------------------------------------------------------------
*
* Tcl_FindHashEntry --
*
* Given a hash table find the entry with a matching key.
*
* Results:
* The return value is a token for the matching entry in the
* hash table, or NULL if there was no matching entry.
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
Tcl_HashEntry *
Tcl_FindHashEntry(tablePtr, key)
Tcl_HashTable *tablePtr; /* Table in which to lookup entry. */
CONST char *key; /* Key to use to find matching entry. */
{
register Tcl_HashEntry *hPtr;
Tcl_HashKeyType *typePtr;
unsigned int hash;
int index;
#if TCL_PRESERVE_BINARY_COMPATABILITY
if (tablePtr->keyType == TCL_STRING_KEYS) {
typePtr = &tclStringHashKeyType;
} else if (tablePtr->keyType == TCL_ONE_WORD_KEYS) {
typePtr = &tclOneWordHashKeyType;
} else if (tablePtr->keyType == TCL_CUSTOM_TYPE_KEYS
|| tablePtr->keyType == TCL_CUSTOM_PTR_KEYS) {
typePtr = tablePtr->typePtr;
} else {
typePtr = &tclArrayHashKeyType;
}
#else
typePtr = tablePtr->typePtr;
if (typePtr == NULL) {
Tcl_Panic("called Tcl_FindHashEntry on deleted table");
return NULL;
}
#endif
if (typePtr->hashKeyProc) {
hash = typePtr->hashKeyProc (tablePtr, (VOID *) key);
if (typePtr->flags & TCL_HASH_KEY_RANDOMIZE_HASH) {
index = RANDOM_INDEX (tablePtr, hash);
} else {
index = hash & tablePtr->mask;
}
} else {
hash = (unsigned int) key;
index = RANDOM_INDEX (tablePtr, hash);
}
/*
* Search all of the entries in the appropriate bucket.
*/
if (typePtr->compareKeysProc) {
for (hPtr = tablePtr->buckets[index]; hPtr != NULL;
hPtr = hPtr->nextPtr) {
#if TCL_HASH_KEY_STORE_HASH
if (hash != (unsigned int) hPtr->hash) {
continue;
}
#endif
if (typePtr->compareKeysProc ((VOID *) key, hPtr)) {
return hPtr;
}
}
} else {
for (hPtr = tablePtr->buckets[index]; hPtr != NULL;
hPtr = hPtr->nextPtr) {
#if TCL_HASH_KEY_STORE_HASH
if (hash != (unsigned int) hPtr->hash) {
continue;
}
#endif
if (key == hPtr->key.oneWordValue) {
return hPtr;
}
}
}
return NULL;
}
/*
*----------------------------------------------------------------------
*
* Tcl_CreateHashEntry --
*
* Given a hash table with string keys, and a string key, find
* the entry with a matching key. If there is no matching entry,
* then create a new entry that does match.
*
* Results:
* The return value is a pointer to the matching entry. If this
* is a newly-created entry, then *newPtr will be set to a non-zero
* value; otherwise *newPtr will be set to 0. If this is a new
* entry the value stored in the entry will initially be 0.
*
* Side effects:
* A new entry may be added to the hash table.
*
*----------------------------------------------------------------------
*/
Tcl_HashEntry *
Tcl_CreateHashEntry(tablePtr, key, newPtr)
Tcl_HashTable *tablePtr; /* Table in which to lookup entry. */
CONST char *key; /* Key to use to find or create matching
* entry. */
int *newPtr; /* Store info here telling whether a new
* entry was created. */
{
register Tcl_HashEntry *hPtr;
Tcl_HashKeyType *typePtr;
unsigned int hash;
int index;
#if TCL_PRESERVE_BINARY_COMPATABILITY
if (tablePtr->keyType == TCL_STRING_KEYS) {
typePtr = &tclStringHashKeyType;
} else if (tablePtr->keyType == TCL_ONE_WORD_KEYS) {
typePtr = &tclOneWordHashKeyType;
} else if (tablePtr->keyType == TCL_CUSTOM_TYPE_KEYS
|| tablePtr->keyType == TCL_CUSTOM_PTR_KEYS) {
typePtr = tablePtr->typePtr;
} else {
typePtr = &tclArrayHashKeyType;
}
#else
typePtr = tablePtr->typePtr;
if (typePtr == NULL) {
Tcl_Panic("called Tcl_CreateHashEntry on deleted table");
return NULL;
}
#endif
if (typePtr->hashKeyProc) {
hash = typePtr->hashKeyProc (tablePtr, (VOID *) key);
if (typePtr->flags & TCL_HASH_KEY_RANDOMIZE_HASH) {
index = RANDOM_INDEX (tablePtr, hash);
} else {
index = hash & tablePtr->mask;
}
} else {
hash = (unsigned int) key;
index = RANDOM_INDEX (tablePtr, hash);
}
/*
* Search all of the entries in the appropriate bucket.
*/
if (typePtr->compareKeysProc) {
for (hPtr = tablePtr->buckets[index]; hPtr != NULL;
hPtr = hPtr->nextPtr) {
#if TCL_HASH_KEY_STORE_HASH
if (hash != (unsigned int) hPtr->hash) {
continue;
}
#endif
if (typePtr->compareKeysProc ((VOID *) key, hPtr)) {
*newPtr = 0;
return hPtr;
}
}
} else {
for (hPtr = tablePtr->buckets[index]; hPtr != NULL;
hPtr = hPtr->nextPtr) {
#if TCL_HASH_KEY_STORE_HASH
if (hash != (unsigned int) hPtr->hash) {
continue;
}
#endif
if (key == hPtr->key.oneWordValue) {
*newPtr = 0;
return hPtr;
}
}
}
/*
* Entry not found. Add a new one to the bucket.
*/
*newPtr = 1;
if (typePtr->allocEntryProc) {
hPtr = typePtr->allocEntryProc (tablePtr, (VOID *) key);
} else {
hPtr = (Tcl_HashEntry *) ckalloc((unsigned) sizeof(Tcl_HashEntry));
hPtr->key.oneWordValue = (char *) key;
}
hPtr->tablePtr = tablePtr;
#if TCL_HASH_KEY_STORE_HASH
# if TCL_PRESERVE_BINARY_COMPATABILITY
hPtr->hash = (VOID *) hash;
# else
hPtr->hash = hash;
# endif
hPtr->nextPtr = tablePtr->buckets[index];
tablePtr->buckets[index] = hPtr;
#else
hPtr->bucketPtr = &(tablePtr->buckets[index]);
hPtr->nextPtr = *hPtr->bucketPtr;
*hPtr->bucketPtr = hPtr;
#endif
hPtr->clientData = 0;
tablePtr->numEntries++;
/*
* If the table has exceeded a decent size, rebuild it with many
* more buckets.
*/
if (tablePtr->numEntries >= tablePtr->rebuildSize) {
RebuildTable(tablePtr);
}
return hPtr;
}
/*
*----------------------------------------------------------------------
*
* Tcl_DeleteHashEntry --
*
* Remove a single entry from a hash table.
*
* Results:
* None.
*
* Side effects:
* The entry given by entryPtr is deleted from its table and
* should never again be used by the caller. It is up to the
* caller to free the clientData field of the entry, if that
* is relevant.
*
*----------------------------------------------------------------------
*/
void
Tcl_DeleteHashEntry(entryPtr)
Tcl_HashEntry *entryPtr;
{
register Tcl_HashEntry *prevPtr;
Tcl_HashKeyType *typePtr;
Tcl_HashTable *tablePtr;
Tcl_HashEntry **bucketPtr;
#if TCL_HASH_KEY_STORE_HASH
int index;
#endif
tablePtr = entryPtr->tablePtr;
#if TCL_PRESERVE_BINARY_COMPATABILITY
if (tablePtr->keyType == TCL_STRING_KEYS) {
typePtr = &tclStringHashKeyType;
} else if (tablePtr->keyType == TCL_ONE_WORD_KEYS) {
typePtr = &tclOneWordHashKeyType;
} else if (tablePtr->keyType == TCL_CUSTOM_TYPE_KEYS
|| tablePtr->keyType == TCL_CUSTOM_PTR_KEYS) {
typePtr = tablePtr->typePtr;
} else {
typePtr = &tclArrayHashKeyType;
}
#else
typePtr = tablePtr->typePtr;
#endif
#if TCL_HASH_KEY_STORE_HASH
if (typePtr->hashKeyProc == NULL
|| typePtr->flags & TCL_HASH_KEY_RANDOMIZE_HASH) {
index = RANDOM_INDEX (tablePtr, entryPtr->hash);
} else {
index = ((unsigned int) entryPtr->hash) & tablePtr->mask;
}
bucketPtr = &(tablePtr->buckets[index]);
#else
bucketPtr = entryPtr->bucketPtr;
#endif
if (*bucketPtr == entryPtr) {
*bucketPtr = entryPtr->nextPtr;
} else {
for (prevPtr = *bucketPtr; ; prevPtr = prevPtr->nextPtr) {
if (prevPtr == NULL) {
panic("malformed bucket chain in Tcl_DeleteHashEntry");
}
if (prevPtr->nextPtr == entryPtr) {
prevPtr->nextPtr = entryPtr->nextPtr;
break;
}
}
}
tablePtr->numEntries--;
if (typePtr->freeEntryProc) {
typePtr->freeEntryProc (entryPtr);
} else {
ckfree((char *) entryPtr);
}
}
/*
*----------------------------------------------------------------------
*
* Tcl_DeleteHashTable --
*
* Free up everything associated with a hash table except for
* the record for the table itself.
*
* Results:
* None.
*
* Side effects:
* The hash table is no longer useable.
*
*----------------------------------------------------------------------
*/
void
Tcl_DeleteHashTable(tablePtr)
register Tcl_HashTable *tablePtr; /* Table to delete. */
{
register Tcl_HashEntry *hPtr, *nextPtr;
Tcl_HashKeyType *typePtr;
int i;
#if TCL_PRESERVE_BINARY_COMPATABILITY
if (tablePtr->keyType == TCL_STRING_KEYS) {
typePtr = &tclStringHashKeyType;
} else if (tablePtr->keyType == TCL_ONE_WORD_KEYS) {
typePtr = &tclOneWordHashKeyType;
} else if (tablePtr->keyType == TCL_CUSTOM_TYPE_KEYS
|| tablePtr->keyType == TCL_CUSTOM_PTR_KEYS) {
typePtr = tablePtr->typePtr;
} else {
typePtr = &tclArrayHashKeyType;
}
#else
typePtr = tablePtr->typePtr;
#endif
/*
* Free up all the entries in the table.
*/
for (i = 0; i < tablePtr->numBuckets; i++) {
hPtr = tablePtr->buckets[i];
while (hPtr != NULL) {
nextPtr = hPtr->nextPtr;
if (typePtr->freeEntryProc) {
typePtr->freeEntryProc (hPtr);
} else {
ckfree((char *) hPtr);
}
hPtr = nextPtr;
}
}
/*
* Free up the bucket array, if it was dynamically allocated.
*/
if (tablePtr->buckets != tablePtr->staticBuckets) {
ckfree((char *) tablePtr->buckets);
}
/*
* Arrange for panics if the table is used again without
* re-initialization.
*/
#if TCL_PRESERVE_BINARY_COMPATABILITY
tablePtr->findProc = BogusFind;
tablePtr->createProc = BogusCreate;
#else
tablePtr->typePtr = NULL;
#endif
}
/*
*----------------------------------------------------------------------
*
* Tcl_FirstHashEntry --
*
* Locate the first entry in a hash table and set up a record
* that can be used to step through all the remaining entries
* of the table.
*
* Results:
* The return value is a pointer to the first entry in tablePtr,
* or NULL if tablePtr has no entries in it. The memory at
* *searchPtr is initialized so that subsequent calls to
* Tcl_NextHashEntry will return all of the entries in the table,
* one at a time.
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
Tcl_HashEntry *
Tcl_FirstHashEntry(tablePtr, searchPtr)
Tcl_HashTable *tablePtr; /* Table to search. */
Tcl_HashSearch *searchPtr; /* Place to store information about
* progress through the table. */
{
searchPtr->tablePtr = tablePtr;
searchPtr->nextIndex = 0;
searchPtr->nextEntryPtr = NULL;
return Tcl_NextHashEntry(searchPtr);
}
/*
*----------------------------------------------------------------------
*
* Tcl_NextHashEntry --
*
* Once a hash table enumeration has been initiated by calling
* Tcl_FirstHashEntry, this procedure may be called to return
* successive elements of the table.
*
* Results:
* The return value is the next entry in the hash table being
* enumerated, or NULL if the end of the table is reached.
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
Tcl_HashEntry *
Tcl_NextHashEntry(searchPtr)
register Tcl_HashSearch *searchPtr; /* Place to store information about
* progress through the table. Must
* have been initialized by calling
* Tcl_FirstHashEntry. */
{
Tcl_HashEntry *hPtr;
while (searchPtr->nextEntryPtr == NULL) {
if (searchPtr->nextIndex >= searchPtr->tablePtr->numBuckets) {
return NULL;
}
searchPtr->nextEntryPtr =
searchPtr->tablePtr->buckets[searchPtr->nextIndex];
searchPtr->nextIndex++;
}
hPtr = searchPtr->nextEntryPtr;
searchPtr->nextEntryPtr = hPtr->nextPtr;
return hPtr;
}
/*
*----------------------------------------------------------------------
*
* Tcl_HashStats --
*
* Return statistics describing the layout of the hash table
* in its hash buckets.
*
* Results:
* The return value is a malloc-ed string containing information
* about tablePtr. It is the caller's responsibility to free
* this string.
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
char *
Tcl_HashStats(tablePtr)
Tcl_HashTable *tablePtr; /* Table for which to produce stats. */
{
#define NUM_COUNTERS 10
int count[NUM_COUNTERS], overflow, i, j;
double average, tmp;
register Tcl_HashEntry *hPtr;
char *result, *p;
/*
* Compute a histogram of bucket usage.
*/
for (i = 0; i < NUM_COUNTERS; i++) {
count[i] = 0;
}
overflow = 0;
average = 0.0;
for (i = 0; i < tablePtr->numBuckets; i++) {
j = 0;
for (hPtr = tablePtr->buckets[i]; hPtr != NULL; hPtr = hPtr->nextPtr) {
j++;
}
if (j < NUM_COUNTERS) {
count[j]++;
} else {
overflow++;
}
tmp = j;
average += (tmp+1.0)*(tmp/tablePtr->numEntries)/2.0;
}
/*
* Print out the histogram and a few other pieces of information.
*/
result = (char *) ckalloc((unsigned) ((NUM_COUNTERS*60) + 300));
sprintf(result, "%d entries in table, %d buckets\n",
tablePtr->numEntries, tablePtr->numBuckets);
p = result + strlen(result);
for (i = 0; i < NUM_COUNTERS; i++) {
sprintf(p, "number of buckets with %d entries: %d\n",
i, count[i]);
p += strlen(p);
}
sprintf(p, "number of buckets with %d or more entries: %d\n",
NUM_COUNTERS, overflow);
p += strlen(p);
sprintf(p, "average search distance for entry: %.1f", average);
return result;
}
/*
*----------------------------------------------------------------------
*
* AllocArrayEntry --
*
* Allocate space for a Tcl_HashEntry containing the array key.
*
* Results:
* The return value is a pointer to the created entry.
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
static Tcl_HashEntry *
AllocArrayEntry(tablePtr, keyPtr)
Tcl_HashTable *tablePtr; /* Hash table. */
VOID *keyPtr; /* Key to store in the hash table entry. */
{
int *array = (int *) keyPtr;
register int *iPtr1, *iPtr2;
Tcl_HashEntry *hPtr;
int count;
count = tablePtr->keyType;
hPtr = (Tcl_HashEntry *) ckalloc((unsigned) (sizeof(Tcl_HashEntry)
+ (count*sizeof(int)) - sizeof(hPtr->key)));
for (iPtr1 = array, iPtr2 = hPtr->key.words;
count > 0; count--, iPtr1++, iPtr2++) {
*iPtr2 = *iPtr1;
}
return hPtr;
}
/*
*----------------------------------------------------------------------
*
* CompareArrayKeys --
*
* Compares two array keys.
*
* Results:
* The return value is 0 if they are different and 1 if they are
* the same.
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
static int
CompareArrayKeys(keyPtr, hPtr)
VOID *keyPtr; /* New key to compare. */
Tcl_HashEntry *hPtr; /* Existing key to compare. */
{
register CONST int *iPtr1 = (CONST int *) keyPtr;
register CONST int *iPtr2 = (CONST int *) hPtr->key.words;
Tcl_HashTable *tablePtr = hPtr->tablePtr;
int count;
for (count = tablePtr->keyType; ; count--, iPtr1++, iPtr2++) {
if (count == 0) {
return 1;
}
if (*iPtr1 != *iPtr2) {
break;
}
}
return 0;
}
/*
*----------------------------------------------------------------------
*
* HashArrayKey --
*
* Compute a one-word summary of an array, which can be
* used to generate a hash index.
*
* Results:
* The return value is a one-word summary of the information in
* string.
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
static unsigned int
HashArrayKey(tablePtr, keyPtr)
Tcl_HashTable *tablePtr; /* Hash table. */
VOID *keyPtr; /* Key from which to compute hash value. */
{
register CONST int *array = (CONST int *) keyPtr;
register unsigned int result;
int count;
for (result = 0, count = tablePtr->keyType; count > 0;
count--, array++) {
result += *array;
}
return result;
}
/*
*----------------------------------------------------------------------
*
* AllocStringEntry --
*
* Allocate space for a Tcl_HashEntry containing the string key.
*
* Results:
* The return value is a pointer to the created entry.
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
static Tcl_HashEntry *
AllocStringEntry(tablePtr, keyPtr)
Tcl_HashTable *tablePtr; /* Hash table. */
VOID *keyPtr; /* Key to store in the hash table entry. */
{
CONST char *string = (CONST char *) keyPtr;
Tcl_HashEntry *hPtr;
hPtr = (Tcl_HashEntry *) ckalloc((unsigned)
(sizeof(Tcl_HashEntry) + strlen(string) + 1 - sizeof(hPtr->key)));
strcpy(hPtr->key.string, string);
return hPtr;
}
/*
*----------------------------------------------------------------------
*
* CompareStringKeys --
*
* Compares two string keys.
*
* Results:
* The return value is 0 if they are different and 1 if they are
* the same.
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
static int
CompareStringKeys(keyPtr, hPtr)
VOID *keyPtr; /* New key to compare. */
Tcl_HashEntry *hPtr; /* Existing key to compare. */
{
register CONST char *p1 = (CONST char *) keyPtr;
register CONST char *p2 = (CONST char *) hPtr->key.string;
for (;; p1++, p2++) {
if (*p1 != *p2) {
break;
}
if (*p1 == '\0') {
return 1;
}
}
return 0;
}
/*
*----------------------------------------------------------------------
*
* HashStringKey --
*
* Compute a one-word summary of a text string, which can be
* used to generate a hash index.
*
* Results:
* The return value is a one-word summary of the information in
* string.
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
static unsigned int
HashStringKey(tablePtr, keyPtr)
Tcl_HashTable *tablePtr; /* Hash table. */
VOID *keyPtr; /* Key from which to compute hash value. */
{
register CONST char *string = (CONST char *) keyPtr;
register unsigned int result;
register int c;
/*
* I tried a zillion different hash functions and asked many other
* people for advice. Many people had their own favorite functions,
* all different, but no-one had much idea why they were good ones.
* I chose the one below (multiply by 9 and add new character)
* because of the following reasons:
*
* 1. Multiplying by 10 is perfect for keys that are decimal strings,
* and multiplying by 9 is just about as good.
* 2. Times-9 is (shift-left-3) plus (old). This means that each
* character's bits hang around in the low-order bits of the
* hash value for ever, plus they spread fairly rapidly up to
* the high-order bits to fill out the hash value. This seems
* works well both for decimal and non-decimal strings.
*/
result = 0;
while (1) {
c = *string;
string++;
if (c == 0) {
break;
}
result += (result<<3) + c;
}
return result;
}
#if TCL_PRESERVE_BINARY_COMPATABILITY
/*
*----------------------------------------------------------------------
*
* BogusFind --
*
* This procedure is invoked when an Tcl_FindHashEntry is called
* on a table that has been deleted.
*
* Results:
* If panic returns (which it shouldn't) this procedure returns
* NULL.
*
* Side effects:
* Generates a panic.
*
*----------------------------------------------------------------------
*/
/* ARGSUSED */
static Tcl_HashEntry *
BogusFind(tablePtr, key)
Tcl_HashTable *tablePtr; /* Table in which to lookup entry. */
CONST char *key; /* Key to use to find matching entry. */
{
panic("called Tcl_FindHashEntry on deleted table");
return NULL;
}
/*
*----------------------------------------------------------------------
*
* BogusCreate --
*
* This procedure is invoked when an Tcl_CreateHashEntry is called
* on a table that has been deleted.
*
* Results:
* If panic returns (which it shouldn't) this procedure returns
* NULL.
*
* Side effects:
* Generates a panic.
*
*----------------------------------------------------------------------
*/
/* ARGSUSED */
static Tcl_HashEntry *
BogusCreate(tablePtr, key, newPtr)
Tcl_HashTable *tablePtr; /* Table in which to lookup entry. */
CONST char *key; /* Key to use to find or create matching
* entry. */
int *newPtr; /* Store info here telling whether a new
* entry was created. */
{
panic("called Tcl_CreateHashEntry on deleted table");
return NULL;
}
#endif
/*
*----------------------------------------------------------------------
*
* RebuildTable --
*
* This procedure is invoked when the ratio of entries to hash
* buckets becomes too large. It creates a new table with a
* larger bucket array and moves all of the entries into the
* new table.
*
* Results:
* None.
*
* Side effects:
* Memory gets reallocated and entries get re-hashed to new
* buckets.
*
*----------------------------------------------------------------------
*/
static void
RebuildTable(tablePtr)
register Tcl_HashTable *tablePtr; /* Table to enlarge. */
{
int oldSize, count, index;
Tcl_HashEntry **oldBuckets;
register Tcl_HashEntry **oldChainPtr, **newChainPtr;
register Tcl_HashEntry *hPtr;
Tcl_HashKeyType *typePtr;
VOID *key;
oldSize = tablePtr->numBuckets;
oldBuckets = tablePtr->buckets;
/*
* Allocate and initialize the new bucket array, and set up
* hashing constants for new array size.
*/
tablePtr->numBuckets *= 4;
tablePtr->buckets = (Tcl_HashEntry **) ckalloc((unsigned)
(tablePtr->numBuckets * sizeof(Tcl_HashEntry *)));
for (count = tablePtr->numBuckets, newChainPtr = tablePtr->buckets;
count > 0; count--, newChainPtr++) {
*newChainPtr = NULL;
}
tablePtr->rebuildSize *= 4;
tablePtr->downShift -= 2;
tablePtr->mask = (tablePtr->mask << 2) + 3;
#if TCL_PRESERVE_BINARY_COMPATABILITY
if (tablePtr->keyType == TCL_STRING_KEYS) {
typePtr = &tclStringHashKeyType;
} else if (tablePtr->keyType == TCL_ONE_WORD_KEYS) {
typePtr = &tclOneWordHashKeyType;
} else if (tablePtr->keyType == TCL_CUSTOM_TYPE_KEYS
|| tablePtr->keyType == TCL_CUSTOM_PTR_KEYS) {
typePtr = tablePtr->typePtr;
} else {
typePtr = &tclArrayHashKeyType;
}
#else
typePtr = tablePtr->typePtr;
#endif
/*
* Rehash all of the existing entries into the new bucket array.
*/
for (oldChainPtr = oldBuckets; oldSize > 0; oldSize--, oldChainPtr++) {
for (hPtr = *oldChainPtr; hPtr != NULL; hPtr = *oldChainPtr) {
*oldChainPtr = hPtr->nextPtr;
key = (VOID *) Tcl_GetHashKey (tablePtr, hPtr);
#if TCL_HASH_KEY_STORE_HASH
if (typePtr->hashKeyProc == NULL
|| typePtr->flags & TCL_HASH_KEY_RANDOMIZE_HASH) {
index = RANDOM_INDEX (tablePtr, hPtr->hash);
} else {
index = ((unsigned int) hPtr->hash) & tablePtr->mask;
}
hPtr->nextPtr = tablePtr->buckets[index];
tablePtr->buckets[index] = hPtr;
#else
if (typePtr->hashKeyProc) {
unsigned int hash;
hash = typePtr->hashKeyProc (tablePtr, (VOID *) key);
if (typePtr->flags & TCL_HASH_KEY_RANDOMIZE_HASH) {
index = RANDOM_INDEX (tablePtr, hash);
} else {
index = hash & tablePtr->mask;
}
} else {
index = RANDOM_INDEX (tablePtr, key);
}
hPtr->bucketPtr = &(tablePtr->buckets[index]);
hPtr->nextPtr = *hPtr->bucketPtr;
*hPtr->bucketPtr = hPtr;
#endif
}
}
/*
* Free up the old bucket array, if it was dynamically allocated.
*/
if (oldBuckets != tablePtr->staticBuckets) {
ckfree((char *) oldBuckets);
}
}
| [
"BawooiT@d1c0eb94-fc07-11dd-a7be-4b3ef3b0700c"
]
| [
[
[
1,
1196
]
]
]
|
4d5ddb003964da070c9a46023d7afde058e0b0c9 | 48c6de8cb63cf11147049ce07b2bd7e020d0d12b | /gcc/opencollada/include/COLLADAStreamWriter/include/COLLADASWLibraryImages.h | cd0959a08480b4deebbf5c052b3dff4854111180 | []
| no_license | ngbinh/libBlenderWindows | 73effaa1aab8d9d1745908f5528ded88eca21ce3 | 23fbaaaad973603509b23f789a903959f6ebb560 | refs/heads/master | 2020-06-08T00:41:55.437544 | 2011-03-25T05:13:25 | 2011-03-25T05:13:25 | 1,516,625 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,214 | h | /*
Copyright (c) 2008-2009 NetAllied Systems GmbH
This file is part of COLLADAStreamWriter.
Licensed under the MIT Open Source License,
for details please see LICENSE file or the website
http://www.opensource.org/licenses/mit-license.php
*/
#ifndef __COLLADASTREAMWRITER_LIBRARY_IMAGES_H__
#define __COLLADASTREAMWRITER_LIBRARY_IMAGES_H__
#include "COLLADASWPrerequisites.h"
#include "COLLADASWExtraTechnique.h"
#include "COLLADASWLibrary.h"
#include "COLLADASWImage.h"
namespace COLLADASW
{
/** Class to simply the creation of @a \<library_images\> and @a \<images\>'s*/
class LibraryImages : public Library
{
public:
/** Constructor
@param streamWriter The stream the @a \<library_images\> and @a \<images\>'s
should be written to.
*/
LibraryImages ( StreamWriter* streamWriter );
/** Destructor*/
virtual ~LibraryImages() {}
protected:
/** Adds @a \<image\> element. If not already opened, it opens @a \<library_images\>*/
void addImage ( const Image& image );
};
} //namespace COLLADASW
#endif //__COLLADASTREAMWRITER_LIBRARY_IMAGES_H__
| [
"[email protected]"
]
| [
[
[
1,
45
]
]
]
|
ac810333320820162428a9033ac71d9d25b6516d | 81a38f1f0e77081746812a7f76a52dd0290fde81 | /minicurso-glsl/05.Extensoes1/src/Modelo.cpp | 0795cf189a09fc40332fcef07d8a1c2cad2617cc | []
| no_license | tamiresharumi/cg_project | 500f437977465264460cd345f484c83feae95454 | 5c4027b3ae749f57f676ae830f2140cd72b51898 | refs/heads/master | 2021-01-20T12:16:41.916754 | 2011-06-20T02:00:23 | 2011-06-20T02:00:23 | 1,761,107 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 648 | cpp | #include "Modelo.h"
#include <cassert>
#include <GL/gl.h>
void Modelo::carrega(const Vertices &vertices, const Indices &indices)
{
m_vertices = vertices;
m_indices = indices;
}
void Modelo::desenha()
{
unsigned numVerts = m_indices.size() / 3;
//Tem que ser múltiplo de três pra formar triângulos
assert(m_indices.size() % 3 == 0);
glBegin(GL_TRIANGLES);
for (unsigned i=0 ; i<numVerts ; ++i)
{
for (unsigned j=0 ; j<3 ; ++j)
{
Vertice &v = m_vertices[m_indices[i*3 + j]];
glTexCoord2fv(v.texCoord.data());
glNormal3fv(v.normal.data());
glVertex3fv(v.posicao.data());
}
}
glEnd();
}
| [
"[email protected]"
]
| [
[
[
1,
30
]
]
]
|
fe3269c11135081ad6e47e739c7d2bd810d4293e | d826e0dcc5b51f57101f2579d65ce8e010f084ec | /post/postug.cpp | 4197832adb07fd411d75c5ffaa37912472d37c93 | []
| no_license | crazyhedgehog/macro-parametric | 308d9253b96978537a26ade55c9c235e0442d2c4 | 9c98d25e148f894b45f69094a4031b8ad938bcc9 | refs/heads/master | 2020-05-18T06:01:30.426388 | 2009-06-26T15:00:02 | 2009-06-26T15:00:02 | 38,305,994 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,405 | cpp | #include ".\postug.h"
#include <iostream>
#include <uf.h>
#include "Part.h"
#include "Definition.h"
using namespace std;
TransCAD::IApplicationPtr g_spApplication; // TransCAD Application Pointer
int main ( int argc, char *argv[] )
{
// Usage
if ( argc > 2 ) {
cout << "Usage: postug [filename]" << endl;
return -1;
}
HRESULT hr = ::CoInitialize(NULL); // COM Automation API Initialization
if(FAILED(hr)) {
cerr << "COM initialization failed." << endl;
return -1;
}
int status = UF_initialize ( ); // UG API Initialization
if ( !status ) {
// create TransCAD
hr = g_spApplication.CreateInstance(__uuidof(TransCAD::Application));
if(FAILED(hr)) return FALSE;
// visualize TransCAD
g_spApplication->Visible = VARIANT_TRUE;
// Pause
cout << endl << "Press enter to start \"PostUG\"";
WaitGetEnter();
// create a Part class
Part * pPart;
if (argc < 2) pPart = new Part ();
else pPart = new Part (string(argv[1]));
pPart->GetInfo();
pPart->ToUG();
//Pause
cout << endl << "Press enter to close \"ToUG\"... ";
WaitGetEnter();
// delete Part class
//delete pPart;
// Clear TransCAD
g_spApplication.Release();
status = UF_terminate ( ); // UG API Uninitialzation
}
::CoUninitialize(); // COM Automation API Uninitialization
return status;
}
| [
"surplusz@2d8c97fe-2f4b-11de-8e0c-53a27eea117e"
]
| [
[
[
1,
66
]
]
]
|
266175a7828c7993e13d5c62eb69737e36b6dd95 | fd196fe7f1a57a3d589dd987127391b6428dbc9f | /Projects/Platform2DGameTest/Engine/GWColor.cpp | e9da975673c0a2db9302147cf82ac9db9b6f5bd5 | []
| no_license | aosyang/Graphic-Workbench | 73651b597b7ad9f759618bad30313bfad12a35b5 | 48c3b4b034ea332fb926ac0a0bd1f7c1fc1a2bb1 | refs/heads/master | 2021-01-22T23:25:48.330855 | 2011-11-29T09:27:52 | 2011-11-29T09:27:52 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 563 | cpp | /********************************************************************
created: 2011/10/31
filename: GWColor.cpp
author: Mwolf
purpose:
*********************************************************************/
#include "GWColor.h"
GWColor GWColor::WHITE = GWColor(1.0f, 1.0f, 1.0f);
GWColor GWColor::BLACK = GWColor(0.0f, 0.0f, 0.0f);
GWColor GWColor::RED = GWColor(1.0f, 0.0f, 0.0f);
GWColor GWColor::GREEN = GWColor(0.0f, 1.0f, 0.0f);
GWColor GWColor::BLUE = GWColor(0.0f, 0.0f, 1.0f);
GWColor GWColor::YELLOW = GWColor(1.0f, 1.0f, 0.0f);
| [
"[email protected]@b4c0308a-e464-ec88-fcea-6ff8c68c914a"
]
| [
[
[
1,
16
]
]
]
|
c71754d3ee014c9b24a16aeb9c7b4e9f68d34e6e | 7f4230cae41e0712d5942960674bfafe4cccd1f1 | /code/LWOLoader.h | 60260e11ee7dedcfad5af37207c1c03f2ecb755b | [
"BSD-3-Clause"
]
| permissive | tonttu/assimp | c6941538b3b3c3d66652423415dea098be21f37a | 320a7a7a7e0422e4d8d9c2a22b74cb48f74b14ce | refs/heads/master | 2021-01-16T19:56:09.309754 | 2011-06-07T20:00:41 | 2011-06-07T20:00:41 | 1,295,427 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 16,074 | h | /*
Open Asset Import Library (ASSIMP)
----------------------------------------------------------------------
Copyright (c) 2006-2010, ASSIMP Development Team
All rights reserved.
Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the
following conditions are met:
* Redistributions of source code must retain the above
copyright notice, this list of conditions and the
following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other
materials provided with the distribution.
* Neither the name of the ASSIMP team, nor the names of its
contributors may be used to endorse or promote products
derived from this software without specific prior
written permission of the ASSIMP Development Team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
----------------------------------------------------------------------
*/
/** @file Declaration of the LWO importer class. */
#ifndef AI_LWOLOADER_H_INCLUDED
#define AI_LWOLOADER_H_INCLUDED
#include "../include/aiTypes.h"
#include "../include/DefaultLogger.h"
#include "LWOFileData.h"
#include "BaseImporter.h"
#include "MaterialSystem.h"
struct aiTexture;
struct aiNode;
namespace Assimp {
using namespace LWO;
// ---------------------------------------------------------------------------
/** Class to load LWO files.
*
* @note Methods named "xxxLWO2[xxx]" are used with the newer LWO2 format.
* Methods named "xxxLWOB[xxx]" are used with the older LWOB format.
* Methods named "xxxLWO[xxx]" are used with both formats.
* Methods named "xxx" are used to preprocess the loaded data -
* they aren't specific to one format version
*/
// ---------------------------------------------------------------------------
class LWOImporter : public BaseImporter
{
friend class Importer;
protected:
/** Constructor to be privately used by Importer */
LWOImporter();
/** Destructor, private as well */
~LWOImporter();
public:
// -------------------------------------------------------------------
/** Returns whether the class can handle the format of the given file.
* See BaseImporter::CanRead() for details.
*/
bool CanRead( const std::string& pFile, IOSystem* pIOHandler,
bool checkSig) const;
// -------------------------------------------------------------------
/** Called prior to ReadFile().
* The function is a request to the importer to update its configuration
* basing on the Importer's configuration property list.
*/
void SetupProperties(const Importer* pImp);
protected:
// -------------------------------------------------------------------
/** Called by Importer::GetExtensionList() for each loaded importer.
* See BaseImporter::GetExtensionList() for details
*/
void GetExtensionList(std::set<std::string>& extensions)
{
extensions.insert("lxo");
extensions.insert("lwo");
}
// -------------------------------------------------------------------
/** Imports the given file into the given scene structure.
* See BaseImporter::InternReadFile() for details
*/
void InternReadFile( const std::string& pFile, aiScene* pScene,
IOSystem* pIOHandler);
private:
// -------------------------------------------------------------------
/** Loads a LWO file in the older LWOB format (LW < 6)
*/
void LoadLWOBFile();
// -------------------------------------------------------------------
/** Loads a LWO file in the newer LWO2 format (LW >= 6)
*/
void LoadLWO2File();
// -------------------------------------------------------------------
/** Parsing functions used for all file format versions
*/
inline void GetS0(std::string& out,unsigned int max);
inline float GetF4();
inline uint32_t GetU4();
inline uint16_t GetU2();
inline uint8_t GetU1();
// -------------------------------------------------------------------
/** Loads a surface chunk from an LWOB file
* @param size Maximum size to be read, in bytes.
*/
void LoadLWOBSurface(unsigned int size);
// -------------------------------------------------------------------
/** Loads a surface chunk from an LWO2 file
* @param size Maximum size to be read, in bytes.
*/
void LoadLWO2Surface(unsigned int size);
// -------------------------------------------------------------------
/** Loads a texture block from a LWO2 file.
* @param size Maximum size to be read, in bytes.
* @param head Header of the SUF.BLOK header
*/
void LoadLWO2TextureBlock(LE_NCONST IFF::SubChunkHeader* head,
unsigned int size );
// -------------------------------------------------------------------
/** Loads a shader block from a LWO2 file.
* @param size Maximum size to be read, in bytes.
* @param head Header of the SUF.BLOK header
*/
void LoadLWO2ShaderBlock(LE_NCONST IFF::SubChunkHeader* head,
unsigned int size );
// -------------------------------------------------------------------
/** Loads an image map from a LWO2 file
* @param size Maximum size to be read, in bytes.
* @param tex Texture object to be filled
*/
void LoadLWO2ImageMap(unsigned int size, LWO::Texture& tex );
void LoadLWO2Gradient(unsigned int size, LWO::Texture& tex );
void LoadLWO2Procedural(unsigned int size, LWO::Texture& tex );
// loads the header - used by thethree functions above
void LoadLWO2TextureHeader(unsigned int size, LWO::Texture& tex );
// -------------------------------------------------------------------
/** Loads the LWO tag list from the file
* @param size Maximum size to be read, in bytes.
*/
void LoadLWOTags(unsigned int size);
// -------------------------------------------------------------------
/** Load polygons from a POLS chunk
* @param length Size of the chunk
*/
void LoadLWO2Polygons(unsigned int length);
void LoadLWOBPolygons(unsigned int length);
// -------------------------------------------------------------------
/** Load polygon tags from a PTAG chunk
* @param length Size of the chunk
*/
void LoadLWO2PolygonTags(unsigned int length);
// -------------------------------------------------------------------
/** Load a vertex map from a VMAP/VMAD chunk
* @param length Size of the chunk
* @param perPoly Operate on per-polygon base?
*/
void LoadLWO2VertexMap(unsigned int length, bool perPoly);
// -------------------------------------------------------------------
/** Load polygons from a PNTS chunk
* @param length Size of the chunk
*/
void LoadLWOPoints(unsigned int length);
// -------------------------------------------------------------------
/** Load a clip from a CLIP chunk
* @param length Size of the chunk
*/
void LoadLWO2Clip(unsigned int length);
// -------------------------------------------------------------------
/** Load an envelope from an EVL chunk
* @param length Size of the chunk
*/
void LoadLWO2Envelope(unsigned int length);
// -------------------------------------------------------------------
/** Count vertices and faces in a LWOB/LWO2 file
*/
void CountVertsAndFacesLWO2(unsigned int& verts,
unsigned int& faces,
uint16_t*& cursor,
const uint16_t* const end,
unsigned int max = UINT_MAX);
void CountVertsAndFacesLWOB(unsigned int& verts,
unsigned int& faces,
LE_NCONST uint16_t*& cursor,
const uint16_t* const end,
unsigned int max = UINT_MAX);
// -------------------------------------------------------------------
/** Read vertices and faces in a LWOB/LWO2 file
*/
void CopyFaceIndicesLWO2(LWO::FaceList::iterator& it,
uint16_t*& cursor,
const uint16_t* const end);
// -------------------------------------------------------------------
void CopyFaceIndicesLWOB(LWO::FaceList::iterator& it,
LE_NCONST uint16_t*& cursor,
const uint16_t* const end,
unsigned int max = UINT_MAX);
// -------------------------------------------------------------------
/** Resolve the tag and surface lists that have been loaded.
* Generates the mMapping table.
*/
void ResolveTags();
// -------------------------------------------------------------------
/** Resolve the clip list that has been loaded.
* Replaces clip references with real clips.
*/
void ResolveClips();
// -------------------------------------------------------------------
/** Add a texture list to an output material description.
*
* @param pcMat Output material
* @param in Input texture list
* @param type Type identifier of the texture list
*/
bool HandleTextures(MaterialHelper* pcMat, const TextureList& in,
aiTextureType type);
// -------------------------------------------------------------------
/** Adjust a texture path
*/
void AdjustTexturePath(std::string& out);
// -------------------------------------------------------------------
/** Convert a LWO surface description to an ASSIMP material
*/
void ConvertMaterial(const LWO::Surface& surf,MaterialHelper* pcMat);
// -------------------------------------------------------------------
/** Get a list of all UV/VC channels required by a specific surface.
*
* @param surf Working surface
* @param layer Working layer
* @param out Output list. The members are indices into the
* UV/VC channel lists of the layer
*/
void FindUVChannels(/*const*/ LWO::Surface& surf,
LWO::SortedRep& sorted,
/*const*/ LWO::Layer& layer,
unsigned int out[AI_MAX_NUMBER_OF_TEXTURECOORDS]);
// -------------------------------------------------------------------
char FindUVChannels(LWO::TextureList& list,
LWO::Layer& layer,LWO::UVChannel& uv, unsigned int next);
// -------------------------------------------------------------------
void FindVCChannels(const LWO::Surface& surf,
LWO::SortedRep& sorted,
const LWO::Layer& layer,
unsigned int out[AI_MAX_NUMBER_OF_COLOR_SETS]);
// -------------------------------------------------------------------
/** Generate the final node graph
* Unused nodes are deleted.
* @param apcNodes Flat list of nodes
*/
void GenerateNodeGraph(std::vector<aiNode*>& apcNodes);
// -------------------------------------------------------------------
/** Add children to a node
* @param node Node to become a father
* @param parent Index of the node
* @param apcNodes Flat list of nodes - used nodes are set to NULL.
*/
void AddChildren(aiNode* node, uint16_t parent,
std::vector<aiNode*>& apcNodes);
// -------------------------------------------------------------------
/** Read a variable sized integer
* @param inout Input and output buffer
*/
int ReadVSizedIntLWO2(uint8_t*& inout);
// -------------------------------------------------------------------
/** Assign a value from a VMAP to a vertex and all vertices
* attached to it.
* @param base VMAP destination data
* @param numRead Number of float's to be read
* @param idx Absolute index of the first vertex
* @param data Value of the VMAP to be assigned - read numRead
* floats from this array.
*/
void DoRecursiveVMAPAssignment(VMapEntry* base, unsigned int numRead,
unsigned int idx, float* data);
// -------------------------------------------------------------------
/** Compute normal vectors for a mesh
* @param mesh Input mesh
* @param smoothingGroups Smoothing-groups-per-face array
* @param surface Surface for the mesh
*/
void ComputeNormals(aiMesh* mesh, const std::vector<unsigned int>& smoothingGroups,
const LWO::Surface& surface);
// -------------------------------------------------------------------
/** Setup a new texture after the corresponding chunk was
* encountered in the file.
* @param list Texture list
* @param size Maximum number of bytes to be read
* @return Pointer to new texture
*/
LWO::Texture* SetupNewTextureLWOB(LWO::TextureList& list,
unsigned int size);
protected:
/** true if the file is a LWO2 file*/
bool mIsLWO2;
/** true if the file is a LXOB file*/
bool mIsLXOB;
/** Temporary list of layers from the file */
LayerList* mLayers;
/** Pointer to the current layer */
LWO::Layer* mCurLayer;
/** Temporary tag list from the file */
TagList* mTags;
/** Mapping table to convert from tag to surface indices.
UINT_MAX indicates that a no corresponding surface is available */
TagMappingTable* mMapping;
/** Temporary surface list from the file */
SurfaceList* mSurfaces;
/** Temporary clip list from the file */
ClipList mClips;
/** Temporary envelope list from the file */
EnvelopeList mEnvelopes;
/** file buffer */
uint8_t* mFileBuffer;
/** Size of the file, in bytes */
unsigned int fileSize;
/** Output scene */
aiScene* pScene;
/** Configuration option: speed flag set? */
bool configSpeedFlag;
/** Configuration option: index of layer to be loaded */
unsigned int configLayerIndex;
/** Configuration option: name of layer to be loaded */
std::string configLayerName;
/** True if we have a named layer */
bool hasNamedLayer;
};
// ------------------------------------------------------------------------------------------------
inline float LWOImporter::GetF4()
{
float f = *((float*)mFileBuffer);mFileBuffer += 4;
AI_LSWAP4(f);
return f;
}
// ------------------------------------------------------------------------------------------------
inline uint32_t LWOImporter::GetU4()
{
uint32_t f = *((uint32_t*)mFileBuffer);mFileBuffer += 4;
AI_LSWAP4(f);
return f;
}
// ------------------------------------------------------------------------------------------------
inline uint16_t LWOImporter::GetU2()
{
uint16_t f = *((uint16_t*)mFileBuffer);mFileBuffer += 2;
AI_LSWAP2(f);
return f;
}
// ------------------------------------------------------------------------------------------------
inline uint8_t LWOImporter::GetU1()
{
return *mFileBuffer++;
}
// ------------------------------------------------------------------------------------------------
inline int LWOImporter::ReadVSizedIntLWO2(uint8_t*& inout)
{
int i;
int c = *inout;inout++;
if(c != 0xFF)
{
i = c << 8;
c = *inout;inout++;
i |= c;
}
else
{
c = *inout;inout++;
i = c << 16;
c = *inout;inout++;
i |= c << 8;
c = *inout;inout++;
i |= c;
}
return i;
}
// ------------------------------------------------------------------------------------------------
inline void LWOImporter::GetS0(std::string& out,unsigned int max)
{
unsigned int iCursor = 0;
const char*sz = (const char*)mFileBuffer;
while (*mFileBuffer)
{
if (++iCursor > max)
{
DefaultLogger::get()->warn("LWO: Invalid file, string is is too long");
break;
}
++mFileBuffer;
}
size_t len = (size_t) ((const char*)mFileBuffer-sz);
out = std::string(sz,len);
mFileBuffer += (len&0x1 ? 1 : 2);
}
} // end of namespace Assimp
#endif // AI_LWOIMPORTER_H_INCLUDED
| [
"aramis_acg@67173fc5-114c-0410-ac8e-9d2fd5bffc1f",
"alil@67173fc5-114c-0410-ac8e-9d2fd5bffc1f"
]
| [
[
[
1,
227
],
[
229,
241
],
[
243,
391
],
[
393,
490
]
],
[
[
228,
228
],
[
242,
242
],
[
392,
392
]
]
]
|
c8a86a3fcbdc342971c10eb122c7fa5afe49272e | 975d45994f670a7f284b0dc88d3a0ebe44458a82 | /logica/WarBugsLogic/LWarBugsLib/CCenario.h | ed97609d1eec9dbd12e42e74f5273c619f89bb1b | []
| no_license | phabh/warbugs | 2b616be17a54fbf46c78b576f17e702f6ddda1e6 | bf1def2f8b7d4267fb7af42df104e9cdbe0378f8 | refs/heads/master | 2020-12-25T08:51:02.308060 | 2010-11-15T00:37:38 | 2010-11-15T00:37:38 | 60,636,297 | 0 | 0 | null | null | null | null | ISO-8859-2 | C++ | false | false | 2,865 | h | #pragma once
#ifndef _CCENARIO_H_
#include <iostream>
using namespace std;
#include "Enumerators.h"
#include "C3DObject.h"
#include "CBolsaList.h"
//#include "CBolsa.h"
//#include "CItem.h"
#include "CPeopleList.h"
//#include "CPersonagem.h"
#include "CPersonagemJogador.h"
#ifndef _CINIMIGO_H_
#include "CInimigo.h"
#ifndef _CINIMIGO_H_
class CInimigo;
#endif
#endif
#include "CNPC.h"
#include "CPortal.h"
#include "CVendedor.h"
#define _CCENARIO_H_
class CCenario : public C3DObject
{
private:
CObjectCount *_contador;
CPeopleList *_jogadores;//Lista de personagens
CPeopleList *_inimigos;
CPeopleList *_npcs;
CPeopleList *_vendedores;
CBolsaList *_itens;//Lista de itens
CPortal *_saidaNorte;
CPortal *_saidaSul;
CPortal *_saidaLeft;
CPortal *_saidaRight;
Raca _lealdadeNecessaria;
int _quantidadeNecessaria;
public:
bool matrizDeCaminhamento[MAPMAXCOL][MAPMAXCOL];
void initMatrix();
CCenario(int ID, CPeopleList *players, CPeopleList *monsters, CPeopleList *npcs, CPeopleList *vendedores, CBolsaList *bolsa, CPortal *saidaNorte, CPortal *saidaSul, CPortal *saidaLeft, CPortal *saidaRight);
bool isSceneFull();
bool haveLoyaltyRequired(CPersonagemJogador *jogador);
int playerCount();
int bagCount();
int monsterCount();
int NPCCount();
int salesmanCount();
CPeopleList *getPlayerList();
CPeopleList *getMonsterList();
CPeopleList *getNPCList();
CPeopleList *getSalesmanList();
CPersonagemJogador *getPlayer(int idJogador);
CInimigo *getMonster(int idInimigo);
CNPC *getNpc(int idNpc);
CBolsa *getBag(int idBag);
CVendedor *getSalesman(int idVendedor);
CPersonagemJogador *getPlayerAt(int pos);
CInimigo *getMonsterAt(int pos);
CNPC *getNpcAt(int pos);
CBolsa *getBagAt(int pos);
CVendedor *getSalesmanAt(int pos);
CPortal *getExit(TypeDirecao idPortal);
Raca getRaceNeeded();
int getRaceNeededAsInt();
int getLoyaltyRequired();
void setExit(CPortal *newExit, TypeDirecao idPortal);
void setRaceNeeded(Raca race);
void setLoyaltyRequired(int value);
void addPlayer(CPersonagem *jogador);
void addMonster(CPersonagem *inimigo);
void addNpc(CPersonagem *npc);
void addBag(CBolsa *bolsa);
void addSalesman(CVendedor *vendedor);
CPersonagemJogador *removePlayer(int idJogador);
CInimigo *removeMonster(int idInimigo);
CNPC *removeNPC(int idNPC);
CBolsa *removeBag(int idBag);
CVendedor *removeSalesman(int idVendedor);
void update();
//Métodos de quadrante
Ponto *getQuadCenter(int linha, int coluna);
Ponto *getQuadCenter(int idQuad);
Ponto *getQuadCenter(Ponto *posicao);
void getQuadLinhaColuna(Ponto *posicao, int &linha, int &coluna);
void getQuadLinhaColuna(int idQuad, int &linha, int &coluna);
int getQuadID(Ponto *posicao);
int getQuadID(int linha, int coluna);
};
#endif | [
"[email protected]"
]
| [
[
[
1,
104
]
]
]
|
4fb613b1fbcaade2b549ddd4d657718bda5a4b31 | b0252ba622183d115d160eb28953189930ebf9c0 | /Source/CCity.cpp | 8ba4be20b37291be6675e890ba0b8e4b92d41a13 | []
| no_license | slewicki/khanquest | 6c0ced33bffd3c9ee8a60c1ef936139a594fe2fc | f2d68072a1d207f683c099372454add951da903a | refs/heads/master | 2020-04-06T03:40:18.180208 | 2008-08-28T03:43:26 | 2008-08-28T03:43:26 | 34,305,386 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,579 | cpp | //////////////////////////////////////////////////////
// File : "CCity.cpp"
//
// Author : Sean Hamstra (SH)
//
// Purpose : Store all information and functionality
// of a city.
//////////////////////////////////////////////////////
#include "CCity.h"
CCity::CCity()
{
PROFILE("CCity::CCity()");
m_nImageID = -1;
m_nGoldTribute = 0;
m_nCurrentOwner = -1;
m_dwColor = 0;
m_bIsAttackable = false;
m_ptAttackPoint.x = 0;
m_ptAttackPoint.y = 0;
STOP("CCity::CCity()");
}
CCity::~CCity()
{
PROFILE("CCity::~CCity()");
CSGD_TextureManager::GetInstance()->ReleaseTexture(m_nImageID);
STOP("CCity::~CCity()");
}
void CCity::SetDefaultColor(int nCityID)
{
PROFILE("CCity::SetDefaultColor(int)");
switch(nCityID)
{
case PCITY:
m_dwColor = D3DCOLOR_ARGB(255, 0, 255, 255);
break;
case KCITY1:
m_dwColor = D3DCOLOR_ARGB(255, 120, 255, 120);
break;
case KCITY2:
m_dwColor = D3DCOLOR_ARGB(255, 0, 255, 0);
break;
case KCITY3:
m_dwColor = D3DCOLOR_ARGB(255, 0, 170, 0);
break;
case XCITY1:
m_dwColor = D3DCOLOR_ARGB(255, 255, 180, 0);
break;
case XCITY2:
m_dwColor = D3DCOLOR_ARGB(255, 255, 128, 0);
break;
case XCITY3:
m_dwColor = D3DCOLOR_ARGB(255, 255, 90, 0);
break;
case JCITY1:
m_dwColor = D3DCOLOR_ARGB(255, 209, 147, 255);
break;
case JCITY2:
m_dwColor = D3DCOLOR_ARGB(255, 178, 0, 255);
break;
case JCITY3:
m_dwColor = D3DCOLOR_ARGB(255, 132, 0, 140);
break;
}
STOP("CCity::SetDefaultColor(int)");
}
| [
"[email protected]@631b4192-2952-0410-9426-c5ed74a7d3ec",
"[email protected]@631b4192-2952-0410-9426-c5ed74a7d3ec"
]
| [
[
[
1,
12
],
[
14,
20
],
[
22,
24
],
[
26,
26
],
[
28,
31
],
[
33,
65
],
[
67,
67
]
],
[
[
13,
13
],
[
21,
21
],
[
25,
25
],
[
27,
27
],
[
32,
32
],
[
66,
66
]
]
]
|
3034c87d9965cd73086d21573658f2056ae364d3 | 3e6ac11a78ca7c997e9048a0069589ad38148ae5 | /mapsModeling/Geometry/Geometry.h | 2547a43f9607b29f4f13579face6e41327b0c377 | []
| no_license | Warhate/wpas | c147dca008fff0367963474badcf882a774e035b | 3b6819b857577bff4aae328d2a16fbd4aa1f45e0 | refs/heads/master | 2021-01-01T18:08:05.650000 | 2011-04-19T17:17:07 | 2011-04-19T17:17:07 | 32,133,661 | 0 | 0 | null | null | null | null | WINDOWS-1251 | C++ | false | false | 562 | h | // Geometry.h: главный файл заголовка для DLL Geometry
//
#pragma once
#ifndef __AFXWIN_H__
#error "включить stdafx.h до включения этого файла в PCH"
#endif
#include "resource.h" // основные символы
// CGeometryApp
// Про реализацию данного класса см. Geometry.cpp
//
class CGeometryApp : public CWinApp
{
public:
CGeometryApp();
// Переопределение
public:
virtual BOOL InitInstance();
DECLARE_MESSAGE_MAP()
};
| [
"[email protected]@ab12fe6d-bf48-fcdd-0e91-272aff1f9dad"
]
| [
[
[
1,
27
]
]
]
|
bb3de2bbe3e3e2e372063a6021ed9a29305211e2 | 9df55ed98688ff13caec3061237a2a0895914577 | /Game.h | c4cf78b6a58010fda7c3741a0902468f65719a3e | []
| no_license | tiashaun/sdl_tetris | f625ee0f06e642411f7a04b18b470aa0df61c1ca | 4799cfa4b28cd21b8431f8b6a00bacfb89e794f0 | refs/heads/master | 2020-11-30T23:32:43.812813 | 2009-12-06T20:33:43 | 2009-12-06T20:33:43 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 863 | h | #ifndef GAME_H
#define GAME_H
#include "IO.h"
#include "Board.h"
#include "Piece.h"
#include "Pieces.h"
#define BOARD_ROWS 30 // in array
#define BOARD_COLS 10
#define PADDING 1 // in pixels
#define BLOCK_H 15
#define BLOCK_W 15
#define BOARD_W (BLOCK_W*BOARD_COLS)
#define BOARD_H (BLOCK_H*BOARD_ROWS)
#define BORDER_W 10
#define BORDER_COLOR 0xffffffff
#define BLOCK_COLOR 0xffffffff
#define PIECE_COLOR 0xffffffff
#define WAIT_TIME 200 // in milliseconds
class Game
{
public:
Game();
~Game();
void startGame();
private:
IO *io;
Board *board;
Pieces *pieces;
Piece curPiece;
Piece nextPiece;
int cur_x, cur_y;
void drawScene();
void drawBoard();
void drawPiece();
void drawNextPiece();
int startXInPixels();
int startYInPixels();
void resetBlockPos();
void createNewPiece();
};
#endif
| [
"[email protected]"
]
| [
[
[
1,
50
]
]
]
|
c5737e9bd570ea42b8d7da8cf1b7e282934c0d7e | be2e23022d2eadb59a3ac3932180a1d9c9dee9c2 | /NpcServer/NpcKernel/User.h | 81ca344b09f780d2739c6f0e155d55ffb23d5dd5 | []
| no_license | cronoszeu/revresyksgpr | 78fa60d375718ef789042c452cca1c77c8fa098e | 5a8f637e78f7d9e3e52acdd7abee63404de27e78 | refs/heads/master | 2020-04-16T17:33:10.793895 | 2010-06-16T12:52:45 | 2010-06-16T12:52:45 | 35,539,807 | 0 | 2 | null | null | null | null | GB18030 | C++ | false | false | 4,138 | h |
#pragma once
#include "GameObj.h"
#include "define.h"
#include "Npc.h"
#include "I_Role.h"
#include "TimeOut.h"
const int PLAYERACTIVE_SECS = 30; // 每30秒检查一次玩家是否存在
const int MASK_CHANGELOOK = 10000000; // 变身时LOCKFACE的掩码,face=face + new_face*10000000
struct ST_USERINFO
{
OBJID id;
NAMESTR szName;
DWORD dwLookFace;
USHORT usHair;
uint64 i64Effect;
DWORD dwHelmetType;
DWORD dwArmorType;
DWORD dwWeaponRType;
DWORD dwWeaponLType;
DWORD dwMountType;
DWORD dwMantleType;
DWORD dwMedalSelect;
OBJID idSyn;
UCHAR nRank;
USHORT usPosX, usPosY;
UCHAR ucDir;
UCHAR ucPose;
UCHAR ucSizeAdd;
};
enum { POSE_STAND=0, };
//enum { STATUS_NORMAL=0, STATUS_FREEZE, STATUS_DIE };
class CUser : public CGameObj, IRole
{
public:
CUser();
virtual ~CUser();
static CUser* CreateNew() { return new CUser; }
bool Create(ST_USERINFO* pInfo, OBJID idMap);
ULONG ReleaseByOwner() { delete this; return 0; }
IRole* QueryRole() { return (IRole*)this; }
IRoleAttr* QueryRoleAttr() { return static_cast<IRoleAttr*>(this); }
virtual CAutoLink<IRole>& QueryLink(const CAutoLink<IRole>&) { return m_lnkThis; }
template<TYPENAME T>
T* QueryInterface(T** ppT) { if(ppT) *ppT = this; return this; }
virtual void* QueryInterface(int id, void** ppT) { void* p=NULL; if(id==GUID_OF(CUser)) p=this; if(ppT) *ppT=p; return p; }
void OnTimer(); // 可能删除自己
public: // get info
OBJID GetID() { return m_Info.id; }
LPCTSTR GetName() { return m_Info.szName; }
DWORD GetLookFace() { return m_Info.dwLookFace; }
uint64 GetEffect() { return m_Info.i64Effect; }
DWORD GetHelmetType() { return m_Info.dwHelmetType; }
DWORD GetArmorType() { return m_Info.dwArmorType; }
DWORD GetWeaponRType() { return m_Info.dwWeaponRType; }
DWORD GetWeaponLType() { return m_Info.dwWeaponLType; }
DWORD GetMountType() { return m_Info.dwMountType; }
DWORD GetMedalSelect() { return m_Info.dwMedalSelect; }
OBJID GetSynID() { return m_Info.idSyn; }
OBJID GetMapID();
int GetPosX() { return m_Info.usPosX; }
int GetPosY() { return m_Info.usPosY; }
int GetHair() { return m_Info.usHair; }
int GetDir() { return m_Info.ucDir; }
int GetPose() { return m_Info.ucPose; }
int GetAttackRange(int nSizeAdd);
int GetSizeAdd() { return m_Info.ucSizeAdd; }
public: // get
bool IsAlive() { return (GetEffect() & KEEPEFFECT_DIE) == 0; }
bool IsFarWeapen() { return GetWeaponLType() != ID_NONE; } //@
bool IsVirtuous() { return (GetEffect() & KEEPEFFECT_NOT_VIRTUOUS) == 0; }
bool IsPker() { return (GetEffect() & KEEPEFFECT_DEEPRED) != 0; }
bool IsEvil() { return (GetEffect() & (KEEPEFFECT_DEEPRED|KEEPEFFECT_CRIME)) != 0; }
bool IsRighteous() { return (GetEffect() & KEEPEFFECT_DEEPRED) == 0; }
bool IsCrime() { return (GetEffect() & KEEPEFFECT_CRIME) != 0; }
bool IsLurker() { return (GetEffect() & (KEEPEFFECT_LURKER | KEEPEFFECT_HIDDEN)) != 0; }
bool IsBlockNpc() { return (GetEffect() & KEEPEFFECT_NOT_BLOCKNPC) == 0; }
bool IsWing() { return false; } //{ return (GetEffect() & KEEPEFFECT_WING) != 0; }
bool IsTeamLeader() { return (GetEffect() & KEEPEFFECT_TEAMLEADER) != 0; }
CGameMap* GetMap() { return m_pMap; }
public: // set
void SetEffect(uint64 i64Effect);
void SetDir(int nDir) { m_Info.ucDir = nDir; }
void SetPose(int nPose) { m_Info.ucPose = nPose; }
void SetPos(int uPosX, int nPosY);
void FlyMap(OBJID idMap, int nPosX, int nPosY);
bool MoveForward(int nDir);
void JumpPos(int nPosX, int nPosY, int nDir);
void SetSizeAdd(int nSizeAdd);
public: // set (call by msguserattrib)
void SetLife(int nLife) {}
void SetPower(int nPower) {}
public: // application
int Distance(int x, int y) { return __max(abs(x-GetPosX()), abs(y-GetPosY())); }
protected: // state, 其它在INFO中
CGameMap* m_pMap;
ST_USERINFO m_Info;
CTimeOut m_tActive;
CAutoLink<IRole> m_lnkThis;
};
| [
"rpgsky.com@cc92e6ba-efcf-11de-bf31-4dec8810c1c1"
]
| [
[
[
1,
121
]
]
]
|
0df2b9d8bae5d53e04d112c910b0a32d3f983873 | 14a00dfaf0619eb57f1f04bb784edd3126e10658 | /Lab3/Sphere.cpp | 6bfa208afade0450961df615558ded0c439c57fa | []
| no_license | SHINOTECH/modanimation | 89f842262b1f552f1044d4aafb3d5a2ce4b587bd | 43d0fde55cf75df9d9a28a7681eddeb77460f97c | refs/heads/master | 2021-01-21T09:34:18.032922 | 2010-04-07T12:23:13 | 2010-04-07T12:23:13 | null | 0 | 0 | null | null | null | null | ISO-8859-1 | C++ | false | false | 909 | cpp | /*************************************************************************************************
*
* Modeling and animation (TNM079) 2007
* Code base for lab assignments. Copyright:
* Gunnar Johansson ([email protected])
* Ken Museth ([email protected])
* Michael Bang Nielsen ([email protected])
* Ola Nilsson ([email protected])
* Andreas Söderström ([email protected])
*
*************************************************************************************************/
#include "Sphere.h"
Sphere::Sphere(float r)
{
this->radius2 = r*r;
this->mBox = Bbox(Vector3<float>(-r, -r, -r), Vector3<float>(r, r, r));
}
Sphere::~Sphere() { }
float Sphere::getValue(float x, float y, float z) const
{
Vector4<float> vprim;
Vector4<float> v(x, y, z, 1.f);
vprim = mWorld2Obj*v;
return (vprim*vprim - 1.f - radius2);
}
| [
"jpjorge@da195381-492e-0410-b4d9-ef7979db4686",
"onnepoika@da195381-492e-0410-b4d9-ef7979db4686"
]
| [
[
[
1,
23
],
[
26,
29
]
],
[
[
24,
25
]
]
]
|
9c2cb87ed979dde686104a6c5b6b357ffd3c10fa | b73f27ba54ad98fa4314a79f2afbaee638cf13f0 | /test/testSetting/contentSettingTest.cpp | ec962bb7e21aec0da163340a8350d3f37b47a2ef | []
| no_license | weimingtom/httpcontentparser | 4d5ed678f2b38812e05328b01bc6b0c161690991 | 54554f163b16a7c56e8350a148b1bd29461300a0 | refs/heads/master | 2021-01-09T21:58:30.326476 | 2009-09-23T08:05:31 | 2009-09-23T08:05:31 | 48,733,304 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,671 | cpp | #include "StdAfx.h"
#include ".\contentsettingtest.h"
#include <setting\contentchecksetting.h>
#include <webcontenttype.h>
#include <boost\test\test_tools.hpp>
using namespace boost::unit_test;
//===========================
//
void TestEnableCheck() {
}
void TestTwoWrong() {
BOOST_CHECK(SettingItem::MODE_CHILD == SettingItem::getModel());
SettingItem::setModified(false);
ContentCheckSetting contentSetting;
contentSetting.enableCheck(IMAGE_TYPE_BMP, true);
contentSetting.enableCheck(IMAGE_TYPE_JPEG, true);
contentSetting.enableCheck(IMAGE_TYPE_GIF, false);
contentSetting.enableCheck(IMAGE_TYPE_PNG, false);
BOOST_CHECK( true == SettingItem::isModified());
BOOST_CHECK(true == contentSetting.needCheck(IMAGE_TYPE_BMP));
BOOST_CHECK(true == contentSetting.needCheck(IMAGE_TYPE_JPEG));
BOOST_CHECK(false == contentSetting.needCheck(IMAGE_TYPE_GIF));
BOOST_CHECK(false == contentSetting.needCheck(IMAGE_TYPE_PNG));
}
void TestTwoModel() {
BOOST_CHECK(SettingItem::MODE_CHILD == SettingItem::getModel());
ContentCheckSetting contentSetting;
SettingItem::setModified(false);
contentSetting.enableCheck(CONTYPE_HTML, true);
contentSetting.enableCheck(CONTYPE_PNG, true);
contentSetting.enableCheck(CONTYPE_XML, true);
BOOST_CHECK( true == SettingItem::isModified());
BOOST_CHECK(false == contentSetting.needCheck(CONTYPE_JPG));
BOOST_CHECK(true == contentSetting.needCheck(CONTYPE_HTML));
BOOST_CHECK(true == contentSetting.needCheck(CONTYPE_PNG));
BOOST_CHECK(true == contentSetting.needCheck(CONTYPE_XML));
SettingItem::setModel(SettingItem::MODE_PARENT);
BOOST_CHECK(false == contentSetting.needCheck(CONTYPE_JPG));
BOOST_CHECK(false == contentSetting.needCheck(CONTYPE_HTML));
BOOST_CHECK(false == contentSetting.needCheck(CONTYPE_PNG));
BOOST_CHECK(false == contentSetting.needCheck(CONTYPE_XML));
SettingItem::setModel(SettingItem::MODE_CHILD);
BOOST_CHECK(false == contentSetting.needCheck(CONTYPE_JPG));
BOOST_CHECK(true == contentSetting.needCheck(CONTYPE_HTML));
BOOST_CHECK(true == contentSetting.needCheck(CONTYPE_PNG));
BOOST_CHECK(true == contentSetting.needCheck(CONTYPE_XML));
}
void TestNeedCheck() {
BOOST_CHECK(SettingItem::MODE_CHILD == SettingItem::getModel());
ContentCheckSetting contentSetting;
contentSetting.enableCheck(CONTYPE_HTML, true);
BOOST_CHECK(contentSetting.needCheck(CONTYPE_HTML));
BOOST_CHECK(false == contentSetting.needCheck(CONTYPE_JPG));
BOOST_CHECK(true == contentSetting.needCheck(CONTYPE_HTML));
BOOST_CHECK(false == contentSetting.needCheck(CONTYPE_PNG));
BOOST_CHECK(false == contentSetting.needCheck(CONTYPE_XML));
contentSetting.enableCheck(CONTYPE_PNG, true);
BOOST_CHECK(contentSetting.needCheck(CONTYPE_HTML));
BOOST_CHECK(contentSetting.needCheck(CONTYPE_PNG));
BOOST_CHECK(false == contentSetting.needCheck(CONTYPE_JPG));
BOOST_CHECK(false == contentSetting.needCheck(CONTYPE_XML));
contentSetting.enableCheck(CONTYPE_XML, true);
BOOST_CHECK(contentSetting.needCheck(CONTYPE_HTML));
BOOST_CHECK(contentSetting.needCheck(CONTYPE_PNG));
BOOST_CHECK(contentSetting.needCheck(CONTYPE_XML));
BOOST_CHECK(false == contentSetting.needCheck(CONTYPE_JPG));
contentSetting.enableCheck(CONTYPE_XML, false);
BOOST_CHECK(contentSetting.needCheck(CONTYPE_HTML));
BOOST_CHECK(contentSetting.needCheck(CONTYPE_PNG));
BOOST_CHECK(false == contentSetting.needCheck(CONTYPE_JPG));
contentSetting.enableCheck(CONTYPE_XML, true);
BOOST_CHECK(contentSetting.needCheck(CONTYPE_HTML));
BOOST_CHECK(contentSetting.needCheck(CONTYPE_PNG));
BOOST_CHECK(contentSetting.needCheck(CONTYPE_XML));
BOOST_CHECK(false == contentSetting.needCheck(CONTYPE_JPG));
contentSetting.enableCheck(CONTYPE_XML, true);
BOOST_CHECK(contentSetting.needCheck(CONTYPE_HTML));
BOOST_CHECK(contentSetting.needCheck(CONTYPE_PNG));
BOOST_CHECK(contentSetting.needCheck(CONTYPE_XML));
BOOST_CHECK(false == contentSetting.needCheck(CONTYPE_JPG));
contentSetting.enableCheck(CONTYPE_BMP, true);
BOOST_CHECK(contentSetting.needCheck(CONTYPE_HTML));
BOOST_CHECK(contentSetting.needCheck(CONTYPE_PNG));
BOOST_CHECK(contentSetting.needCheck(CONTYPE_XML));
BOOST_CHECK(contentSetting.needCheck(CONTYPE_BMP));
BOOST_CHECK(false == contentSetting.needCheck(CONTYPE_JPG));
contentSetting.enableCheck(CONTYPE_JPG, true);
BOOST_CHECK(contentSetting.needCheck(CONTYPE_JPG));
BOOST_CHECK(contentSetting.needCheck(CONTYPE_HTML));
BOOST_CHECK(contentSetting.needCheck(CONTYPE_PNG));
BOOST_CHECK(contentSetting.needCheck(CONTYPE_XML));
BOOST_CHECK(contentSetting.needCheck(CONTYPE_BMP));
} | [
"[email protected]"
]
| [
[
[
1,
108
]
]
]
|
c99bff7b8d12f33cd937f62a9cd452a18e84bfd9 | 016774685beb74919bb4245d4d626708228e745e | /iOS/GLEssentials/ozcollide/aabbtree_aabb.h | 6ab8e28c3a49dd131d6f3cafee6e4b2ff00ff6c9 | []
| no_license | sutuglon/Motor | 10ec08954d45565675c9b53f642f52f404cb5d4d | 16f667b181b1516dc83adc0710f8f5a63b00cc75 | refs/heads/master | 2020-12-24T16:59:23.348677 | 2011-12-20T20:44:19 | 2011-12-20T20:44:19 | 1,925,770 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,066 | h | /*
OZCollide - Collision Detection Library
Copyright (C) 2006 Igor Kravtchenko
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Contact the author: [email protected]
*/
#ifndef OZCOLLIDE_AABBTREEAABB_H
#define OZCOLLIDE_AABBTREEAABB_H
#ifndef OZCOLLIDE_PCH
#include <ozcollide/ozcollide.h>
#endif
#include <ozcollide/aabbtree.h>
#include <ozcollide/vector.h>
#include <ozcollide/sphere.h>
ENTER_NAMESPACE_OZCOLLIDE
class DataIn;
class DataOut;
typedef void AABBCDAABB_callback( const class AABBTreeAABB &,
const Box &box,
const Box &boundingBox,
void *userCallback);
class AABBTreeAABBLeaf : public AABBTreeNode {
public:
AABBTreeAABBLeaf();
int nbBoxes;
const Box *boxes;
int users;
};
class AABBTreeAABB : public AABBTree {
AABBTreeAABB(int leafDepth);
~AABBTreeAABB();
public:
class BoxColResult {
public:
Vector<const Box*> boxes_;
Vector<int> users_;
Box boxQuery_;
};
OZCOLLIDE_API static ERR loadBinary(const char *fileName, AABBTreeAABB **);
OZCOLLIDE_API static ERR loadBinary(DataIn &, AABBTreeAABB **);
OZCOLLIDE_API int getMemoryConsumption() const;
//
// BOX QUERY
// Simply return a boolean. No caching and/or temporal coherence are used
OZCOLLIDE_API bool isCollideWithBox(const Box &);
// Simple return a boolean but use collision cache if temporal coherence is turned on.
// The method tests collision with the first previous collided box ; if it still
// collides the method return immediatly with TRUE
OZCOLLIDE_API bool isCollideWithBox(const Box &, BoxColResult &);
// Fill BoxColResult with the result of the collision.
// If temporal coherence is turned on, the current content of BoxColResult is taken as a
// collision cache. The method then returns immediatly if the box is inside 'boxQuery'
// (which usually has been inflated to favorise collision cache)
// That 'boxQuery' is updated by the method itself.
OZCOLLIDE_API void collideWithBox(const Box &, BoxColResult &);
// Perform a brute query and return result through a callback.
// No caching and/or temporal coherence are used.
// This method should be used only when memory usage is a concern.
OZCOLLIDE_API void collideWithBox(const Box &, AABBCDAABB_callback *, void *userCallback = NULL);
// Return the number of collided primitives since the last collision query
OZCOLLIDE_API int getNbCollidedPrimitives() const;
OZCOLLIDE_API ERR saveBinary(const char *filename);
OZCOLLIDE_API ERR saveBinary(DataOut &);
// Scale the entire tree (nodes + leafs)
OZCOLLIDE_API void scale(float);
private:
bool isCollideWithBox(const AABBTreeNode &);
void collideWithBox(const AABBTreeNode &);
void calculNbLeafs(const AABBTreeNode *, int &nb) const;
void readPNTSchunk(DataIn &, int chunkSize);
void readNODSchunk(DataIn &, int chunkSize, int nbNodes);
void readLEFSchunk(DataIn &, int chunkSize, int nbLeafs);
AABBTreeAABBLeaf *leafs_;
AABBCDAABB_callback *callback_;
void *userCallback_;
BoxColResult *colRes_;
// Some primitives used internally for a reason or another...
Box box_;
Vec3f segment_pt0_;
Vec3f segment_pt1_;
Sphere sphere_;
int nbColls_;
friend class AABBTree;
friend class AABBTreeAABB_Builder;
};
LEAVE_NAMESPACE
#endif
| [
"[email protected]"
]
| [
[
[
1,
133
]
]
]
|
3149e6f61cf3c58811d0bb87d3580b13228fc311 | e7c45d18fa1e4285e5227e5984e07c47f8867d1d | /Application/SysCAD/ScdOPCServer.h | f0862260bf682c3b639e8ee4627b6fa963744a72 | []
| no_license | abcweizhuo/Test3 | 0f3379e528a543c0d43aad09489b2444a2e0f86d | 128a4edcf9a93d36a45e5585b70dee75e4502db4 | refs/heads/master | 2021-01-17T01:59:39.357645 | 2008-08-20T00:00:29 | 2008-08-20T00:00:29 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,867 | h | // ScdOPCServer.h : Declaration of the CScdOPCServer
#pragma once
#include "resource.h" // main symbols
#include "SysCAD.h"
#include "_IScdOPCServerEvents_CP.h"
// CScdOPCServer
class ATL_NO_VTABLE CScdOPCServer :
public CScdCOCmdBase,
public CComObjectRootEx<CComMultiThreadModel>,
public CComCoClass<CScdOPCServer, &CLSID_ScdOPCServer>,
public ISupportErrorInfo,
public IConnectionPointContainerImpl<CScdOPCServer>,
public CProxy_IScdOPCServerEvents<CScdOPCServer>,
public IDispatchImpl<IScdOPCServer, &IID_IScdOPCServer, &LIBID_ScdApp, /*wMajor =*/ 1, /*wMinor =*/ 0>
{
public:
CScdOPCServer() : CScdCOCmdBase(WMU_COM_APP)
{
}
DECLARE_REGISTRY_RESOURCEID(IDR_SCDOPCSERVER)
DECLARE_GET_CONTROLLING_UNKNOWN()
DECLARE_NOT_AGGREGATABLE(CScdOPCServer)
BEGIN_COM_MAP(CScdOPCServer)
COM_INTERFACE_ENTRY(IScdOPCServer)
COM_INTERFACE_ENTRY(IDispatch)
COM_INTERFACE_ENTRY(ISupportErrorInfo)
COM_INTERFACE_ENTRY(IConnectionPointContainer)
END_COM_MAP()
BEGIN_CONNECTION_POINT_MAP(CScdOPCServer)
CONNECTION_POINT_ENTRY(__uuidof(_IScdOPCServerEvents))
END_CONNECTION_POINT_MAP()
DECLARE_SCD(long);
// ISupportsErrorInfo
STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
DECLARE_PROTECT_FINAL_CONSTRUCT()
HRESULT FinalConstruct()
{
return S_OK;
}
void FinalRelease()
{
}
public:
// IScdASyncEvents
STDMETHOD(DoEventMsg)(LONG Evt, LONG Data)
{
CScdCOCmdBase::DoEventMsg(Evt, Data);
return S_OK;
}
virtual void FireTheEvent(long Evt, long Data);
STDMETHOD(get_On)(VARIANT_BOOL* pVal);
STDMETHOD(put_On)(VARIANT_BOOL newVal);
};
//OBJECT_ENTRY_AUTO(__uuidof(ScdOPCServer), CScdOPCServer)
| [
"[email protected]"
]
| [
[
[
1,
71
]
]
]
|
ea4f925357e068b89c15193e2ea883c27b4e78e5 | cd787383f4b4ffad1c6a1d45899ed16a8d12a18a | /CHoboCopyException.h | 3f469ca24abe943db5dcf83e2a74d19561ea743c | [
"MIT",
"LicenseRef-scancode-warranty-disclaimer"
]
| permissive | brianly/hobocopy | f6d6277203422d0a757459bafa4856e47dab118d | 0450f1551a4df300829723048db0924b69ec7d96 | refs/heads/master | 2020-12-25T13:08:22.457084 | 2011-01-22T00:55:01 | 2011-01-22T00:55:01 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,396 | h | /*
Copyright (c) 2006 Wangdera Corporation ([email protected])
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#pragma once
class CHoboCopyException
{
private:
CString _message;
public:
CHoboCopyException::CHoboCopyException(LPCTSTR message)
{
_message.Append(message);
}
LPCTSTR get_Message(void)
{
return _message;
}
}; | [
"[email protected]"
]
| [
[
[
1,
41
]
]
]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.