浏览代码

Synchronized fur demos

GLScene 2 年之前
父节点
当前提交
90d83442c8

+ 3 - 0
Examples/Demos/glslshaders/FurShader/FurShaderD.dpr

@@ -1,3 +1,6 @@
+(*
+   Thor's fur coat rotation created by Trinix
+*)
 program FurShaderD;
 program FurShaderD;
 
 
 uses
 uses

+ 1 - 2
Examples/Demos/glslshaders/FurShader/FurShaderD.dproj

@@ -97,7 +97,7 @@
         <VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
         <VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
         <VerInfo_Locale>1033</VerInfo_Locale>
         <VerInfo_Locale>1033</VerInfo_Locale>
         <VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName)</VerInfo_Keys>
         <VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName)</VerInfo_Keys>
-        <Icon_MainIcon>..\..\..\Asset\Button\GLScene.ico</Icon_MainIcon>
+        <Icon_MainIcon>$(BDS)\bin\delphi_PROJECTICON.ico</Icon_MainIcon>
     </PropertyGroup>
     </PropertyGroup>
     <ItemGroup>
     <ItemGroup>
         <DelphiCompile Include="$(MainSource)">
         <DelphiCompile Include="$(MainSource)">
@@ -127,7 +127,6 @@
                     <Source Name="MainSource">FurShaderD.dpr</Source>
                     <Source Name="MainSource">FurShaderD.dpr</Source>
                 </Source>
                 </Source>
                 <Excluded_Packages>
                 <Excluded_Packages>
-                    <Excluded_Packages Name="C:\Users\Public\Documents\Embarcadero\Studio\22.0\Bpl\GBE3D.bpl">File C:\Users\Public\Documents\Embarcadero\Studio\22.0\Bpl\GBE3D.bpl not found</Excluded_Packages>
                     <Excluded_Packages Name="$(BDSBIN)\bcboffice2k280.bpl">Embarcadero C++Builder Office 2000 Servers Package</Excluded_Packages>
                     <Excluded_Packages Name="$(BDSBIN)\bcboffice2k280.bpl">Embarcadero C++Builder Office 2000 Servers Package</Excluded_Packages>
                     <Excluded_Packages Name="$(BDSBIN)\bcbofficexp280.bpl">Embarcadero C++Builder Office XP Servers Package</Excluded_Packages>
                     <Excluded_Packages Name="$(BDSBIN)\bcbofficexp280.bpl">Embarcadero C++Builder Office XP Servers Package</Excluded_Packages>
                     <Excluded_Packages Name="$(BDSBIN)\dcloffice2k280.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
                     <Excluded_Packages Name="$(BDSBIN)\dcloffice2k280.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>

+ 0 - 1
Examples/Demos/glslshaders/FurShader/fFurShaderD.dfm

@@ -32,7 +32,6 @@ object FormFur: TFormFur
     OnMouseDown = GLViewerMouseDown
     OnMouseDown = GLViewerMouseDown
     OnMouseMove = GLViewerMouseMove
     OnMouseMove = GLViewerMouseMove
     TabOrder = 0
     TabOrder = 0
-    ExplicitWidth = 731
   end
   end
   object GLScene1: TGLScene
   object GLScene1: TGLScene
     Left = 24
     Left = 24

+ 0 - 1
Examples/Demos/glslshaders/FurShader/fFurShaderD.pas

@@ -1,4 +1,3 @@
-(* Created by Trinix *)
 unit fFurShaderD;
 unit fFurShaderD;
 
 
 interface
 interface

+ 148 - 150
Examples/Demos/materials/multipass/fMultipassC.cpp

@@ -8,7 +8,7 @@
    You'll also note the glPolygonOffset call, it displaces fragments depths
    You'll also note the glPolygonOffset call, it displaces fragments depths
    value a little "farther away" so that surface fill depth values do not
    value a little "farther away" so that surface fill depth values do not
    interact with the rendering of the lines (comment out the call and you'll
    interact with the rendering of the lines (comment out the call and you'll
-   see).<br>
+   see).
    The axis and sphere allow you to see the limit of that simple technique:
    The axis and sphere allow you to see the limit of that simple technique:
    it actually "paints" between the lines, so you cannot use it to make
    it actually "paints" between the lines, so you cannot use it to make
    transparent wireframed objects with hidden lines - if that thought ever
    transparent wireframed objects with hidden lines - if that thought ever
@@ -39,187 +39,185 @@
 #include "GLS.OpenGLTokens.hpp"
 #include "GLS.OpenGLTokens.hpp"
 
 
 #pragma resource "*.dfm"
 #pragma resource "*.dfm"
-TForm1 *Form1;
+TForm1* Form1;
 //---------------------------------------------------------------------------
 //---------------------------------------------------------------------------
-__fastcall TForm1::TForm1(TComponent* Owner)
-        : TForm(Owner)
-{
-}
+__fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) {}
 //---------------------------------------------------------------------------
 //---------------------------------------------------------------------------
-__fastcall THiddenLineShader::THiddenLineShader(TComponent* AOwner)
-        : TGLShader(AOwner)
+__fastcall THiddenLineShader::THiddenLineShader(TComponent* AOwner) :
+    TGLShader(AOwner)
 {
 {
 }
 }
 //---------------------------------------------------------------------------
 //---------------------------------------------------------------------------
-__fastcall THiddenLineShader::~THiddenLineShader(void)
-{
-}  
+__fastcall THiddenLineShader::~THiddenLineShader(void) {}
 //---------------------------------------------------------------------------
 //---------------------------------------------------------------------------
-void __fastcall THiddenLineShader::DoApply(TGLRenderContextInfo &rci, System::TObject* Sender)
+void __fastcall THiddenLineShader::DoApply(
+    TGLRenderContextInfo &rci, System::TObject* Sender)
 {
 {
-  // new object getting rendered, 1st pass
-  PassCount = 1;
-
-  // backup state
-  glPushAttrib(GL_ENABLE_BIT);
-  // disable lighting, this is a solid fill
-  glDisable(GL_LIGHTING);
-  rci.GLStates->PolygonMode = GL_FRONT_AND_BACK, GL_FILL;
-  // use background color
-  glColor3fv(&BackgroundColor.X);
-  // enable and adjust polygon offset
-  glEnable(GL_POLYGON_OFFSET_FILL);
-  glPolygonOffset(1, 2);
+    // new object getting rendered, 1st pass
+    PassCount = 1;
+
+    // backup state
+    glPushAttrib(GL_ENABLE_BIT);
+    // disable lighting, this is a solid fill
+    glDisable(GL_LIGHTING);
+    rci.GLStates->PolygonMode = GL_FRONT_AND_BACK, GL_FILL;
+    // use background color
+    glColor3fv(&BackgroundColor.X);
+    // enable and adjust polygon offset
+    glEnable(GL_POLYGON_OFFSET_FILL);
+    glPolygonOffset(1, 2);
 }
 }
 //---------------------------------------------------------------------------
 //---------------------------------------------------------------------------
 bool __fastcall THiddenLineShader::DoUnApply(TGLRenderContextInfo &rci)
 bool __fastcall THiddenLineShader::DoUnApply(TGLRenderContextInfo &rci)
 {
 {
-  bool result;
-
-  switch (PassCount)
-  {
-    case 1 : {
-       // 1st pass completed, we setup for the second
-       PassCount = 2;
-
-       // switch to wireframe and its color
-       rci.GLStates->PolygonMode = GL_FRONT_AND_BACK, GL_LINE;
-       glColor3fv(&LineColor.X);
-       // disable polygon offset
-       glDisable(GL_POLYGON_OFFSET_LINE);
-
-       result = true;
-       break;
-    }
-    case 2 : {
-       // restore state
-       glPopAttrib();
-
-       // we're done
-       result = false;
-       break;
+    bool result;
+
+    switch (PassCount) {
+        case 1: {
+            // 1st pass completed, we setup for the second
+            PassCount = 2;
+
+            // switch to wireframe and its color
+            rci.GLStates->PolygonMode = GL_FRONT_AND_BACK, GL_LINE;
+            glColor3fv(&LineColor.X);
+            // disable polygon offset
+			glDisable(GL_POLYGON_OFFSET_LINE);
+
+            result = true;
+            break;
+        }
+        case 2: {
+            // restore state
+            glPopAttrib();
+
+            // we're done
+            result = false;
+            break;
+        }
+        default: {
+            // doesn't hurt to be cautious
+            assert(false);
+            result = false;
+        }
     }
     }
-    default : {
-      // doesn't hurt to be cautious
-      assert(false);
-      result = false;
-    }
-  }
-  return result;
+    return result;
 }
 }
 //---------------------------------------------------------------------------
 //---------------------------------------------------------------------------
-__fastcall TOutLineShader::TOutLineShader(TComponent* AOwner)
-         : TGLShader(AOwner)
+__fastcall TOutLineShader::TOutLineShader(TComponent* AOwner) :
+    TGLShader(AOwner)
 {
 {
 }
 }
 //---------------------------------------------------------------------------
 //---------------------------------------------------------------------------
