⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 geneditdoc.h

📁 3D游戏场景编辑器
💻 H
📖 第 1 页 / 共 2 页
字号:
/****************************************************************************************/
/*  GenEditDoc.h                                                                         */
/*                                                                                      */
/*  Author:       Jim Mischel, Ken Baird, Jeff Lomax                                    */
/*  Description:  Genesis world editor header file                                      */
/*                                                                                      */
/*                                                                                      */
/*  The contents of this file are subject to the Genesis3D Public License               */
/*  Version 1.01 (the "License"); you may not use this file except in                   */
/*  compliance with the License. You may obtain a copy of the License at                */
/*  http://www.genesis3d.com                                                            */
/*                                                                                      */
/*  Software distributed under the License is distributed on an "AS IS"                 */
/*  basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.  See                */
/*  the License for the specific language governing rights and limitations              */
/*  under the License.                                                                  */
/*                                                                                      */
/*  The Original Code is Genesis3D, released March 25, 1999.                            */
/*  Genesis3D Version 1.1 released November 15, 1999                                 */
/*  Copyright (C) 1999 WildTangent, Inc. All Rights Reserved           */
/*                                                                                      */
/*  Modified by Tom Morris for GenEdit-Classic ver. 0.58, April 23, 2001				*/
/****************************************************************************************/
#ifndef GenEditDOC_H
#define GenEditDOC_H

#include <assert.h>

#include "GenEdit.h"
#include "mainfrm.h"
#include "level.h"


#include "FaceAttributesDialog.h"
#include "BrushAttributesDialog.h"
#include "SelFaceList.h"
#include "SelBrushList.h"
#include "EntityTable.h"
#include "TextureDlg.h"
#include "Prefs.h"

#include "undostack.h"

#include <afxpriv.h>	// for WM_SETMESSAGESTRING message

#define WINDOW_TOP_VIEW 0
#define WINDOW_FRONT_VIEW 1
#define WINDOW_SIDE_VIEW 2
#define MAX_SEL	1000
#define CURTOOL_NONE	(-1)

enum UpdateFlags
{
	REBUILD_QUICK				=1,
	UAV_RENDER_ONLY				=2,
	UAV_ACTIVE3DVIEW_ONLY		=4,
	UAV_NONACTIVE3DVIEWS_ONLY	=8,
	UAV_TEXTUREVIEW_ONLY		=16,
	UAV_GRID_ONLY				=32,
	UAV_TEXTUREBROWSER_ONLY		=64,
	UAV_ALLVIEWS				=128,
	UAV_ALL3DVIEWS				=256,
	UAV_THIS_GRID_ONLY			=512
};

enum
{
	fctNOTHING,
	fctENTITY,
	fctBRUSH
};

enum BrushSel
{
	brushSelToggle,
	brushSelAlways,
	brushDeselAlways
} ;

enum GridFlags
{
	USE_GRID			=1,
	CONSTRAIN_HOLLOWS	=2
};

enum SelectionState
{
	NOBRUSHES=0, ONEBRUSH=1, MULTIBRUSH=2, RESERVEDBRUSH=4,
	NOFACES=8, ONEFACE=16, MULTIFACE=32, RESERVEDFACE=64,
	NOENTITIES=128, ONEENTITY=256, MULTIENTITY=512, RESERVEDENTITY=1024,
	ONEBRUSHONLY=137, ONEBRUSH_ONEFACE=145, ONEENTITYONLY=264,
	ONEBRUSH_ONEENTITY=265, NOSELECTIONS=136,
	BRUSHCLEAR=7, FACECLEAR=120, ENTITYCLEAR=1920,
	ANYENTITY=1792, ANYBRUSH=7, ANYFACE=112
};

//bool callback for flag checking
typedef geBoolean (*BrushFlagTest)(const Brush *pBrush);


enum fdocAdjustEnum
{
	ADJUST_MODE_TOGGLE,
	ADJUST_MODE_BRUSH,
	ADJUST_MODE_FACE
};

class CMainFrame;

class CGenEditDoc : public CDocument
{
protected: // create from serialization only
	CGenEditDoc();
	DECLARE_SERIAL(CGenEditDoc);

public:
	Level *pLevel;

	//states and stats
	int	NumSelEntities;

	int mShowSelectedFaces;
	int mCurrentTool, mCurrentBitmap, mShowBrush, mModeTool;
	int mShowEntities, mCurrentGroup, mCurTextureSelection;
	int IsNewDocument, mActiveView, mLastOp;
	fdocAdjustEnum mAdjustMode;
	int mShowSelectedBrushes;
	int mLockAxis;
	geBoolean	mConstrainHollows ;
	BOOL SelectLock, TempEnt;
    BOOL PlaceObjectFlag;	// this flag signifies to place an object rather than putting
							// down an entity when enter is pressed
	DWORD SelState;

