mirror of
https://github.com/electronicarts/CnC_Renegade.git
synced 2026-02-03 23:43:56 -05:00
Initial commit of Command & Conquer Renegade source code.
This commit is contained in:
400
Code/ww3d2/hueshift/enbassetmgr.cpp
Normal file
400
Code/ww3d2/hueshift/enbassetmgr.cpp
Normal file
@@ -0,0 +1,400 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/***********************************************************************************************
|
||||
*** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
|
||||
***********************************************************************************************
|
||||
* *
|
||||
* Project Name : ENBAssetMgr *
|
||||
* *
|
||||
* $Archive:: /VSS_Sync/ww3d2/hueshift/enbassetmgr.cpp $*
|
||||
* *
|
||||
* Original Author:: Hector Yee *
|
||||
* *
|
||||
* $Author:: Vss_sync $*
|
||||
* *
|
||||
* $Modtime:: 8/29/01 10:35p $*
|
||||
* *
|
||||
* $Revision:: 1 $*
|
||||
* *
|
||||
*---------------------------------------------------------------------------------------------*
|
||||
* Functions: *
|
||||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
#include "always.h"
|
||||
#include "enbassetmgr.h"
|
||||
#include "proto.h"
|
||||
#include "rendobj.h"
|
||||
#include "vector3.h"
|
||||
#include "mesh.h"
|
||||
#include "hlod.h"
|
||||
#include "matinfo.h"
|
||||
#include "meshmdl.h"
|
||||
#include "part_emt.h"
|
||||
#include "vertmaterial.h"
|
||||
#include "dx8wrapper.h"
|
||||
#include "texture.h"
|
||||
#include "surfaceclass.h"
|
||||
#include "textureloader.h"
|
||||
#include "ww3dformat.h"
|
||||
#include "colorspace.h"
|
||||
#include <stdio.h>
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// Constants
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
const float ident_scale(1.0f);
|
||||
const Vector3 ident_HSV(0,0,0);
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// ENBPrototype
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
class ENBPrototypeClass : public PrototypeClass
|
||||
{
|
||||
public:
|
||||
ENBPrototypeClass(RenderObjClass * proto,const char* name);
|
||||
virtual ~ENBPrototypeClass(void);
|
||||
|
||||
virtual const char * Get_Name(void) const;
|
||||
virtual int Get_Class_ID(void) const;
|
||||
virtual RenderObjClass * Create(void);
|
||||
RenderObjClass * Proto;
|
||||
char * Name;
|
||||
};
|
||||
|
||||
ENBPrototypeClass::ENBPrototypeClass(RenderObjClass * proto, const char *name)
|
||||
{
|
||||
Name=strdup(name);
|
||||
Proto = proto;
|
||||
assert(Proto);
|
||||
Proto->Add_Ref();
|
||||
}
|
||||
|
||||
ENBPrototypeClass::~ENBPrototypeClass(void)
|
||||
{
|
||||
delete [] Name;
|
||||
if (Proto) {
|
||||
Proto->Release_Ref();
|
||||
}
|
||||
}
|
||||
|
||||
const char * ENBPrototypeClass::Get_Name(void) const
|
||||
{
|
||||
return Name;
|
||||
}
|
||||
|
||||
int ENBPrototypeClass::Get_Class_ID(void) const
|
||||
{
|
||||
return Proto->Class_ID();
|
||||
}
|
||||
|
||||
RenderObjClass * ENBPrototypeClass::Create(void)
|
||||
{
|
||||
return (RenderObjClass *)( SET_REF_OWNER( Proto->Clone() ) );
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// ENBAssetManager
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
ENBAssetManager::ENBAssetManager(void)
|
||||
{
|
||||
}
|
||||
|
||||
ENBAssetManager::~ENBAssetManager(void)
|
||||
{
|
||||
}
|
||||
|
||||
RenderObjClass * ENBAssetManager::Create_Render_Obj(const char * name,float Scale,Vector3 &HSV_shift)
|
||||
{
|
||||
char newname[512];
|
||||
bool scale,hsv_shift;
|
||||
scale=(Scale!=ident_scale);
|
||||
hsv_shift=(HSV_shift!=ident_HSV);
|
||||
|
||||
// base case, no scale or hue shifting
|
||||
if (!scale && !hsv_shift) return WW3DAssetManager::Create_Render_Obj(name);
|
||||
|
||||
sprintf(newname,"#%s!%gH%gS%gV%g",name,Scale,HSV_shift.X,HSV_shift.Y,HSV_shift.Z);
|
||||
|
||||
// see if we got a cached version
|
||||
RenderObjClass *rendobj=NULL;
|
||||
rendobj=WW3DAssetManager::Create_Render_Obj(newname);
|
||||
if (rendobj) return rendobj;
|
||||
|
||||
// create a new one based on
|
||||
// exisiting prototype
|
||||
rendobj=WW3DAssetManager::Create_Render_Obj(name);
|
||||
if (!rendobj) return NULL;
|
||||
|
||||
Make_Unique(rendobj,scale,hsv_shift);
|
||||
if (scale) rendobj->Scale(Scale);
|
||||
if (hsv_shift) Recolor_Asset(rendobj,HSV_shift);
|
||||
|
||||
ENBPrototypeClass *proto=new ENBPrototypeClass(rendobj,newname);
|
||||
Add_Prototype(proto);
|
||||
|
||||
return rendobj;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// Uniqing
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
void ENBAssetManager::Make_Mesh_Unique(RenderObjClass *robj,bool geometry, bool colors)
|
||||
{
|
||||
int i;
|
||||
MeshClass *mesh=(MeshClass*) robj;
|
||||
mesh->Make_Unique();
|
||||
MeshModelClass * model = mesh->Get_Model();
|
||||
|
||||
if (colors) {
|
||||
// make all vertex materials unique
|
||||
MaterialInfoClass *material = mesh->Get_Material_Info();
|
||||
for (i=0; i<material->Vertex_Material_Count(); i++)
|
||||
material->Peek_Vertex_Material(i)->Make_Unique();
|
||||
REF_PTR_RELEASE(material);
|
||||
// make all color arrays unique
|
||||
model->Make_Color_Array_Unique(0);
|
||||
model->Make_Color_Array_Unique(1);
|
||||
// do not do textures yet
|
||||
// because we want to do the color conversion
|
||||
// for the top mip level and then
|
||||
// mip filter instead of converting all mip levels
|
||||
}
|
||||
|
||||
if (geometry) {
|
||||
// make geometry unique
|
||||
model->Make_Geometry_Unique();
|
||||
}
|
||||
|
||||
REF_PTR_RELEASE(model);
|
||||
}
|
||||
|
||||
void ENBAssetManager::Make_HLOD_Unique(RenderObjClass *robj,bool geometry, bool colors)
|
||||
{
|
||||
int num_sub = robj->Get_Num_Sub_Objects();
|
||||
for(int i = 0; i < num_sub; i++) {
|
||||
RenderObjClass *sub_obj = robj->Get_Sub_Object(i);
|
||||
Make_Unique(sub_obj,geometry,colors);
|
||||
REF_PTR_RELEASE(sub_obj);
|
||||
}
|
||||
}
|
||||
|
||||
void ENBAssetManager::Make_Unique(RenderObjClass *robj,bool geometry, bool colors)
|
||||
{
|
||||
switch (robj->Class_ID()) {
|
||||
case RenderObjClass::CLASSID_MESH:
|
||||
Make_Mesh_Unique(robj,geometry,colors);
|
||||
break;
|
||||
case RenderObjClass::CLASSID_HLOD:
|
||||
Make_HLOD_Unique(robj,geometry,colors);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// Coloring
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
void ENBAssetManager::Recolor_Vertex_Material(VertexMaterialClass *vmat,Vector3 &hsv_shift)
|
||||
{
|
||||
Vector3 rgb;
|
||||
|
||||
vmat->Get_Ambient(&rgb);
|
||||
Recolor(rgb,hsv_shift);
|
||||
vmat->Set_Ambient(rgb);
|
||||
|
||||
vmat->Get_Diffuse(&rgb);
|
||||
Recolor(rgb,hsv_shift);
|
||||
vmat->Set_Diffuse(rgb);
|
||||
|
||||
vmat->Get_Emissive(&rgb);
|
||||
Recolor(rgb,hsv_shift);
|
||||
vmat->Set_Emissive(rgb);
|
||||
|
||||
vmat->Get_Specular(&rgb);
|
||||
Recolor(rgb,hsv_shift);
|
||||
vmat->Set_Specular(rgb);
|
||||
}
|
||||
|
||||
void ENBAssetManager::Recolor_Vertices(unsigned int *color, int count, Vector3 &hsv_shift)
|
||||
{
|
||||
int i;
|
||||
Vector4 rgba;
|
||||
|
||||
for (i=0; i<count; i++)
|
||||
{
|
||||
rgba=DX8Wrapper::Convert_Color(color[i]);
|
||||
Recolor(reinterpret_cast<Vector3&>(rgba),hsv_shift);
|
||||
color[i]=DX8Wrapper::Convert_Color_Clamp(rgba);
|
||||
}
|
||||
}
|
||||
|
||||
TextureClass * ENBAssetManager::Recolor_Texture(TextureClass *texture, Vector3 &hsv_shift)
|
||||
{
|
||||
const char *name=texture->Get_Name();
|
||||
|
||||
// if texture is procedural return NULL
|
||||
if (name && name[0]=='!') return NULL;
|
||||
|
||||
// make sure texture is loaded
|
||||
if (!texture->Is_Initialized())
|
||||
TextureLoader::Request_High_Priority_Loading(texture,0,(TextureClass::MipCountType) texture->Get_Mip_Level_Count());
|
||||
|
||||
SurfaceClass::SurfaceDescription desc;
|
||||
SurfaceClass *newsurf, *oldsurf, *smallsurf;
|
||||
texture->Get_Level_Description(desc);
|
||||
|
||||
// if texture is monochrome and no value shifting
|
||||
// return NULL
|
||||
smallsurf=texture->Get_Surface_Level((TextureClass::MipCountType)texture->Get_Mip_Level_Count()-1);
|
||||
if (hsv_shift.Z==0.0f && smallsurf->Is_Monochrome())
|
||||
{
|
||||
REF_PTR_RELEASE(smallsurf);
|
||||
return NULL;
|
||||
}
|
||||
REF_PTR_RELEASE(smallsurf);
|
||||
|
||||
oldsurf=texture->Get_Surface_Level();
|
||||
|
||||
// see if we have a cached copy
|
||||
char newname[512];
|
||||
StringClass lower_case_name(texture->Get_Name(),true);
|
||||
_strlwr(lower_case_name.Peek_Buffer());
|
||||
sprintf(newname,"#%s!H%gS%gV%g",lower_case_name,hsv_shift.X,hsv_shift.Y,hsv_shift.Z);
|
||||
TextureClass* newtex = TextureHash.Get(newname);
|
||||
if (newtex)
|
||||
{
|
||||
newtex->Add_Ref();
|
||||
REF_PTR_RELEASE(oldsurf);
|
||||
return newtex;
|
||||
}
|
||||
|
||||
// no cached copy, make new recolorized texture
|
||||
newsurf=NEW_REF(SurfaceClass,(desc.Width,desc.Height,desc.Format));
|
||||
newsurf->Copy(0,0,0,0,desc.Width,desc.Height,oldsurf);
|
||||
newsurf->Hue_Shift(hsv_shift);
|
||||
newtex=NEW_REF(TextureClass,(newsurf,(TextureClass::MipCountType)texture->Get_Mip_Level_Count()));
|
||||
newtex->Set_Mag_Filter(texture->Get_Mag_Filter());
|
||||
newtex->Set_Min_Filter(texture->Get_Min_Filter());
|
||||
newtex->Set_Mip_Mapping(texture->Get_Mip_Mapping());
|
||||
newtex->Set_Name(newname);
|
||||
newtex->Set_U_Addr_Mode(texture->Get_U_Addr_Mode());
|
||||
newtex->Set_V_Addr_Mode(texture->Get_V_Addr_Mode());
|
||||
|
||||
TextureHash.Insert(newname,newtex);
|
||||
newtex->Add_Ref();
|
||||
|
||||
REF_PTR_RELEASE(oldsurf);
|
||||
REF_PTR_RELEASE(newsurf);
|
||||
|
||||
return newtex;
|
||||
}
|
||||
|
||||
void ENBAssetManager::Recolor_Mesh(RenderObjClass *robj,Vector3 &hsv_shift)
|
||||
{
|
||||
int i;
|
||||
|
||||
MeshClass *mesh=(MeshClass*) robj;
|
||||
MeshModelClass * model = mesh->Get_Model();
|
||||
MaterialInfoClass *material = mesh->Get_Material_Info();
|
||||
|
||||
// recolor vertex material
|
||||
for (i=0; i<material->Vertex_Material_Count(); i++)
|
||||
Recolor_Vertex_Material(material->Peek_Vertex_Material(i),hsv_shift);
|
||||
|
||||
// recolor color arrays
|
||||
unsigned int * color;
|
||||
color=model->Get_Color_Array(0,false);
|
||||
if (color) Recolor_Vertices(color,model->Get_Vertex_Count(),hsv_shift);
|
||||
color=model->Get_Color_Array(1,false);
|
||||
if (color) Recolor_Vertices(color,model->Get_Vertex_Count(),hsv_shift);
|
||||
|
||||
// recolor textures
|
||||
|
||||
TextureClass *newtex,*oldtex;
|
||||
for (i=0; i<material->Texture_Count(); i++)
|
||||
{
|
||||
oldtex=material->Peek_Texture(i);
|
||||
newtex=Recolor_Texture(oldtex,hsv_shift);
|
||||
if (newtex)
|
||||
{
|
||||
model->Replace_Texture(oldtex,newtex);
|
||||
material->Replace_Texture(i,newtex);
|
||||
REF_PTR_RELEASE(newtex);
|
||||
}
|
||||
}
|
||||
|
||||
REF_PTR_RELEASE(material);
|
||||
REF_PTR_RELEASE(model);
|
||||
}
|
||||
|
||||
void ENBAssetManager::Recolor_HLOD(RenderObjClass *robj,Vector3 &hsv_shift)
|
||||
{
|
||||
int num_sub = robj->Get_Num_Sub_Objects();
|
||||
for(int i = 0; i < num_sub; i++) {
|
||||
RenderObjClass *sub_obj = robj->Get_Sub_Object(i);
|
||||
Recolor_Asset(sub_obj,hsv_shift);
|
||||
REF_PTR_RELEASE(sub_obj);
|
||||
}
|
||||
}
|
||||
|
||||
void ENBAssetManager::Recolor_ParticleEmitter(RenderObjClass *robj,Vector3 &hsv_shift)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
ParticleEmitterClass* emit=(ParticleEmitterClass*) robj;
|
||||
ParticlePropertyStruct<Vector3> colors;
|
||||
|
||||
emit->Get_Color_Key_Frames(colors);
|
||||
Recolor(colors.Start,hsv_shift);
|
||||
Recolor(colors.Rand,hsv_shift);
|
||||
for (i=0; i<colors.NumKeyFrames; i++)
|
||||
Recolor(colors.Values[i],hsv_shift);
|
||||
emit->Reset_Colors(colors);
|
||||
|
||||
delete colors.Values;
|
||||
delete colors.KeyTimes;
|
||||
|
||||
TextureClass *tex=emit->Get_Texture();
|
||||
TextureClass *newtex=Recolor_Texture(tex,hsv_shift);
|
||||
if (newtex)
|
||||
{
|
||||
emit->Set_Texture(newtex);
|
||||
REF_PTR_RELEASE(newtex);
|
||||
}
|
||||
REF_PTR_RELEASE(tex);
|
||||
}
|
||||
|
||||
void ENBAssetManager::Recolor_Asset(RenderObjClass *robj,Vector3 &hsv_shift)
|
||||
{
|
||||
switch (robj->Class_ID()) {
|
||||
case RenderObjClass::CLASSID_MESH:
|
||||
Recolor_Mesh(robj,hsv_shift);
|
||||
break;
|
||||
case RenderObjClass::CLASSID_HLOD:
|
||||
Recolor_HLOD(robj,hsv_shift);
|
||||
break;
|
||||
case RenderObjClass::CLASSID_PARTICLEEMITTER:
|
||||
Recolor_ParticleEmitter(robj,hsv_shift);
|
||||
break;
|
||||
}
|
||||
}
|
||||
74
Code/ww3d2/hueshift/enbassetmgr.h
Normal file
74
Code/ww3d2/hueshift/enbassetmgr.h
Normal file
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/***********************************************************************************************
|
||||
*** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
|
||||
***********************************************************************************************
|
||||
* *
|
||||
* Project Name : ENBAssetMgr *
|
||||
* *
|
||||
* $Archive:: /VSS_Sync/ww3d2/hueshift/enbassetmgr.h $*
|
||||
* *
|
||||
* Original Author:: Hector Yee *
|
||||
* *
|
||||
* $Author:: Vss_sync $*
|
||||
* *
|
||||
* $Modtime:: 8/29/01 10:35p $*
|
||||
* *
|
||||
* $Revision:: 1 $*
|
||||
* *
|
||||
*---------------------------------------------------------------------------------------------*
|
||||
* Functions: *
|
||||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#ifndef ENBASSETMGR_H
|
||||
#define ENBASSETMGR_H
|
||||
|
||||
#include <assetmgr.h>
|
||||
|
||||
class Vector3;
|
||||
class VertexMaterialClass;
|
||||
|
||||
class ENBAssetManager: public WW3DAssetManager
|
||||
{
|
||||
public:
|
||||
ENBAssetManager(void);
|
||||
virtual ~ENBAssetManager(void);
|
||||
|
||||
// unique to ENBAssetManager
|
||||
virtual RenderObjClass * Create_Render_Obj(const char * name,float Scale,Vector3 &HSV_shift);
|
||||
|
||||
private:
|
||||
void Make_Mesh_Unique(RenderObjClass *robj,bool geometry, bool colors);
|
||||
void Make_HLOD_Unique(RenderObjClass *robj,bool geometry, bool colors);
|
||||
void Make_Unique(RenderObjClass *robj,bool geometry, bool colors);
|
||||
void Recolor_Vertex_Material(VertexMaterialClass *vmat,Vector3 &hsv_shift);
|
||||
void Recolor_Vertices(unsigned int *color, int count, Vector3 &hsv_shift);
|
||||
void Recolor_Mesh(RenderObjClass *robj,Vector3 &hsv_shift);
|
||||
TextureClass * Recolor_Texture(TextureClass *texture, Vector3 &hsv_shift);
|
||||
void Recolor_HLOD(RenderObjClass *robj,Vector3 &hsv_shift);
|
||||
void Recolor_ParticleEmitter(RenderObjClass *robj,Vector3 &hsv_shift);
|
||||
void Recolor_Asset(RenderObjClass *robj,Vector3 &hsv_shift);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
678
Code/ww3d2/hueshift/hueshift.cpp
Normal file
678
Code/ww3d2/hueshift/hueshift.cpp
Normal file
@@ -0,0 +1,678 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
//
|
||||
// skeleton.cpp : Defines the entry point for the application.
|
||||
//
|
||||
// Skeleton WW3D code, Hector Yee, 8/31/00
|
||||
|
||||
#include "resource.h"
|
||||
#include "wwmath.h"
|
||||
#include "ww3d.h"
|
||||
#include "scene.h"
|
||||
#include "rendobj.h"
|
||||
#include "camera.h"
|
||||
#include "enbassetmgr.H"
|
||||
#include "msgloop.h"
|
||||
#include "part_ldr.h"
|
||||
#include "rendobj.h"
|
||||
#include "hanim.h"
|
||||
#include "dx8wrapper.h"
|
||||
#include "dx8indexbuffer.h"
|
||||
#include "dx8vertexbuffer.h"
|
||||
#include "dx8fvf.h"
|
||||
#include "vertmaterial.h"
|
||||
#include "font3d.h"
|
||||
#include "render2d.h"
|
||||
#include "textdraw.h"
|
||||
#include "rect.h"
|
||||
#include "mesh.h"
|
||||
#include "meshmdl.h"
|
||||
#include "vector2i.h"
|
||||
#include "bmp2d.h"
|
||||
#include "decalsys.h"
|
||||
#include "shattersystem.h"
|
||||
#include "light.h"
|
||||
#include "keyboard.h"
|
||||
#include "wwmouse.h"
|
||||
#include "predlod.h"
|
||||
#include "sphere.h"
|
||||
#include <stdio.h>
|
||||
#include "dx8renderer.h"
|
||||
#include "ini.h"
|
||||
|
||||
#define MAX_LOADSTRING 100
|
||||
|
||||
static void Log_Statistics();
|
||||
static void Init_3D_Scene();
|
||||
|
||||
// Global Variables:
|
||||
HINSTANCE hInst; // current instance
|
||||
TCHAR szTitle[MAX_LOADSTRING]; // The title bar text
|
||||
TCHAR szWindowClass[MAX_LOADSTRING]; // The title bar text
|
||||
WW3DAssetManager * AssetManager=NULL;
|
||||
SimpleSceneClass * my_scene = NULL;
|
||||
CameraClass * my_camera = NULL;
|
||||
Render2DTextClass * mytext = NULL;
|
||||
RenderObjClass * orig_object = NULL;
|
||||
RenderObjClass * shift_object = NULL;
|
||||
HAnimClass * my_anim = NULL;
|
||||
Font3DInstanceClass *my_font_a=NULL;
|
||||
Font3DInstanceClass *my_font_b=NULL;
|
||||
|
||||
DecalSystemClass TheDecalSystem;
|
||||
bool running=true;
|
||||
bool rotate=false;
|
||||
bool staticsort=true;
|
||||
bool sort=true;
|
||||
float sep;
|
||||
|
||||
// Foward declarations of functions included in this code module:
|
||||
ATOM MyRegisterClass(HINSTANCE hInstance);
|
||||
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
|
||||
LRESULT CALLBACK About(HWND, UINT, WPARAM, LPARAM);
|
||||
void Render();
|
||||
void WWDebug_Message_Callback(DebugType type, const char * message);
|
||||
void WWAssert_Callback(const char * message);
|
||||
void Debug_Refs(void);
|
||||
void LoadAssets();
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// FPS counter class counts how many times Update() has been called during the
|
||||
// last second. The fps counter caps at MAX_FPS which is the maximum fps count
|
||||
// that can be measured.
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
const unsigned MAX_FPS=2000;
|
||||
class FPSCounterClass
|
||||
{
|
||||
unsigned frame_times[MAX_FPS];
|
||||
unsigned frame_time_count;
|
||||
public:
|
||||
FPSCounterClass();
|
||||
|
||||
void Update();
|
||||
unsigned Get_FPS();
|
||||
};
|
||||
|
||||
static FPSCounterClass fps_counter;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
FPSCounterClass::FPSCounterClass()
|
||||
:
|
||||
frame_time_count(0)
|
||||
{
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void FPSCounterClass::Update()
|
||||
{
|
||||
unsigned frame_time=timeGetTime();
|
||||
unsigned limit=frame_time-1000;
|
||||
|
||||
for (unsigned i=0;i<frame_time_count;++i) {
|
||||
if (frame_times[i]<limit) {
|
||||
frame_times[i]=frame_times[frame_time_count-1];
|
||||
frame_time_count--;
|
||||
}
|
||||
}
|
||||
if (frame_time_count<MAX_FPS) {
|
||||
frame_times[frame_time_count++]=frame_time;
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
unsigned FPSCounterClass::Get_FPS()
|
||||
{
|
||||
return frame_time_count;
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
int APIENTRY WinMain(HINSTANCE hInstance,
|
||||
HINSTANCE hPrevInstance,
|
||||
LPSTR lpCmdLine,
|
||||
int nCmdShow)
|
||||
{
|
||||
HACCEL hAccelTable;
|
||||
hAccelTable = LoadAccelerators(hInstance, (LPCTSTR)IDC_SKELETON);
|
||||
|
||||
// install debug callbacks
|
||||
WWDebug_Install_Message_Handler(WWDebug_Message_Callback);
|
||||
WWDebug_Install_Assert_Handler(WWAssert_Callback);
|
||||
|
||||
// Initialize global strings
|
||||
LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
|
||||
LoadString(hInstance, IDC_SKELETON, szWindowClass, MAX_LOADSTRING);
|
||||
MyRegisterClass(hInstance);
|
||||
|
||||
// Perform application initialization:
|
||||
|
||||
hInst = hInstance; // Store instance handle in our global variable
|
||||
HWND hWnd = CreateWindow(
|
||||
szWindowClass,
|
||||
szTitle,
|
||||
WS_OVERLAPPEDWINDOW,
|
||||
CW_USEDEFAULT,
|
||||
0,
|
||||
CW_USEDEFAULT,
|
||||
0,
|
||||
NULL,
|
||||
NULL,
|
||||
hInstance,
|
||||
NULL);
|
||||
|
||||
ShowWindow(hWnd, nCmdShow);
|
||||
UpdateWindow(hWnd);
|
||||
|
||||
// WW Inits
|
||||
WWMath::Init ();
|
||||
AssetManager=new ENBAssetManager;
|
||||
AssetManager->Register_Prototype_Loader(&_ParticleEmitterLoader);
|
||||
WW3D::Init(hWnd);
|
||||
WW3D::Set_Texture_Thumbnail_Mode(WW3D::TEXTURE_THUMBNAIL_MODE_ON);
|
||||
|
||||
// WW3D::Set_Prelit_Mode(WW3D::PRELIT_MODE_VERTEX);
|
||||
WW3D::Set_Prelit_Mode(WW3D::PRELIT_MODE_LIGHTMAP_MULTI_PASS);
|
||||
// WW3D::Set_Prelit_Mode(WW3D::PRELIT_MODE_LIGHTMAP_MULTI_TEXTURE);
|
||||
WW3D::Set_Collision_Box_Display_Mask(0xFF);
|
||||
|
||||
if (WW3D::Set_Render_Device(0,800,600,32,1,true)!=WW3D_ERROR_OK) {
|
||||
WW3D::Shutdown();
|
||||
WWMath::Shutdown ();
|
||||
Debug_Refs();
|
||||
return 0;
|
||||
}
|
||||
|
||||
Init_3D_Scene();
|
||||
WW3D::Enable_Static_Sort_Lists(staticsort);
|
||||
WW3D::Enable_Sorting(sort);
|
||||
|
||||
// main loop
|
||||
int time=timeGetTime();
|
||||
float theta = 0.0f;
|
||||
|
||||
while (running)
|
||||
{
|
||||
if (rotate) {
|
||||
theta += DEG_TO_RADF(0.5f);
|
||||
Matrix3D tm(1);
|
||||
tm.Rotate_Z(theta);
|
||||
if (orig_object) orig_object->Set_Transform(tm);
|
||||
if (shift_object) shift_object->Set_Transform(tm);
|
||||
|
||||
const SphereClass &sp1=shift_object->Get_Bounding_Sphere();
|
||||
const SphereClass &sp2=orig_object->Get_Bounding_Sphere();
|
||||
shift_object->Set_Position(Vector3(0,sep,0));
|
||||
orig_object->Set_Position(Vector3(0,-sep,0));
|
||||
}
|
||||
|
||||
Render();
|
||||
Windows_Message_Handler();
|
||||
WW3D::Sync(timeGetTime()-time);
|
||||
|
||||
Log_Statistics();
|
||||
}
|
||||
|
||||
REF_PTR_RELEASE(my_scene);
|
||||
REF_PTR_RELEASE(my_camera);
|
||||
delete mytext;
|
||||
REF_PTR_RELEASE(my_font_a);
|
||||
REF_PTR_RELEASE(my_font_b);
|
||||
REF_PTR_RELEASE(orig_object);
|
||||
REF_PTR_RELEASE(shift_object);
|
||||
REF_PTR_RELEASE(my_anim);
|
||||
PredictiveLODOptimizerClass::Free();
|
||||
|
||||
// shutdown
|
||||
AssetManager->Free_Assets ();
|
||||
delete AssetManager;
|
||||
WW3D::Shutdown ();
|
||||
WWMath::Shutdown ();
|
||||
|
||||
Debug_Refs();
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// Render everything. Rendering stars with Begin_Scene() and ends to End_Scene().
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void Render()
|
||||
{
|
||||
// Predictive LOD optimizer optimizes the mesh LOD levels to match the given polygon budget
|
||||
|
||||
my_scene->Visibility_Check(my_camera);
|
||||
PredictiveLODOptimizerClass::Optimize_LODs(150000);
|
||||
|
||||
WW3D::Begin_Render(true,true,Vector3(0.5f,0.5f,0.5f));
|
||||
|
||||
// Render 3D scene
|
||||
WW3D::Render(my_scene,my_camera);
|
||||
|
||||
if (mytext) mytext->Render();
|
||||
|
||||
WW3D::End_Render();
|
||||
fps_counter.Update();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// FUNCTION: MyRegisterClass()
|
||||
//
|
||||
// PURPOSE: Registers the window class.
|
||||
//
|
||||
// COMMENTS:
|
||||
//
|
||||
// This function and its usage is only necessary if you want this code
|
||||
// to be compatible with Win32 systems prior to the 'RegisterClassEx'
|
||||
// function that was added to Windows 95. It is important to call this function
|
||||
// so that the application will get 'well formed' small icons associated
|
||||
// with it.
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
ATOM MyRegisterClass(HINSTANCE hInstance)
|
||||
{
|
||||
WNDCLASSEX wcex;
|
||||
|
||||
wcex.cbSize = sizeof(WNDCLASSEX);
|
||||
|
||||
wcex.style = CS_HREDRAW | CS_VREDRAW;
|
||||
wcex.lpfnWndProc = (WNDPROC)WndProc;
|
||||
wcex.cbClsExtra = 0;
|
||||
wcex.cbWndExtra = 0;
|
||||
wcex.hInstance = hInstance;
|
||||
wcex.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_SKELETON);
|
||||
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
|
||||
wcex.lpszMenuName = (LPCSTR)IDC_SKELETON;
|
||||
wcex.lpszClassName = szWindowClass;
|
||||
wcex.hIconSm = LoadIcon(wcex.hInstance, (LPCTSTR)IDI_SMALL);
|
||||
|
||||
return RegisterClassEx(&wcex);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// FUNCTION: WndProc(HWND, unsigned, WORD, LONG)
|
||||
//
|
||||
// PURPOSE: Processes messages for the main window.
|
||||
//
|
||||
// WM_COMMAND - process the application menu
|
||||
// WM_PAINT - Paint the main window
|
||||
// WM_DESTROY - post a quit message and return
|
||||
//
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
int wmId, wmEvent;
|
||||
PAINTSTRUCT ps;
|
||||
HDC hdc;
|
||||
|
||||
switch (message)
|
||||
{
|
||||
case WM_COMMAND:
|
||||
wmId = LOWORD(wParam);
|
||||
wmEvent = HIWORD(wParam);
|
||||
// Parse the menu selections:
|
||||
switch (wmId)
|
||||
{
|
||||
case IDM_ABOUT:
|
||||
DialogBox(hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, (DLGPROC)About);
|
||||
break;
|
||||
case IDM_EXIT:
|
||||
DestroyWindow(hWnd);
|
||||
break;
|
||||
case IDM_RELOAD:
|
||||
LoadAssets();
|
||||
break;
|
||||
default:
|
||||
return DefWindowProc(hWnd, message, wParam, lParam);
|
||||
}
|
||||
break;
|
||||
case WM_ACTIVATEAPP:
|
||||
if (wParam) WW3D::On_Activate_App();
|
||||
else WW3D::On_Deactivate_App();
|
||||
return DefWindowProc(hWnd, message, wParam, lParam);
|
||||
case WM_PAINT:
|
||||
hdc = BeginPaint(hWnd, &ps);
|
||||
// TODO: Add any drawing code here...
|
||||
EndPaint(hWnd, &ps);
|
||||
break;
|
||||
case WM_DESTROY:
|
||||
running=false;
|
||||
PostQuitMessage(0);
|
||||
break;
|
||||
case WM_KEYUP:
|
||||
if ((wParam&0xff)==VK_ESCAPE) {
|
||||
DestroyWindow(hWnd);
|
||||
return 0;
|
||||
}
|
||||
return DefWindowProc(hWnd, message, wParam, lParam);
|
||||
case WM_CHAR:
|
||||
{
|
||||
char key=LOWORD(wParam);
|
||||
switch (key)
|
||||
{
|
||||
case '-':
|
||||
WW3D::Make_Screen_Shot("screen");
|
||||
break;
|
||||
case '+':
|
||||
WW3D::Toggle_Movie_Capture();
|
||||
break;
|
||||
case ' ':
|
||||
rotate=!rotate;
|
||||
break;
|
||||
case 's':
|
||||
staticsort=!staticsort;
|
||||
WW3D::Enable_Static_Sort_Lists(staticsort);
|
||||
break;
|
||||
case 'S':
|
||||
sort=!sort;
|
||||
WW3D::Enable_Sorting(sort);
|
||||
break;
|
||||
case 'm':
|
||||
{
|
||||
SceneClass::PolyRenderType type = my_scene->Get_Polygon_Mode();
|
||||
type = (type == SceneClass::POINT) ? SceneClass::LINE : ((type == SceneClass::LINE) ? SceneClass::FILL : SceneClass::POINT);
|
||||
my_scene->Set_Polygon_Mode(type);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
default:
|
||||
return DefWindowProc(hWnd, message, wParam, lParam);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// Mesage handler for about box.
|
||||
LRESULT CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (message)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
return TRUE;
|
||||
|
||||
case WM_COMMAND:
|
||||
if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
|
||||
{
|
||||
EndDialog(hDlg, LOWORD(wParam));
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// WWDebug message callback defines the behavior of WWDEBUG_SAY().
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void WWDebug_Message_Callback(DebugType type, const char * message)
|
||||
{
|
||||
OutputDebugString(message);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// WWAssert callback defines the behavior of WWASSERT().
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void WWAssert_Callback(const char * message)
|
||||
{
|
||||
OutputDebugString(message);
|
||||
_asm int 0x03
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void Debug_Refs(void)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
WWDEBUG_SAY(("Dumping Un-Released Ref-Counted objects...\r\n"));
|
||||
RefBaseNodeClass * first = RefBaseClass::ActiveRefList.First();
|
||||
RefBaseNodeClass * node = first;
|
||||
while (node->Is_Valid())
|
||||
{
|
||||
RefBaseClass * obj = node->Get();
|
||||
ActiveRefStruct * ref = &(obj->ActiveRefInfo);
|
||||
|
||||
bool display = true;
|
||||
int count = 0;
|
||||
RefBaseNodeClass * search = first;
|
||||
while (search->Is_Valid()) {
|
||||
|
||||
if (search == node) { // if this is not the first one
|
||||
if (count != 0) {
|
||||
display = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
RefBaseClass * search_obj = search->Get();
|
||||
ActiveRefStruct * search_ref = &(search_obj->ActiveRefInfo);
|
||||
|
||||
if ( ref->File && search_ref->File &&
|
||||
!strcmp(search_ref->File, ref->File) &&
|
||||
(search_ref->Line == ref->Line) ) {
|
||||
count++;
|
||||
} else if ( (ref->File == NULL) && (search_ref->File == NULL) ) {
|
||||
count++;
|
||||
}
|
||||
|
||||
search = search->Next();
|
||||
}
|
||||
|
||||
if ( display ) {
|
||||
WWDEBUG_SAY(( "%d Active Ref: %s %d %p\n", count, ref->File,ref->Line,obj));
|
||||
|
||||
static int num_printed = 0;
|
||||
if (++num_printed > 20) {
|
||||
WWDEBUG_SAY(( "And Many More......\n"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
node = node->Next();
|
||||
}
|
||||
WWDEBUG_SAY(("Done.\r\n"));
|
||||
#endif
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
//
|
||||
// Ugly statistics block!!!
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
void Log_Statistics()
|
||||
{
|
||||
StringClass format(255,true);
|
||||
StringClass status_text(500,true);
|
||||
|
||||
// static unsigned last_frame_time=0;
|
||||
// unsigned frame_time=timeGetTime();
|
||||
// unsigned time=frame_time-last_frame_time;
|
||||
// last_frame_time=frame_time;
|
||||
// if (time>1000) time=1000;
|
||||
// float fps=1000.0f/float(time);
|
||||
// static float time_fps;
|
||||
// static float current_fps;
|
||||
// static unsigned fps_count;
|
||||
// time_fps+=fps;
|
||||
// fps_count++;
|
||||
// if (fps_count==20) {
|
||||
// fps_count=0;
|
||||
// current_fps=time_fps/20.0f;
|
||||
// time_fps=0.0f;
|
||||
// }
|
||||
unsigned current_fps=fps_counter.Get_FPS();
|
||||
|
||||
static unsigned stats_mode;
|
||||
|
||||
static bool tab_pressed;
|
||||
if (GetAsyncKeyState(VK_TAB)) {
|
||||
if (!tab_pressed) {
|
||||
stats_mode++;
|
||||
stats_mode%=3;
|
||||
}
|
||||
tab_pressed=true;
|
||||
}
|
||||
else {
|
||||
tab_pressed=false;
|
||||
}
|
||||
|
||||
switch (stats_mode) {
|
||||
case 0:
|
||||
Debug_Statistics::Record_Texture_Mode(Debug_Statistics::RECORD_TEXTURE_NONE);
|
||||
break;
|
||||
case 1:
|
||||
Debug_Statistics::Record_Texture_Mode(Debug_Statistics::RECORD_TEXTURE_NONE);
|
||||
format.Format("%d FPS\n",current_fps);
|
||||
status_text+=format;
|
||||
format.Format("%d Polys/frame (%dk pps)\n",Debug_Statistics::Get_DX8_Polygons(),unsigned(Debug_Statistics::Get_DX8_Polygons()*float(current_fps))/1000);
|
||||
status_text+=format;
|
||||
break;
|
||||
case 2:
|
||||
Debug_Statistics::Record_Texture_Mode(Debug_Statistics::RECORD_TEXTURE_NONE);
|
||||
format.Format("%d FPS\n",current_fps);
|
||||
status_text+=format;
|
||||
format.Format("%d Polys/frame (%dk pps)\n",Debug_Statistics::Get_DX8_Polygons(),unsigned(Debug_Statistics::Get_DX8_Polygons()*float(current_fps))/1000);
|
||||
status_text+=format;
|
||||
format.Format("%d Verts/frame (%dk vps)\n",Debug_Statistics::Get_DX8_Vertices(),unsigned(Debug_Statistics::Get_DX8_Vertices()*float(current_fps))/1000);
|
||||
status_text+=format;
|
||||
format.Format("%d DX8 calls\n",DX8Wrapper::Get_Last_Frame_DX8_Calls());
|
||||
status_text+=format;
|
||||
format.Format("%d VB changes\n",DX8Wrapper::Get_Last_Frame_Vertex_Buffer_Changes());
|
||||
status_text+=format;
|
||||
format.Format("%d IB changes\n",DX8Wrapper::Get_Last_Frame_Index_Buffer_Changes());
|
||||
status_text+=format;
|
||||
format.Format("%d texture changes\n",DX8Wrapper::Get_Last_Frame_Texture_Changes());
|
||||
status_text+=format;
|
||||
format.Format("%d material changes\n",DX8Wrapper::Get_Last_Frame_Material_Changes());
|
||||
status_text+=format;
|
||||
format.Format("%d light changes\n",DX8Wrapper::Get_Last_Frame_Light_Changes());
|
||||
status_text+=format;
|
||||
format.Format("%d RS changes\n",DX8Wrapper::Get_Last_Frame_Render_State_Changes());
|
||||
status_text+=format;
|
||||
format.Format("%d TSS changes\n",DX8Wrapper::Get_Last_Frame_Texture_Stage_State_Changes());
|
||||
status_text+=format;
|
||||
format.Format("%d Mtx changes\n",DX8Wrapper::Get_Last_Frame_Matrix_Changes());
|
||||
status_text+=format;
|
||||
if (sort)
|
||||
format.Format("Sorting On\n");
|
||||
else
|
||||
format.Format("Sorting Off\n");
|
||||
status_text+=format;
|
||||
if (staticsort)
|
||||
format.Format("Static Sorting On\n");
|
||||
else
|
||||
format.Format("Static Sorting Off\n");
|
||||
status_text+=format;
|
||||
break;
|
||||
}
|
||||
|
||||
mytext->Reset();
|
||||
mytext->Set_Location(Vector2(0.0,0.0));
|
||||
mytext->Draw_Text(status_text,0xffff0000);
|
||||
}
|
||||
|
||||
void LoadAssets()
|
||||
{
|
||||
if (shift_object)
|
||||
{
|
||||
my_scene->Remove_Render_Object(shift_object);
|
||||
REF_PTR_RELEASE(shift_object);
|
||||
}
|
||||
if (orig_object)
|
||||
{
|
||||
my_scene->Remove_Render_Object(orig_object);
|
||||
REF_PTR_RELEASE(orig_object);
|
||||
}
|
||||
|
||||
INIClass ini;
|
||||
ini.Load("hueshift.ini");
|
||||
|
||||
StringClass asset=ini.Get_String("GENERAL","ASSET");
|
||||
float scale=ini.Get_Float("GENERAL","SCALE",1.0f);
|
||||
Vector3 hsv;
|
||||
hsv.X=ini.Get_Float("GENERAL","HUE",0.0f);
|
||||
hsv.Y=ini.Get_Float("GENERAL","SAT",1.0f);
|
||||
hsv.Z=ini.Get_Float("GENERAL","VAL",1.0f);
|
||||
|
||||
AssetManager->Load_3D_Assets(asset+".w3d");
|
||||
|
||||
shift_object = ((ENBAssetManager*)AssetManager)->Create_Render_Obj(asset,scale,hsv);
|
||||
orig_object = AssetManager->Create_Render_Obj(asset);
|
||||
|
||||
if (shift_object && orig_object)
|
||||
{
|
||||
const SphereClass &sp1=shift_object->Get_Bounding_Sphere();
|
||||
const SphereClass &sp2=orig_object->Get_Bounding_Sphere();
|
||||
|
||||
my_scene->Add_Render_Object(shift_object);
|
||||
my_scene->Add_Render_Object(orig_object);
|
||||
|
||||
sep=WWMath::Max(sp1.Radius,sp2.Radius);
|
||||
shift_object->Set_Position(Vector3(0,sep,0));
|
||||
orig_object->Set_Position(Vector3(0,-sep,0));
|
||||
}
|
||||
|
||||
Matrix3D camtransform(1);
|
||||
camtransform.Look_At(Vector3(3*sep,0,3*sep),Vector3(0,0,0),0);
|
||||
my_camera->Set_Transform(camtransform);
|
||||
my_camera->Set_Clip_Planes(1.0f,8*sep);
|
||||
}
|
||||
|
||||
void Init_3D_Scene()
|
||||
{
|
||||
my_font_a = AssetManager->Get_Font3DInstance("font12x16.tga");
|
||||
my_font_b = AssetManager->Get_Font3DInstance("fontnew4.tga");
|
||||
|
||||
mytext=new Render2DTextClass(my_font_a);
|
||||
mytext->Set_Coordinate_Range( Render2DClass::Get_Screen_Resolution() );
|
||||
|
||||
// build scene
|
||||
my_scene=NEW_REF(SimpleSceneClass,());
|
||||
my_scene->Set_Ambient_Light(Vector3(1.0f,1.0f,1.0f));
|
||||
|
||||
my_camera=NEW_REF(CameraClass,());
|
||||
|
||||
LoadAssets();
|
||||
}
|
||||
132
Code/ww3d2/hueshift/hueshift.dsp
Normal file
132
Code/ww3d2/hueshift/hueshift.dsp
Normal file
@@ -0,0 +1,132 @@
|
||||
# Microsoft Developer Studio Project File - Name="skeleton" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Application" 0x0101
|
||||
|
||||
CFG=skeleton - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "hueshift.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "hueshift.mak" CFG="skeleton - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "skeleton - Win32 Release" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "skeleton - Win32 Debug" (based on "Win32 (x86) Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""$/Commando/skeleton", MBYDAAAA"
|
||||
# PROP Scc_LocalPath "."
|
||||
CPP=cl.exe
|
||||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "skeleton - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /GR /GX /Zi /O2 /I "..\..\wwlib" /I "..\..\wwmath" /I "..\..\wwdebug" /I "..\..\wwcpuid" /I "..\..\wwsaveload" /I "..\..\ww3d2" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /FD /c
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
|
||||
# ADD LINK32 winmm.lib vfw32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib d3dx8.lib d3d8.lib wwlib.lib wwsaveload.lib wwdebug.lib wwmath.lib ww3d2.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libcmt.lib" /out:"Run/hueshift.exe" /libpath:"..\..\srsdk1x\MSVC6\lib\release\\" /libpath:"..\..\libs\release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "skeleton - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /I "..\..\wwlib" /I "..\..\wwmath" /I "..\..\wwdebug" /I "..\..\wwcpuid" /I "..\..\wwsaveload" /I "..\..\ww3d2" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "WWDEBUG" /FR /YX"Always.h" /FD /GZ /c
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386
|
||||
# ADD LINK32 winmm.lib vfw32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib d3dx8.lib d3d8.lib wwlib.lib wwsaveload.lib wwdebug.lib wwmath.lib ww3d2.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libcmt.lib" /out:"Run/hueshiftD.exe" /libpath:"..\..\srsdk1x\MSVC6\lib\debug\\" /libpath:"..\..\libs\debug"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "skeleton - Win32 Release"
|
||||
# Name "skeleton - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\enbassetmgr.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\enbassetmgr.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\hueshift.cpp
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\hueshift.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\resource.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\hueshift.rc
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\small.ico
|
||||
# End Source File
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
90
Code/ww3d2/hueshift/hueshift.dsw
Normal file
90
Code/ww3d2/hueshift/hueshift.dsw
Normal file
@@ -0,0 +1,90 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "skeleton"=.\hueshift.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
begin source code control
|
||||
"$/VSS_Sync/ww3d2/skeleton", PQCEAAAA
|
||||
.
|
||||
end source code control
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name ww3d2
|
||||
End Project Dependency
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name wwmath
|
||||
End Project Dependency
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name wwlib
|
||||
End Project Dependency
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "ww3d2"=..\ww3d2.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
begin source code control
|
||||
"$/Commando/Code/ww3d2", QFBEAAAA
|
||||
..
|
||||
end source code control
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "wwlib"=..\..\wwlib\wwlib.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
begin source code control
|
||||
"$/Commando/Code/wwlib", KOGAAAAA
|
||||
..\..\wwlib
|
||||
end source code control
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "wwmath"=..\..\wwmath\wwmath.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
begin source code control
|
||||
"$/Commando/Code/wwmath", UEFAAAAA
|
||||
..\..\wwmath
|
||||
end source code control
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
29
Code/ww3d2/hueshift/hueshift.h
Normal file
29
Code/ww3d2/hueshift/hueshift.h
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if !defined(AFX_SKELETON_H__E48DBEDA_2947_4E55_9064_895B85FBE5B2__INCLUDED_)
|
||||
#define AFX_SKELETON_H__E48DBEDA_2947_4E55_9064_895B85FBE5B2__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#include "resource.h"
|
||||
|
||||
|
||||
#endif // !defined(AFX_SKELETON_H__E48DBEDA_2947_4E55_9064_895B85FBE5B2__INCLUDED_)
|
||||
BIN
Code/ww3d2/hueshift/hueshift.ico
Normal file
BIN
Code/ww3d2/hueshift/hueshift.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
141
Code/ww3d2/hueshift/hueshift.rc
Normal file
141
Code/ww3d2/hueshift/hueshift.rc
Normal file
@@ -0,0 +1,141 @@
|
||||
//Microsoft Developer Studio generated resource script.
|
||||
//
|
||||
#include "resource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#define APSTUDIO_HIDDEN_SYMBOLS
|
||||
#include "windows.h"
|
||||
#undef APSTUDIO_HIDDEN_SYMBOLS
|
||||
#include "resource.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.S.) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Icon
|
||||
//
|
||||
|
||||
// Icon with lowest ID value placed first to ensure application icon
|
||||
// remains consistent on all systems.
|
||||
IDI_SKELETON ICON DISCARDABLE "hueshift.ICO"
|
||||
IDI_SMALL ICON DISCARDABLE "SMALL.ICO"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Menu
|
||||
//
|
||||
|
||||
IDC_SKELETON MENU DISCARDABLE
|
||||
BEGIN
|
||||
POPUP "&File"
|
||||
BEGIN
|
||||
MENUITEM "&Reload", IDM_RELOAD
|
||||
MENUITEM "E&xit", IDM_EXIT
|
||||
END
|
||||
POPUP "&Help"
|
||||
BEGIN
|
||||
MENUITEM "&About ...", IDM_ABOUT
|
||||
END
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Accelerator
|
||||
//
|
||||
|
||||
IDC_SKELETON ACCELERATORS MOVEABLE PURE
|
||||
BEGIN
|
||||
"?", IDM_ABOUT, ASCII, ALT
|
||||
"/", IDM_ABOUT, ASCII, ALT
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dialog
|
||||
//
|
||||
|
||||
IDD_ABOUTBOX DIALOG DISCARDABLE 22, 17, 230, 75
|
||||
STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "About"
|
||||
FONT 8, "System"
|
||||
BEGIN
|
||||
ICON IDI_SKELETON,IDC_MYICON,14,9,20,20
|
||||
LTEXT "Hueshift Version 1.0",IDC_STATIC,49,10,119,8,
|
||||
SS_NOPREFIX
|
||||
LTEXT "Hector Yee, 8/29/00",IDC_STATIC,49,20,119,8
|
||||
DEFPUSHBUTTON "OK",IDOK,195,6,30,11,WS_GROUP
|
||||
END
|
||||
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
2 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"#define APSTUDIO_HIDDEN_SYMBOLS\r\n"
|
||||
"#include ""windows.h""\r\n"
|
||||
"#undef APSTUDIO_HIDDEN_SYMBOLS\r\n"
|
||||
"#include ""resource.h""\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
1 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// String Table
|
||||
//
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
IDS_APP_TITLE "HueShift"
|
||||
IDS_HELLO "Hello World!"
|
||||
IDC_SKELETON "HUESHIFT"
|
||||
END
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
||||
28
Code/ww3d2/hueshift/resource.h
Normal file
28
Code/ww3d2/hueshift/resource.h
Normal file
@@ -0,0 +1,28 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by hueshift.rc
|
||||
//
|
||||
#define IDC_MYICON 2
|
||||
#define IDD_SKELETON_DIALOG 102
|
||||
#define IDD_ABOUTBOX 103
|
||||
#define IDS_APP_TITLE 103
|
||||
#define IDM_ABOUT 104
|
||||
#define IDM_EXIT 105
|
||||
#define IDS_HELLO 106
|
||||
#define IDI_SKELETON 107
|
||||
#define IDI_SMALL 108
|
||||
#define IDC_SKELETON 109
|
||||
#define IDR_MAINFRAME 128
|
||||
#define IDM_RELOAD 32772
|
||||
#define IDC_STATIC -1
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 129
|
||||
#define _APS_NEXT_COMMAND_VALUE 32773
|
||||
#define _APS_NEXT_CONTROL_VALUE 1000
|
||||
#define _APS_NEXT_SYMED_VALUE 110
|
||||
#endif
|
||||
#endif
|
||||
BIN
Code/ww3d2/hueshift/small.ico
Normal file
BIN
Code/ww3d2/hueshift/small.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 318 B |
Reference in New Issue
Block a user