-__fastcall TOutLineShader::~TOutLineShader(void)
-{
-}
+__fastcall TOutLineShader::~TOutLineShader(void) {}
 //---------------------------------------------------------------------------
 //---------------------------------------------------------------------------
-void __fastcall TOutLineShader::DoApply(TGLRenderContextInfo &rci, System::TObject* Sender)
+void __fastcall TOutLineShader::DoApply(
+    TGLRenderContextInfo &rci, System::TObject* Sender)
 {
 {
-   PassCount = 1;
-   glPushAttrib(GL_ENABLE_BIT);
-   glDisable(GL_LIGHTING);
-
-   if (OutlineSmooth)
-   {
-      glEnable(GL_BLEND);
-      glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
-      glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
-      glEnable(GL_LINE_SMOOTH);
-   }
-   else glDisable(GL_LINE_SMOOTH);
-
-   glGetFloatv(GL_LINE_WIDTH,&OldlineWidth);
-   glLineWidth(OutlineWidth);
-   glPolygonMode(GL_BACK, GL_LINE);
-   glCullFace(GL_FRONT);
-   glDepthFunc(GL_LEQUAL);
-   glColor3fv(&LineColor.X);
+	PassCount = 1;
+    glPushAttrib(GL_ENABLE_BIT);
+    glDisable(GL_LIGHTING);
+
+    if (OutlineSmooth) {
+        glEnable(GL_BLEND);
+        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+        glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
+        glEnable(GL_LINE_SMOOTH);
+    } else
+        glDisable(GL_LINE_SMOOTH);
+
+    glGetFloatv(GL_LINE_WIDTH, &OldlineWidth);
+    glLineWidth(OutlineWidth);
+    glPolygonMode(GL_BACK, GL_LINE);
+    glCullFace(GL_FRONT);
+    glDepthFunc(GL_LEQUAL);
+    glColor3fv(&LineColor.X);
 }
 }
 //---------------------------------------------------------------------------
 //---------------------------------------------------------------------------
 bool __fastcall TOutLineShader::DoUnApply(TGLRenderContextInfo &rci)
 bool __fastcall TOutLineShader::DoUnApply(TGLRenderContextInfo &rci)
 {
 {
-  bool result;
-
-  switch (PassCount)
-  {
-    case 1 : {
-       PassCount=2;
-       if (Lighting)
-         glEnable(GL_LIGHTING);
-       else glColor3fv(&BackgroundColor.X);
-       glDepthFunc(GL_LESS);
-       glCullFace(GL_BACK);
-       glPolygonMode(GL_BACK, GL_FILL);
-
-       result=true;
-       break;
-    }
-    case 2 : {
-       glPopAttrib();
-       glLineWidth(OldlineWidth);
-       result=false;
-       break;
-    }
-    default : {
-      assert(false);
-      result=false;
+    bool result;
+
+    switch (PassCount) {
+        case 1: {
+            PassCount = 2;
+            if (Lighting)
+                glEnable(GL_LIGHTING);
+            else
+                glColor3fv(&BackgroundColor.X);
+            glDepthFunc(GL_LESS);
+			glCullFace(GL_BACK);
+            glPolygonMode(GL_BACK, GL_FILL);
+
+            result = true;
+            break;
+        }
+        case 2: {
+            glPopAttrib();
+            glLineWidth(OldlineWidth);
+            result = false;
+            break;
+        }
+        default: {
+            assert(false);
+            result = false;
+        }
     }
     }
-  }
-  return result;
+    return result;
 }
 }
 //---------------------------------------------------------------------------
 //---------------------------------------------------------------------------
-void __fastcall TForm1::BUBindClick(TObject *Sender)
+void __fastcall TForm1::BUBindClick(TObject* Sender)
 {
 {
-  THiddenLineShader *shader1;
-  TOutLineShader *shader2 ,*shader3;
-
-  BUBind->Enabled=False;
-
-  // instantiate our shaders
-
-  shader1 = new THiddenLineShader(this);
-  shader1->BackgroundColor=ConvertWinColor(GLSceneViewer1->Buffer->BackgroundColor,0);
-  shader1->LineColor=clrBlue;
-
-  shader2 = new TOutLineShader(this);
-
-  shader2->BackgroundColor=ConvertWinColor(GLSceneViewer1->Buffer->BackgroundColor,0);
-  shader2->OutlineSmooth=true;
-  shader2->OutlineWidth=2;
-  shader2->Lighting=false;
-  shader2->LineColor=clrBlack;
-
-
-  shader3 = new TOutLineShader(this);
-  shader3->BackgroundColor=ConvertWinColor(GLSceneViewer1->Buffer->BackgroundColor,0);
-  shader3->OutlineSmooth=false;
-  shader3->OutlineWidth=4;
-  shader3->Lighting=true;
-  shader3->LineColor=clrRed;
-
-  // binds the shaders to the materials
-  GLMaterialLibrary1->Materials->Items[0]->Shader=shader1;
-  GLMaterialLibrary1->Materials->Items[1]->Shader=shader2;
-  GLMaterialLibrary1->Materials->Items[2]->Shader=shader3;
+    THiddenLineShader* shader1;
+    TOutLineShader *shader2, *shader3;
+
+    BUBind->Enabled = False;
+
+    // instantiate our shaders
+
+    shader1 = new THiddenLineShader(this);
+    shader1->BackgroundColor =
+        ConvertWinColor(GLSceneViewer1->Buffer->BackgroundColor, 0);
+	shader1->LineColor = clrBlue;
+
+    shader2 = new TOutLineShader(this);
+
+    shader2->BackgroundColor =
+        ConvertWinColor(GLSceneViewer1->Buffer->BackgroundColor, 0);
+    shader2->OutlineSmooth = true;
+    shader2->OutlineWidth = 2;
+    shader2->Lighting = false;
+    shader2->LineColor = clrBlack;
+
+    shader3 = new TOutLineShader(this);
+    shader3->BackgroundColor =
+        ConvertWinColor(GLSceneViewer1->Buffer->BackgroundColor, 0);
+    shader3->OutlineSmooth = false;
+    shader3->OutlineWidth = 4;
+    shader3->Lighting = true;
+    shader3->LineColor = clrRed;
+
+    // binds the shaders to the materials
+    GLMaterialLibrary1->Materials->Items[0]->Shader = shader1;
+    GLMaterialLibrary1->Materials->Items[1]->Shader = shader2;
+    GLMaterialLibrary1->Materials->Items[2]->Shader = shader3;
 }
 }
 //---------------------------------------------------------------------------
 //---------------------------------------------------------------------------
-void __fastcall TForm1::GLSceneViewer1MouseDown(TObject *Sender,
-      TMouseButton Button, TShiftState Shift, int X, int Y)
+void __fastcall TForm1::GLSceneViewer1MouseDown(
+    TObject* Sender, TMouseButton Button, TShiftState Shift, int X, int Y)
 {
 {
-   mx=X; my=Y;
+    mx = X;
+    my = Y;
 }
 }
 //---------------------------------------------------------------------------
 //---------------------------------------------------------------------------
-void __fastcall TForm1::GLSceneViewer1MouseMove(TObject *Sender,
-      TShiftState Shift, int X, int Y)
+void __fastcall TForm1::GLSceneViewer1MouseMove(
+    TObject* Sender, TShiftState Shift, int X, int Y)
 {
 {
-   if (Shift.Contains(ssLeft))
-      GLCamera1->MoveAroundTarget(my-Y, mx-X);
-   else if (Shift.Contains(ssRight))
-      GLCamera1->RotateTarget(my-Y, mx-X, 0);
-   mx=X; my=Y;
+    if (Shift.Contains(ssLeft))
+        GLCamera1->MoveAroundTarget(my - Y, mx - X);
+    else if (Shift.Contains(ssRight))
+        GLCamera1->RotateTarget(my - Y, mx - X, 0);
+    mx = X;
+    my = Y;
 }
 }
 //---------------------------------------------------------------------------
 //---------------------------------------------------------------------------
+

+ 1 - 3
Examples/Demos/materials/multipass/fMultipassC.dfm

@@ -10,9 +10,7 @@ object Form1: TForm1
   Font.Height = -10
   Font.Height = -10
   Font.Name = 'MS Sans Serif'
   Font.Name = 'MS Sans Serif'
   Font.Style = []
   Font.Style = []
-  OldCreateOrder = False
-  WindowState = wsMaximized
-  PixelsPerInch = 96
+  Position = poScreenCenter
   TextHeight = 13
   TextHeight = 13
   object GLSceneViewer1: TGLSceneViewer
   object GLSceneViewer1: TGLSceneViewer
     Left = 0
     Left = 0

+ 42 - 43
Examples/Demos/materials/multipass/fMultipassC.h