	//list related
	Brush	*BTemplate, *CurBrush, *TempShearTemplate;
	SelBrushList *pSelBrushes;
	SelBrushList *pTempSelBrushes;
	SelFaceList *pSelFaces;

	Node			*mWorldBsp;
	CEntity			mRegularEntity;
	int				mCurrentEntity, ScaleNum;
	geVec3d			SelectedGeoCenter, FinalRot, FinalScale, FinalPos;

	//dialogs / controls
	CFrameWnd *mpActiveViewFrame;
	CBrushAttributesDialog *mpBrushAttributes;
	CMainFrame *mpMainFrame;
	CFaceAttributesDialog *mpFaceAttributes;

	geBoolean BrushIsVisible( const Brush * pBrush ) const ;
	geBoolean EntityIsVisible( const CEntity *pEntity ) const ;
	void TempCopySelectedBrushes();
	void DoneRotate(void);
	void DoneResize(int sides, int inidx);
	void DoneShear(int sides, int inidx);
	void DoneMove(void);
	void SnapScaleNearest(int sides, int inidx, ViewVars *v);
	DWORD GetSelState(void){  return SelState;  }
	int	 GetLockAxis( void ) { return mLockAxis ; } ;
	void SetLockAxis( int Lock ) { mLockAxis = Lock ; } ;
	void SetCurrentBrushTexture();
	BOOL IsEntitySelected();
	void SelectAll (void);
	void DeleteSelectedEntities();
	void UpdateSelected();
	void ResetAllSelectedEntities();
	void CopySelectedBrushes();
	void SetSelectedEntity( int ID );
	void AdjustEntityAngle( const ViewVars * v, const geFloat dx ) ;
	void AdjustEntityArc( const ViewVars * v, const geFloat dx ) ;
	void AdjustEntityRadius( const geVec3d *pVec ) ;

	void CenterThingInActiveView( Brush* pBrush, CEntity* pEntity );
	void SelectAllBrushes();
	void ResetAllSelections();
	void SelectGroupBrushes (BOOL Select, int WhichGroup);
	void SelectModelBrushes (BOOL Select, int ModelId);

	void OnBrushAddtoworld();
	void DoGeneralSelect (void);
	void CreateEntity(char const *pEntityName);
	geBoolean CreateEntityFromName (char const *pEntityType, CEntity &NewEnt);

	// creates a template entity with which the user specifies a location for any objects
	// they place
	void CreateObjectTemplate();

	void CreateStaircase();
	void CreateCylinder();
	void CreateSpheroid();
	void CreateCube();
	void CreateCone();
	void CreateArch();

	void SetMode(int mMode);			//	new g3dc
	void CreateNewTemplateBrush (Brush *pBrush);		// brought into public scope by g3dc
	CString		m_currentTemplateName;
	const Brush		*m_recentStairs;
	const Brush		*m_recentCyl;
	const Brush		*m_recentSphere;
	const Brush		*m_recentCube;
	const Brush		*m_recentCone;
	const Brush		*m_recentArch;
	

	void SetSelectedBrush();
	void SetSelectedFace(int PolyNum);
	void ResetSelectedBrush();
	void ResetSelectedFace(int PolyNum = 0);
	BOOL OneBrushSelectedOnly(void);
	void ToggleSelectionLock(void){ SelectLock=!(SelectLock); }
	BOOL IsSelectionLocked(void){ return SelectLock; }
	void RotateSelectedBrushes(geVec3d const *v);
	void RotateSelectedBrushesDirect(geVec3d const *v);

	void SelectTextureFromFace3D(CPoint point, ViewVars *v);
	void PlaceTemplateEntity3D(CPoint point, ViewVars *v);
	void MoveToNearest(void);
	void ResetAllSelectedFaces();
	void ResetAllSelectedBrushes();
	void AddBrushToWorld();
	void NullBrushAttributes();
	void ConfigureCurrentTool();
	void UpdateCameraEntity( const ViewVars *v ) ;
	void SetRenderedViewCamera( const geVec3d * pVec, const geVec3d * pPRY ) ;
	void GetCursorInfo(char *info, int MaxSize);
	void NullFaceAttributes();
	void FaceAttributesDialog ();
	void UpdateAllViews(int Mode, CView* pSender, BOOL Override = FALSE );
	int SubtractBrushFromList(Brush& Brush);
	void ResetSelectedFaceAttributes ();
	void ResizeSelected(float dx, float dy, int sides, int inidx);
	void ShearSelected(float dx, float dy, int sides, int inidx);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -