EXAMPLE1.C

Go to the documentation of this file.
00001 /* --
00002 OpenFX version 1.0 - Modelling, Animation and Rendering Package
00003 Copyright (C) 2000 OpenFX Development Team
00004 
00005 This program is free software; you can redistribute it and/or
00006 modify it under the terms of the GNU General Public License
00007 as published by the Free Software Foundation; either version 2
00008 of the License, or (at your option) any later version.
00009 
00010 This program is distributed in the hope that it will be useful,
00011 but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 GNU General Public License for more details.
00014 
00015 You should have received a copy of the GNU General Public License
00016 along with this program; if not, write to the Free Software
00017 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00018 
00019 You may contact the OpenFX development team via elecronic mail
00020 at core@openfx.org, or visit our website at http://openfx.org for
00021 further information and support details.
00022 -- */
00023 
00024 /* MODEL1.C                */
00025 
00026 #include <math.h>
00027 #include <windows.h>
00028 
00029 #include "example1.h"
00030 
00031 #if __ZTC__ || __SC__
00032 #ifndef max
00033 #define max(a,b)  ( ((a) > (b)) ? (a) : (b) )
00034 #endif
00035 #endif
00036 
00037 #if __X__MIPS__
00038 BOOL WINAPI _CRT_INIT(HINSTANCE ,DWORD , LPVOID );
00039 #endif
00040 
00041 static HINSTANCE hDLLinstance=NULL; /* use to pick up resources from DLL   */
00042 
00043 #include "..\animate\astruct.h"
00044 #include "..\animate\dstruct.h"
00045 
00046 
00047 #if __WATCOMC__
00048 int APIENTRY LibMain(HANDLE hDLL, DWORD dwReason, LPVOID lpReserved){
00049 #else
00050 BOOL WINAPI DllMain(HANDLE hDLL, DWORD dwReason, LPVOID lpReserved){
00051 #endif
00052   switch (dwReason) {
00053     case DLL_PROCESS_ATTACH:
00054 #if __X__MIPS__
00055       if(!_CRT_INIT(hDLL,dwReason,lpReserved))return(int)FALSE;
00056 #endif
00057       hDLLinstance = hDLL;  /* handle to DLL file */
00058       break;
00059     case DLL_PROCESS_DETACH:
00060 #if __X__MIPS__
00061       if(!_CRT_INIT(hDLL,dwReason,lpReserved))return(int)FALSE;
00062 #endif
00063       break;
00064   }
00065 return (int)TRUE;
00066 }
00067 
00068 #if __SC__
00069 #pragma startaddress(LibMain)
00070 #endif
00071 
00072 
00073 BOOL _ExternalPreset(HWND parent, ANI_STRUCTURE *lpevi){
00074  object   *Op;
00075  position *Pp;
00076  char f_name[255],f_dir[255];
00077  lpEVI=lpevi;
00078  MessageBox(parent,"Example1 External Script","Debug",MB_OK);
00079  SetNumberOfFrames(60);
00080  /* add Camera position channel and move the camera - Camera always present */
00081  if(CreatePosition(FirstNp,1,(short)Nframes) == NULL)return FALSE;
00082  FirstNp->fpos->finish[0]=TVpointX+TVsizeX*2;
00083  FirstNp->fpos->finish[1]=TVpointY+TVsizeY*2;
00084  FirstNp->fpos->finish[2]=TVpointZ+TVsizeZ*2;
00085  /* create a Target Actor and Costume default at (0,0,0) */
00086  if(CreateNode() == NULL)return FALSE;
00087  strcpy(MainNp->actorname,"Target");
00088  MainNp->type=TARGET;
00089  if((Op=CreateActor(MainNp,1,(short)Nframes)) == NULL)return FALSE;
00090  Op->type=MainNp->type;
00091  /* Now point the Camera to Look at the target */
00092  if(CreateAlign(FirstNp,1,(short)Nframes) == NULL)return FALSE;
00093  FirstNp->fali->type=TRACK; FirstNp->fali->topath=MainNp;
00094  /* Now load a light actor */
00095  if(CreateNode() == NULL)return FALSE;
00096  strcpy(MainNp->actorname,"Light");
00097  MainNp->type=LIGHT;
00098  if((Op=CreateActor(MainNp,1,Nframes)) == NULL)return FALSE;
00099  Op->type=MainNp->type;
00100  Op->lighttype=SPHERE; Op->colour[0]=Op->colour[1]=Op->colour[2]=255;
00101  /* Position Channel for Light */
00102  if((Pp=CreatePosition(MainNp,1,(short)Nframes)) == NULL)return FALSE;
00103  Pp->finish[0]=FirstNp->fpos->finish[0]+TVsizeX/2;
00104  Pp->finish[1]=FirstNp->fpos->finish[1]+TVsizeY;
00105  Pp->finish[2]=FirstNp->fpos->finish[2]+TVsizeZ*2;
00106  /* Add Actor with Chosen Model for Costume */
00107  if(CreateNode() == NULL)return FALSE;
00108  strcpy(MainNp->actorname,"Actor");
00109  MainNp->type=NORMAL;
00110  if((Op=CreateActor(MainNp,1,(short)Nframes)) == NULL)return FALSE;
00111  Op->type=MainNp->type;
00112  strcpy(f_dir,gszHomeDir); strcat(f_dir,"objects"); strcpy(f_name,"*.sce");
00113  if(SelectFileName(0,f_name,f_dir,"Choose Actor's Costume",
00114                    "(*.SCE)|*.sce|",parent) == TRUE){
00115    strcpy(Op->name,f_name);
00116    Op->morph=NO;
00117    if(StageLoadObject(f_name,Op,YES,YES,NO) == FAIL)DeleteActor(MainNp,1);
00118  }
00119  else return FALSE;
00120 
00121  return TRUE;
00122 }

Generated on Sun Apr 27 14:20:13 2014 for OpenFX by  doxygen 1.5.6