@@ -19,62 +19,61 @@
 //---------------------------------------------------------------------------
 //---------------------------------------------------------------------------
 class TForm1 : public TForm
 class TForm1 : public TForm
 {
 {
-__published:	// IDE-managed Components
-        TGLSceneViewer *GLSceneViewer1;
-        TButton *BUBind;
-        TGLScene *GLScene1;
-        TGLLightSource *GLLightSource1;
-        TGLTorus *Torus1;
-        TGLSphere *Sphere1;
-        TGLAnnulus *GLAnnulus1;
-        TGLAnnulus *GLAnnulus2;
-        TGLCube *GLCube1;
-        TGLSphere *GLSphere1;
-        TGLCamera *GLCamera1;
-        TGLMaterialLibrary *GLMaterialLibrary1;
-        void __fastcall BUBindClick(TObject *Sender);
-        void __fastcall GLSceneViewer1MouseDown(TObject *Sender,
-          TMouseButton Button, TShiftState Shift, int X, int Y);
-        void __fastcall GLSceneViewer1MouseMove(TObject *Sender,
-          TShiftState Shift, int X, int Y);
-private:	// User declarations
-        int mx, my;
-public:		// User declarations
-        __fastcall TForm1(TComponent* Owner);
+  __published: // IDE-managed Components
+    TGLSceneViewer* GLSceneViewer1;
+    TButton* BUBind;
+    TGLScene* GLScene1;
+    TGLLightSource* GLLightSource1;
+    TGLTorus* Torus1;
+    TGLSphere* Sphere1;
+    TGLAnnulus* GLAnnulus1;
+    TGLAnnulus* GLAnnulus2;
+    TGLCube* GLCube1;
+    TGLSphere* GLSphere1;
+    TGLCamera* GLCamera1;
+    TGLMaterialLibrary* GLMaterialLibrary1;
+    void __fastcall BUBindClick(TObject* Sender);
+    void __fastcall GLSceneViewer1MouseDown(
+        TObject* Sender, TMouseButton Button, TShiftState Shift, int X, int Y);
+    void __fastcall GLSceneViewer1MouseMove(
+        TObject* Sender, TShiftState Shift, int X, int Y);
+  private: // User declarations
+    int mx, my;
+  public: // User declarations
+    __fastcall TForm1(TComponent* Owner);
 };
 };
 //---------------------------------------------------------------------------
 //---------------------------------------------------------------------------
 class THiddenLineShader : public TGLShader
 class THiddenLineShader : public TGLShader
 {
 {
-private:
+  private:
+  public:
+    __fastcall virtual THiddenLineShader(TComponent* AOwner);
+    __fastcall virtual ~THiddenLineShader(void);
 
 
-public:
-	__fastcall virtual THiddenLineShader(TComponent* AOwner);
-	__fastcall virtual ~THiddenLineShader(void);
+    TGLColorVector BackgroundColor, LineColor;
+    int PassCount;
 
 
-        TGLColorVector BackgroundColor, LineColor;
-        int PassCount;
-
-	void __fastcall DoApply(TGLRenderContextInfo &rci, System::TObject* Sender);
-	bool __fastcall DoUnApply(TGLRenderContextInfo &rci);
+    void __fastcall DoApply(TGLRenderContextInfo &rci, System::TObject* Sender);
+    bool __fastcall DoUnApply(TGLRenderContextInfo &rci);
 };
 };
 
 
 class TOutLineShader : public TGLShader
 class TOutLineShader : public TGLShader
 {
 {
-private:
+  private:
+  public:
+    __fastcall virtual TOutLineShader(TComponent* AOwner);
+    __fastcall virtual ~TOutLineShader(void);
 
 
-public:
-	__fastcall virtual TOutLineShader(TComponent* AOwner);
-	__fastcall virtual ~TOutLineShader(void);
-        
-        TGLColorVector BackgroundColor, LineColor;
-        bool OutlineSmooth, Lighting;
-        float OutlineWidth, OldlineWidth;
-        int PassCount;
+    TGLColorVector BackgroundColor, LineColor;
+    bool OutlineSmooth, Lighting;
+    float OutlineWidth, OldlineWidth;
+    int PassCount;
 
 
-	void __fastcall DoApply(TGLRenderContextInfo &rci, System::TObject* Sender);
-	bool __fastcall DoUnApply(TGLRenderContextInfo &rci);
+    void __fastcall DoApply(TGLRenderContextInfo &rci, System::TObject* Sender);
+    bool __fastcall DoUnApply(TGLRenderContextInfo &rci);
 };
 };
 //---------------------------------------------------------------------------
 //---------------------------------------------------------------------------
-extern PACKAGE TForm1 *Form1;
+extern PACKAGE TForm1* Form1;
 //---------------------------------------------------------------------------
 //---------------------------------------------------------------------------
 #endif
 #endif
+