114#define MAX_LOADSTRING 100
115#define WINDOW_WIDTH 640
116#define WINDOW_HEIGHT 480
117#define UPDATE_TIME 100
118#define MOUSE_WHEEL_FACTOR 32
120#define SAMPLE_DYNAMIC_LIGHT 1
121#ifdef SAMPLE_DYNAMIC_LIGHT
123static Real theLightXOffset = 0.1f;
124static Real theLightYOffset = 0.07f;
125static Int theFlashCount = 0;
136static void WWDebug_Message_Callback(
DebugType type,
const char * message);
137static void WWAssert_Callback(
const char * message);
138static void Debug_Refs(
void);
141static void WWDebug_Message_Callback(
DebugType type,
const char * message)
144 ::OutputDebugString(message);
149static void WWAssert_Callback(
const char * message)
152 ::OutputDebugString(message);
180 void *userData ) {
return 0;};
345 m_showObjToolTrackingObj = show;
349 if (modelName != m_objectToolTrackingModelName) {
350 m_objectToolTrackingModelName = modelName;
352 m_objectToolTrackingObj = m_assetManager->Create_Render_Obj( modelName.
str(),
scale, 0);
354 if (m_objectToolTrackingObj ==
NULL) {
357 pos.
z += m_heightMapRenderObj->getHeightMapHeight(pos.
x, pos.
y,
NULL);
361 m_objectToolTrackingObj->Set_Transform( renderObjPos );
373 m_assetManager(
NULL),
375 m_overlayScene(
NULL),
376 m_transparentObjectsScene(
NULL),
377 m_baseBuildScene(
NULL),
378 m_objectToolTrackingObj(
NULL),
379 m_showObjToolTrackingObj(
false),
381 m_heightMapRenderObj(
NULL),
382 m_mouseWheelOffset(0),
383 m_actualWinSize(0, 0),
386 m_actualHeightAboveGround(0.0f),
391 m_needToLoadRoads(0),
397 m_showEntireMap(
false),
398 m_partialMapSize(129),
399 m_showWireframe(
false),
401 m_showShadows(
false),
406 m_showLayersList(
false),
407 m_showMapBoundaries(
false),
408 m_showBoundingBoxes(
false),
409 m_showSightRanges(
false),
410 m_showWeaponRanges(
false),
411 m_highlightTestArt(
false),
412 m_showLetterbox(
false),
413 m_showSoundCircles(
false)
418 m_cameraOffset.x = m_cameraOffset.y = m_cameraOffset.z = 1;
423 m_lightFeedbackMesh[i]=
NULL;
426 m_showWireframe = (::AfxGetApp()->GetProfileInt(
MAIN_FRAME_SECTION,
"ShowWireframe", 0) != 0);
427 m_showEntireMap = (::AfxGetApp()->GetProfileInt(
MAIN_FRAME_SECTION,
"ShowEntireMap", 1) != 0);
428 m_projection = (::AfxGetApp()->GetProfileInt(
MAIN_FRAME_SECTION,
"ShowTopDownView", 0) != 0);
429 m_showShadows = (::AfxGetApp()->GetProfileInt(
MAIN_FRAME_SECTION,
"ShowShadows", 1) != 0);
448 if (m_lightFeedbackMesh[i] !=
NULL)
449 { m_lightFeedbackMesh[i]->Remove();
462 delete m_intersector;
463 m_intersector =
NULL;
479 m_lightList.Reset_List();
481 if (m_assetManager) {
483 m_assetManager->Free_Assets();
484 delete m_assetManager;
485 m_assetManager =
NULL;
504#ifdef SAMPLE_DYNAMIC_LIGHT
511 m_ww3dInited =
false;
529 m_drawObject->freeMapResources();
545 m_drawObject->initData();
551 logFont.lfHeight = 20;
553 logFont.lfEscapement = 0;
554 logFont.lfOrientation = 0;
555 logFont.lfWeight = FW_REGULAR;
556 logFont.lfItalic =
FALSE;
557 logFont.lfUnderline =
FALSE;
558 logFont.lfStrikeOut =
FALSE;
559 logFont.lfCharSet = ANSI_CHARSET;
560 logFont.lfOutPrecision = OUT_DEFAULT_PRECIS;
561 logFont.lfClipPrecision = CLIP_DEFAULT_PRECIS;
562 logFont.lfQuality = DEFAULT_QUALITY;
563 logFont.lfPitchAndFamily = DEFAULT_PITCH;
564 strcpy(logFont.lfFaceName,
"Arial");
566 HFONT hFont = CreateFontIndirect(&logFont);
568 D3DXCreateFont(pDev, hFont, &m3DFont);
583 if (m_timer !=
NULL) {
592 if (m_actualWinSize.x == width &&
593 m_actualWinSize.y == height) {
599 m_actualWinSize.x = width;
600 m_actualWinSize.y = height;
613 m_assetManager->Set_WW3D_Load_On_Demand(
true);
617#define TERRAIN_SAMPLE_SIZE 40.0f
623 Real terrainHeightMax = terrainHeight;
629 return terrainHeightMax;
636 float zOffset = - m_mouseWheelOffset / 1200;
639 Real zPos = (m_cameraOffset.length()-m_groundLevel)/m_cameraOffset.length();
640 Real zAbs = zOffset + zPos;
641 if (zAbs<0) zAbs = -zAbs;
642 if (zAbs<0.01) zAbs = 0.01f;
646 }
else if (zOffset < -0.3f) {
647 zOffset = -0.15f + zOffset/2.0f;
649 if (zOffset < -0.6f) {
650 zOffset = -0.3f + zOffset/2.0f;
659 Real angle = m_cameraAngle;
666 Real groundLevel = m_heightMapRenderObj?getHeightAroundPos(m_heightMapRenderObj, pos.
x, pos.
y) : 0;
674 sourcePos.
X = m_cameraOffset.x * zoom;
675 sourcePos.
Y = m_cameraOffset.y * zoom;
676 sourcePos.
Z = m_cameraOffset.z * zoom;
684 Real factor = 1.0 - (groundLevel/sourcePos.
Z );
693#ifdef ALLOW_TEMPORARIES
694 sourcePos = pitchTransform * sourcePos;
695 sourcePos = angleTransform * sourcePos;
704 sourcePos.
X += pos.
x;
705 sourcePos.
Y += pos.
y;
706 sourcePos.
Z += pos.
z+groundLevel;
708 targetPos.
X += pos.
x;
709 targetPos.
Y += pos.
y;
710 targetPos.
Z += pos.
z+groundLevel;
713 Real height = sourcePos.
Z - targetPos.
Z;
715 targetPos.
Z = sourcePos.
Z - height;
718 m_actualHeightAboveGround = m_cameraOffset.z * zoom - groundLevel;
719 m_cameraSource = sourcePos;
720 m_cameraTarget = targetPos;
733 targetPos = sourcePos + (sourcePos-targetPos);
735 camtransform.
Look_At( sourcePos, targetPos, 0 );
738 Real lookDistance = (targetPos-sourcePos).Length();
740 if (lookDistance < 300) lookDistance = 300;
741 m_camera->Get_Clip_Planes(nearZ, farZ);
742 m_camera->Set_Clip_Planes(lookDistance/200, lookDistance*3);
744 if (m_heightMapRenderObj) {
748 m_heightMapRenderObj->setFlattenHeights(
true);
751 m_heightMapRenderObj->setFlattenHeights(
false);
755 m_camera->Set_Transform( camtransform );
756 if (m_heightMapRenderObj) {
757 m_heightMapRenderObj->setDrawEntireMap(m_showEntireMap);
775#ifdef SAMPLE_DYNAMIC_LIGHT
781 if(red==0 && blue==0 && green==0) {
782 red = green = blue = 1;
784 theDynamicLight->Set_Ambient(
Vector3( red, green, blue ) );
785 theDynamicLight->Set_Diffuse(
Vector3( red, green, blue) );
786 theDynamicLight->Set_Position(
Vector3(211, 363, 10));
787 theDynamicLight->Set_Far_Attenuation_Range(5, 15);
789 m_scene->addDynamicLight( theDynamicLight );
795 m_scene->Set_Ambient_Light(
Vector3(0.5f,0.5f,0.5f));
796 m_overlayScene->Set_Ambient_Light(
Vector3(0.5f,0.5f,0.5f));
797 m_baseBuildScene->Set_Ambient_Light(
Vector3(0.5f,0.5f,0.5f));
807 if (!m_scene)
return;
817 m_scene->Remove_Render_Object(robj);
821 m_scene->Destroy_Iterator(sceneIter);
822 sceneIter = m_baseBuildScene->Create_Iterator();
827 m_baseBuildScene->Remove_Render_Object(robj);
831 m_baseBuildScene->Destroy_Iterator(sceneIter);
850 m_needToLoadRoads =
true;
856 if (m_heightMapRenderObj) {
857 m_scene->Add_Render_Object(m_heightMapRenderObj);
858 m_heightMapRenderObj->removeAllTrees();
859 m_heightMapRenderObj->removeAllProps();
887 if( m_globalLight ) {
888 m_globalLight[whichLight]->Set_Ambient(
Vector3( 0.0f, 0.0f, 0.0f ) );
890 m_globalLight[whichLight]->Set_Specular(
Vector3(0,0,0) );
892 mtx.
Set(
Vector3(1,0,0),
Vector3(0,1,0),
Vector3(ol->
lightPos.
x, ol->
lightPos.
y, ol->
lightPos.
z),
Vector3(0,0,0));
893 m_globalLight[whichLight]->Set_Transform(mtx);
894 if( m_scene && whichLight == 0) {
905 m_needToLoadRoads =
true;
915 m_lightList.Reset_List();
934 if( m_globalLight[i] )
937 m_globalLight[i]->Set_Ambient(
Vector3( 0.0f, 0.0f, 0.0f ) );
939 m_globalLight[i]->Set_Specular(
Vector3(0,0,0) );
941 mtx.
Set(
Vector3(1,0,0),
Vector3(0,1,0),
Vector3(ol->
lightPos.
x, ol->
lightPos.
y, ol->
lightPos.
z),
Vector3(0,0,0));
942 m_globalLight[i]->Set_Transform(mtx);
943 m_scene->setGlobalLight(m_globalLight[i],i);
944 m_baseBuildScene->setGlobalLight(m_globalLight[i],i);
955 while (pMapObj && m_heightMapRenderObj) {
958 loc.
z += m_heightMapRenderObj->getHeightMapHeight(loc.
x, loc.
y,
NULL);
961 m_scene->Remove_Render_Object(renderObj);
969 Real lightHeightAboveTerrain, lightInnerRadius, lightOuterRadius;
970 RGBColor lightAmbientColor, lightDiffuseColor;
971 lightHeightAboveTerrain = props->
getReal(TheKey_lightHeightAboveTerrain);
972 lightInnerRadius = props->
getReal(TheKey_lightInnerRadius);
973 lightOuterRadius = props->
getReal(TheKey_lightOuterRadius);
984 m_lightList.Add(lightP);
985 m_scene->Add_Render_Object(lightP);
1037 if (m_heightMapRenderObj) {
1038 pos.
z += m_heightMapRenderObj->getHeightMapHeight(pos.
x, pos.
y,
NULL);
1058 for (pMapObj = pObject; pMapObj; pMapObj = pMapObj->
getNext())
1062 loc.
z += m_heightMapRenderObj->getHeightMapHeight(loc.
x, loc.
y,
NULL);
1071 strncmp( modelName.
str(),
"No ", 3 ) )
1074 renderObj = m_assetManager->Create_Render_Obj( modelName.
str(),
scale, 0);
1090 m_scene->Add_Render_Object(renderObj);
1104 for (pMapObj = pObject; pMapObj; pMapObj = pMapObj->
getNext())
1107 m_scene->Remove_Render_Object(pMapObj->
getRenderObj());
1151 Bool exists =
false;
1152 Int color = sideDict->
getInt(TheKey_playerColor, &exists);
1161 if (pBuildToInval == pBuild) {
1164 if (!found && pBuildToInval) {
1171 Coord3D loc = *pBuild->getLocation();
1172 loc.
z += m_heightMapRenderObj->getHeightMapHeight(loc.
x, loc.
y,
NULL);
1176 if (pBuild->getRenderObj()) {
1177 if (!m_baseBuildScene->safeContains(pBuild->getRenderObj())) {
1178 pBuild->setRenderObj(
NULL);
1185 AsciiString thingName = pBuild->getTemplateName();
1197 strncmp( modelName.
str(),
"No ", 3 ) )
1219 pBuild->setRenderObj(renderObj);
1220 pBuild->setShadowObj(shadowObj);
1224 renderObjPos.
Rotate_Z(pBuild->getAngle());
1227 m_baseBuildScene->Add_Render_Object(renderObj);
1236 if (!found && pBuildToInval && pBuildToInval->
getRenderObj()) {
1237 if (!m_baseBuildScene->safeContains(pBuildToInval->
getRenderObj())) {
1241 if (!found && pBuildToInval && pBuildToInval->
getRenderObj()) {
1242 m_baseBuildScene->Remove_Render_Object(pBuildToInval->
getRenderObj());
1252 switch (curDamageState)
1318 char buffer[ _MAX_PATH ];
1324 for (i=0; buffer[i]; i++) {
1325 if (buffer[i] ==
'/') {
1330 modelName = buffer+i;
1334 modelName =
"No Model Name";
1354 Bool updateAllTrees =
false;
1355 if (m_heightMapRenderObj ==
NULL) {
1358 m_scene->Add_Render_Object(m_heightMapRenderObj);
1360 if (pMapObjIn ==
NULL) {
1364 Bool isRoad =
false;
1365 Bool isLight =
false;
1366 Bool isScorch =
false;
1367 if (pMapObjIn ==
NULL)
1373 if (pMapObjIn == pMapObj)
1375 if (pMapObjIn !=
NULL && !found) {
1387 if (pMapObj == pMapObjIn) {
1395 loc.
z += m_heightMapRenderObj->getHeightMapHeight(loc.
x, loc.
y,
NULL);
1399 if (!m_heightMapRenderObj->updateTreePosition((
DrawableID)(
Int)pMapObj, loc, pMapObj->getAngle())) {
1401 updateAllTrees =
true;
1412 Bool isVehicle =
false;
1425 Bool hasColor =
false;
1442 Real ratio = health/100.0;
1451 else if (ratio > 0.0f)
1466 strncmp( modelName.
str(),
"No ", 3 ) )
1488 }
else if (!tTemplate) {
1512 m_heightMapRenderObj->getHeightMapHeight(loc.
x, loc.
y, &terrainNormal );
1517 m_scene->Add_Render_Object(renderObj);
1520 }
else if (renderObj) {
1521 m_scene->Remove_Render_Object(renderObj);
1525 if (!found && pMapObjIn) {
1531 updateAllTrees =
true;
1534 if (!found && pMapObjIn && pMapObjIn->
getRenderObj()) {
1535 if( m_showShadows ) {
1541 m_scene->Remove_Render_Object(pMapObjIn->
getRenderObj());
1546 m_needToLoadRoads =
true;
1548 if (updateAllTrees) {
1570 if (m_heightMapRenderObj ==
NULL) {
1572 m_scene->Add_Render_Object(m_heightMapRenderObj);
1577 if (m_heightMapRenderObj) {
1579 Int curTicks = ::GetTickCount();
1583 m_heightMapRenderObj->doPartialUpdate(partialRange, htMap, &lightListIt);
1585 if (m_showEntireMap) {
1589 m_heightMapRenderObj->initHeightData(htMap->
getXExtent(), htMap->
getYExtent(), htMap, &lightListIt);
1595 m_heightMapRenderObj->updateViewImpassableAreas();
1597 curTicks = GetTickCount() - curTicks;
1598 if (curTicks < 1) curTicks = 1;
1628 if (m_intersector && m_layer) {
1630 this->GetClientRect(&client);
1631 float logX = (
Real)viewPt.x / (
Real)client.Width();
1632 float logY = (
Real)viewPt.y / (
Real)client.Height();
1635 Bool hit = m_intersector->Intersect_Screen_Point_Layer( logX, logY, *m_layer );
1640 if (pObj->
getRenderObj() == m_intersector->Result.IntersectedRenderObject) {
1663 Coord3D center = *pBuild->getLocation();
1675 if (m_intersector && m_buildLayer) {
1677 this->GetClientRect(&client);
1678 float logX = (
Real)viewPt.x / (
Real)client.Width();
1679 float logY = (
Real)viewPt.y / (
Real)client.Height();
1682 Bool hit = m_intersector->Intersect_Screen_Point_Layer( logX, logY, *m_buildLayer );
1687 if (pBuild->getRenderObj() == m_intersector->Result.IntersectedRenderObject) {
1703 Bool result =
false;
1705 this->GetClientRect(&client);
1708 float logX = (
Real)curPt.x / (
Real)client.Width();
1709 float logY = (
Real)curPt.y / (
Real)client.Height();
1712 Matrix3D camera_matrix = m_camera->Get_Transform();
1714 Vector3 camera_location = m_camera->Get_Position();
1720 rayLocation = camera_location;
1725 m_camera->Get_View_Plane(
min,
max);
1726 float xscale = (
max.X -
min.X);
1727 float yscale = (
max.Y -
min.Y);
1730 float xmod = (-logX + 0.5 + viewport.
Min.
X) * zmod * xscale;
1731 float ymod = (logY - 0.5 - viewport.
Min.
Y) * zmod * yscale;
1734 float x = zmod * camera_matrix[0][2] + xmod * camera_matrix[0][0] + ymod * camera_matrix[0][1];
1735 float y = zmod * camera_matrix[1][2] + xmod * camera_matrix[1][0] + ymod * camera_matrix[1][1];
1736 float z = zmod * camera_matrix[2][2] + xmod * camera_matrix[2][0] + ymod * camera_matrix[2][1];
1738 rayDirection.
Set(x,y,z);
1741 rayDirectionPt = rayLocation + rayDirection*MaxDistance;
1750 Bool followTerrain =
true;
1751 if (
WbApp()->isCurToolLocked()) {
1761 m_curTrackingZ = intersection.
Z;
1770 newPt->
x = intersection.
X;
1771 newPt->
y = intersection.
Y;
1781 }
else if (dy>2*dx) {
1795 if (m_cameraAngle >
PI) {
1796 m_cameraAngle -= 2*
PI;
1798 if (m_cameraAngle < -
PI) {
1799 m_cameraAngle += 2*
PI;
1803 if (
PI/4<m_cameraAngle && m_cameraAngle < 3*
PI/4) {
1806 if (-
PI/4>m_cameraAngle && m_cameraAngle > -3*
PI/4) {
1811 if (m_doLockVertical) {
1813 }
else if (m_doLockHorizontal) {
1817 if (m_doLockHorizontal) {
1819 }
else if (m_doLockVertical) {
1833 this->GetClientRect(&client);
1836 float logX = (
Real)curPt.x / (
Real)client.Width();
1837 float logY = (
Real)curPt.y / (
Real)client.Height();
1840 Matrix3D camera_matrix = m_camera->Get_Transform();
1842 Vector3 camera_location = m_camera->Get_Position();
1848 rayLocation = camera_location;
1853 m_camera->Get_View_Plane(
min,
max);
1854 float xscale = (
max.X -
min.X);
1855 float yscale = (
max.Y -
min.Y);
1858 float xmod = (-logX + 0.5 + viewport.
Min.
X) * zmod * xscale;
1859 float ymod = (logY - 0.5 - viewport.
Min.
Y) * zmod * yscale;
1862 float x = zmod * camera_matrix[0][2] + xmod * camera_matrix[0][0] + ymod * camera_matrix[0][1];
1863 float y = zmod * camera_matrix[1][2] + xmod * camera_matrix[1][0] + ymod * camera_matrix[1][1];
1864 float z = zmod * camera_matrix[2][2] + xmod * camera_matrix[2][0] + ymod * camera_matrix[2][1];
1866 rayDirection.
Set(x,y,z);
1869 rayDirectionPt = rayLocation + rayDirection*MaxDistance;
1876 newPt->
x = intersection.
X;
1877 newPt->
y = intersection.
Y;
1886 GetClientRect(&client);
1888 curPt.x = (client.left+client.right)/2;
1889 curPt.y = (client.bottom+client.top)/2;
1891 float logX = (
Real)curPt.x / (
Real)client.Width();
1892 float logY = (
Real)curPt.y / (
Real)client.Height();
1895 Matrix3D camera_matrix = m_camera->Get_Transform();
1897 Vector3 camera_location = m_camera->Get_Position();
1903 rayLocation = camera_location;
1908 m_camera->Get_View_Plane(
min,
max);
1909 float xscale = (
max.X -
min.X);
1910 float yscale = (
max.Y -
min.Y);
1913 float xmod = (-logX + 0.5 + viewport.
Min.
X) * zmod * xscale;
1914 float ymod = (logY - 0.5 - viewport.
Min.
Y) * zmod * yscale;
1917 float x = zmod * camera_matrix[0][2] + xmod * camera_matrix[0][0] + ymod * camera_matrix[0][1];
1918 float y = zmod * camera_matrix[1][2] + xmod * camera_matrix[1][0] + ymod * camera_matrix[1][1];
1919 float z = zmod * camera_matrix[2][2] + xmod * camera_matrix[2][0] + ymod * camera_matrix[2][1];
1921 rayDirection.
Set(x,y,z);
1922 rayDirectionPt = rayLocation + rayDirection;
1928 logX = (
Real)(curPt.x+3) / (
Real)client.Width();
1931 xmod = (-logX + 0.5 + viewport.
Min.
X) * zmod * xscale;
1932 ymod = (logY - 0.5 - viewport.
Min.
Y) * zmod * yscale;
1935 x = zmod * camera_matrix[0][2] + xmod * camera_matrix[0][0] + ymod * camera_matrix[0][1];
1936 y = zmod * camera_matrix[1][2] + xmod * camera_matrix[1][0] + ymod * camera_matrix[1][1];
1937 z = zmod * camera_matrix[2][2] + xmod * camera_matrix[2][0] + ymod * camera_matrix[2][1];
1938 rayDirection.
Set(x,y,z);
1939 rayDirectionPt = rayLocation + rayDirection;
1942 offset = offset - intersection;
1945 logX = (
Real)(curPt.x) / (
Real)client.Width();
1946 logY = (
Real)(curPt.y+3) / (
Real)client.Height();
1948 xmod = (-logX + 0.5 + viewport.
Min.
X) * zmod * xscale;
1949 ymod = (logY - 0.5 - viewport.
Min.
Y) * zmod * yscale;
1952 x = zmod * camera_matrix[0][2] + xmod * camera_matrix[0][0] + ymod * camera_matrix[0][1];
1953 y = zmod * camera_matrix[1][2] + xmod * camera_matrix[1][0] + ymod * camera_matrix[1][1];
1954 z = zmod * camera_matrix[2][2] + xmod * camera_matrix[2][0] + ymod * camera_matrix[2][1];
1955 rayDirection.
Set(x,y,z);
1956 rayDirectionPt = rayLocation + rayDirection;
1959 offset = offset - intersection;
1964 loc.
x = intersection.
X;
1965 loc.
y = intersection.
Y;
1966 loc.
z = intersection.
Z;
1971 Int dx = pt1.x-pt2.x;
1973 Int dy = pt1.y-pt2.y;
1977 m_pickPixels = dx+3;
1984 Bool coordInsideFrustrum =
true;
1989 if (m_heightMapRenderObj) {
1990 curPt.
z += m_heightMapRenderObj->getHeightMapHeight(curPt.
x, curPt.
y,
NULL);
1993 world.
Set( curPt.
x, curPt.
y, curPt.
z );
1995 coordInsideFrustrum =
false;
1997 coordInsideFrustrum =
true;
2001 GetClientRect(&rClient);
2012 rClient.right-rClient.left, rClient.bottom-rClient.top );
2014 newPt->x = rClient.left + sx;
2015 newPt->y = rClient.top + sy;
2017 return coordInsideFrustrum;
2023 if (m_updateCount > 0) {
2029 if (!IsWindowVisible()) {
2032 if (!m_ww3dInited) {
2039 if (m_heightMapRenderObj) {
2040 if (m_needToLoadRoads) {
2041 m_heightMapRenderObj->loadRoadsAndBridges(
NULL,
FALSE);
2042 m_heightMapRenderObj->worldBuilderUpdateBridgeTowers( m_assetManager, m_scene );
2043 m_needToLoadRoads =
false;
2046 Int curTicks = GetTickCount();
2048 m_heightMapRenderObj->updateCenter(m_camera, &lightListIt);
2049 m_heightMapRenderObj->On_Frame_Update();
2052 curTicks = GetTickCount()-curTicks;
2061 m_showBoundingBoxes, m_showSightRanges, m_showWeaponRanges, m_showSoundCircles, m_highlightTestArt, m_showLetterbox);
2065 m_buildRedMultiplier += (GetTickCount()-m_time)/500.0f;
2066 if (m_buildRedMultiplier>4.0f || m_buildRedMultiplier<0) {
2067 m_buildRedMultiplier = 0;
2070 m_time = ::GetTickCount();
2084 if (m_heightMapRenderObj) {
2086 m_heightMapRenderObj->doTextures(
true);
2091 Vector3 amb = m_baseBuildScene->Get_Ambient_Light();
2093 Real mul = m_buildRedMultiplier;
2094 if (mul>2.0f) mul = 4.0f-mul;
2095 Real gMul = 2.0-mul;
2098 if (newAmb.
X>1) newAmb.
X = 1;
2099 m_baseBuildScene->Set_Ambient_Light(newAmb);
2101 m_baseBuildScene->Set_Ambient_Light(amb);
2103 if (m_showWireframe) {
2104 if (m_heightMapRenderObj) {
2105 m_heightMapRenderObj->doTextures(
false);
2110 m_heightMapRenderObj->doTextures(
true);
2113 if (m_showObjToolTrackingObj && m_objectToolTrackingObj) {
2114 m_transparentObjectsScene->Add_Render_Object(m_objectToolTrackingObj);
2117 Real lightLevel = 1.0f;
2118 m_transparentObjectsScene->Set_Ambient_Light(
Vector3(lightLevel,lightLevel,lightLevel));
2122 m_transparentObjectsScene->Remove_Render_Object(m_objectToolTrackingObj);
2217void WbView3d::AssertValid()
const
2219 WbView::AssertValid();
2223void WbView3d::Dump(CDumpContext& dc)
const
2233 if (!m_ww3dInited) {
2237 m_ww3dInited =
true;
2266 logFont.lfHeight = 20;
2267 logFont.lfWidth = 0;
2268 logFont.lfEscapement = 0;
2269 logFont.lfOrientation = 0;
2270 logFont.lfWeight = FW_REGULAR;
2271 logFont.lfItalic =
FALSE;
2272 logFont.lfUnderline =
FALSE;
2273 logFont.lfStrikeOut =
FALSE;
2274 logFont.lfCharSet = ANSI_CHARSET;
2275 logFont.lfOutPrecision = OUT_DEFAULT_PRECIS;
2276 logFont.lfClipPrecision = CLIP_DEFAULT_PRECIS;
2277 logFont.lfQuality = DEFAULT_QUALITY;
2278 logFont.lfPitchAndFamily = DEFAULT_PITCH;
2279 strcpy(logFont.lfFaceName,
"Arial");
2281 HFONT hFont = CreateFontIndirect(&logFont);
2283 D3DXCreateFont(pDev, hFont, &m3DFont);
2284 DeleteObject(hFont);
2299 m_layer =
new LayerClass( m_scene, m_camera );
2300 m_buildLayer =
new LayerClass( m_baseBuildScene, m_camera );
2303 m_overlayScene->Add_Render_Object(m_drawObject);
2336 AfxGetApp()->WriteProfileInt(
"GameOptions",
"cloudMap",
TheGlobalData->m_useCloudMap);
2337 m_partialMapSize = AfxGetApp()->GetProfileInt(
"GameOptions",
"partialMapSize", 97);
2339 m_showLayersList = AfxGetApp()->GetProfileInt(
MAIN_FRAME_SECTION,
"ShowLayersList", 0);
2340 m_showMapBoundaries = AfxGetApp()->GetProfileInt(
MAIN_FRAME_SECTION,
"ShowMapBoundaries", 0);
2341 m_showAmbientSounds = AfxGetApp()->GetProfileInt(
MAIN_FRAME_SECTION,
"ShowAmbientSounds", 0);
2342 m_showSoundCircles = AfxGetApp()->GetProfileInt(
MAIN_FRAME_SECTION,
"ShowSoundCircles", 0);
2354 HDC hdc = ::BeginPaint(m_hWnd, &ps);
2355 if (!m_firstPaint) {
2359 ::EndPaint(m_hWnd, &ps);
2362 m_firstPaint =
false;
2372 CPoint rulerPoints[2];
2378 HPEN pen = CreatePen(PS_SOLID, 2, color);
2379 HPEN penOld = (HPEN)SelectObject(hdc, pen);
2383 pnt.
x = centerPoint.
x + radius * (
Real)cosf(angle);
2384 pnt.
y = centerPoint.
y + radius * (
Real)sinf(angle);
2385 pnt.
z = centerPoint.
z;
2389 for(; angle <= 2.0f *
PI; angle += inc) {
2391 pnt.
x = centerPoint.
x + radius * (
Real)cosf(angle);
2392 pnt.
y = centerPoint.
y + radius * (
Real)sinf(angle);
2393 pnt.
z = centerPoint.
z;
2397 ::Polyline(hdc, rulerPoints, 2);
2400 rulerPoints[0].x = rulerPoints[1].x;
2401 rulerPoints[0].y = rulerPoints[1].y;
2405 SelectObject(hdc, penOld);
2413 CDC * pDC = GetDC();
2422 Real selectedRadius=120.0f;
2423 selectedPos.
x=0;selectedPos.
y=0;selectedPos.
z=0;
2440 selectedPos.
z = m_heightMapRenderObj->getHeightMapHeight(selectedPos.
x, selectedPos.
y,
NULL);
2454 pos.
z = m_heightMapRenderObj->getHeightMapHeight(pos.
x, pos.
y,
NULL);
2459 pos.
z += m_heightMapRenderObj->getHeightMapHeight(pos.
x, pos.
y,
NULL);
2462 for (i=0; i<4; i++) {
2469 default: name.
clear();
2487 GetClientRect(&rClient);
2498 rClient.right-rClient.left, rClient.bottom-rClient.top );
2499 pt.x = rClient.left+sx;
2500 pt.y = rClient.top+sy;
2505 red = 0; green = 255;
2507 red = 255, green = 0;
2510 if (m3DFont && !hdc) {
2514 rct.top = rct.bottom = pt.y;
2515 rct.left = rct.right = pt.x;
2517 DT_LEFT | DT_NOCLIP | DT_TOP | DT_SINGLELINE, 0xAF000000 + (red<<16) + (green<<8));
2519 }
else if (!m3DFont) {
2521 ::SetBkMode(hdc, TRANSPARENT);
2524 ::SetTextColor(hdc,
RGB(red,green,0));
2525 ::TextOut(hdc, pt.x, pt.y, name.
str(), name.
getLength());
2537 brush.CreateSolidBrush(
RGB(0,255,0));
2538 ::FrameRect(hdc, &
m_feedbackBox, (HBRUSH)brush.GetSafeHandle());
2544 CPoint rulerPoints[2];
2549 HPEN pen = CreatePen(PS_SOLID, 2,
RGB(0,255,0));
2550 HPEN penOld = (HPEN)SelectObject(hdc, pen);
2552 ::Polyline(hdc, rulerPoints, 2);
2555 SelectObject(hdc, penOld);
2569 Vector3 worldStart, screenStart;
2572 worldStart.
Set( selectedPos.
x, selectedPos.
y, selectedPos.
z );
2577 if (m_lightFeedbackMesh[lIndex] ==
NULL)
2579 sprintf(nameBuf,
"WB_LIGHT%d",lIndex+1);
2582 if (m_lightFeedbackMesh[lIndex]==
NULL) {
2587 lightMat.
Look_At(worldEnd,worldStart,0);
2590 m_lightFeedbackMesh[lIndex]->Add(m_scene);
2591 m_lightFeedbackMesh[lIndex]->Set_Transform(lightMat);
2592#ifdef DRAW_LIGHT_DIRECTION_RAYS
2597 GetClientRect(&rClient);
2605 Int sxStart, syStart;
2613 rayPoints[0].x = rClient.left+sxStart;
2614 rayPoints[0].y= rClient.top+syStart;
2616 rayPoints[1].x = rClient.left+sxEnd;
2617 rayPoints[1].y= rClient.top+syEnd;
2619 HPEN pen=CreatePen( PS_SOLID,2, LightColors[lIndex]);
2620 HPEN penOld = (HPEN)SelectObject(hdc, pen);
2621 Polyline(hdc,rayPoints,2);
2622 SelectObject(hdc, penOld);
2634 if (m_lightFeedbackMesh[lIndex] !=
NULL)
2635 { m_lightFeedbackMesh[lIndex]->Remove();
2647 WbView::OnSize(nType, cx, cy);
2659 m_mouseWheelOffset += zDelta;
2663 m_mouseWheelOffset += zDelta/2;
2667 m_mouseWheelOffset += zDelta/8;
2671 while (::PeekMessage(&
msg, m_hWnd, WM_MOUSEWHEEL, WM_MOUSEWHEEL, PM_REMOVE)) {
2672 zDelta = (short) HIWORD(
msg.wParam);
2673 m_mouseWheelOffset += zDelta;
2687 m_mouseWheelOffset = 0;
2704 m_groundLevel = 10.0;
2720 if (m_heightMapRenderObj) {
2721 m_groundLevel = m_heightMapRenderObj->getHeightMapHeight(pos.
x, pos.
y,
NULL);
2725 m_cameraOffset.z = m_groundLevel+
TheGlobalData->m_maxCameraHeight;
2726 m_cameraOffset.y = -(m_cameraOffset.z / tan(
TheGlobalData->m_cameraPitch * (
PI / 180.0)));
2727 m_cameraOffset.x = -(m_cameraOffset.y * tan(
TheGlobalData->m_cameraYaw * (
PI / 180.0)));
2729 m_cameraOffset.x *= 1.0f;
2730 m_cameraOffset.y *= 1.0f;
2731 m_cameraOffset.z *= 1.0f;
2746 if (m_projection)
return;
2747 m_cameraAngle += delta;
2756 if (m_projection)
return;
2766 if (m_projection)
return;
2767 m_FXPitch = absolutePitch;
2783 float zOffset = - m_mouseWheelOffset / 1200;
2786 Real zPos = (m_cameraOffset.length()-m_groundLevel)/m_cameraOffset.length();
2787 Real zAbs = zOffset + zPos;
2788 if (zAbs<0) zAbs = -zAbs;
2789 if (zAbs<0.01) zAbs = 0.01f;
2793 }
else if (zOffset < -0.3f) {
2794 zOffset = -0.15f + zOffset/2.0f;
2796 if (zOffset < -0.6f) {
2797 zOffset = -0.3f + zOffset/2.0f;
2818 WbView::OnDestroy();
2824 WbView::OnShowWindow(bShow, nStatus);
2846 m_showWireframe = !m_showWireframe;
2847 ::AfxGetApp()->WriteProfileInt(
MAIN_FRAME_SECTION,
"ShowWireframe", m_showWireframe?1:0);
2852 pCmdUI->SetCheck(m_showWireframe?1:0);
2865 m_showEntireMap = !m_showEntireMap;
2869 ::AfxGetApp()->WriteProfileInt(
MAIN_FRAME_SECTION,
"ShowEntireMap", m_showEntireMap?1:0);
2874 pCmdUI->SetCheck(m_showEntireMap?1:0);
2879 m_projection = !m_projection;
2880 m_heightMapRenderObj->setFlattenHeights(m_projection);
2882 ::AfxGetApp()->WriteProfileInt(
MAIN_FRAME_SECTION,
"ShowTopDownView", m_projection?1:0);
2887 pCmdUI->SetCheck(m_projection?1:0);
2893 AfxGetApp()->WriteProfileInt(
"GameOptions",
"cloudMap",
TheGlobalData->m_useCloudMap);
2923 m_showShadows = !m_showShadows;
2924 if (m_showShadows) {
2930 ::AfxMessageBox(
"Shadows require a 32 bit color desktop.", IDOK);
2931 m_showShadows =
false;
2941 ::AfxGetApp()->WriteProfileInt(
MAIN_FRAME_SECTION,
"ShowShadows", m_showShadows?1:0);
2946 pCmdUI->SetCheck(m_showShadows?1:0);
2955 WbDoc()->GetHeightMap());
2963 pCmdUI->SetCheck(
TheGlobalData->m_showSoftWaterEdge ? 1 : 0);
2978 pCmdUI->SetCheck(
TheGlobalData->m_use3WayTerrainBlends > 1 ? 1 : 0);
2985 if (dlg.DoModal() == IDOK) {
2993 if (!m_showShadows) {
3097 Bool showImpassable =
false;
3109 Bool showImpassable =
false;
3113 pCmdUI->SetCheck(showImpassable?1:0);
3122 if (opts.DoModal() == IDOK) {
3136 m_partialMapSize = 97;
3137 AfxGetApp()->WriteProfileInt(
"GameOptions",
"partialMapSize", m_partialMapSize);
3138 m_showEntireMap =
false;
3147 pCmdUI->SetCheck(m_partialMapSize == 97?1:0);
3152 m_partialMapSize = 192;
3153 AfxGetApp()->WriteProfileInt(
"GameOptions",
"partialMapSize", m_partialMapSize);
3154 m_showEntireMap =
false;
3163 pCmdUI->SetCheck(m_partialMapSize == 192?1:0);
3168 m_partialMapSize = 161;
3169 AfxGetApp()->WriteProfileInt(
"GameOptions",
"partialMapSize", m_partialMapSize);
3170 m_showEntireMap =
false;
3179 pCmdUI->SetCheck(m_partialMapSize == 161?1:0);
3184 m_partialMapSize = 129;
3185 AfxGetApp()->WriteProfileInt(
"GameOptions",
"partialMapSize", m_partialMapSize);
3186 m_showEntireMap =
false;
3195 pCmdUI->SetCheck(m_partialMapSize == 129?1:0);
3200 m_showLayersList = !m_showLayersList;
3201 ::AfxGetApp()->WriteProfileInt(
MAIN_FRAME_SECTION,
"ShowLayersList", m_showLayersList ? 1 : 0);
3202 TheLayersList->ShowWindow(m_showLayersList ? SW_SHOW : SW_HIDE);
3203 if (m_showLayersList) {
3212 pCmdUI->SetCheck(m_showLayersList ? 1 : 0);
3217 m_showMapBoundaries = !m_showMapBoundaries;
3218 ::AfxGetApp()->WriteProfileInt(
MAIN_FRAME_SECTION,
"ShowMapBoundaries", m_showMapBoundaries ? 1 : 0);
3224 pCmdUI->SetCheck(m_showMapBoundaries ? 1 : 0);
3230 m_showAmbientSounds = !m_showAmbientSounds;
3231 ::AfxGetApp()->WriteProfileInt(
MAIN_FRAME_SECTION,
"ShowAmbientSounds", m_showAmbientSounds ? 1 : 0);
3237 pCmdUI->SetCheck(m_showAmbientSounds ? 1 : 0);
3242 m_showSoundCircles = !m_showSoundCircles;
3243 ::AfxGetApp()->WriteProfileInt(
MAIN_FRAME_SECTION,
"ShowSoundCircles", m_showSoundCircles ? 1 : 0);
3250 pCmdUI->SetCheck(m_showSoundCircles ? 1 : 0);
BaseHeightMapRenderObjClass * TheTerrainRenderObject
The one-of for the terrain rendering object.
@ BODY_RUBBLE
unit has been reduced to rubble/corpse/exploded-hulk, etc
@ BODY_REALLYDAMAGED
unit is extremely damaged / nearly destroyed
@ BODY_PRISTINE
unit should appear in pristine condition
@ BODY_DAMAGED
unit has been damaged
#define DEBUG_ASSERTCRASH(c, m)
Color scale(const Color &a, const Color &b)
ObjectID
A unique, generic "identifier" used to access Objects.
DrawableID
A unique, generic "identifier" used to access Drawables.
const Int MAX_GLOBAL_LIGHTS
GlobalData * TheWritableGlobalData
The global data singleton.
@ KINDOF_VEHICLE
unit like tank, jeep, plane, helicopter, etc.
@ KINDOF_OPTIMIZED_TREE
An optimized, client side only tree. (The only good kind of tree. jba)
LayersList * TheLayersList
#define MAIN_FRAME_SECTION
@ FLAG_DONT_RENDER
If set, do not render this object. Only WB pays attention to this. (Right now, anyways)
@ FLAG_ROAD_FLAGS
If nonzero, object is a road piece.
@ FLAG_BRIDGE_FLAGS
If nonzero, object is a bridge piece.
@ MODELCONDITION_REALLY_DAMAGED
@ MODELCONDITION_GARRISONED
BitFlags< MODELCONDITION_COUNT > ModelConditionFlags
NameKeyGenerator * TheNameKeyGenerator
just one namespace for now
NameKeyType NAMEKEY(const AsciiString &name)
AsciiString KEYNAME(NameKeyType nk)
PlayerTemplateStore * ThePlayerTemplateStore
singleton instance of PlayerTemplateStore
SidesList * TheSidesList
singleton instance of SidesList
void makeAlignToNormalMatrix(Real angle, const Coord3D &pos, const Coord3D &normal, Matrix3D &mtx)
ThingFactory * TheThingFactory
the template singleton
View * TheTacticalView
the main tactical interface to the game world
void W3DLogicalScreenToPixelScreen(Real logX, Real logY, Int *screenX, Int *screenY, Int screenWidth, Int screenHeight)
W3DShadowManager * TheW3DShadowManager
#define TERRAIN_SAMPLE_SIZE
OVERRIDE< WaterTransparencySetting > TheWaterTransparency
CWorldBuilderApp * WbApp()
AggregateLoaderClass _AggregateLoader
static AsciiString TheEmptyString
void set(Int i, Int val=1)
void setRenderObj(RenderObjClass *pObj)
RenderObjClass * getRenderObj(void)
BuildListInfo * getNext(void) const
void adjustWindowSize(void)
static CMainFrame * GetMainFrame()
void handleCameraChange(void)
static CWorldBuilderDoc * GetActiveDoc()
WorldHeightMapEdit * GetHeightMap()
void syncViewCenters(Real x, Real y)
static void SetForceMultiply(bool multiply)
static IDirect3DDevice8 * _Get_D3D_Device8()
static void SetCleanupHook(DX8_CleanupHook *pCleanupHook)
Int getInt(NameKeyType key, Bool *exists=NULL) const
Real getReal(NameKeyType key, Bool *exists=NULL) const
AsciiString getAsciiString(NameKeyType key, Bool *exists=NULL) const
static void setDoAmbientSoundFeedback(Bool val)
static void setDoBoundaryFeedback(Bool val)
void SetDefaultSlopeToShow(Real slopeToShow)
Real GetSlopeToShow() const
Real GetDefaultSlope() const
void Set_Diffuse(const Vector3 &color)
void Set_Ambient(const Vector3 &color)
void Set_Far_Attenuation_Range(double fStart, double fEnd)
void setRenderObj(RenderObjClass *pObj)
const Coord3D * getLocation(void) const
Get the center point.
const ThingTemplate * getThingTemplate(void) const
void setShadowObj(Shadow *pObj)
Dict * getProperties()
return the object's property sheet.
static MapObject * getFirstMapObject(void)
Bool isScorch(void) const
AsciiString getName(void) const
Gets the object name.
RenderObjClass * getRenderObj(void) const
Bool isWaypoint(void) const
MapObject * getNext(void) const
Next map object in the list. Not a copy, don't delete it.
Real getAngle(void) const
Get the angle.
Bool isSelected(void) const
AsciiString getWaypointName()
WWINLINE void Set_Translation(const Vector3 &t)
void mulVector3(const Vector3 &in, Vector3 &out) const
void Translate(float x, float y, float z)
void Rotate_Z(float theta)
WWINLINE void Make_Identity(void)
void Look_At(const Vector3 &p, const Vector3 &t, float roll)
WWINLINE void Set(float m[12])
virtual const W3DTreeDrawModuleData * getAsW3DTreeDrawModuleData() const
NameKeyType getModuleTagNameKey() const
virtual const W3DModelDrawModuleData * getAsW3DModelDrawModuleData() const
const ModuleData * getNthData(Int i) const
virtual enum FilterTypes getViewFilterType(void)
Turns on viewport special effect (black & white mode)
virtual void lookAt(const Coord3D *o)
Center the view on the given coordinate.
virtual void zoomIn(void)
Zoom in, closer to the ground, limit to min.
virtual Real getHeightAboveGround()
virtual View * prependViewToList(View *list)
Prepend this view to the given list, return the new list.
virtual void rotateCameraTowardObject(ObjectID id, Int milliseconds, Int holdMilliseconds, Real easeIn, Real easeOut)
Rotate camera about current viewpoint.
virtual void setZoom(Real z)
virtual ObjectID getCameraLock() const
set the view's current location from to the view location object
virtual void updateView(void)
Render the world visible in this view.
virtual enum FilterModes getViewFilterMode(void)
Turns on viewport special effect (black & white mode)
virtual void setMouseLock(Bool mouseLocked)
lock/unlock the mouse input to the tactical view
virtual void resetCamera(const Coord3D *location, Int frames, Real easeIn, Real easeOut)
virtual void cameraModFinalLookToward(Coord3D *pLoc)
Sets a look at point during camera movement.
virtual void initHeightForMap(void)
Center the view on the given coordinate.
virtual void cameraModFreezeTime(void)
Final pitch for current camera movement.
virtual void setHeight(Int height)
virtual void shake(const Coord3D *epicenter, CameraShakeType shakeType)
Add an impulse force to shake the camera.
virtual Bool setViewFilterMode(enum FilterModes)
Get the horizontal field of view angle.
virtual void setOkToAdjustHeight(Bool val)
Set this to adjust camera height.
virtual void setWidth(Int width)
virtual Int getWidth(void)
virtual Real getFXPitch(void) const
returns the FX pitch angle
virtual void setLocation(const ViewLocation *location)
write the view's current location in to the view location object
virtual Real getCurrentHeightAboveGround()
virtual void zoomCamera(Real finalZoom, Int milliseconds, Real easeIn, Real easeOut)
virtual void cameraModFreezeAngle(void)
Freezes time during the next camera movement.
virtual void getScreenCornerWorldPointsAtZ(Coord3D *topLeft, Coord3D *topRight, Coord3D *bottomLeft, Coord3D *bottomRight, Real z)
transform screen point to world point at the specified world Z value
virtual WorldToScreenReturn worldToScreenTriReturn(const Coord3D *w, ICoord2D *s)
Like worldToScreen(), but with a more informative return value.
virtual Drawable * pickDrawable(const ICoord2D *screen, Bool forceAttack, PickType pickType)
pick drawable given the screen pixel coords. If force attack, picks bridges as well.
virtual void rotateCamera(Real rotations, Int frames, Real easeIn, Real easeOut)
Move camera to location, and reset to default angle & zoom.
virtual Real getPitch(void)
Rotate the view around the horizontal axis to the given angle.
virtual void screenToWorldAtZ(const ICoord2D *s, Coord3D *w, Real z)
transform screen coord to a point on the 3D terrain
virtual Int getTimeMultiplier(void)
virtual void setZoomToDefault(void)
Set zoom to default value.
virtual void cameraModFinalZoom(Real finalZoom, Real easeIn, Real easeOut)
Rotate camera to face an object, and hold on it.
virtual void getOrigin(Int *x, Int *y)
Return location of top-left view corner on display.
virtual void setSnapMode(CameraLockType lockType, Real lockDist)
virtual Bool isZoomLimited(void)
get status of zoom limit
virtual void screenToTerrain(const ICoord2D *screen, Coord3D *world)
Transform screen coordinate "s" into world coordinate "w".
virtual void setPitch(Real angle)
Rotate the view around the horizontal axis to the given angle.
virtual void drawView(void)
Render the world visible in this view.
virtual Bool isMouseLocked(void)
is the mouse input locked to the tactical view?
virtual void cameraModFinalTimeMultiplier(Int finalMultiplier)
Number of frames to average movement for current camera movement.
virtual void setZoomLimited(Bool limit)
Render the world visible in this view.
virtual void setFieldOfView(Real angle)
Set the horizontal field of view angle.
virtual Int iterateDrawablesInRegion(IRegion2D *screenRegion, Bool(*callback)(Drawable *draw, void *userData), void *userData)
pick drawable given the screen pixel coords
virtual void zoomOut(void)
Zoom out, farther away from the ground, limit to max.
virtual void scrollBy(Coord2D *delta)
Init the camera height for the map at the current position.
virtual void setViewFilterPos(const Coord3D *pos)
virtual void setCurrentHeightAboveGround(Real z)
virtual void setCameraLockDrawable(Drawable *drawable)
virtual const Coord3D & get3DCameraPosition() const
Rotate camera to face an object, and hold on it.
virtual void setOrigin(Int x, Int y)
Sets location of top-left view corner on display.
virtual Real getAngle(void)
Rotate the view around the up axis to the given angle.
virtual void screenToWorld(const ICoord2D *s, Coord3D *w)
Transform world coordinate "w" into screen coordinate "s".
virtual Real getFieldOfView(void)
Set the horizontal field of view angle.
Int m_height
Dimensions of the view.
virtual void setCameraLock(ObjectID id)
virtual void getPosition(Coord3D *pos)
Set the view angle back to default.
virtual void setHeightAboveGround(Real z)
virtual void rotateCameraTowardPosition(const Coord3D *pLoc, Int milliseconds, Real easeIn, Real easeOut, Bool reverseRotation)
Rotate camera to face an object, and hold on it.
virtual void setDefaultView(Real pitch, Real angle, Real maxHeight)
Set the time multiplier.
virtual Real getTerrainHeightUnderCamera()
virtual void cameraModRollingAverage(Int framesToAverage)
Final zoom for current camera movement.
virtual void forceCameraConstraintRecalc(void)
virtual void set3DWireFrameMode(Bool enable)
stub
virtual Bool setViewFilter(enum FilterTypes m_viewFilterMode)
stub
virtual void cameraModFinalPitch(Real finalPitch, Real easeIn, Real easeOut)
Final time multiplier for current camera movement.
virtual Drawable * getCameraLockDrawable() const
virtual View * getNextView(void)
Prepend this view to the given list, return the new list.
virtual void setFadeParameters(Int fadeFrames, Int direction)
stub
virtual void forceRedraw()
virtual void pitchCamera(Real finalPitch, Int milliseconds, Real easeIn, Real easeOut)
virtual Int getHeight(void)
virtual Bool isTimeFrozen(void)
Sets a final move to.
virtual void setTerrainHeightUnderCamera(Real z)
virtual void setAngleAndPitchToDefault(void)
Set the view angle back to default.
Int m_originY
Location of top/left view corner.
virtual Bool isCameraMovementFinished(void)
virtual void snapToCameraLock(void)
virtual void getLocation(ViewLocation *location)
write the view's current location in to the view location object
virtual void setAngle(Real angle)
Rotate the view around the up axis to the given angle.
virtual void cameraModFinalMoveTo(Coord3D *pLoc)
virtual void cameraModLookToward(Coord3D *pLoc)
Sets a look at point during camera movement.
virtual void setGuardBandBias(const Coord2D *gb)
virtual void setTimeMultiplier(Int multiple)
Get the time multiplier.
virtual void moveCameraTo(const Coord3D *o, Int frames, Int shutter, Bool orient, Real easeIn, Real easeOut)
Shift the view by the given delta.
virtual UnsignedInt getID(void)
virtual Real getMaxZoom(void)
return max zoom value
virtual void moveCameraAlongWaypointPath(Waypoint *way, Int frames, Int shutter, Bool orient, Real easeIn, Real easeOut)
const RGBColor * getPreferredColor() const
RTS3DScene()
RTSScene constructor.
WWINLINE void Release_Ref(void) const
virtual void Set_Transform(const Matrix3D &m)
virtual void Get_Obj_Space_Bounding_Sphere(SphereClass &sphere) const
virtual void Set_Position(const Vector3 &v)
virtual void Remove_Render_Object(RenderObjClass *obj)
virtual void Next(void)=0
virtual RenderObjClass * Current_Item(void)=0
virtual void First(void)=0
virtual bool Is_Done(void)=0
BuildListInfo * getBuildList(void)
Gets the build list.
virtual void Destroy_Iterator(SceneIterator *it)
virtual SceneIterator * Create_Iterator(bool onlyvisible=false)
RefRenderObjListClass RenderList
void Set_Material_Pass(MaterialPassClass *pass)
Bool safeContains(RenderObjClass *obj)
MaterialPassClass * m_testPass
~SkeletonSceneClass(void)
virtual void Remove_Render_Object(RenderObjClass *obj)
Real getShadowOffsetY() const
Real getAssetScale() const
return uniform scaling
const ModuleInfo & getDrawModuleInfo() const
Bool isKindOf(KindOfType t) const
return true iff the template has the specified kindOf flag set.
Real getShadowSizeY() const
ShadowType getShadowType() const
const AsciiString & getName() const
return the name of this template
const AsciiString & getShadowTextureName(void) const
Real getShadowSizeX() const
Real getShadowOffsetX() const
static WWINLINE float Find_Y_At_Z(float z, const Vector3 &p1, const Vector3 &p2)
WWINLINE float Length(void) const
static WWINLINE float Find_X_At_Z(float z, const Vector3 &p1, const Vector3 &p2)
WWINLINE void Set(float x, float y, float z)
CameraShakeType
Add an impulse force to shake the camera.
AsciiString getBestModelNameForWB(const ModelConditionFlags &c) const
static void shutdown(void)
release resources used by shaders
static void init(void)
determine optimal shaders for current device.
virtual Real getHeightMapHeight(Real x, Real y, Coord3D *normal)
return height and normal at given point
virtual RenderObjClass * Create_Render_Obj(const char *name)
static WW3DAssetManager * Get_Instance(void)
virtual void Register_Prototype_Loader(PrototypeLoaderClass *loader)
static WW3DErrorType Render(const LayerListClass &layerlist)
static WW3DErrorType Set_Render_Device(int dev=-1, int resx=-1, int resy=-1, int bits=-1, int windowed=-1, bool resize_window=false, bool reset_device=false, bool restore_assets=true)
static WW3DErrorType Init(void *hwnd, char *defaultpal=NULL, bool lite=false)
static WW3DErrorType Set_Device_Resolution(int w=-1, int h=-1, int bits=-1, int windowed=-1, bool resize_window=false)
static WW3DErrorType Begin_Render(bool clear=false, bool clearz=true, const Vector3 &color=Vector3(0, 0, 0), float dest_alpha=0.0f, void(*network_callback)(void)=NULL)
static WW3DErrorType Shutdown(void)
static void Set_Thumbnail_Enabled(bool b)
static void Get_Device_Resolution(int &set_w, int &set_h, int &get_bits, bool &get_windowed)
@ PRELIT_MODE_LIGHTMAP_MULTI_PASS
static void Sync(unsigned int sync_time)
static WW3DErrorType End_Render(bool flip_frame=true)
static void Set_Screen_UV_Bias(bool onoff)
static void Enable_Static_Sort_Lists(bool onoff)
static void Set_Collision_Box_Display_Mask(int mask)
static void Set_Prelit_Mode(PrelitModeEnum mode)
static void Shutdown(void)
afx_msg void OnUpdateShowLetterbox(CCmdUI *pCmdUI)
afx_msg void OnViewBoundingBoxes()
afx_msg void OnUpdateViewShowwireframe(CCmdUI *pCmdUI)
AsciiString getBestModelName(const ThingTemplate *tt, const ModelConditionFlags &c)
afx_msg void OnViewShowmacrotexture()
afx_msg void OnUpdateViewPartialmapsize192x192(CCmdUI *pCmdUI)
void invalBuildListItemInView(BuildListInfo *pBuild)
Invalidates an build list object.
void setLighting(const GlobalData::TerrainLighting *tl, Int whichLighting, Int whichLight=0)
afx_msg void OnViewShowMapBoundaries()
void resetRenderObjects()
Removes all render objects. Call when swithing to a new map.
virtual BuildListInfo * pickedBuildObjectInView(CPoint viewPt)
void setShowBoundingBoxes(Bool toggle)
virtual Bool docToViewCoords(Coord3D curPt, CPoint *newPt)
afx_msg void OnUpdateViewGarrisoned(CCmdUI *pCmdUI)
afx_msg void OnUpdateViewShowclouds(CCmdUI *pCmdUI)
afx_msg void OnViewShowtopdownview()
void setObjTracking(MapObject *pMapObj, Coord3D pos, Real angle, Bool show)
afx_msg void OnUpdateViewShowmacrotexture(CCmdUI *pCmdUI)
afx_msg void OnViewShowentire3dmap()
afx_msg void OnShowWindow(BOOL bShow, UINT nStatus)
afx_msg void OnViewPartialmapsize160x160()
afx_msg void OnImpassableAreaOptions()
virtual void rotateCamera(Real delta)
afx_msg void OnViewShowModels()
afx_msg void OnUpdateViewPartialmapsize128x128(CCmdUI *pCmdUI)
void drawCircle(HDC hdc, const Coord3D ¢erPoint, Real radius, COLORREF color)
Draw a (not very good) circle into the hdc.
void setShowSightRanges(Bool toggle)
afx_msg void OnSize(UINT nType, int cx, int cy)
afx_msg void OnShowLetterbox()
afx_msg void OnUpdateViewPartialmapsize160x160(CCmdUI *pCmdUI)
afx_msg void OnEditSelectmacrotexture()
afx_msg void OnUpdateHighlightTestArt(CCmdUI *pCmdUI)
afx_msg void OnUpdateViewSightRanges(CCmdUI *pCmdUI)
AsciiString getModelNameAndScale(MapObject *pMapObj, Real *scale, BodyDamageType curDamageState)
Real getCurrentZoom(void)
afx_msg void OnViewShowSoftWater()
Bool getShowBoundingBoxes(void)
afx_msg void OnUpdateViewShowtopdownview(CCmdUI *pCmdUI)
virtual void pitchCamera(Real delta)
afx_msg void OnUpdateViewShowModels(CCmdUI *pCmdUI)
afx_msg void OnViewSightRanges()
afx_msg void OnHighlightTestArt()
virtual void ReAcquireResources(void)
Reacquire all resources after device reset.
afx_msg void OnViewExtraBlends()
afx_msg void OnViewShowAmbientSounds()
afx_msg void OnViewShowSoundCircles()
afx_msg void OnUpdateViewShowSoundCircles(CCmdUI *pCmdUI)
void updateFenceListObjects(MapObject *pObject)
afx_msg void OnUpdateViewShowimpassableareas(CCmdUI *pCmdUI)
virtual void setDefaultCamera()
void reset3dEngineDisplaySize(Int width, Int height)
Closes & reinitializes w3d.
Bool getHighlightTestArt(void)
afx_msg void OnViewShowclouds()
afx_msg void OnUpdateViewLayersList(CCmdUI *pCmdUI)
afx_msg void OnUpdateViewShowSoftWater(CCmdUI *pCmdUI)
afx_msg void OnViewShowwireframe()
void setHighlightTestArt(Bool toggle)
void setShowLetterbox(Bool toggle)
void setShowWeaponRanges(Bool toggle)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct)
virtual Bool viewToDocCoords(CPoint curPt, Coord3D *newPt, Bool constrain=true)
virtual void updateHeightMapInView(WorldHeightMap *htMap, Bool partial, const IRegion2D &partialRange)
Update the height map in the 3d window.
void removeFenceListObjects(MapObject *pObject)
virtual void invalidateCellInView(int xIndex, int yIndex)
Invalidates the area of one height map cell in the 2d view.
afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt)
afx_msg void OnEditShadows()
Bool getShowSightRanges(void)
virtual MapObject * picked3dObjectInView(CPoint viewPt)
virtual Bool viewToDocCoordZ(CPoint curPt, Coord3D *newPt, Real Z)
Bool getShowWeaponRanges(void)
afx_msg void OnViewPartialmapsize128x128()
afx_msg BOOL OnEraseBkgnd(CDC *pDC)
afx_msg void OnViewShowshadows()
virtual void invalObjectInView(MapObject *pObj)
Invalidates an object. Pass NULL to inval all objects.
afx_msg void OnViewShowimpassableareas()
virtual void ReleaseResources(void)
Release all dx8 resources so the device can be reset.
Real getCameraPitch(void)
afx_msg void OnUpdateViewWeaponRanges(CCmdUI *pCmdUI)
afx_msg void OnUpdateViewShowshadows(CCmdUI *pCmdUI)
Bool getShowLetterbox(void)
afx_msg void OnViewLayersList()
afx_msg void OnViewPartialmapsize96x96()
afx_msg void OnUpdateViewPartialmapsize96x96(CCmdUI *pCmdUI)
virtual void OnDraw(CDC *pDC)
void setCameraPitch(Real absolutePitch)
virtual void setCenterInView(Real x, Real y)
Set the center for display.
afx_msg void OnViewWeaponRanges()
afx_msg void OnUpdateViewShowMapBoundaries(CCmdUI *pCmdUI)
afx_msg void OnTimer(UINT nIDEvent)
afx_msg void OnViewGarrisoned()
afx_msg void OnEditMapSettings()
afx_msg void OnViewPartialmapsize192x192()
afx_msg void OnUpdateViewShowExtraBlends(CCmdUI *pCmdUI)
afx_msg void OnUpdateViewShowentire3dmap(CCmdUI *pCmdUI)
void updateHysteresis(void)
afx_msg void OnUpdateViewShowAmbientSounds(CCmdUI *pCmdUI)
virtual void scrollInView(Real x, Real y, Bool end)
Scrolls the window by this amount.
afx_msg void OnUpdateViewBoundingBoxes(CCmdUI *pCmdUI)
afx_msg int OnCreate(LPCREATESTRUCT lpcs)
Bool m_showObjects
Flag whether object icons are drawn in the 2d and 3d view.
CWorldBuilderDoc * WbDoc()
void setShowGarrisoned(Bool show)
Bool getShowGarrisoned(void)
Coord3D m_lightDirection[3]
void setShowModels(Bool show)
Bool m_doLockAngle
True if we are currently locking.
Bool isNamesVisible(void)
Coord3D m_mouseDownDocPoint
TTrackingMode m_trackingMode
Bool m_showPolygonTriggers
Bool m_showTerrain
Flag whether terrain is rendered or not. (Useful for debugging)
void setDrawWidth(Int width)
Int getXExtent(void)
number of vertices in x
Bool setDrawOrg(Int xOrg, Int yOrg)
void setDrawHeight(Int height)
Int getYExtent(void)
number of vertices in y
DX8MeshRendererClass TheDX8MeshRenderer
ParticleEmitterLoaderClass _ParticleEmitterLoader
#define REF_PTR_RELEASE(x)
#define REF_PTR_SET(dst, src)
RefMultiListIterator< RenderObjClass > RefRenderObjListIterator
PlaceholderView bogusTacticalView
PrintFunc WWDebug_Install_Message_Handler(PrintFunc func)
AssertPrintFunc WWDebug_Install_Assert_Handler(AssertPrintFunc func)