From 51657e10769faa2617d546a06c42e4c62a19bb50 Mon Sep 17 00:00:00 2001 From: Aki Date: Sun, 30 Jan 2022 17:41:24 +0100 Subject: Removed trailing whitespace all over the place --- Magic2/Command.cpp | 2 +- Magic2/Command.h | 2 +- Magic2/Editor.cpp | 34 +++++----- Magic2/Grid.h | 2 +- Magic2/GridProps.cpp | 10 +-- Magic2/Locale_ss.cpp | 2 +- Magic2/M3DS.cpp | 2 +- Magic2/M3DS.h | 24 +++---- Magic2/Magic.cpp | 4 +- Magic2/MagicDoc.cpp | 20 +++--- Magic2/MagicView.cpp | 160 ++++++++++++++++++++++---------------------- Magic2/MagicView.h | 2 +- Magic2/MainFrm.cpp | 8 +-- Magic2/MainFrm.h | 2 +- Magic2/MaterialDialog.cpp | 56 ++++++++-------- Magic2/ModelFileMAG.cpp | 2 +- Magic2/ModelView.cpp | 18 ++--- Magic2/Primitives.h | 2 +- Magic2/Selection.cpp | 2 +- Magic2/Selection.h | 2 +- Magic2/Selector.cpp | 10 +-- Magic2/StdAfx.h | 4 +- Magic2/TextureMapDialog.cpp | 8 +-- Magic2/Thumbnail.cpp | 2 +- Magic2/UVMapView.cpp | 10 +-- Magic2/VideoDX9.cpp | 64 +++++++++--------- Magic2/VideoDX9.h | 10 +-- Magic2/l3ds.cpp | 60 ++++++++--------- Magic2/l3ds.h | 34 +++++----- Magic2/resource.h | 2 +- 30 files changed, 280 insertions(+), 280 deletions(-) (limited to 'Magic2') diff --git a/Magic2/Command.cpp b/Magic2/Command.cpp index ce199b6..c018dad 100644 --- a/Magic2/Command.cpp +++ b/Magic2/Command.cpp @@ -33,7 +33,7 @@ OVERVIEW ======== - Base class (interface) for command pattern. A + Base class (interface) for command pattern. A command encapsulates a single editing operation that may be performed on a document. Each command may be done or undone multiple times. The specialized diff --git a/Magic2/Command.h b/Magic2/Command.h index f35e237..34190e5 100644 --- a/Magic2/Command.h +++ b/Magic2/Command.h @@ -33,7 +33,7 @@ OVERVIEW ======== - Base class (interface) for command pattern. A + Base class (interface) for command pattern. A command encapsulates a single editing operation that may be performed on a document. Each command may be done or undone multiple times. The specialized diff --git a/Magic2/Editor.cpp b/Magic2/Editor.cpp index 24ac589..0f1aa4b 100644 --- a/Magic2/Editor.cpp +++ b/Magic2/Editor.cpp @@ -53,7 +53,7 @@ static float project_u(Vec3& v, int style) case 1: return v.x; // FRONT case 2: return v.z; // SIDE } - + return v.x; } @@ -64,7 +64,7 @@ static float project_v(Vec3& v, int style) case 1: return -v.z; // FRONT case 2: return -v.y; // SIDE } - + return -v.y; } @@ -88,7 +88,7 @@ static float project_u_cylindrical(Vec3& v, int axis) // SIDE case 2: return (float) atan2(v.z, v.y); // SIDE } - + return project_u(v, axis); } @@ -99,7 +99,7 @@ static float project_v_cylindrical(Vec3& v, int axis) case 1: return v.y; // FRONT case 2: return v.x; // SIDE } - + return project_v(v, axis); } @@ -137,7 +137,7 @@ Editor::ApplyMaterial(Material* material, List& polys, Poly* poly = iter.value(); for (int i = 0; i < poly->nverts; i++) { int v = poly->verts[i]; - + float u0 = project_u(loc[v], axis); float v0 = project_v(loc[v], axis); @@ -151,7 +151,7 @@ Editor::ApplyMaterial(Material* material, List& polys, float base_u = 0.0f; float base_v = 0.0f; - + if (max_u != min_u) base_u = 1.0f / (max_u - min_u); if (max_v != min_v) base_v = 1.0f / (max_v - min_v); @@ -160,7 +160,7 @@ Editor::ApplyMaterial(Material* material, List& polys, // assign texture id and coordinates: while (++iter) { Poly* poly = iter.value(); - + poly->material = material; if (mapping == MAP_NONE) @@ -179,7 +179,7 @@ Editor::ApplyMaterial(Material* material, List& polys, if (flip) vset->tv[v] = (1.0f - base_v * (project_v(loc[v], axis) - min_v)) * scale_v; - else + else vset->tv[v] = (project_v(loc[v], axis) - min_v) * scale_v * base_v; } else { @@ -190,7 +190,7 @@ Editor::ApplyMaterial(Material* material, List& polys, if (flip) vset->tu[v] = (1.0f - base_v * (project_v(loc[v], axis) - min_v)) * scale_v; - else + else vset->tu[v] = (project_v(loc[v], axis) - min_v) * scale_v * base_v; } } @@ -208,7 +208,7 @@ Editor::ApplyMaterial(Material* material, List& polys, if (flip) vset->tv[v] = scale_v * (float) (i <= 1); - else + else vset->tv[v] = scale_v * (float) (i > 1); } else { @@ -219,7 +219,7 @@ Editor::ApplyMaterial(Material* material, List& polys, if (flip) vset->tu[v] = scale_u * (float) (i <= 1); - else + else vset->tu[v] = scale_u * (float) (i > 1); } } @@ -247,7 +247,7 @@ Editor::ApplyMaterialCylindrical(Material* material, List& polys, Poly* poly = iter.value(); for (int i = 0; i < poly->nverts; i++) { int v = poly->verts[i]; - + float u0 = project_u_cylindrical(loc[v], axis); float v0 = project_v_cylindrical(loc[v], axis); @@ -260,7 +260,7 @@ Editor::ApplyMaterialCylindrical(Material* material, List& polys, float base_u = 0.0f; float base_v = 0.0f; - + if (max_u != min_u) base_u = 1.0f / (max_u - min_u); if (max_v != min_v) base_v = 1.0f / (max_v - min_v); @@ -269,9 +269,9 @@ Editor::ApplyMaterialCylindrical(Material* material, List& polys, // assign texture id and coordinates: while (++iter) { Poly* poly = iter.value(); - + poly->material = material; - + for (int i = 0; i < poly->nverts; i++) { int v = poly->verts[i]; float u0 = project_u_cylindrical(loc[v], axis); @@ -285,7 +285,7 @@ Editor::ApplyMaterialCylindrical(Material* material, List& polys, if (flip) vset->tv[v] = (1.0f - base_v * (v0 - min_v)) * scale_v; - else + else vset->tv[v] = (v0 - min_v) * scale_v * base_v; } else { @@ -296,7 +296,7 @@ Editor::ApplyMaterialCylindrical(Material* material, List& polys, if (flip) vset->tu[v] = (1.0f - base_v * (v0 - min_v)) * scale_v; - else + else vset->tu[v] = (v0 - min_v) * scale_v * base_v; } } diff --git a/Magic2/Grid.h b/Magic2/Grid.h index 7e0491c..629d11e 100644 --- a/Magic2/Grid.h +++ b/Magic2/Grid.h @@ -71,7 +71,7 @@ public: void SetReferenceFront(const char* fname); const char* GetReferenceSide() const; void SetReferenceSide(const char* fname); - + int GetSize() const { return x_size; } // operations diff --git a/Magic2/GridProps.cpp b/Magic2/GridProps.cpp index 89ff991..32f0b1d 100644 --- a/Magic2/GridProps.cpp +++ b/Magic2/GridProps.cpp @@ -117,11 +117,11 @@ static void OnImageFile(CString& strImageFile) char filename[512]; filename[0] = '\0'; CFileDialog ofd(TRUE, "pcx"); - + ofd.m_ofn.lpstrFilter = "PCX Files\0*.pcx\0All Files\0*.*\0\0"; ofd.m_ofn.lpstrFile = filename; ofd.m_ofn.nMaxFile = sizeof(filename); - + if (ofd.DoModal() != IDOK) return; @@ -131,19 +131,19 @@ static void OnImageFile(CString& strImageFile) strImageFile = tex_name; } -void GridProps::OnFilePlan() +void GridProps::OnFilePlan() { OnImageFile(mReferencePlan); UpdateData(FALSE); } -void GridProps::OnFileFront() +void GridProps::OnFileFront() { OnImageFile(mReferenceFront); UpdateData(FALSE); } -void GridProps::OnFileSide() +void GridProps::OnFileSide() { OnImageFile(mReferenceSide); UpdateData(FALSE); diff --git a/Magic2/Locale_ss.cpp b/Magic2/Locale_ss.cpp index d079791..bf8ea03 100644 --- a/Magic2/Locale_ss.cpp +++ b/Magic2/Locale_ss.cpp @@ -185,7 +185,7 @@ Locale::CreateLocale(const char* l, const char* c, const char* v) // +--------------------------------------------------------------------+ -const List& +const List& Locale::GetAllLocales() { return locales; diff --git a/Magic2/M3DS.cpp b/Magic2/M3DS.cpp index f5b5fc5..39d38cf 100644 --- a/Magic2/M3DS.cpp +++ b/Magic2/M3DS.cpp @@ -200,7 +200,7 @@ protected: List binormals; List tangents; List uv; - + // triangles List triangles; diff --git a/Magic2/M3DS.h b/Magic2/M3DS.h index f9b002a..f12adc5 100644 --- a/Magic2/M3DS.h +++ b/Magic2/M3DS.h @@ -161,7 +161,7 @@ public: DWORD GetTriangleCount(); void SetTriangleArraySize(DWORD value); - // returns given vertex + // returns given vertex const LVector4& GetVertex(DWORD index); // returns the given normal const LVector3& GetNormal(DWORD index); @@ -171,21 +171,21 @@ public: const LVector3& GetTangent(DWORD index); // returns the pointer to the array of binormals const LVector3& GetBinormal(DWORD index); - // sets the vertex at a given index to "vec" - for internal use + // sets the vertex at a given index to "vec" - for internal use void SetVertex(const LVector4 &vec, DWORD index); - // sets the normal at a given index to "vec" - for internal use + // sets the normal at a given index to "vec" - for internal use void SetNormal(const LVector3 &vec, DWORD index); - // sets the texture coordinates vector at a given index to "vec" - for internal use + // sets the texture coordinates vector at a given index to "vec" - for internal use void SetUV(const LVector2 &vec, DWORD index); - // sets the tangent at a given index to "vec" - for internal use + // sets the tangent at a given index to "vec" - for internal use void SetTangent(const LVector3 &vec, DWORD index); - // sets the binormal at a given index to "vec" - for internal use + // sets the binormal at a given index to "vec" - for internal use void SetBinormal(const LVector3 &vec, DWORD index); // returns the triangle with a given index const LTriangle& GetTriangle(DWORD index); // returns the triangle with a given index, see LTriangle2 structure description LTriangle2 GetTriangle2(DWORD index); - // returns the mesh matrix, should be identity matrix after loading + // returns the mesh matrix, should be identity matrix after loading LMatrix4 GetMatrix(); // sets the mesh matrix to a given matrix - for internal use void SetMatrix(LMatrix4 m); @@ -208,7 +208,7 @@ protected: List binormals; List tangents; List uv; - + // triangles List triangles; @@ -254,7 +254,7 @@ public: LMaterial& GetMaterial(DWORD index); // returns the pointer to the material with a given name, or NULL if the material was not found LMaterial* FindMaterial(const Text &name); - // returns the pointer to the mesh with a given name, or NULL if the mesh with such name + // returns the pointer to the mesh with a given name, or NULL if the mesh with such name // is not present in the scene LMesh* FindMesh(const Text &name); // returns the pointer to the light with a given name, or NULL if not found @@ -286,7 +286,7 @@ public: L3DS(const char *filename); // destructor virtual ~L3DS(); - // load 3ds file + // load 3ds file virtual bool LoadFile(const char *filename); protected: // used internally for reading @@ -310,7 +310,7 @@ protected: float ReadFloat(); //reads an unsigned byte from the buffer byte ReadByte(); - //reads an asciiz string + //reads an asciiz string int ReadASCIIZ(char *buf, int max_count); // seek wihtin the buffer void Seek(int offset, int origin); @@ -332,7 +332,7 @@ protected: float ReadPercentage(const LChunk &chunk); // this is where 3ds file is being read bool Read3DS(); - // read a light chunk + // read a light chunk void ReadLight(const LChunk &parent); // read a trimesh chunk void ReadMesh(const LChunk &parent); diff --git a/Magic2/Magic.cpp b/Magic2/Magic.cpp index f1bc859..b3aad1d 100644 --- a/Magic2/Magic.cpp +++ b/Magic2/Magic.cpp @@ -214,10 +214,10 @@ void Magic::OnAppAbout() // // Magic message handlers -BOOL Magic::OnIdle(LONG lCount) +BOOL Magic::OnIdle(LONG lCount) { CWinApp::OnIdle(lCount); - + if (!app_active) Sleep(50); diff --git a/Magic2/MagicDoc.cpp b/Magic2/MagicDoc.cpp index f0c7929..d794aa2 100644 --- a/Magic2/MagicDoc.cpp +++ b/Magic2/MagicDoc.cpp @@ -107,7 +107,7 @@ void MagicDoc::Exec(Command* command) { int nredo = commands.size() - nundo; - + while (nredo) { delete commands.removeIndex(commands.size()-1); nredo--; @@ -208,7 +208,7 @@ void MagicDoc::Dump(CDumpContext& dc) const // +--------------------------------------------------------------------+ -BOOL MagicDoc::OnSaveDocument(LPCTSTR path_name) +BOOL MagicDoc::OnSaveDocument(LPCTSTR path_name) { SetModifiedFlag(FALSE); @@ -220,7 +220,7 @@ BOOL MagicDoc::OnSaveDocument(LPCTSTR path_name) return TRUE; } -BOOL MagicDoc::OnOpenDocument(LPCTSTR path_name) +BOOL MagicDoc::OnOpenDocument(LPCTSTR path_name) { FILE* fp = fopen(path_name, "rb"); if (!fp) { @@ -464,7 +464,7 @@ int LoadBuffer(const char* filename, BYTE*& buf, bool null_terminate) // +--------------------------------------------------------------------+ -void MagicDoc::DeleteContents() +void MagicDoc::DeleteContents() { CDocument::DeleteContents(); InitCommandStack(); @@ -483,7 +483,7 @@ void MagicDoc::DeleteContents() int LoadTexture(const char* fname, Bitmap*& bitmap, int type) { int result = 0; - + if (!fname || !*fname) return result; @@ -586,7 +586,7 @@ int LoadAlpha(const char* name, Bitmap& bitmap, int type) // first try to load from current directory: bool loaded = false; - + if (pcx_file) loaded = pcx.Load(filename) == PCX_OK; @@ -610,7 +610,7 @@ int LoadAlpha(const char* name, Bitmap& bitmap, int type) } -void MagicDoc::OnSurfaceOptimize() +void MagicDoc::OnSurfaceOptimize() { if (solid && solid->GetModel()) { solid->GetModel()->OptimizeMesh(); @@ -619,12 +619,12 @@ void MagicDoc::OnSurfaceOptimize() } } -void MagicDoc::OnUpdateSurfaceOptimize(CCmdUI* pCmdUI) +void MagicDoc::OnUpdateSurfaceOptimize(CCmdUI* pCmdUI) { pCmdUI->Enable(solid && solid->GetModel()); } -void MagicDoc::OnSurfaceExplode() +void MagicDoc::OnSurfaceExplode() { if (solid && solid->GetModel()) { solid->GetModel()->ExplodeMesh(); @@ -633,7 +633,7 @@ void MagicDoc::OnSurfaceExplode() } } -void MagicDoc::OnUpdateSurfaceExplode(CCmdUI* pCmdUI) +void MagicDoc::OnUpdateSurfaceExplode(CCmdUI* pCmdUI) { pCmdUI->Enable(solid && solid->GetModel()); } diff --git a/Magic2/MagicView.cpp b/Magic2/MagicView.cpp index e29e5d3..09e6314 100644 --- a/Magic2/MagicView.cpp +++ b/Magic2/MagicView.cpp @@ -238,7 +238,7 @@ MagicDoc* MagicView::GetDocument() // non-debug version is inline // +--------------------------------------------------------------------+ -void MagicView::OnInitialUpdate() +void MagicView::OnInitialUpdate() { CView::OnInitialUpdate(); Color::SetPalette(standard_palette, 256, inverse_palette); @@ -271,7 +271,7 @@ void MagicView::OnInitialUpdate() } ::Print(" Created screen object (%d x %d).\n", w, h); - + if (!screen->SetBackgroundColor(Color::Black)) ::Print(" WARNING: could not set video background color to Black\n"); @@ -323,7 +323,7 @@ void MagicView::OnInitialUpdate() screen->AddWindow(main_win); - DWORD view_types[] = { + DWORD view_types[] = { ModelView::VIEW_PLAN, ModelView::VIEW_PROJECT, ModelView::VIEW_SIDE, @@ -334,13 +334,13 @@ void MagicView::OnInitialUpdate() for (int col = 0; col < 2; col++) { int index = 2*row + col; - ActiveWindow* win = new ActiveWindow(screen, - col*w/2, - row*h/2, - w/2, - h/2, - 101+index, - WIN_BLACK_FRAME, + ActiveWindow* win = new ActiveWindow(screen, + col*w/2, + row*h/2, + w/2, + h/2, + 101+index, + WIN_BLACK_FRAME, main_win); win->SetCells(col, row, 1, 1); @@ -531,13 +531,13 @@ MagicView::GetModelViewByIndex(int index) // +--------------------------------------------------------------------+ -void MagicView::OnPaint() +void MagicView::OnPaint() { ValidateRect(0); OnRender(); } -void MagicView::OnDraw(CDC* dc) +void MagicView::OnDraw(CDC* dc) { } @@ -580,7 +580,7 @@ void MagicView::ResizeVideo() } if (screen) - screen->Resize(video_settings->window_width, + screen->Resize(video_settings->window_width, video_settings->window_height); video->InvalidateCache(); @@ -590,7 +590,7 @@ void MagicView::ResizeVideo() // +--------------------------------------------------------------------+ -void MagicView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint) +void MagicView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint) { CView::OnUpdate(pSender, lHint, pHint); @@ -627,7 +627,7 @@ MagicView::LPtoWP(const CPoint& p) // // MagicView message handlers -void MagicView::OnEnterSizeMove() +void MagicView::OnEnterSizeMove() { is_sizing = true; } @@ -638,7 +638,7 @@ void MagicView::OnExitSizeMove() ResizeVideo(); } -void MagicView::OnSize(UINT nType, int cx, int cy) +void MagicView::OnSize(UINT nType, int cx, int cy) { CView::OnSize(nType, cx, cy); @@ -670,9 +670,9 @@ void MagicView::OnSize(UINT nType, int cx, int cy) ResizeVideo(); } else { - // If we're neither maximized nor minimized, the window size - // is changing by the user dragging the window edges. In this - // case, we don't reset the device yet -- we wait until the + // If we're neither maximized nor minimized, the window size + // is changing by the user dragging the window edges. In this + // case, we don't reset the device yet -- we wait until the // user stops dragging, and a WM_EXITSIZEMOVE message comes. } } @@ -680,9 +680,9 @@ void MagicView::OnSize(UINT nType, int cx, int cy) // +--------------------------------------------------------------------+ -void MagicView::OnRender() +void MagicView::OnRender() { - if (!screen || !video) + if (!screen || !video) return; double s = sin(timeGetTime() * 0.001); @@ -729,66 +729,66 @@ void MagicView::CloseUVEditor() // +--------------------------------------------------------------------+ -void MagicView::OnViewAll() +void MagicView::OnViewAll() { CloseUVEditor(); view_mode = VIEW_ALL; SetupModelViews(); } -void MagicView::OnUpdateViewAll(CCmdUI* pCmdUI) +void MagicView::OnUpdateViewAll(CCmdUI* pCmdUI) { if (pCmdUI) pCmdUI->SetCheck(view_mode == VIEW_ALL); } -void MagicView::OnViewFront() +void MagicView::OnViewFront() { CloseUVEditor(); view_mode = VIEW_FRONT; SetupModelViews(); } -void MagicView::OnUpdateViewFront(CCmdUI* pCmdUI) +void MagicView::OnUpdateViewFront(CCmdUI* pCmdUI) { if (pCmdUI) pCmdUI->SetCheck(view_mode == VIEW_FRONT); } -void MagicView::OnViewPerspective() +void MagicView::OnViewPerspective() { CloseUVEditor(); view_mode = VIEW_PERSPECTIVE; SetupModelViews(); } -void MagicView::OnUpdateViewPerspective(CCmdUI* pCmdUI) +void MagicView::OnUpdateViewPerspective(CCmdUI* pCmdUI) { if (pCmdUI) pCmdUI->SetCheck(view_mode == VIEW_PERSPECTIVE); } -void MagicView::OnViewSide() +void MagicView::OnViewSide() { CloseUVEditor(); view_mode = VIEW_SIDE; SetupModelViews(); } -void MagicView::OnUpdateViewSide(CCmdUI* pCmdUI) +void MagicView::OnUpdateViewSide(CCmdUI* pCmdUI) { if (pCmdUI) pCmdUI->SetCheck(view_mode == VIEW_SIDE); } -void MagicView::OnViewTop() +void MagicView::OnViewTop() { CloseUVEditor(); view_mode = VIEW_TOP; SetupModelViews(); } -void MagicView::OnUpdateViewTop(CCmdUI* pCmdUI) +void MagicView::OnUpdateViewTop(CCmdUI* pCmdUI) { if (pCmdUI) pCmdUI->SetCheck(view_mode == VIEW_TOP); @@ -796,7 +796,7 @@ void MagicView::OnUpdateViewTop(CCmdUI* pCmdUI) // +--------------------------------------------------------------------+ -void MagicView::OnFileImport() +void MagicView::OnFileImport() { DWORD err = 0; char filename[256]; @@ -823,7 +823,7 @@ void MagicView::OnFileImport() } } -void MagicView::OnFileExport() +void MagicView::OnFileExport() { DWORD err = 0; char filename[256]; @@ -851,13 +851,13 @@ void MagicView::OnFileExport() // +--------------------------------------------------------------------+ -void MagicView::OnSurfaceProperties() +void MagicView::OnSurfaceProperties() { SurfacePropertiesDialog dlg(this); dlg.DoModal(); } -void MagicView::OnUpdateSurfaceProperties(CCmdUI* pCmdUI) +void MagicView::OnUpdateSurfaceProperties(CCmdUI* pCmdUI) { Solid* solid = GetDocument()->GetSolid(); pCmdUI->Enable(solid && solid->GetModel()); @@ -865,7 +865,7 @@ void MagicView::OnUpdateSurfaceProperties(CCmdUI* pCmdUI) // +--------------------------------------------------------------------+ -void MagicView::OnTextureMap() +void MagicView::OnTextureMap() { TextureMapDialog dlg(this); if (dlg.DoModal() == IDOK) { @@ -893,7 +893,7 @@ void MagicView::OnTextureMap() } } -void MagicView::OnUpdateTextureMap(CCmdUI* pCmdUI) +void MagicView::OnUpdateTextureMap(CCmdUI* pCmdUI) { Solid* solid = GetDocument()->GetSolid(); Selection* seln = GetDocument()->GetSelection(); @@ -901,7 +901,7 @@ void MagicView::OnUpdateTextureMap(CCmdUI* pCmdUI) pCmdUI->Enable(solid && solid->GetModel() && seln && seln->GetPolys().size() > 0); } -void MagicView::OnModifyMaterial() +void MagicView::OnModifyMaterial() { MaterialDialog dlg(this); dlg.DoModal(); @@ -911,13 +911,13 @@ void MagicView::OnModifyMaterial() GetDocument()->UpdateAllViews(this); } -void MagicView::OnUpdateModifyMaterial(CCmdUI* pCmdUI) +void MagicView::OnUpdateModifyMaterial(CCmdUI* pCmdUI) { Solid* solid = GetDocument()->GetSolid(); pCmdUI->Enable(solid && solid->GetModel()); } -void MagicView::OnModifyUVMap() +void MagicView::OnModifyUVMap() { Selection* seln = GetDocument()->GetSelection(); @@ -934,32 +934,32 @@ void MagicView::OnModifyUVMap() } } -void MagicView::OnUpdateModifyUVMap(CCmdUI* pCmdUI) +void MagicView::OnUpdateModifyUVMap(CCmdUI* pCmdUI) { OnUpdateTextureMap(pCmdUI); } // +--------------------------------------------------------------------+ -void MagicView::OnGridProperties() +void MagicView::OnGridProperties() { GridProps dlg(grid, this); dlg.DoModal(); } -void MagicView::OnGridShow() +void MagicView::OnGridShow() { if (grid) grid->SetShow(!grid->IsShow()); } -void MagicView::OnGridSnap() +void MagicView::OnGridSnap() { if (grid) grid->SetSnap(!grid->IsSnap()); } -void MagicView::OnUpdateGridSnap(CCmdUI* pCmdUI) +void MagicView::OnUpdateGridSnap(CCmdUI* pCmdUI) { if (grid) pCmdUI->SetCheck(grid->IsSnap()); @@ -967,7 +967,7 @@ void MagicView::OnUpdateGridSnap(CCmdUI* pCmdUI) // +--------------------------------------------------------------------+ -void MagicView::OnLButtonDown(UINT nFlags, CPoint point) +void MagicView::OnLButtonDown(UINT nFlags, CPoint point) { CView::OnLButtonDown(nFlags, point); SetCapture(); @@ -1008,7 +1008,7 @@ void MagicView::OnLButtonDown(UINT nFlags, CPoint point) } } -void MagicView::OnLButtonUp(UINT nFlags, CPoint point) +void MagicView::OnLButtonUp(UINT nFlags, CPoint point) { CView::OnLButtonUp(nFlags, point); ReleaseCapture(); @@ -1025,7 +1025,7 @@ void MagicView::OnLButtonUp(UINT nFlags, CPoint point) selector->End(); } -void MagicView::OnLButtonDblClk(UINT nFlags, CPoint point) +void MagicView::OnLButtonDblClk(UINT nFlags, CPoint point) { CView::OnLButtonDblClk(nFlags, point); @@ -1041,7 +1041,7 @@ void MagicView::OnLButtonDblClk(UINT nFlags, CPoint point) selector->Clear(); } -void MagicView::OnRButtonDown(UINT nFlags, CPoint point) +void MagicView::OnRButtonDown(UINT nFlags, CPoint point) { CView::OnRButtonDown(nFlags, point); SetCapture(); @@ -1055,7 +1055,7 @@ void MagicView::OnRButtonDown(UINT nFlags, CPoint point) drag_right = true; } -void MagicView::OnRButtonUp(UINT nFlags, CPoint point) +void MagicView::OnRButtonUp(UINT nFlags, CPoint point) { CView::OnRButtonUp(nFlags, point); ReleaseCapture(); @@ -1063,7 +1063,7 @@ void MagicView::OnRButtonUp(UINT nFlags, CPoint point) drag_right = false; } -void MagicView::OnRButtonDblClk(UINT nFlags, CPoint point) +void MagicView::OnRButtonDblClk(UINT nFlags, CPoint point) { CView::OnRButtonDblClk(nFlags, point); ReleaseCapture(); @@ -1085,14 +1085,14 @@ void MagicView::OnRButtonDblClk(UINT nFlags, CPoint point) SetFocusModelView(view_focus); } -void MagicView::OnMouseMove(UINT nFlags, CPoint point) +void MagicView::OnMouseMove(UINT nFlags, CPoint point) { if (drag_right) { CPoint offset = point - drag_start; if (view_focus == VIEW_PERSPECTIVE) { ModelView* view = GetModelViewByIndex(view_focus); - view->SpinBy(offset.x * 0.5 * DEGREES, + view->SpinBy(offset.x * 0.5 * DEGREES, offset.y * 0.5 * DEGREES); } @@ -1148,7 +1148,7 @@ void MagicView::OnMouseMove(UINT nFlags, CPoint point) CView::OnMouseMove(nFlags, point); } -BOOL MagicView::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt) +BOOL MagicView::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt) { if (view_focus == VIEW_PERSPECTIVE) { ModelView* view = GetModelViewByIndex(view_focus); @@ -1192,7 +1192,7 @@ BOOL MagicView::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt) // +--------------------------------------------------------------------+ -void MagicView::OnViewZoomNormal() +void MagicView::OnViewZoomNormal() { for (int i = 0; i < 4; i++) { ModelView* view = GetModelViewByIndex(i); @@ -1203,7 +1203,7 @@ void MagicView::OnViewZoomNormal() } } -void MagicView::OnViewZoomIn() +void MagicView::OnViewZoomIn() { for (int i = 0; i < 4; i++) { ModelView* view = GetModelViewByIndex(i); @@ -1215,7 +1215,7 @@ void MagicView::OnViewZoomIn() } } -void MagicView::OnViewZoomOut() +void MagicView::OnViewZoomOut() { for (int i = 0; i < 4; i++) { ModelView* view = GetModelViewByIndex(i); @@ -1229,7 +1229,7 @@ void MagicView::OnViewZoomOut() // +--------------------------------------------------------------------+ -void MagicView::OnViewModeWireframe() +void MagicView::OnViewModeWireframe() { ModelView* view = GetModelViewByIndex(view_focus); @@ -1238,7 +1238,7 @@ void MagicView::OnViewModeWireframe() } } -void MagicView::OnViewModeSolid() +void MagicView::OnViewModeSolid() { ModelView* view = GetModelViewByIndex(view_focus); @@ -1247,7 +1247,7 @@ void MagicView::OnViewModeSolid() } } -void MagicView::OnViewModeTextured() +void MagicView::OnViewModeTextured() { ModelView* view = GetModelViewByIndex(view_focus); @@ -1256,7 +1256,7 @@ void MagicView::OnViewModeTextured() } } -void MagicView::OnViewBackColor() +void MagicView::OnViewBackColor() { ModelView* view = GetModelViewByIndex(view_focus); @@ -1275,7 +1275,7 @@ void MagicView::OnViewBackColor() // +--------------------------------------------------------------------+ -void MagicView::OnSelectAll() +void MagicView::OnSelectAll() { Solid* solid = GetDocument()->GetSolid(); Selector* selector = GetDocument()->GetSelector(); @@ -1290,7 +1290,7 @@ void MagicView::OnSelectAll() } } -void MagicView::OnSelectNone() +void MagicView::OnSelectNone() { Solid* solid = GetDocument()->GetSolid(); Selector* selector = GetDocument()->GetSelector(); @@ -1305,7 +1305,7 @@ void MagicView::OnSelectNone() } } -void MagicView::OnSelectInverse() +void MagicView::OnSelectInverse() { Solid* solid = GetDocument()->GetSolid(); Selector* selector = GetDocument()->GetSelector(); @@ -1320,7 +1320,7 @@ void MagicView::OnSelectInverse() } } -void MagicView::OnViewShadows() +void MagicView::OnViewShadows() { view_shadows = !view_shadows; @@ -1328,22 +1328,22 @@ void MagicView::OnViewShadows() video->SetShadowEnabled(view_shadows); } -void MagicView::OnUpdateViewShadows(CCmdUI* pCmdUI) +void MagicView::OnUpdateViewShadows(CCmdUI* pCmdUI) { pCmdUI->SetCheck(view_shadows); } -void MagicView::OnViewAnimatelight() +void MagicView::OnViewAnimatelight() { animate_light = !animate_light; } -void MagicView::OnUpdateViewAnimatelight(CCmdUI* pCmdUI) +void MagicView::OnUpdateViewAnimatelight(CCmdUI* pCmdUI) { pCmdUI->SetCheck(animate_light); } -void MagicView::OnViewBumpmaps() +void MagicView::OnViewBumpmaps() { view_bumpmaps = !view_bumpmaps; @@ -1351,12 +1351,12 @@ void MagicView::OnViewBumpmaps() video->SetBumpMapEnabled(view_bumpmaps); } -void MagicView::OnUpdateViewBumpmaps(CCmdUI* pCmdUI) +void MagicView::OnUpdateViewBumpmaps(CCmdUI* pCmdUI) { pCmdUI->SetCheck(view_bumpmaps); } -void MagicView::OnViewVertexshader() +void MagicView::OnViewVertexshader() { if (video) { VideoSettings* vs = (VideoSettings*) video->GetVideoSettings(); @@ -1364,13 +1364,13 @@ void MagicView::OnViewVertexshader() } } -void MagicView::OnUpdateViewVertexshader(CCmdUI* pCmdUI) +void MagicView::OnUpdateViewVertexshader(CCmdUI* pCmdUI) { if (video) pCmdUI->SetCheck(video->GetVideoSettings()->enable_vs); } -void MagicView::OnViewPixelshader() +void MagicView::OnViewPixelshader() { if (video) { VideoSettings* vs = (VideoSettings*) video->GetVideoSettings(); @@ -1378,23 +1378,23 @@ void MagicView::OnViewPixelshader() } } -void MagicView::OnUpdateViewPixelshader(CCmdUI* pCmdUI) +void MagicView::OnUpdateViewPixelshader(CCmdUI* pCmdUI) { if (video) pCmdUI->SetCheck(video->GetVideoSettings()->enable_ps); } -void MagicView::OnViewVisibleshadows() +void MagicView::OnViewVisibleshadows() { Shadow::SetVisibleShadowVolumes(!Shadow::GetVisibleShadowVolumes()); } -void MagicView::OnUpdateViewVisibleshadows(CCmdUI* pCmdUI) +void MagicView::OnUpdateViewVisibleshadows(CCmdUI* pCmdUI) { pCmdUI->SetCheck(Shadow::GetVisibleShadowVolumes()); } -void MagicView::OnEditUndo() +void MagicView::OnEditUndo() { MagicDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); @@ -1413,7 +1413,7 @@ void MagicView::OnEditUndo() pDoc->UpdateAllViews(this); } -void MagicView::OnUpdateEditUndo(CCmdUI* pCmdUI) +void MagicView::OnUpdateEditUndo(CCmdUI* pCmdUI) { MagicDoc* pDoc = GetDocument(); @@ -1427,7 +1427,7 @@ void MagicView::OnUpdateEditUndo(CCmdUI* pCmdUI) } } -void MagicView::OnEditRedo() +void MagicView::OnEditRedo() { MagicDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); @@ -1446,7 +1446,7 @@ void MagicView::OnEditRedo() pDoc->UpdateAllViews(this); } -void MagicView::OnUpdateEditRedo(CCmdUI* pCmdUI) +void MagicView::OnUpdateEditRedo(CCmdUI* pCmdUI) { MagicDoc* pDoc = GetDocument(); diff --git a/Magic2/MagicView.h b/Magic2/MagicView.h index 287982c..3cec777 100644 --- a/Magic2/MagicView.h +++ b/Magic2/MagicView.h @@ -130,7 +130,7 @@ protected: enum VIEW_MODE { VIEW_TOP = 0, VIEW_PERSPECTIVE = 1, - VIEW_SIDE = 2, + VIEW_SIDE = 2, VIEW_FRONT = 3, VIEW_ALL = 4, VIEW_UV_MAP = 5 diff --git a/Magic2/MainFrm.cpp b/Magic2/MainFrm.cpp index 3d2d256..eb09b0d 100644 --- a/Magic2/MainFrm.cpp +++ b/Magic2/MainFrm.cpp @@ -72,7 +72,7 @@ MainFrame* MainFrame::statframe; MainFrame::MainFrame() { statframe = this; - + } MainFrame::~MainFrame() @@ -101,7 +101,7 @@ int MainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CFrameWnd::OnCreate(lpCreateStruct) == -1) return -1; - + if (!m_wndToolBar.Create(this) || !m_wndToolBar.LoadToolBar(IDR_MAINFRAME)) { @@ -165,12 +165,12 @@ void MainFrame::Dump(CDumpContext& dc) const // MainFrame message handlers -void MainFrame::OnActivateApp(BOOL bActive, DWORD dwThreadID) +void MainFrame::OnActivateApp(BOOL bActive, DWORD dwThreadID) { ((Magic*)AfxGetApp())->SetAppActivated(bActive ? true : false); } -void MainFrame::OnRender() +void MainFrame::OnRender() { MagicView* magic_view = MagicView::GetInstance(); if (magic_view) diff --git a/Magic2/MainFrm.h b/Magic2/MainFrm.h index 39e43bd..7239ced 100644 --- a/Magic2/MainFrm.h +++ b/Magic2/MainFrm.h @@ -36,7 +36,7 @@ class MainFrame : public CFrameWnd { - + protected: // create from serialization only MainFrame(); DECLARE_DYNCREATE(MainFrame) diff --git a/Magic2/MaterialDialog.cpp b/Magic2/MaterialDialog.cpp index 15d13a8..5747dc6 100644 --- a/Magic2/MaterialDialog.cpp +++ b/Magic2/MaterialDialog.cpp @@ -240,7 +240,7 @@ void MaterialDialog::UpdateMaterial() // MaterialDialog message handlers // +--------------------------------------------------------------------+ -BOOL MaterialDialog::OnInitDialog() +BOOL MaterialDialog::OnInitDialog() { if (solid && solid->GetModel() && !material) { Model* model = solid->GetModel(); @@ -277,12 +277,12 @@ BOOL MaterialDialog::OnInitDialog() CDialog::OnInitDialog(); UpdateMaterial(); - + return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } -void MaterialDialog::OnPaint() +void MaterialDialog::OnPaint() { CPaintDC dc(this); // device context for painting @@ -291,7 +291,7 @@ void MaterialDialog::OnPaint() } } -void MaterialDialog::OnAmbientColor() +void MaterialDialog::OnAmbientColor() { if (material) { Color c = material->ambient_color; @@ -306,7 +306,7 @@ void MaterialDialog::OnAmbientColor() } } -void MaterialDialog::OnDiffuseColor() +void MaterialDialog::OnDiffuseColor() { if (material) { Color c = material->diffuse_color; @@ -321,7 +321,7 @@ void MaterialDialog::OnDiffuseColor() } } -void MaterialDialog::OnSpecularColor() +void MaterialDialog::OnSpecularColor() { if (material) { Color c = material->specular_color; @@ -336,7 +336,7 @@ void MaterialDialog::OnSpecularColor() } } -void MaterialDialog::OnEmissiveColor() +void MaterialDialog::OnEmissiveColor() { if (material) { Color c = material->emissive_color; @@ -351,7 +351,7 @@ void MaterialDialog::OnEmissiveColor() } } -void MaterialDialog::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct) +void MaterialDialog::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct) { CWnd* wnd = GetDlgItem(nIDCtl); Color c = Color::LightGray; @@ -381,7 +381,7 @@ void MaterialDialog::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct) // +--------------------------------------------------------------------+ -void MaterialDialog::OnChangeMaterialValue() +void MaterialDialog::OnChangeMaterialValue() { UpdateMaterial(); } @@ -396,11 +396,11 @@ void MaterialDialog::OnFileTexture(int type) char filename[512]; filename[0] = '\0'; CFileDialog ofd(TRUE, "pcx"); - + ofd.m_ofn.lpstrFilter = "All Image Files\0*.bmp; *.dds; *.jpg; *.pcx; *.png; *.tga\0Bitmap Files (*.bmp)\0*.bmp\0JPEG Files (*.jpg)\0*.pcx\0PCX Files (*.pcx)\0*.pcx\0PNG Files (*.png)\0*.png\0Truevision Targa Files (*.tga)\0*.png\0All Files\0*.*\0\0"; ofd.m_ofn.lpstrFile = filename; ofd.m_ofn.nMaxFile = sizeof(filename); - + if (ofd.DoModal() != IDOK) return; @@ -444,27 +444,27 @@ void MaterialDialog::ChangeFileTexture(char* fname, int type) } } -void MaterialDialog::OnFileDiffuse() +void MaterialDialog::OnFileDiffuse() { OnFileTexture(0); } -void MaterialDialog::OnFileSpecular() +void MaterialDialog::OnFileSpecular() { OnFileTexture(1); } -void MaterialDialog::OnFileEmissive() +void MaterialDialog::OnFileEmissive() { OnFileTexture(2); } -void MaterialDialog::OnFileBump() +void MaterialDialog::OnFileBump() { OnFileTexture(3); } -void MaterialDialog::OnChangeDiffuseTexture() +void MaterialDialog::OnChangeDiffuseTexture() { if (material) { UpdateData(); @@ -481,7 +481,7 @@ void MaterialDialog::OnChangeDiffuseTexture() } } -void MaterialDialog::OnChangeSpecularTexture() +void MaterialDialog::OnChangeSpecularTexture() { if (material) { UpdateData(); @@ -498,7 +498,7 @@ void MaterialDialog::OnChangeSpecularTexture() } } -void MaterialDialog::OnChangeEmissiveTexture() +void MaterialDialog::OnChangeEmissiveTexture() { if (material) { UpdateData(); @@ -515,7 +515,7 @@ void MaterialDialog::OnChangeEmissiveTexture() } } -void MaterialDialog::OnChangeBumpTexture() +void MaterialDialog::OnChangeBumpTexture() { if (material) { UpdateData(); @@ -534,7 +534,7 @@ void MaterialDialog::OnChangeBumpTexture() // +--------------------------------------------------------------------+ -void MaterialDialog::OnChangeMaterialName() +void MaterialDialog::OnChangeMaterialName() { if (material) { UpdateData(); @@ -542,7 +542,7 @@ void MaterialDialog::OnChangeMaterialName() } } -void MaterialDialog::OnChangeMaterialShader() +void MaterialDialog::OnChangeMaterialShader() { if (material) { UpdateData(); @@ -550,7 +550,7 @@ void MaterialDialog::OnChangeMaterialShader() } } -void MaterialDialog::OnSelectMaterial() +void MaterialDialog::OnSelectMaterial() { int selected = mMaterialList.GetCurSel(); Material* mtl = 0; @@ -603,7 +603,7 @@ void MaterialDialog::OnSelectMaterial() // +--------------------------------------------------------------------+ -void MaterialDialog::OnNewMaterial() +void MaterialDialog::OnNewMaterial() { if (solid && material && material != &emergency_material) { Model* model = solid->GetModel(); @@ -637,7 +637,7 @@ void MaterialDialog::OnNewMaterial() } } -void MaterialDialog::OnDelMaterial() +void MaterialDialog::OnDelMaterial() { if (solid && material && material != &emergency_material) { Model* model = solid->GetModel(); @@ -683,7 +683,7 @@ void MaterialDialog::OnDelMaterial() } } -void MaterialDialog::OnSelectPolys() +void MaterialDialog::OnSelectPolys() { if (solid && doc && doc->GetSelector()) { Selector* selector = doc->GetSelector(); @@ -695,19 +695,19 @@ void MaterialDialog::OnSelectPolys() } } -void MaterialDialog::OnSelectBlendMode() +void MaterialDialog::OnSelectBlendMode() { if (material) material->blend = SelectionToBlendMode(mBlendModeList.GetCurSel()); } -void MaterialDialog::OnSelectShadow() +void MaterialDialog::OnSelectShadow() { if (material) material->shadow = mShadowList.GetCurSel() ? true : false; } -void MaterialDialog::OnOK() +void MaterialDialog::OnOK() { Video* video = Video::GetInstance(); if (video) diff --git a/Magic2/ModelFileMAG.cpp b/Magic2/ModelFileMAG.cpp index 51c6a46..8f18515 100644 --- a/Magic2/ModelFileMAG.cpp +++ b/Magic2/ModelFileMAG.cpp @@ -573,7 +573,7 @@ ModelFileMAG::LoadMag5(FILE* fp, Model* m, double scale) vset->rw[v] = 1; poly.verts[vi] = v; } - + fread(texture_index_buffer, sizeof(float), poly_nverts, fp); // tu's for (int vi = 0; vi < poly_nverts; vi++) { int v = poly.verts[vi]; diff --git a/Magic2/ModelView.cpp b/Magic2/ModelView.cpp index 68ab304..74ed539 100644 --- a/Magic2/ModelView.cpp +++ b/Magic2/ModelView.cpp @@ -82,7 +82,7 @@ ModelView::~ModelView() // +--------------------------------------------------------------------+ -void +void ModelView::SetViewMode(DWORD m) { if (view_mode != m) { @@ -141,7 +141,7 @@ ModelView::FindView(DWORD mode) // +--------------------------------------------------------------------+ -void +void ModelView::MoveTo(Point pos) { switch (view_mode) { @@ -165,7 +165,7 @@ ModelView::MoveTo(Point pos) } } -void +void ModelView::MoveBy(double dx, double dy) { Point pos = cam.Pos(); @@ -203,7 +203,7 @@ ModelView::MoveBy(double dx, double dy) } } -void +void ModelView::SpinBy(double phi, double theta) { const double limit = (0.43 * PI); @@ -242,8 +242,8 @@ void ModelView::ZoomNormal() { DWORD v = view_mode; // remember current view mode - view_mode = 100; // force set view mode to setup the view - az = -PI/4; // if this happens to be a perspective view, + view_mode = 100; // force set view mode to setup the view + az = -PI/4; // if this happens to be a perspective view, el = PI/4; // reset the spin to the original 3/4ths view SetViewMode(v); // restore default view params for this mode @@ -306,7 +306,7 @@ ModelView::RenderScene() // +--------------------------------------------------------------------+ -void +void ModelView::Render(Graphic* g, DWORD flags) { if (!g) @@ -425,7 +425,7 @@ ModelView::ProjectPoint(Vec3& p) Vec3 pt = p; projector.Transform(pt); projector.Project(pt, false); - + result.x = (LONG) (pt.x + GetWindow()->X()); result.y = (LONG) (pt.y + GetWindow()->Y()); } @@ -436,6 +436,6 @@ ModelView::ProjectPoint(Vec3& p) result.y = 0; break; } - + return result; } diff --git a/Magic2/Primitives.h b/Magic2/Primitives.h index 56cf26c..4da9c75 100644 --- a/Magic2/Primitives.h +++ b/Magic2/Primitives.h @@ -56,7 +56,7 @@ class ModelView; class CreatePolyCommand : public Command { public: - CreatePolyCommand(MagicDoc* doc, + CreatePolyCommand(MagicDoc* doc, int nsides, double lx, double ly, diff --git a/Magic2/Selection.cpp b/Magic2/Selection.cpp index 570ab21..1a2510a 100644 --- a/Magic2/Selection.cpp +++ b/Magic2/Selection.cpp @@ -192,7 +192,7 @@ void Selection::RemoveVert(WORD s, WORD v) { DWORD value = (s << 16) | v; - + for (auto vi = verts.begin(); vi != verts.end(); ++vi) { if (*vi == value) { verts.erase(vi); diff --git a/Magic2/Selection.h b/Magic2/Selection.h index e70a3b3..ba0f2e4 100644 --- a/Magic2/Selection.h +++ b/Magic2/Selection.h @@ -75,7 +75,7 @@ public: List& GetPolys() { return polys; } std::vector& GetVerts() { return verts; } - virtual void Clear() { polys.clear(); + virtual void Clear() { polys.clear(); verts.clear(); } void AddPoly(Poly* p); diff --git a/Magic2/Selector.cpp b/Magic2/Selector.cpp index 0b37f83..2dad00f 100644 --- a/Magic2/Selector.cpp +++ b/Magic2/Selector.cpp @@ -127,10 +127,10 @@ Selector::End() { ModelView* view = ModelView::FindView(view_mode); view_mode = 0; - + // get the model: if (!model || !nmarks || !view) return; - + // if not adding to selection: if (select_mode == SELECT_REPLACE) { Clear(); @@ -159,7 +159,7 @@ Selector::End() CRgn rgn; rgn.CreatePolygonRgn(pts, poly->nverts, ALTERNATE); - + if (rgn.PtInRegion(marks[0])) { if (select_mode == SELECT_REMOVE) { selection->RemovePoly(poly); @@ -214,7 +214,7 @@ Selector::End() bool will_select = true; for (int v = 0; v < poly->nverts && will_select; v++) - will_select = will_select && + will_select = will_select && selection->Contains((WORD) s_iter.index(), poly->verts[v]); if (will_select) @@ -403,7 +403,7 @@ Selector::Reselect() bool will_select = true; for (int v = 0; v < poly->nverts && will_select; v++) - will_select = will_select && + will_select = will_select && selection->Contains(s_index, poly->verts[v]); if (will_select) diff --git a/Magic2/StdAfx.h b/Magic2/StdAfx.h index 36a4cb6..08b4389 100644 --- a/Magic2/StdAfx.h +++ b/Magic2/StdAfx.h @@ -27,8 +27,8 @@ #include // MFC support for Windows Common Controls #endif // _AFX_NO_AFXCMN_SUPPORT -// Enable extra D3D debugging in debug builds if using the debug DirectX runtime. -// This makes D3D objects work well in the debugger watch window, but slows down +// Enable extra D3D debugging in debug builds if using the debug DirectX runtime. +// This makes D3D objects work well in the debugger watch window, but slows down // performance slightly. #if defined(DEBUG) | defined(_DEBUG) #define D3D_DEBUG_INFO diff --git a/Magic2/TextureMapDialog.cpp b/Magic2/TextureMapDialog.cpp index f7085a1..7647e28 100644 --- a/Magic2/TextureMapDialog.cpp +++ b/Magic2/TextureMapDialog.cpp @@ -138,7 +138,7 @@ END_MESSAGE_MAP() // TextureMapDialog message handlers // +--------------------------------------------------------------------+ -BOOL TextureMapDialog::OnInitDialog() +BOOL TextureMapDialog::OnInitDialog() { CDialog::OnInitDialog(); @@ -165,7 +165,7 @@ BOOL TextureMapDialog::OnInitDialog() // +--------------------------------------------------------------------+ -void TextureMapDialog::OnPaint() +void TextureMapDialog::OnPaint() { CPaintDC dc(this); // device context for painting @@ -177,7 +177,7 @@ void TextureMapDialog::OnPaint() } } -void TextureMapDialog::OnSelectMaterial() +void TextureMapDialog::OnSelectMaterial() { mMaterialIndex = mMaterialList.GetCurSel()-1; material = 0; @@ -195,7 +195,7 @@ void TextureMapDialog::OnSelectMaterial() } } -void TextureMapDialog::OnAlign() +void TextureMapDialog::OnAlign() { if (mMapping.GetCurSel() == 0) { mMapping.SetCurSel(1); diff --git a/Magic2/Thumbnail.cpp b/Magic2/Thumbnail.cpp index 28bacbb..40c8d2b 100644 --- a/Magic2/Thumbnail.cpp +++ b/Magic2/Thumbnail.cpp @@ -67,7 +67,7 @@ void ThumbPreview(HWND hprev, Bitmap* bitmap) pbmiDIB->bmiHeader.biClrImportant = 0; int result = - ::StretchDIBits(hdc, + ::StretchDIBits(hdc, 1, 1, 128, 128, 0, 0, bitmap->Width(), bitmap->Height(), bitmap->HiPixels(), diff --git a/Magic2/UVMapView.cpp b/Magic2/UVMapView.cpp index d775b5c..dbbf2de 100644 --- a/Magic2/UVMapView.cpp +++ b/Magic2/UVMapView.cpp @@ -73,7 +73,7 @@ UVMapView::~UVMapView() const int BATCH_SIZE = 64; -void +void UVMapView::Refresh() { video = Video::GetInstance(); @@ -180,7 +180,7 @@ UVMapView::UseMaterial(Material* m) } } -void +void UVMapView::UsePolys(List& p) { polys.clear(); @@ -252,7 +252,7 @@ UVMapView::End() // get the model: if (!nmarks || !material || !material->tex_diffuse) return; - + // if not adding to selection: if (select_mode == SELECT_REPLACE) { Clear(); @@ -425,7 +425,7 @@ UVMapView::IsSelected(Poly* poly, WORD v) DWORD value = (p << 16) | v; bool contains = false; - + for (auto svi = selverts.begin(); svi != selverts.end(); ++svi) { if (*svi == value) return true; @@ -439,7 +439,7 @@ UVMapView::WillSelect(CPoint& p) { if (!material || !material->tex_diffuse) return false; - + Bitmap* bmp = material->tex_diffuse; int w = bmp->Width(); int h = bmp->Height(); diff --git a/Magic2/VideoDX9.cpp b/Magic2/VideoDX9.cpp index 0c9e24d..f4c3f7b 100644 --- a/Magic2/VideoDX9.cpp +++ b/Magic2/VideoDX9.cpp @@ -101,7 +101,7 @@ public: model_clients.append(model); } - virtual ~VideoDX9SurfaceData() { + virtual ~VideoDX9SurfaceData() { model_clients.remove(model); delete vertex_buffer; @@ -165,8 +165,8 @@ struct VideoDX9ScreenVertex static DWORD FVF; }; -DWORD VideoDX9ScreenVertex::FVF = D3DFVF_XYZRHW | -D3DFVF_DIFFUSE | +DWORD VideoDX9ScreenVertex::FVF = D3DFVF_XYZRHW | +D3DFVF_DIFFUSE | D3DFVF_TEX1; struct VideoDX9NormalVertex @@ -184,7 +184,7 @@ struct VideoDX9NormalVertex DWORD VideoDX9NormalVertex::FVF = 0; // Global Vertex Declaration shared by shaders -D3DVERTEXELEMENT9 videoDX9NormalVertexElements[] = +D3DVERTEXELEMENT9 videoDX9NormalVertexElements[] = { { 0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0 }, { 0, 12, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_NORMAL, 0 }, @@ -204,8 +204,8 @@ struct VideoDX9SolidVertex static DWORD FVF; }; -DWORD VideoDX9SolidVertex::FVF = D3DFVF_XYZ | -D3DFVF_NORMAL | +DWORD VideoDX9SolidVertex::FVF = D3DFVF_XYZ | +D3DFVF_NORMAL | D3DFVF_TEX1 | D3DFVF_TEXCOORDSIZE2(0); @@ -218,8 +218,8 @@ struct VideoDX9LuminousVertex static DWORD FVF; }; -DWORD VideoDX9LuminousVertex::FVF = D3DFVF_XYZ | -D3DFVF_DIFFUSE | +DWORD VideoDX9LuminousVertex::FVF = D3DFVF_XYZ | +D3DFVF_DIFFUSE | D3DFVF_TEX1 | D3DFVF_TEXCOORDSIZE2(0); @@ -234,7 +234,7 @@ struct VideoDX9DetailVertex static DWORD FVF; }; -DWORD VideoDX9DetailVertex::FVF = D3DFVF_XYZ | +DWORD VideoDX9DetailVertex::FVF = D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX2; @@ -247,7 +247,7 @@ struct VideoDX9LineVertex static DWORD FVF; }; -DWORD VideoDX9LineVertex::FVF = D3DFVF_XYZ | +DWORD VideoDX9LineVertex::FVF = D3DFVF_XYZ | D3DFVF_DIFFUSE; enum { @@ -470,7 +470,7 @@ VideoDX9::~VideoDX9() video_dx9_instance = 0; } -IDirect3DDevice9* +IDirect3DDevice9* VideoDX9::GetD3DDevice9() { if (video_dx9_instance) @@ -617,7 +617,7 @@ VideoDX9::Reset(const VideoSettings* vs) d3ddevice->SetSamplerState(0, D3DSAMP_MIPFILTER, D3DTEXF_NONE); D3DVIEWPORT9 view; - + hr = d3ddevice->GetViewport(&view); if (SUCCEEDED(hr)) { rect.x = view.X; @@ -890,7 +890,7 @@ VideoDX9::SetGammaLevel(int g) // compute 1/gamma float recip_gray = ReciprocalGamma(g); - + // compute i**(1/gamma) for all i and scale to range for (UINT i = 0; i < 256; i++) { int val = RampValue(i, recip_gray, f); @@ -1135,11 +1135,11 @@ VideoDX9::Capture(Bitmap& bmp) desc.Format = D3DFMT_A8R8G8B8; hr = d3ddevice->CreateOffscreenPlainSurface( - desc.Width, - desc.Height, - desc.Format, - D3DPOOL_SYSTEMMEM, - &pTempSurf, + desc.Width, + desc.Height, + desc.Format, + D3DPOOL_SYSTEMMEM, + &pTempSurf, NULL); if (FAILED(hr)) { @@ -1174,10 +1174,10 @@ VideoDX9::Capture(Bitmap& bmp) // and to do so hits performance, so copy to another surface // Must be the same format as the source surface hr = d3ddevice->CreateOffscreenPlainSurface( - desc.Width, - desc.Height, - desc.Format, - D3DPOOL_DEFAULT, + desc.Width, + desc.Height, + desc.Format, + D3DPOOL_DEFAULT, &pSurf, NULL); @@ -1203,14 +1203,14 @@ VideoDX9::Capture(Bitmap& bmp) } D3DLOCKED_RECT lockedRect; - hr = pTempSurf->LockRect(&lockedRect, NULL, + hr = pTempSurf->LockRect(&lockedRect, NULL, D3DLOCK_READONLY | D3DLOCK_NOSYSLOCK); if (FAILED(hr)) { VideoDX9Error("VideoDX9::Capture - can't lock rect", hr); RELEASE(pTempSurf); return false; - } + } // Allocate color buffer DWORD* buffer = new DWORD[desc.Width * desc.Height]; @@ -1248,7 +1248,7 @@ VideoDX9::Capture(Bitmap& bmp) *dst++ = pRow[2]; // B *dst++ = 255; - pRow += 3; + pRow += 3; break; } @@ -1315,8 +1315,8 @@ VideoDX9::SetViewport(int x, int y, int w, int h) view.Y = y; view.Width = w; view.Height = h; - view.MinZ = 0.0f; - view.MaxZ = 1.0f; + view.MinZ = 0.0f; + view.MaxZ = 1.0f; hr = d3ddevice->SetViewport(&view); if (FAILED(hr)) { @@ -1460,7 +1460,7 @@ VideoDX9::SetProjection(float fov, float znear, float zfar, DWORD type) /*** *** PERSPECTIVE PROJECTION: - ***/ + ***/ if (type == PROJECTION_PERSPECTIVE) { double xscale = width / fov; @@ -3374,7 +3374,7 @@ VideoDX9::SetupPass(int pass) d3ddevice->SetTextureStageState(1, D3DTSS_COLORARG2, D3DTA_TEXTURE); d3ddevice->SetTextureStageState(1, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1); d3ddevice->SetTextureStageState(1, D3DTSS_ALPHAARG1, D3DTA_CURRENT); - d3ddevice->SetTextureStageState(1, D3DTSS_TEXCOORDINDEX, 0); + d3ddevice->SetTextureStageState(1, D3DTSS_TEXCOORDINDEX, 0); d3ddevice->SetTextureStageState(2, D3DTSS_COLOROP, D3DTOP_MODULATE); d3ddevice->SetTextureStageState(2, D3DTSS_COLORARG1, D3DTA_CURRENT); @@ -3397,21 +3397,21 @@ VideoDX9::SetupPass(int pass) d3ddevice->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE); d3ddevice->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1); d3ddevice->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_DIFFUSE); - d3ddevice->SetTextureStageState(0, D3DTSS_TEXCOORDINDEX, 0); + d3ddevice->SetTextureStageState(0, D3DTSS_TEXCOORDINDEX, 0); d3ddevice->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_BLENDCURRENTALPHA); d3ddevice->SetTextureStageState(1, D3DTSS_COLORARG1, D3DTA_CURRENT); d3ddevice->SetTextureStageState(1, D3DTSS_COLORARG2, D3DTA_TEXTURE); d3ddevice->SetTextureStageState(1, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1); d3ddevice->SetTextureStageState(1, D3DTSS_ALPHAARG1, D3DTA_CURRENT); - d3ddevice->SetTextureStageState(1, D3DTSS_TEXCOORDINDEX, 0); + d3ddevice->SetTextureStageState(1, D3DTSS_TEXCOORDINDEX, 0); d3ddevice->SetTextureStageState(2, D3DTSS_COLOROP, D3DTOP_BLENDTEXTUREALPHA); d3ddevice->SetTextureStageState(2, D3DTSS_COLORARG1, D3DTA_TEXTURE); d3ddevice->SetTextureStageState(2, D3DTSS_COLORARG2, D3DTA_CURRENT); d3ddevice->SetTextureStageState(2, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1); d3ddevice->SetTextureStageState(2, D3DTSS_ALPHAARG1, D3DTA_CURRENT); - d3ddevice->SetTextureStageState(2, D3DTSS_TEXCOORDINDEX, 1); + d3ddevice->SetTextureStageState(2, D3DTSS_TEXCOORDINDEX, 1); d3ddevice->SetTextureStageState(3, D3DTSS_COLOROP, D3DTOP_MODULATE); d3ddevice->SetTextureStageState(3, D3DTSS_COLORARG1, D3DTA_CURRENT); diff --git a/Magic2/VideoDX9.h b/Magic2/VideoDX9.h index fdc37ff..675a464 100644 --- a/Magic2/VideoDX9.h +++ b/Magic2/VideoDX9.h @@ -33,7 +33,7 @@ OVERVIEW ======== - Direct3D and Direct3D Video classes for DirectX 7 + Direct3D and Direct3D Video classes for DirectX 7 */ #ifndef VideoDX9_h @@ -67,7 +67,7 @@ public: VideoDX9(const HWND& window, VideoSettings* vs); virtual ~VideoDX9(); - virtual const VideoSettings* + virtual const VideoSettings* GetVideoSettings() const { return &video_settings; } virtual bool SetVideoSettings(const VideoSettings* vs); @@ -114,9 +114,9 @@ public: virtual bool SetEnvironment(Bitmap** faces); virtual bool SetAmbient(Color c); virtual bool SetLights(const List& lights); - virtual bool SetProjection(float fov, - float znear=1.0f, - float zfar=1.0e6f, + virtual bool SetProjection(float fov, + float znear=1.0f, + float zfar=1.0e6f, DWORD type=PROJECTION_PERSPECTIVE); virtual bool SetRenderState(RENDER_STATE state, DWORD value); virtual bool SetBlendType(int blend_type); diff --git a/Magic2/l3ds.cpp b/Magic2/l3ds.cpp index 3cbdcfa..3f9ed47 100644 --- a/Magic2/l3ds.cpp +++ b/Magic2/l3ds.cpp @@ -15,12 +15,12 @@ //------------------------------------------------------- // generic stuff //------------------------------------------------------- - + typedef unsigned long ulong; #define SEEK_START 1900 #define SEEK_CURSOR 1901 - + // common chunks // colors #define COLOR_F 0x0010 @@ -40,7 +40,7 @@ typedef unsigned long ulong; // keyframer chunk ids #define KFDATA 0xB000 // the keyframer section #define KFHDR 0xB00A -#define OBJECT_NODE_TAG 0xB002 +#define OBJECT_NODE_TAG 0xB002 #define NODE_HDR 0xB010 #define PIVOT 0xB013 #define POS_TRACK_TAG 0xB020 @@ -446,7 +446,7 @@ void LMesh::SetTriangleArraySize(uint value) const LVector4& LMesh::GetVertex(uint index) { - return m_vertices[index]; + return m_vertices[index]; } const LVector3& LMesh::GetNormal(uint index) @@ -494,7 +494,7 @@ void LMesh::SetTangent(const LVector3 &vec, uint index) { if (index >= m_vertices.size()) return; - m_tangents[index] = vec; + m_tangents[index] = vec; } void LMesh::SetBinormal(const LVector3 &vec, uint index) @@ -520,11 +520,11 @@ LTriangle2 LMesh::GetTriangle2(uint index) f.vertexNormals[0] = GetNormal(t.a); f.vertexNormals[1] = GetNormal(t.b); f.vertexNormals[2] = GetNormal(t.c); - + f.textureCoords[0] = GetUV(t.a); f.textureCoords[1] = GetUV(t.b); f.textureCoords[2] = GetUV(t.c); - + LVector3 a, b; a = SubtractVectors(_4to3(f.vertices[1]), _4to3(f.vertices[0])); @@ -535,7 +535,7 @@ LTriangle2 LMesh::GetTriangle2(uint index) f.faceNormal = NormalizeVector(f.faceNormal); f.materialId = m_tris[index].materialId; - + return f; } @@ -581,10 +581,10 @@ void LMesh::CalcNormals(bool useSmoothingGroups) k = m_tris[i].c; array[k].push_back(i); - } + } LVector3 temp; - + if (!useSmoothingGroups) { // now calculate the normals without using smoothing groups @@ -608,7 +608,7 @@ void LMesh::CalcNormals(bool useSmoothingGroups) // I'm assuming a triangle can only belong to one smoothing group at a time! std::vector smGroups; std::vector< std::vector > smList; - + uint loop_size = m_vertices.size(); for (i=0; i m_binormals; std::vector m_tangents; std::vector m_uv; - + // triangles std::vector m_triangles; @@ -298,7 +298,7 @@ public: LLight(); // the destructor virtual ~LLight(); - // clears the data the class holds + // clears the data the class holds void Clear(); // sets the position of the light source - for internal use void SetPosition(LVector3 vec); @@ -316,7 +316,7 @@ public: void SetTarget(LVector3 target); // returns the target of the spotlight LVector3 GetTarget(); - // sets the hotspot - internal use + // sets the hotspot - internal use void SetHotspot(float value); // returns the hotspot float GetHotspot(); @@ -358,7 +358,7 @@ public: LMaterial& GetMaterial(uint index); // returns the pointer to the material with a given name, or NULL if the material was not found LMaterial* FindMaterial(const std::string &name); - // returns the pointer to the mesh with a given name, or NULL if the mesh with such name + // returns the pointer to the mesh with a given name, or NULL if the mesh with such name // is not present in the scene LMesh* FindMesh(const std::string &name); // returns the pointer to the light with a given name, or NULL if not found @@ -390,7 +390,7 @@ public: L3DS(const char *filename); // destructor virtual ~L3DS(); - // load 3ds file + // load 3ds file virtual bool LoadFile(const char *filename); protected: // used internally for reading @@ -414,7 +414,7 @@ protected: float ReadFloat(); //reads an unsigned byte from the buffer byte ReadByte(); - //reads an asciiz string + //reads an asciiz string int ReadASCIIZ(char *buf, int max_count); // seek wihtin the buffer void Seek(int offset, int origin); @@ -436,7 +436,7 @@ protected: float ReadPercentage(const LChunk &chunk); // this is where 3ds file is being read bool Read3DS(); - // read a light chunk + // read a light chunk void ReadLight(const LChunk &parent); // read a trimesh chunk void ReadMesh(const LChunk &parent); diff --git a/Magic2/resource.h b/Magic2/resource.h index 84d4573..813abe0 100644 --- a/Magic2/resource.h +++ b/Magic2/resource.h @@ -221,7 +221,7 @@ #define ID_SURFACE_EXPLODE 32864 // Next default values for new objects -// +// #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_3D_CONTROLS 1 -- cgit v1.1