[Igarden-commit] Garden/source/Plugins RenderPlugin.cpp, 1.13.2.5, 1.13.2.6
Status: Beta
Brought to you by:
jlbedell
|
From: Jeffrey B. <jlb...@us...> - 2007-01-12 00:14:01
|
Update of /cvsroot/igarden/Garden/source/Plugins In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv6789 Modified Files: Tag: Release_branch_v1 RenderPlugin.cpp Log Message: Make a new drawing style with variable sized plants Index: RenderPlugin.cpp =================================================================== RCS file: /cvsroot/igarden/Garden/source/Plugins/RenderPlugin.cpp,v retrieving revision 1.13.2.5 retrieving revision 1.13.2.6 diff -C2 -d -r1.13.2.5 -r1.13.2.6 *** RenderPlugin.cpp 26 Dec 2006 19:05:42 -0000 1.13.2.5 --- RenderPlugin.cpp 12 Jan 2007 00:13:59 -0000 1.13.2.6 *************** *** 34,38 **** const revision_t pluginRev = { 1, 0 }; const revision_t interfaceRev = { 1, 0 }; ! const long numStyles = 3; #define kDefaultStyleFactoryID (CFUUIDGetConstantUUIDWithBytes(NULL, 0x12, 0x52, 0x90, 0xcb, 0x0b, 0xba, 0x49, 0xeb, 0x86, 0x27, 0xc1, 0xb4, 0xc5, 0xcb, 0xbb, 0x16)) --- 34,39 ---- const revision_t pluginRev = { 1, 0 }; const revision_t interfaceRev = { 1, 0 }; ! const long numStyles = 4; ! const double PI = 3.1415926535897932; #define kDefaultStyleFactoryID (CFUUIDGetConstantUUIDWithBytes(NULL, 0x12, 0x52, 0x90, 0xcb, 0x0b, 0xba, 0x49, 0xeb, 0x86, 0x27, 0xc1, 0xb4, 0xc5, 0xcb, 0xbb, 0x16)) *************** *** 268,272 **** yaaf::uuid_t uidStruct2 = { 0x350F3AB0, 0x0C0C, 0x11DA, 0xAB, 0x89, 0xC4, 0x67, 0xFD, 0x39, 0x7B, 0x7A }; yaaf::uuid_t uidStruct3 = { 0x97fa73e9, 0xecff, 0x47c1, 0xa9, 0x96, 0x02, 0x5f, 0x4d, 0x0d, 0x3c, 0x5e }; ! PRECONDITION(index < numStyles); switch(index) { --- 269,275 ---- yaaf::uuid_t uidStruct2 = { 0x350F3AB0, 0x0C0C, 0x11DA, 0xAB, 0x89, 0xC4, 0x67, 0xFD, 0x39, 0x7B, 0x7A }; yaaf::uuid_t uidStruct3 = { 0x97fa73e9, 0xecff, 0x47c1, 0xa9, 0x96, 0x02, 0x5f, 0x4d, 0x0d, 0x3c, 0x5e }; ! yaaf::uuid_t uidStruct4 = { 0x6f5e503a, 0x8400, 0x4bb7, 0xa9, 0xbf, 0xbc, 0x3f, 0x0b, 0x9e, 0x8f, 0xc8 }; ! ! PRECONDITION(index < numStyles); switch(index) { *************** *** 280,283 **** --- 283,289 ---- uid.ConvertFromBytes((unsigned char*)&uidStruct3); break; + case 3: + uid.ConvertFromBytes((unsigned char*)&uidStruct4); + break; } return kCanvasOK; *************** *** 302,305 **** --- 308,314 ---- name.SetCString("Presentation (Color)"); break; + case 3: + name.SetCString("Color"); + break; } return kCanvasOK; *************** *** 331,334 **** --- 340,344 ---- case 1: case 2: + case 3: return _presentationMaterialDraw; break; *************** *** 370,373 **** --- 380,389 ---- result = kAlwaysOff; break; + case kStyleVariableSizePlants: + if(index == 3) + result = kAlwaysOn; + else + result = kAlwaysOff; + break; } *************** *** 713,717 **** --- 729,764 ---- RGGLSVGDraw draw(_colorEnabled ? kUseColor : kUseMonochrome); ErrorCode ec; + long n; + if(_fullSpread > _ySize) + { + if(_year == kItemPrimaryYear) + glColor3f (0.25, 0.5, 0.25); + else + glColor3f (0.75, 1.0, 0.75); + + const double deltaDeg = 3.0; + const double deltaAngle = (2*PI)*deltaDeg/360.0; + const long numVertices = 360/deltaDeg; + double angle, endAngle; + planPoint_t pt; + + for(n = 0, angle=0; n <= numVertices+1; n++, angle+=deltaAngle) + { + glBegin(GL_LINES); + pt.xOffset = center.xOffset + (cos(angle) * _fullSpread/2); + pt.yOffset = center.yOffset + (sin(angle) * _fullSpread/2); + pt.zOffset = center.zOffset; + glVertex3f (pt.xOffset, pt.yOffset, _zSize); + + endAngle = angle + (deltaAngle/2.0); + pt.xOffset = center.xOffset + (cos(endAngle) * _fullSpread/2); + pt.yOffset = center.yOffset + (sin(endAngle) * _fullSpread/2); + pt.zOffset = center.zOffset; + glVertex3f (pt.xOffset, pt.yOffset, pt.zOffset+_zSize); + glEnd(); + } + } + ec = draw.Draw(spec, center.xOffset, center.yOffset, kGraphicsZ, _xSize, _ySize, _rotate, kMiddleFixed, _forcePastBounds); return (ec == yaaf::KYAAFNoError) ? kCanvasOK : kCanvasNotHandled; *************** *** 770,774 **** { ec = draw.Draw(spec, center.xOffset, center.yOffset, center.zOffset+kGraphicsZ, ! _fullSpread, _fullSpread, 0.0, kMiddleGrow, _forcePastBounds); } else --- 817,821 ---- { ec = draw.Draw(spec, center.xOffset, center.yOffset, center.zOffset+kGraphicsZ, ! _xSize, _ySize, 0.0, kMiddleGrow, _forcePastBounds); } else |