diff options
author | neodarz <neodarz@neodarz.net> | 2018-08-11 20:21:34 +0200 |
---|---|---|
committer | neodarz <neodarz@neodarz.net> | 2018-08-11 20:21:34 +0200 |
commit | 0ea5fc66924303d1bf73ba283a383e2aadee02f2 (patch) | |
tree | 2568e71a7ccc44ec23b8bb3f0ff97fb6bf2ed709 /cvs/cvsweb.cgi/code/nel/samples/pacs | |
download | nevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.tar.xz nevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.zip |
Initial commit
Diffstat (limited to '')
7 files changed, 1249 insertions, 0 deletions
diff --git a/cvs/cvsweb.cgi/code/nel/samples/pacs/CVS/?sortby=date/index.html b/cvs/cvsweb.cgi/code/nel/samples/pacs/CVS/?sortby=date/index.html new file mode 100644 index 00000000..dc601c4d --- /dev/null +++ b/cvs/cvsweb.cgi/code/nel/samples/pacs/CVS/?sortby=date/index.html @@ -0,0 +1,75 @@ +<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> +<HTML> +<HEAD> + <TITLE>nevrax.org : cvs</TITLE> + <META name="keywords" content="freesoftware,nel,newt,snowballs,richard stallman,GNU,Multi-User Online World"> + + <LINK REL=stylesheet TYPE="text/css" HREF="http://www.nevrax.org/inc/css/nevrax.css"> +</HEAD> +<BODY MARGINHEIGHT="0" MARGINWIDTH="0"> + +<!-- uplinks --> +<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0> + <TR> + <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD> + <TD WIDTH=140 BGCOLOR=#dddddd><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="16" BORDER=0 ALT=""></TD> + <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD> + <TD><IMG width=6 height=14 SRC="http://www.nevrax.org/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle> <A CLASS=uplinks HREF=http://www.nevrax.org><b>Home</B></FONT></A> </TD> + <TD><IMG width=6 height=14 SRC="http://www.nevrax.org/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle> <A CLASS=uplinks HREF=http://www.nevrax.com><b>nevrax.com</B></FONT></A> </TD> + </TR> +</TABLE> + +<!-- banner Nevrax --> +<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH=100%> + <TR><TD BGCOLOR="#000000" BACKGROUND="http://www.nevrax.org/inc/img/black_banner.jpg"><A HREF="http://www.nevrax.org"><IMG SRC="http://www.nevrax.org/inc/img/nevrax.gif" WIDTH="170" HEIGHT="45" BORDER=0 ALT="Nevrax" ></A></TD></TR> +</TABLE> + +<!-- main table --> +<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 height=100%> + <TR> + <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="10" BORDER=0 ALT=""></TD> + <TD WIDTH=140 BGCOLOR=#dddddd VALIGN=TOP ALIGN=middle><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT=""> + + <!------ Begin Box ------> + <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 BGCOLOR=black><TR><TD><TABLE border=0 cellspacing=2 cellpadding=0 width=120><tr><TD ALIGN=middle bgcolor=black> + <FONT COLOR=white FACE="sans-serif"><B>Nevrax.org</B></FONT></TD></TR><tr><td colspan=2 bgcolor=#FFFFFF> + <TABLE cellspacing=0 cellpadding=1 border=0> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/news/" TITLE="Rubrique news"><img width=13 height=15 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-news.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/news/" TITLE="News">News</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/mail/" TITLE="Rubrique mail"><img width=15 height=11 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-mail.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/mail/" TITLE="Mailing list archive">Mailing-list</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/docs/" TITLE="Rubrique docs"><img width=14 height=16 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-docs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/docs/" TITLE="Documentation">Documentation</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/cvs/" TITLE="Rubrique cvs"><img width=13 height=17 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-cvs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/cvs/" TITLE="CVS Web">CVS</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/bugs/" TITLE="Rubrique bugs"><img width=20 height=16 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-bugs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/bugs/" TITLE="Bugtracking">Bugs</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/free/" TITLE="Rubrique license"><img width=18 height=12 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-free.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/free/" TITLE="Free Software">Free software</a></td></tr> + </TABLE> + </TD></TR></TABLE></TD></TR></TABLE> + <!------ End Box ------> + + </TD> + <TD WIDTH=15><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD> + <TD ALIGN=left valign=top><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT=""> + +<!-- title --> +<TABLE background="http://www.nevrax.org/inc/img/redline.gif" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td> +<A HREF="http://www.nevrax.org/cvs/"><img src="http://www.nevrax.org/inc/img/t_cvs.gif" ALT="cvs" HEIGHT=20 BORDER=0></A> +</td><td><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="1" HEIGHT="1" BORDER=0 ALT=""> +</td></tr></table> + + +<!-- title --> +<table width=100%><tr><td align=left><b> <a href="/cvs/cvsweb.cgi/?sortby=date">Nevrax</a> / <a href="/cvs/cvsweb.cgi/code/?sortby=date">code</a> / <a href="/cvs/cvsweb.cgi/code/nel/?sortby=date">nel</a> / <a href="/cvs/cvsweb.cgi/code/nel/samples/?sortby=date">samples</a> / <a href="/cvs/cvsweb.cgi/code/nel/samples/pacs/?sortby=date">pacs</a> / CVS</b></td><td align=right><b></b></td></TR></TABLE> +<table width="100%" border=0 cellspacing=1 cellpadding=2> +<tr><th align=left bgcolor="#000000"><a class=title href="./"><font color=white>File</font></a></th></tr> +<tr bgcolor="#dddddd"><td><A HREF="../?sortby=date"><IMG SRC="http://www.nevrax.org/inc/img/picto-up.gif" ALT="[BACK]" BORDER="0" WIDTH="14" HEIGHT="13"></A> + <A HREF="../?sortby=date">Previous Directory</A> +</td></tr> + + +</table> +<!-- footer --> +<BR><FONT Size=+5> </FONT> +</TD> +<TD WIDTH=15><IMG SRC=http://www.nevrax.org/inc/img/pixel.gif WIDTH=15 HEIGHT=15 BORDER=0 ALT=""></TD> +</TR> +</TABLE> +</BODY> +</HTML></BODY></HTML> diff --git a/cvs/cvsweb.cgi/code/nel/samples/pacs/main.cpp?rev=1.2&content-type=text/x-cvsweb-markup&sortby=date/index.html b/cvs/cvsweb.cgi/code/nel/samples/pacs/main.cpp?rev=1.2&content-type=text/x-cvsweb-markup&sortby=date/index.html new file mode 100644 index 00000000..c7308944 --- /dev/null +++ b/cvs/cvsweb.cgi/code/nel/samples/pacs/main.cpp?rev=1.2&content-type=text/x-cvsweb-markup&sortby=date/index.html @@ -0,0 +1,358 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML> +<HEAD><style> A { color:black }</style> +<!-- hennerik CVSweb $Revision: 1.93 $ --> +<TITLE>code/nel/samples/pacs/main.cpp - view - 1.2</TITLE></HEAD> +<BODY BGCOLOR="#eeeeee"> +<table width="100%" border=0 cellspacing=0 cellpadding=1 bgcolor="#aaaaaa"><tr valign=bottom><td><a href="main.cpp?sortby=date"><IMG SRC="http://www.nevrax.org/inc/img/picto-up.gif" ALT="[BACK]" BORDER="0" WIDTH="14" HEIGHT="13"></a> <b>Return to <A HREF="main.cpp?sortby=date">main.cpp</A> + CVS log</b> <IMG SRC="http://www.nevrax.org/inc/img/picto-news.gif" ALT="[TXT]" BORDER="0" WIDTH="13" HEIGHT="15"></td><td align=right><IMG SRC="http://www.nevrax.org/inc/img/picto-dir.gif" ALT="[DIR]" BORDER="0" WIDTH="15" HEIGHT="13"> <b>Up to <a href="/cvs/cvsweb.cgi/?sortby=date">Nevrax</a> / <a href="/cvs/cvsweb.cgi/code/?sortby=date">code</a> / <a href="/cvs/cvsweb.cgi/code/nel/?sortby=date">nel</a> / <a href="/cvs/cvsweb.cgi/code/nel/samples/?sortby=date">samples</a> / <a href="/cvs/cvsweb.cgi/code/nel/samples/pacs/?sortby=date">pacs</a></b></td></tr></table><HR noshade><table width="100%"><tr><td bgcolor="#ffffff">File: <a href="/cvs/cvsweb.cgi/?sortby=date">Nevrax</a> / <a href="/cvs/cvsweb.cgi/code/?sortby=date">code</a> / <a href="/cvs/cvsweb.cgi/code/nel/?sortby=date">nel</a> / <a href="/cvs/cvsweb.cgi/code/nel/samples/?sortby=date">samples</a> / <a href="/cvs/cvsweb.cgi/code/nel/samples/pacs/?sortby=date">pacs</a> / <a href="/cvs/cvsweb.cgi/code/nel/samples/pacs/main.cpp?sortby=date">main.cpp</a> (<A HREF="/cvs/cvsweb.cgi/~checkout~/code/nel/samples/pacs/main.cpp?rev=1.2&sortby=date" target="cvs_checkout" onClick="window.open('/cvs/cvsweb.cgi/~checkout~/code/nel/samples/pacs/main.cpp?rev=1.2','cvs_checkout','resizeable,scrollbars');"><b>download</b></A>)<BR> +Revision <B>1.2</B>, <i>Wed Feb 20 18:07:14 2002 UTC</i> (5 months ago) by <i>lecroart</i> +<BR>Branch: <b>MAIN</b> +<BR>CVS Tags: <b>georges_v2, HEAD</b><BR>Changes since <b>1.1: +2 -2 + lines</b><PRE> +#FIXED: doxygen warning +</PRE> +</td></tr></table><HR noshade><PRE>/** \file pacs/main.cpp + * Pacs sample using user interface. + * + * $Id: main.cpp,v 1.2 2002/02/20 18:07:14 lecroart Exp $ + */ + +/* Copyright, 2001 Nevrax Ltd. + * + * This file is part of NEVRAX NEL. + * NEVRAX NEL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + + * NEVRAX NEL is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with NEVRAX NEL; see the file COPYING. If not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + */ + +#include "object.h" + +// Pacs includes +#include <nel/pacs/u_move_container.h> +#include <nel/pacs/u_move_primitive.h> +#include <nel/pacs/u_collision_desc.h> + +// Misc includes +#include <nel/misc/time_nl.h> +#include <nel/misc/path.h> + +// 3d includes +#include <nel/3d/u_camera.h> +#include <nel/3d/u_driver.h> +#include <nel/3d/u_text_context.h> +#include <nel/3d/u_instance.h> +#include <nel/3d/u_scene.h> +#include <nel/3d/u_3d_mouse_listener.h> +#include <nel/3d/u_material.h> + +#ifdef NL_OS_WINDOWS + +// Just for the main function and ::MessageBox +#include <windows.h> + +#endif // NL_OS_WINDOWS + +using namespace NLMISC; +using namespace NL3D; +using namespace NLPACS; + +// Some defines +#define ARENA_SIZE 50 +#define NUM_CELL 10 + +#define SIZE_PRIMITIVE_MIN (1) +#define SIZE_PRIMITIVE_MAX 2 +#define KEYBOARD_ACCEL (5.0) // m.s-2 +#define SHOCK_ABSORB (0.9) // +#define DELTA_TIME (0.1) +#define GO (10) +#define BORDER_SIZE SIZE_PRIMITIVE_MAX +#define INIT_SPEED 9 +#define MAX_WORLD_IMAGE 31 + +volatile bool synchro; + +// Get a random size +double randomSize () +{ + return (SIZE_PRIMITIVE_MAX - SIZE_PRIMITIVE_MIN)*((double)rand() / (double)RAND_MAX) + SIZE_PRIMITIVE_MIN; +} + +// Get a random rotation +double randomRot () +{ + return 2*(double)Pi*((double)rand() / (double)RAND_MAX); +} + +// Get a random speed +CVectorD randomSpeed () +{ + return CVectorD ( 2*(double)INIT_SPEED*((double)rand() / (double)RAND_MAX) - INIT_SPEED, + 2*(double)INIT_SPEED*((double)rand() / (double)RAND_MAX) - INIT_SPEED, 0); +} + +// Get a random pos +CVectorD randomPos () +{ + return CVectorD ( ((double)ARENA_SIZE - 2*BORDER_SIZE - SIZE_PRIMITIVE_MAX)*((double)rand() / (double)RAND_MAX) - ARENA_SIZE / 2.0 + BORDER_SIZE+ (SIZE_PRIMITIVE_MAX) / 2, + ((double)ARENA_SIZE - 2*BORDER_SIZE - SIZE_PRIMITIVE_MAX)*((double)rand() / (double)RAND_MAX) - ARENA_SIZE / 2.0 + BORDER_SIZE+ (SIZE_PRIMITIVE_MAX) / 2, + 0); +} + +// Setup speed with keyboard +void keyboard (UDriver *pDriver, double deltaTime, CObjectDyn &obj) +{ + // Add speed to selected object + CVectorD speed (0,0,0); + if (pDriver->AsyncListener.isKeyDown (KeyLEFT)) + speed.x+=KEYBOARD_ACCEL*deltaTime; + if (pDriver->AsyncListener.isKeyDown (KeyRIGHT)) + speed.x-=KEYBOARD_ACCEL*deltaTime; + if (pDriver->AsyncListener.isKeyDown (KeyUP)) + speed.y-=KEYBOARD_ACCEL*deltaTime; + if (pDriver->AsyncListener.isKeyDown (KeyDOWN)) + speed.y+=KEYBOARD_ACCEL*deltaTime; + if (pDriver->AsyncListener.isKeyDown (KeyPRIOR)) + speed.z+=KEYBOARD_ACCEL*deltaTime; + if (pDriver->AsyncListener.isKeyDown (KeyNEXT)) + speed.z-=KEYBOARD_ACCEL*deltaTime; + + // Set new speed + if (speed.norm() > 0) + obj.setSpeed(obj.getSpeed ()+speed); +} + +// ** Main entry + +#ifdef NL_OS_WINDOWS + +int APIENTRY WinMain(HINSTANCE hInstance, + HINSTANCE hPrevInstance, + LPSTR lpCmdLine, + int nCmdShow) + +#else // NL_OS_WINDOWS + +int main () + +#endif // NL_OS_WINDOWS + +{ + try + { + // Init search pathes + CPath::addSearchPath ("shapes"); + + // Create a driver + UDriver *pDriver=UDriver::createDriver(); + + // Setup text context + pDriver->setDisplay (UDriver::CMode(640, 480, 0)); + + // Create a scene + UScene *pScene=pDriver->createScene(); + + // Create a container + // This container has 31 world images. The first is a static world image, the others are dynamic. + // Each frame, the sample eval the collision in the next dynamic world image. + // This is to show the multiple world images fonctionnality. + UMoveContainer *container=UMoveContainer::createMoveContainer (-ARENA_SIZE/2.0, -ARENA_SIZE/2.0, ARENA_SIZE/2.0, ARENA_SIZE/2.0, + NUM_CELL, NUM_CELL, (double)SIZE_PRIMITIVE_MAX*sqrt(2.0), MAX_WORLD_IMAGE ); + + // Set the world image 0 as static (for borders) + container->setAsStatic (0); + + // Array arena + std::vector<CObjectDyn*> arrayArena; + + // Create an arena with boxes + int num_cell=ARENA_SIZE/SIZE_PRIMITIVE_MAX+1; + for (int cell=0; cell<num_cell; cell++) + { + // Create static boxes around the test area + arrayArena.push_back (new CObjectDyn (SIZE_PRIMITIVE_MAX, SIZE_PRIMITIVE_MAX, 10*SIZE_PRIMITIVE_MAX, 0, + CVectorD (SIZE_PRIMITIVE_MAX*cell-(ARENA_SIZE-SIZE_PRIMITIVE_MAX)/2, (ARENA_SIZE-SIZE_PRIMITIVE_MAX)/2, 0), + CVectorD(0,0,0), true, *container, *pScene, UMovePrimitive::DoNothing, 0, 1, 0)); + arrayArena.push_back (new CObjectDyn (SIZE_PRIMITIVE_MAX, SIZE_PRIMITIVE_MAX, 10*SIZE_PRIMITIVE_MAX, 0, + CVectorD (SIZE_PRIMITIVE_MAX*cell-(ARENA_SIZE-SIZE_PRIMITIVE_MAX)/2, -(ARENA_SIZE-SIZE_PRIMITIVE_MAX)/2, 0), + CVectorD(0,0,0), true, *container, *pScene, UMovePrimitive::DoNothing, 0, 1, 0)); + arrayArena.push_back (new CObjectDyn (SIZE_PRIMITIVE_MAX, SIZE_PRIMITIVE_MAX, 10*SIZE_PRIMITIVE_MAX, 0, + CVectorD ((ARENA_SIZE-SIZE_PRIMITIVE_MAX)/2, SIZE_PRIMITIVE_MAX*cell-(ARENA_SIZE-SIZE_PRIMITIVE_MAX)/2, 0), + CVectorD(0,0,0), true, *container, *pScene, UMovePrimitive::DoNothing, 0, 1, 0)); + arrayArena.push_back (new CObjectDyn (SIZE_PRIMITIVE_MAX, SIZE_PRIMITIVE_MAX, 10*SIZE_PRIMITIVE_MAX, 0, + CVectorD (-(ARENA_SIZE-SIZE_PRIMITIVE_MAX)/2, SIZE_PRIMITIVE_MAX*cell-(ARENA_SIZE-SIZE_PRIMITIVE_MAX)/2, 0), + CVectorD(0,0,0), true, *container, *pScene, UMovePrimitive::DoNothing, 0, 1, 0)); + } + + // Setup camera + UCamera *pCam=pScene->getCam(); + pCam->setTransformMode (UTransformable::DirectMatrix); + pCam->setPerspective ((float)Pi/2.f, 1.33f, 0.1f, 1000); + + // Setup the mouse listener + U3dMouseListener *plistener=pDriver->create3dMouseListener (); + plistener->setHotSpot (CVectorD (0,0,0)); + plistener->setFrustrum (pCam->getFrustum()); + plistener->setMatrix (pCam->getMatrix()); + plistener->setMouseMode (U3dMouseListener::edit3d); + + // Array of dynamic objects + std::vector<CObjectDyn*> arrayObj; + + // Create one object + arrayObj.push_back ( + new CObjectDyn (randomSize (), randomSize (), randomPos (), CVectorD(0,0,0), true, *container, *pScene, + UMovePrimitive::Reflexion, 1, 30, 1)); + + // Selected object + uint selected=0; + + // Get time + TTime lastTime=CTime::getLocalTime (); + + // Current world image + uint worldImage=1; + + // Color to clear the background + CRGBA clearColor; + + // Main loop + while (pDriver->isActive() && (!pDriver->AsyncListener.isKeyPushed (KeyESCAPE))) + { + // Get the current time + TTime newTime=CTime::getLocalTime (); + double deltaTime=(double)(uint32)(newTime-lastTime)/1000.0; + lastTime=newTime; + + // Insert objects in press INSERT + if (pDriver->AsyncListener.isKeyDown (KeyINSERT)) + { + // Random cylinder and boxes + if (rand()&1) + arrayObj.push_back (new CObjectDyn (randomSize(), randomSize(), randomSize(), randomRot(), randomPos (), CVectorD(0,0,0), + true, *container, *pScene, UMovePrimitive::Reflexion, 1, 30, worldImage)); + else + arrayObj.push_back (new CObjectDyn (randomSize (), randomSize (), randomPos (), CVectorD(0,0,0), true, *container, + *pScene, UMovePrimitive::Reflexion, 1, 30, worldImage)); + } + + // Make caos if SPACE pressed + if (pDriver->AsyncListener.isKeyDown (KeySPACE)) + { + for (uint t=0; t<arrayObj.size(); t++) + arrayObj[t]->setSpeed (randomSpeed ()); + } + + // Keyboard + if (arrayObj.size()) + { + // Manipulate selected primitive + keyboard (pDriver, deltaTime, *(arrayObj[selected])); + + // Remove a primitive if DELETE pressed + if (pDriver->AsyncListener.isKeyDown (KeyDELETE)) + { + arrayObj[arrayObj.size()-1]->remove (*container, *pScene); + arrayObj.resize (arrayObj.size()-1); + } + + // Check selected + if (selected>=arrayObj.size()) + selected=arrayObj.size()-1; + if (selected<0) + selected=0; + + // Change selected object if TAB pressed + if (pDriver->AsyncListener.isKeyPushed (KeyTAB)) + { + selected++; + selected%=arrayObj.size(); + } + } + + // Move primitives + for (uint i=0; i<arrayObj.size(); i++) + arrayObj[i]->tryMove (DELTA_TIME, *container, worldImage); + + // Eval static world image + container->evalCollision (DELTA_TIME, 0); + + // Eval current dynamic world image + container->evalCollision (DELTA_TIME, worldImage); + + // Simulation new position + for (i=0; i<arrayObj.size(); i++) + arrayObj[i]->doMove (DELTA_TIME, worldImage); + + // Check triggers + clearColor=CRGBA::Black; + if (container->getNumTriggerInfo()) + { + // White if collision + clearColor=CRGBA (100,100,100); + } + + // Setup view matrix + int size=arrayObj.size(); + if (size) + { + // Setup hotspot for the 3d listener + plistener->setHotSpot (arrayObj[selected]->getPos()); + + // Look at selected primitive + pCam->lookAt (plistener->getViewMatrix().getPos (), arrayObj[selected]->getPos()); + } + + // Force listener current matrix + plistener->setMatrix (pCam->getMatrix()); + + // Clear + pDriver->clearBuffers (clearColor); + + // Render + pScene->render (); + + // Draw some lines + pDriver->setMatrixMode3D(*pCam); + + // Swap + pDriver->swapBuffers (); + + // Pump messages + pDriver->EventServer.pump(); + + // Next world image + int nextImage=worldImage+1; + if (nextImage>=MAX_WORLD_IMAGE) + nextImage=1; + container->duplicateWorldImage (worldImage, nextImage); + worldImage=nextImage; + } + + // Remove mouse listener + pDriver->delete3dMouseListener (plistener); + } + catch (Exception& e) + { +#ifdef NL_OS_WINDOWS + ::MessageBox (NULL, e.what(), "Test collision move", MB_OK|MB_ICONEXCLAMATION); +#else // NL_OS_WINDOWS + printf (e.what()); +#endif // NL_OS_WINDOWS + } + + return 0; +} + +</PRE>
\ No newline at end of file diff --git a/cvs/cvsweb.cgi/code/nel/samples/pacs/main.cpp?sortby=date b/cvs/cvsweb.cgi/code/nel/samples/pacs/main.cpp?sortby=date new file mode 100644 index 00000000..92e5f7c2 --- /dev/null +++ b/cvs/cvsweb.cgi/code/nel/samples/pacs/main.cpp?sortby=date @@ -0,0 +1,156 @@ +<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> +<HTML> +<HEAD> + <TITLE>nevrax.org : cvs</TITLE> + <META name="keywords" content="freesoftware,nel,newt,snowballs,richard stallman,GNU,Multi-User Online World"> + + <LINK REL=stylesheet TYPE="text/css" HREF="http://www.nevrax.org/inc/css/nevrax.css"> +</HEAD> +<BODY MARGINHEIGHT="0" MARGINWIDTH="0"> + +<!-- uplinks --> +<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0> + <TR> + <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD> + <TD WIDTH=140 BGCOLOR=#dddddd><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="16" BORDER=0 ALT=""></TD> + <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD> + <TD><IMG width=6 height=14 SRC="http://www.nevrax.org/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle> <A CLASS=uplinks HREF=http://www.nevrax.org><b>Home</B></FONT></A> </TD> + <TD><IMG width=6 height=14 SRC="http://www.nevrax.org/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle> <A CLASS=uplinks HREF=http://www.nevrax.com><b>nevrax.com</B></FONT></A> </TD> + </TR> +</TABLE> + +<!-- banner Nevrax --> +<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH=100%> + <TR><TD BGCOLOR="#000000" BACKGROUND="http://www.nevrax.org/inc/img/black_banner.jpg"><A HREF="http://www.nevrax.org"><IMG SRC="http://www.nevrax.org/inc/img/nevrax.gif" WIDTH="170" HEIGHT="45" BORDER=0 ALT="Nevrax" ></A></TD></TR> +</TABLE> + +<!-- main table --> +<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 height=100%> + <TR> + <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="10" BORDER=0 ALT=""></TD> + <TD WIDTH=140 BGCOLOR=#dddddd VALIGN=TOP ALIGN=middle><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT=""> + + <!------ Begin Box ------> + <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 BGCOLOR=black><TR><TD><TABLE border=0 cellspacing=2 cellpadding=0 width=120><tr><TD ALIGN=middle bgcolor=black> + <FONT COLOR=white FACE="sans-serif"><B>Nevrax.org</B></FONT></TD></TR><tr><td colspan=2 bgcolor=#FFFFFF> + <TABLE cellspacing=0 cellpadding=1 border=0> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/news/" TITLE="Rubrique news"><img width=13 height=15 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-news.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/news/" TITLE="News">News</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/mail/" TITLE="Rubrique mail"><img width=15 height=11 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-mail.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/mail/" TITLE="Mailing list archive">Mailing-list</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/docs/" TITLE="Rubrique docs"><img width=14 height=16 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-docs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/docs/" TITLE="Documentation">Documentation</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/cvs/" TITLE="Rubrique cvs"><img width=13 height=17 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-cvs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/cvs/" TITLE="CVS Web">CVS</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/bugs/" TITLE="Rubrique bugs"><img width=20 height=16 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-bugs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/bugs/" TITLE="Bugtracking">Bugs</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/free/" TITLE="Rubrique license"><img width=18 height=12 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-free.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/free/" TITLE="Free Software">Free software</a></td></tr> + </TABLE> + </TD></TR></TABLE></TD></TR></TABLE> + <!------ End Box ------> + + </TD> + <TD WIDTH=15><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD> + <TD ALIGN=left valign=top><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT=""> + +<!-- title --> +<TABLE background="http://www.nevrax.org/inc/img/redline.gif" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td> +<A HREF="http://www.nevrax.org/cvs/"><img src="http://www.nevrax.org/inc/img/t_cvs.gif" ALT="cvs" HEIGHT=20 BORDER=0></A> +</td><td><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="1" HEIGHT="1" BORDER=0 ALT=""> +</td></tr></table> + +<!-- title --> +<table width=100%><tr><td align=left><b> <a href="/cvs/cvsweb.cgi/?sortby=date">Nevrax</a> / <a href="/cvs/cvsweb.cgi/code/?sortby=date">code</a> / <a href="/cvs/cvsweb.cgi/code/nel/?sortby=date">nel</a> / <a href="/cvs/cvsweb.cgi/code/nel/samples/?sortby=date">samples</a> / <a href="/cvs/cvsweb.cgi/code/nel/samples/pacs/?sortby=date">pacs</a> / main.cpp</b></td><td align=right><b></b></td></TR></TABLE> + +<!-- block --> +<TABLE bgcolor="#dddddd" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td width=1% valign=middle><img width=6 height=14 hspace=2 vspace=2 src="http://www.nevrax.org/inc/img/reddots.gif"></TD> + <TD><B>main.cpp</B></TD> + <TD ALIGN=RIGHT> </td> +</tr></table> +<P> +<p>Default branch: MAIN<BR> +<HR size=1 NOSHADE><P><a NAME="rev1.2"></a><a NAME="georges_v2"></a><a NAME="HEAD"></a><a NAME="MAIN"></a> + Revision <A HREF="main.cpp?rev=1.2&content-type=text/x-cvsweb-markup&sortby=date"><b>1.2</b></A> / (<A HREF="/cvs/cvsweb.cgi/~checkout~/code/nel/samples/pacs/main.cpp?rev=1.2&content-type=text/plain&sortby=date" target="cvs_checkout" onClick="window.open('/cvs/cvsweb.cgi/~checkout~/code/nel/samples/pacs/main.cpp?rev=1.2&content-type=text/plain','cvs_checkout','resizeable,scrollbars');"><b>download</b></A>) - <a href="/cvs/cvsweb.cgi/code/nel/samples/pacs/main.cpp?annotate=1.2&sortby=date">annotate</a> - <A HREF="/cvs/cvsweb.cgi/code/nel/samples/pacs/main.cpp?r1=1.2&sortby=date">[select for diffs]</A> +, <i>Wed Feb 20 18:07:14 2002 UTC</i> (5 months ago) by <i>lecroart</i> +<BR>Branch: <b><A HREF="main.cpp?sortby=date&only_with_tag=MAIN">MAIN</A> +</b> +<BR>CVS Tags: <b><A HREF="main.cpp?sortby=date&only_with_tag=georges_v2">georges_v2</A>, +<A HREF="main.cpp?sortby=date&only_with_tag=HEAD">HEAD</A> +</b><BR>Changes since <b>1.1: +2 -2 + lines</b><BR>Diff to previous <A HREF="/cvs/cvsweb.cgi/code/nel/samples/pacs/main.cpp.diff?r1=1.1&r2=1.2&sortby=date">1.1</A> +<PRE> +#FIXED: doxygen warning +</PRE> +<HR size=1 NOSHADE><P><a NAME="rev1.1"></a><a NAME="nel_0_4"></a><a NAME="demo_0_1"></a> + Revision <A HREF="main.cpp?rev=1.1&content-type=text/x-cvsweb-markup&sortby=date"><b>1.1</b></A> / (<A HREF="/cvs/cvsweb.cgi/~checkout~/code/nel/samples/pacs/main.cpp?rev=1.1&content-type=text/plain&sortby=date" target="cvs_checkout" onClick="window.open('/cvs/cvsweb.cgi/~checkout~/code/nel/samples/pacs/main.cpp?rev=1.1&content-type=text/plain','cvs_checkout','resizeable,scrollbars');"><b>download</b></A>) - <a href="/cvs/cvsweb.cgi/code/nel/samples/pacs/main.cpp?annotate=1.1&sortby=date">annotate</a> - <A HREF="/cvs/cvsweb.cgi/code/nel/samples/pacs/main.cpp?r1=1.1&sortby=date">[select for diffs]</A> +, <i>Thu Jul 19 11:59:02 2001 UTC</i> (12 months, 1 week ago) by <i>corvazier</i> +<BR>Branch: <b><A HREF="main.cpp?sortby=date&only_with_tag=MAIN">MAIN</A> +</b> +<BR>CVS Tags: <b><A HREF="main.cpp?sortby=date&only_with_tag=nel_0_4">nel_0_4</A>, +<A HREF="main.cpp?sortby=date&only_with_tag=demo_0_1">demo_0_1</A> +</b><BR>Diff<PRE> +ADDED: sample to show how to use PACS +</PRE> + +<!-- block --> +<TABLE bgcolor="#dddddd" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td width=1% valign=middle><img width=6 height=14 hspace=2 vspace=2 src="http://www.nevrax.org/inc/img/reddots.gif"></TD> + <TD><B>Request Diffs</B></TD> + <TD ALIGN=RIGHT> </td> +</tr></table> +<P> +<P> +<FORM METHOD="GET" ACTION="/cvs/cvsweb.cgi/code/nel/samples/pacs/main.cpp.diff" NAME="diff_select"> +<INPUT TYPE=HIDDEN NAME="sortby" VALUE="date"> +Diffs between +<SELECT NAME="r1"> +<OPTION VALUE="text" SELECTED>Use Text Field +<OPTION VALUE="1.1:nel_0_4">nel_0_4 +<OPTION VALUE="1.2:georges_v2">georges_v2 +<OPTION VALUE="1.1:demo_0_1">demo_0_1 +<OPTION VALUE="1:MAIN">MAIN +<OPTION VALUE="1.2:HEAD">HEAD +</SELECT> +<INPUT TYPE="TEXT" SIZE="12" NAME="tr1" VALUE="1.1" onChange='document.diff_select.r1.selectedIndex=0'> + and +<SELECT NAME="r2"> +<OPTION VALUE="text" SELECTED>Use Text Field +<OPTION VALUE="1.1:nel_0_4">nel_0_4 +<OPTION VALUE="1.2:georges_v2">georges_v2 +<OPTION VALUE="1.1:demo_0_1">demo_0_1 +<OPTION VALUE="1:MAIN">MAIN +<OPTION VALUE="1.2:HEAD">HEAD +</SELECT> +<INPUT TYPE="TEXT" SIZE="12" NAME="tr2" VALUE="1.2" onChange='docuement.diff_select.r2.selectedIndex=0'> +<BR>Type of Diff should be a <SELECT NAME="f"> +<OPTION VALUE=h SELECTED>Colored Diff<OPTION VALUE=H>Long Colored Diff<OPTION VALUE=u>Unidiff<OPTION VALUE=c>Context Diff<OPTION VALUE=s>Side by Side</SELECT><INPUT TYPE=SUBMIT VALUE=" Get Diffs "> +</FORM> + +<!-- block --> +<TABLE bgcolor="#dddddd" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td width=1% valign=middle><img width=6 height=14 hspace=2 vspace=2 src="http://www.nevrax.org/inc/img/reddots.gif"></TD> + <TD><B>Select branch</B></TD> + <TD ALIGN=RIGHT> </td> +</tr></table> +<P> +<P> +<A name=branch></A> +<FORM METHOD="GET" ACTION="/cvs/cvsweb.cgi/code/nel/samples/pacs/main.cpp"> +<INPUT TYPE=HIDDEN NAME="sortby" VALUE="date"> +View only Branch: +<SELECT NAME="only_with_tag" onchange="submit()"> +<OPTION VALUE="">Show all branches +<OPTION>MAIN +</SELECT> +<INPUT TYPE=SUBMIT VALUE=" View Branch "> +</FORM> +<A name=logsort></A> +<FORM METHOD="GET" ACTION="/cvs/cvsweb.cgi/code/nel/samples/pacs/main.cpp"> +<INPUT TYPE=HIDDEN NAME="sortby" VALUE="date"> +Sort log by: +<SELECT NAME="logsort" onchange="submit()"> +<OPTION VALUE=cvs>Not sorted<OPTION VALUE=date SELECTED>Commit date<OPTION VALUE=rev>Revision</SELECT> +<INPUT TYPE=SUBMIT VALUE=" Sort "> +</FORM> + +<!-- footer --> +<BR><FONT Size=+5> </FONT> +</TD> +<TD WIDTH=15><IMG SRC=http://www.nevrax.org/inc/img/pixel.gif WIDTH=15 HEIGHT=15 BORDER=0 ALT=""></TD> +</TR> +</TABLE> +</BODY> +</HTML></BODY></HTML> diff --git a/cvs/cvsweb.cgi/code/nel/samples/pacs/object.cpp?rev=1.2&content-type=text/x-cvsweb-markup&sortby=date/index.html b/cvs/cvsweb.cgi/code/nel/samples/pacs/object.cpp?rev=1.2&content-type=text/x-cvsweb-markup&sortby=date/index.html new file mode 100644 index 00000000..68c678e0 --- /dev/null +++ b/cvs/cvsweb.cgi/code/nel/samples/pacs/object.cpp?rev=1.2&content-type=text/x-cvsweb-markup&sortby=date/index.html @@ -0,0 +1,229 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML> +<HEAD><style> A { color:black }</style> +<!-- hennerik CVSweb $Revision: 1.93 $ --> +<TITLE>code/nel/samples/pacs/object.cpp - view - 1.2</TITLE></HEAD> +<BODY BGCOLOR="#eeeeee"> +<table width="100%" border=0 cellspacing=0 cellpadding=1 bgcolor="#aaaaaa"><tr valign=bottom><td><a href="object.cpp?sortby=date"><IMG SRC="http://www.nevrax.org/inc/img/picto-up.gif" ALT="[BACK]" BORDER="0" WIDTH="14" HEIGHT="13"></a> <b>Return to <A HREF="object.cpp?sortby=date">object.cpp</A> + CVS log</b> <IMG SRC="http://www.nevrax.org/inc/img/picto-news.gif" ALT="[TXT]" BORDER="0" WIDTH="13" HEIGHT="15"></td><td align=right><IMG SRC="http://www.nevrax.org/inc/img/picto-dir.gif" ALT="[DIR]" BORDER="0" WIDTH="15" HEIGHT="13"> <b>Up to <a href="/cvs/cvsweb.cgi/?sortby=date">Nevrax</a> / <a href="/cvs/cvsweb.cgi/code/?sortby=date">code</a> / <a href="/cvs/cvsweb.cgi/code/nel/?sortby=date">nel</a> / <a href="/cvs/cvsweb.cgi/code/nel/samples/?sortby=date">samples</a> / <a href="/cvs/cvsweb.cgi/code/nel/samples/pacs/?sortby=date">pacs</a></b></td></tr></table><HR noshade><table width="100%"><tr><td bgcolor="#ffffff">File: <a href="/cvs/cvsweb.cgi/?sortby=date">Nevrax</a> / <a href="/cvs/cvsweb.cgi/code/?sortby=date">code</a> / <a href="/cvs/cvsweb.cgi/code/nel/?sortby=date">nel</a> / <a href="/cvs/cvsweb.cgi/code/nel/samples/?sortby=date">samples</a> / <a href="/cvs/cvsweb.cgi/code/nel/samples/pacs/?sortby=date">pacs</a> / <a href="/cvs/cvsweb.cgi/code/nel/samples/pacs/object.cpp?sortby=date">object.cpp</a> (<A HREF="/cvs/cvsweb.cgi/~checkout~/code/nel/samples/pacs/object.cpp?rev=1.2&sortby=date" target="cvs_checkout" onClick="window.open('/cvs/cvsweb.cgi/~checkout~/code/nel/samples/pacs/object.cpp?rev=1.2','cvs_checkout','resizeable,scrollbars');"><b>download</b></A>)<BR> +Revision <B>1.2</B>, <i>Wed Feb 20 18:07:14 2002 UTC</i> (5 months ago) by <i>lecroart</i> +<BR>Branch: <b>MAIN</b> +<BR>CVS Tags: <b>georges_v2, HEAD</b><BR>Changes since <b>1.1: +2 -2 + lines</b><PRE> +#FIXED: doxygen warning +</PRE> +</td></tr></table><HR noshade><PRE>/** \file net_layer5/object.cpp + * Objects for the sample. Link between 3d instance and collision primitives. + * + * $Id: object.cpp,v 1.2 2002/02/20 18:07:14 lecroart Exp $ + */ + +/* Copyright, 2001 Nevrax Ltd. + * + * This file is part of NEVRAX NEL. + * NEVRAX NEL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + + * NEVRAX NEL is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with NEVRAX NEL; see the file COPYING. If not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + */ + +#include "object.h" + +// Pacs includes +#include <nel/pacs/u_move_container.h> +#include <nel/pacs/u_move_primitive.h> + +// 3d includes +#include <nel/3d/u_scene.h> +#include <nel/3d/u_instance.h> + +// Misc includes +#include <nel/misc/vectord.h> + +#define BRAKE_FORCE (-0.1) // (m.s-2) +#define GRAVITY_FORCE (-15.0) +#define SHOCK_ABSORB (1.0) // + +using namespace NL3D; +using namespace NLNET; +using namespace NLMISC; +using namespace NLPACS; + +// *************************************************************************** + +CObjectDyn::CObjectDyn (double width, double depth, double height, double orientation, const CVectorD& pos, + const CVectorD& speed, bool obstacle, UMoveContainer &container, UScene &scene, + UMovePrimitive::TReaction reaction, uint8 worldImage, uint8 nbImage, uint8 insertWorldImage) +{ + // Create a box instance + _Instance = scene.createInstance ("rectangle.shape"); + nlassert (_Instance); + + // Setup the instance + _Instance->setScale (CVectorD (width, depth, height)); + _Instance->setRotQuat (CQuat (CVectorD (0, 0, 1), (float)orientation)); + + // Create a collision volume + _MovePrimitive = container.addCollisionablePrimitive (worldImage, nbImage); + _MovePrimitive->insertInWorldImage (insertWorldImage); + + // Setup the collision primitive + _MovePrimitive->setPrimitiveType (UMovePrimitive::_2DOrientedBox); + _MovePrimitive->setHeight ((float)height); + _MovePrimitive->setOrientation (orientation, insertWorldImage); + _MovePrimitive->setSize ((float)width, (float)depth); + + // This primitive is an obstacle (it blocks others) + _MovePrimitive->setObstacle (obstacle); + + // Setup reaction type + _MovePrimitive->setReactionType (reaction); + + // Setup absorption value + _MovePrimitive->setAbsorbtion (0.9f); + + // Setup user data + _MovePrimitive->UserData=(uint)this; + + // Setup trigger type + _MovePrimitive->setTriggerType (UMovePrimitive::EnterTrigger); + + // Set pos and speed + setPos (pos); + setSpeed (speed); + + _MovePrimitive->setGlobalPosition (pos, insertWorldImage); +} + +// *************************************************************************** + +CObjectDyn::CObjectDyn (double diameter, double height, const CVectorD& pos, const CVectorD& speed, + bool obstacle, UMoveContainer &container, UScene &scene, UMovePrimitive::TReaction reaction, + uint8 worldImage, uint8 nbImage, uint8 insertWorldImage) +{ + // Create a box instance + _Instance = scene.createInstance ("cylinder.shape"); + nlassert (_Instance); + + // Setup the instance + _Instance->setScale (CVectorD (diameter, diameter, height)); + + // Create a collision volume + _MovePrimitive = container.addCollisionablePrimitive (worldImage, nbImage); + _MovePrimitive->insertInWorldImage (insertWorldImage); + + // Setup the primitive + _MovePrimitive->setPrimitiveType (UMovePrimitive::_2DOrientedCylinder); + _MovePrimitive->setHeight ((float)height); + _MovePrimitive->setRadius ((float)diameter/2.f); + + // This primitive is an obstacle (it blocks others) + _MovePrimitive->setObstacle (true); + + // Setup reaction type + _MovePrimitive->setReactionType (reaction); + + // Setup reaction type + _MovePrimitive->setAbsorbtion (0.9f); + + // Setup user data + _MovePrimitive->UserData=(uint)this; + + // Setup trigger type + _MovePrimitive->setTriggerType (UMovePrimitive::EnterTrigger); + + // Set pos and speed + setPos (pos); + setSpeed (speed); + _MovePrimitive->setGlobalPosition (pos, insertWorldImage); +} + +// *************************************************************************** + +void CObjectDyn::tryMove (double deltaTime, UMoveContainer &container, uint8 worldImage) +{ + // New speed + if ( (_MovePrimitive->getSpeed(worldImage).norm()>0.f) || _Speed.norm()>0.f ) + { + // Brake + CVectorD newSpeed=_Speed; + newSpeed.normalize(); + newSpeed*=BRAKE_FORCE*deltaTime; + newSpeed+=_Speed; + + // Stop ? + if (_Speed*newSpeed<=0) + newSpeed=CVectorD (0,0,0); + + // Set speed + setSpeed (newSpeed); + + // Try this move + _MovePrimitive->move (_Speed, worldImage); + _TryMove=true; + } + else + _TryMove=false; + +} + +// *************************************************************************** + +void CObjectDyn::doMove (double deltaTime, uint8 worldImage) +{ + // New speed + setSpeed (_MovePrimitive->getSpeed(worldImage)); + + // New position + setPos (_MovePrimitive->getFinalPosition (worldImage)); +} + +// *************************************************************************** + +void CObjectDyn::setPos (const CVectorD& pos) +{ + _Position=pos; + if (_Instance) + _Instance->setPos (pos); +} + +// *************************************************************************** + +void CObjectDyn::setGlobalPos (UGlobalPosition& gpos, CVectorD& pos, uint8 worldimage) +{ + // Place the primitive the first time + _MovePrimitive->setGlobalPosition (gpos, worldimage); + setPos (pos); +} + +// *************************************************************************** + +void CObjectDyn::setSpeed (const CVectorD& speed) +{ + _Speed=speed; +} + +// *************************************************************************** + +void CObjectDyn::remove (NLPACS::UMoveContainer &container, UScene &scene) +{ + // Remove from container + container.removePrimitive (_MovePrimitive); + + // Remove instance + if (_Instance) + scene.deleteInstance (_Instance); +} + +// *************************************************************************** + +</PRE>
\ No newline at end of file diff --git a/cvs/cvsweb.cgi/code/nel/samples/pacs/object.cpp?sortby=date b/cvs/cvsweb.cgi/code/nel/samples/pacs/object.cpp?sortby=date new file mode 100644 index 00000000..3f2f09bb --- /dev/null +++ b/cvs/cvsweb.cgi/code/nel/samples/pacs/object.cpp?sortby=date @@ -0,0 +1,156 @@ +<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> +<HTML> +<HEAD> + <TITLE>nevrax.org : cvs</TITLE> + <META name="keywords" content="freesoftware,nel,newt,snowballs,richard stallman,GNU,Multi-User Online World"> + + <LINK REL=stylesheet TYPE="text/css" HREF="http://www.nevrax.org/inc/css/nevrax.css"> +</HEAD> +<BODY MARGINHEIGHT="0" MARGINWIDTH="0"> + +<!-- uplinks --> +<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0> + <TR> + <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD> + <TD WIDTH=140 BGCOLOR=#dddddd><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="16" BORDER=0 ALT=""></TD> + <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD> + <TD><IMG width=6 height=14 SRC="http://www.nevrax.org/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle> <A CLASS=uplinks HREF=http://www.nevrax.org><b>Home</B></FONT></A> </TD> + <TD><IMG width=6 height=14 SRC="http://www.nevrax.org/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle> <A CLASS=uplinks HREF=http://www.nevrax.com><b>nevrax.com</B></FONT></A> </TD> + </TR> +</TABLE> + +<!-- banner Nevrax --> +<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH=100%> + <TR><TD BGCOLOR="#000000" BACKGROUND="http://www.nevrax.org/inc/img/black_banner.jpg"><A HREF="http://www.nevrax.org"><IMG SRC="http://www.nevrax.org/inc/img/nevrax.gif" WIDTH="170" HEIGHT="45" BORDER=0 ALT="Nevrax" ></A></TD></TR> +</TABLE> + +<!-- main table --> +<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 height=100%> + <TR> + <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="10" BORDER=0 ALT=""></TD> + <TD WIDTH=140 BGCOLOR=#dddddd VALIGN=TOP ALIGN=middle><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT=""> + + <!------ Begin Box ------> + <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 BGCOLOR=black><TR><TD><TABLE border=0 cellspacing=2 cellpadding=0 width=120><tr><TD ALIGN=middle bgcolor=black> + <FONT COLOR=white FACE="sans-serif"><B>Nevrax.org</B></FONT></TD></TR><tr><td colspan=2 bgcolor=#FFFFFF> + <TABLE cellspacing=0 cellpadding=1 border=0> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/news/" TITLE="Rubrique news"><img width=13 height=15 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-news.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/news/" TITLE="News">News</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/mail/" TITLE="Rubrique mail"><img width=15 height=11 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-mail.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/mail/" TITLE="Mailing list archive">Mailing-list</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/docs/" TITLE="Rubrique docs"><img width=14 height=16 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-docs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/docs/" TITLE="Documentation">Documentation</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/cvs/" TITLE="Rubrique cvs"><img width=13 height=17 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-cvs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/cvs/" TITLE="CVS Web">CVS</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/bugs/" TITLE="Rubrique bugs"><img width=20 height=16 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-bugs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/bugs/" TITLE="Bugtracking">Bugs</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/free/" TITLE="Rubrique license"><img width=18 height=12 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-free.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/free/" TITLE="Free Software">Free software</a></td></tr> + </TABLE> + </TD></TR></TABLE></TD></TR></TABLE> + <!------ End Box ------> + + </TD> + <TD WIDTH=15><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD> + <TD ALIGN=left valign=top><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT=""> + +<!-- title --> +<TABLE background="http://www.nevrax.org/inc/img/redline.gif" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td> +<A HREF="http://www.nevrax.org/cvs/"><img src="http://www.nevrax.org/inc/img/t_cvs.gif" ALT="cvs" HEIGHT=20 BORDER=0></A> +</td><td><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="1" HEIGHT="1" BORDER=0 ALT=""> +</td></tr></table> + +<!-- title --> +<table width=100%><tr><td align=left><b> <a href="/cvs/cvsweb.cgi/?sortby=date">Nevrax</a> / <a href="/cvs/cvsweb.cgi/code/?sortby=date">code</a> / <a href="/cvs/cvsweb.cgi/code/nel/?sortby=date">nel</a> / <a href="/cvs/cvsweb.cgi/code/nel/samples/?sortby=date">samples</a> / <a href="/cvs/cvsweb.cgi/code/nel/samples/pacs/?sortby=date">pacs</a> / object.cpp</b></td><td align=right><b></b></td></TR></TABLE> + +<!-- block --> +<TABLE bgcolor="#dddddd" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td width=1% valign=middle><img width=6 height=14 hspace=2 vspace=2 src="http://www.nevrax.org/inc/img/reddots.gif"></TD> + <TD><B>object.cpp</B></TD> + <TD ALIGN=RIGHT> </td> +</tr></table> +<P> +<p>Default branch: MAIN<BR> +<HR size=1 NOSHADE><P><a NAME="rev1.2"></a><a NAME="georges_v2"></a><a NAME="HEAD"></a><a NAME="MAIN"></a> + Revision <A HREF="object.cpp?rev=1.2&content-type=text/x-cvsweb-markup&sortby=date"><b>1.2</b></A> / (<A HREF="/cvs/cvsweb.cgi/~checkout~/code/nel/samples/pacs/object.cpp?rev=1.2&content-type=text/plain&sortby=date" target="cvs_checkout" onClick="window.open('/cvs/cvsweb.cgi/~checkout~/code/nel/samples/pacs/object.cpp?rev=1.2&content-type=text/plain','cvs_checkout','resizeable,scrollbars');"><b>download</b></A>) - <a href="/cvs/cvsweb.cgi/code/nel/samples/pacs/object.cpp?annotate=1.2&sortby=date">annotate</a> - <A HREF="/cvs/cvsweb.cgi/code/nel/samples/pacs/object.cpp?r1=1.2&sortby=date">[select for diffs]</A> +, <i>Wed Feb 20 18:07:14 2002 UTC</i> (5 months ago) by <i>lecroart</i> +<BR>Branch: <b><A HREF="object.cpp?sortby=date&only_with_tag=MAIN">MAIN</A> +</b> +<BR>CVS Tags: <b><A HREF="object.cpp?sortby=date&only_with_tag=georges_v2">georges_v2</A>, +<A HREF="object.cpp?sortby=date&only_with_tag=HEAD">HEAD</A> +</b><BR>Changes since <b>1.1: +2 -2 + lines</b><BR>Diff to previous <A HREF="/cvs/cvsweb.cgi/code/nel/samples/pacs/object.cpp.diff?r1=1.1&r2=1.2&sortby=date">1.1</A> +<PRE> +#FIXED: doxygen warning +</PRE> +<HR size=1 NOSHADE><P><a NAME="rev1.1"></a><a NAME="nel_0_4"></a><a NAME="demo_0_1"></a> + Revision <A HREF="object.cpp?rev=1.1&content-type=text/x-cvsweb-markup&sortby=date"><b>1.1</b></A> / (<A HREF="/cvs/cvsweb.cgi/~checkout~/code/nel/samples/pacs/object.cpp?rev=1.1&content-type=text/plain&sortby=date" target="cvs_checkout" onClick="window.open('/cvs/cvsweb.cgi/~checkout~/code/nel/samples/pacs/object.cpp?rev=1.1&content-type=text/plain','cvs_checkout','resizeable,scrollbars');"><b>download</b></A>) - <a href="/cvs/cvsweb.cgi/code/nel/samples/pacs/object.cpp?annotate=1.1&sortby=date">annotate</a> - <A HREF="/cvs/cvsweb.cgi/code/nel/samples/pacs/object.cpp?r1=1.1&sortby=date">[select for diffs]</A> +, <i>Thu Jul 19 11:59:02 2001 UTC</i> (12 months, 1 week ago) by <i>corvazier</i> +<BR>Branch: <b><A HREF="object.cpp?sortby=date&only_with_tag=MAIN">MAIN</A> +</b> +<BR>CVS Tags: <b><A HREF="object.cpp?sortby=date&only_with_tag=nel_0_4">nel_0_4</A>, +<A HREF="object.cpp?sortby=date&only_with_tag=demo_0_1">demo_0_1</A> +</b><BR>Diff<PRE> +ADDED: sample to show how to use PACS +</PRE> + +<!-- block --> +<TABLE bgcolor="#dddddd" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td width=1% valign=middle><img width=6 height=14 hspace=2 vspace=2 src="http://www.nevrax.org/inc/img/reddots.gif"></TD> + <TD><B>Request Diffs</B></TD> + <TD ALIGN=RIGHT> </td> +</tr></table> +<P> +<P> +<FORM METHOD="GET" ACTION="/cvs/cvsweb.cgi/code/nel/samples/pacs/object.cpp.diff" NAME="diff_select"> +<INPUT TYPE=HIDDEN NAME="sortby" VALUE="date"> +Diffs between +<SELECT NAME="r1"> +<OPTION VALUE="text" SELECTED>Use Text Field +<OPTION VALUE="1.1:nel_0_4">nel_0_4 +<OPTION VALUE="1.2:georges_v2">georges_v2 +<OPTION VALUE="1.1:demo_0_1">demo_0_1 +<OPTION VALUE="1:MAIN">MAIN +<OPTION VALUE="1.2:HEAD">HEAD +</SELECT> +<INPUT TYPE="TEXT" SIZE="12" NAME="tr1" VALUE="1.1" onChange='document.diff_select.r1.selectedIndex=0'> + and +<SELECT NAME="r2"> +<OPTION VALUE="text" SELECTED>Use Text Field +<OPTION VALUE="1.1:nel_0_4">nel_0_4 +<OPTION VALUE="1.2:georges_v2">georges_v2 +<OPTION VALUE="1.1:demo_0_1">demo_0_1 +<OPTION VALUE="1:MAIN">MAIN +<OPTION VALUE="1.2:HEAD">HEAD +</SELECT> +<INPUT TYPE="TEXT" SIZE="12" NAME="tr2" VALUE="1.2" onChange='docuement.diff_select.r2.selectedIndex=0'> +<BR>Type of Diff should be a <SELECT NAME="f"> +<OPTION VALUE=h SELECTED>Colored Diff<OPTION VALUE=H>Long Colored Diff<OPTION VALUE=u>Unidiff<OPTION VALUE=c>Context Diff<OPTION VALUE=s>Side by Side</SELECT><INPUT TYPE=SUBMIT VALUE=" Get Diffs "> +</FORM> + +<!-- block --> +<TABLE bgcolor="#dddddd" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td width=1% valign=middle><img width=6 height=14 hspace=2 vspace=2 src="http://www.nevrax.org/inc/img/reddots.gif"></TD> + <TD><B>Select branch</B></TD> + <TD ALIGN=RIGHT> </td> +</tr></table> +<P> +<P> +<A name=branch></A> +<FORM METHOD="GET" ACTION="/cvs/cvsweb.cgi/code/nel/samples/pacs/object.cpp"> +<INPUT TYPE=HIDDEN NAME="sortby" VALUE="date"> +View only Branch: +<SELECT NAME="only_with_tag" onchange="submit()"> +<OPTION VALUE="">Show all branches +<OPTION>MAIN +</SELECT> +<INPUT TYPE=SUBMIT VALUE=" View Branch "> +</FORM> +<A name=logsort></A> +<FORM METHOD="GET" ACTION="/cvs/cvsweb.cgi/code/nel/samples/pacs/object.cpp"> +<INPUT TYPE=HIDDEN NAME="sortby" VALUE="date"> +Sort log by: +<SELECT NAME="logsort" onchange="submit()"> +<OPTION VALUE=cvs>Not sorted<OPTION VALUE=date SELECTED>Commit date<OPTION VALUE=rev>Revision</SELECT> +<INPUT TYPE=SUBMIT VALUE=" Sort "> +</FORM> + +<!-- footer --> +<BR><FONT Size=+5> </FONT> +</TD> +<TD WIDTH=15><IMG SRC=http://www.nevrax.org/inc/img/pixel.gif WIDTH=15 HEIGHT=15 BORDER=0 ALT=""></TD> +</TR> +</TABLE> +</BODY> +</HTML></BODY></HTML> diff --git a/cvs/cvsweb.cgi/code/nel/samples/pacs/object.h?rev=1.2&content-type=text/x-cvsweb-markup&sortby=date/index.html b/cvs/cvsweb.cgi/code/nel/samples/pacs/object.h?rev=1.2&content-type=text/x-cvsweb-markup&sortby=date/index.html new file mode 100644 index 00000000..641c72eb --- /dev/null +++ b/cvs/cvsweb.cgi/code/nel/samples/pacs/object.h?rev=1.2&content-type=text/x-cvsweb-markup&sortby=date/index.html @@ -0,0 +1,129 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML> +<HEAD><style> A { color:black }</style> +<!-- hennerik CVSweb $Revision: 1.93 $ --> +<TITLE>code/nel/samples/pacs/object.h - view - 1.2</TITLE></HEAD> +<BODY BGCOLOR="#eeeeee"> +<table width="100%" border=0 cellspacing=0 cellpadding=1 bgcolor="#aaaaaa"><tr valign=bottom><td><a href="object.h?sortby=date"><IMG SRC="http://www.nevrax.org/inc/img/picto-up.gif" ALT="[BACK]" BORDER="0" WIDTH="14" HEIGHT="13"></a> <b>Return to <A HREF="object.h?sortby=date">object.h</A> + CVS log</b> <IMG SRC="http://www.nevrax.org/inc/img/picto-news.gif" ALT="[TXT]" BORDER="0" WIDTH="13" HEIGHT="15"></td><td align=right><IMG SRC="http://www.nevrax.org/inc/img/picto-dir.gif" ALT="[DIR]" BORDER="0" WIDTH="15" HEIGHT="13"> <b>Up to <a href="/cvs/cvsweb.cgi/?sortby=date">Nevrax</a> / <a href="/cvs/cvsweb.cgi/code/?sortby=date">code</a> / <a href="/cvs/cvsweb.cgi/code/nel/?sortby=date">nel</a> / <a href="/cvs/cvsweb.cgi/code/nel/samples/?sortby=date">samples</a> / <a href="/cvs/cvsweb.cgi/code/nel/samples/pacs/?sortby=date">pacs</a></b></td></tr></table><HR noshade><table width="100%"><tr><td bgcolor="#ffffff">File: <a href="/cvs/cvsweb.cgi/?sortby=date">Nevrax</a> / <a href="/cvs/cvsweb.cgi/code/?sortby=date">code</a> / <a href="/cvs/cvsweb.cgi/code/nel/?sortby=date">nel</a> / <a href="/cvs/cvsweb.cgi/code/nel/samples/?sortby=date">samples</a> / <a href="/cvs/cvsweb.cgi/code/nel/samples/pacs/?sortby=date">pacs</a> / <a href="/cvs/cvsweb.cgi/code/nel/samples/pacs/object.h?sortby=date">object.h</a> (<A HREF="/cvs/cvsweb.cgi/~checkout~/code/nel/samples/pacs/object.h?rev=1.2&sortby=date" target="cvs_checkout" onClick="window.open('/cvs/cvsweb.cgi/~checkout~/code/nel/samples/pacs/object.h?rev=1.2','cvs_checkout','resizeable,scrollbars');"><b>download</b></A>)<BR> +Revision <B>1.2</B>, <i>Wed Feb 20 18:07:14 2002 UTC</i> (5 months ago) by <i>lecroart</i> +<BR>Branch: <b>MAIN</b> +<BR>CVS Tags: <b>georges_v2, HEAD</b><BR>Changes since <b>1.1: +2 -2 + lines</b><PRE> +#FIXED: doxygen warning +</PRE> +</td></tr></table><HR noshade><PRE>/** \file net_layer5/object.h + * Objects for the sample. Link between 3d instance and collision primitives. + * + * $Id: object.h,v 1.2 2002/02/20 18:07:14 lecroart Exp $ + */ + +/* Copyright, 2001 Nevrax Ltd. + * + * This file is part of NEVRAX NEL. + * NEVRAX NEL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + + * NEVRAX NEL is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with NEVRAX NEL; see the file COPYING. If not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + */ + +#ifndef NL_OBJECT_H +#define NL_OBJECT_H + +#include "nel/misc/types_nl.h" +#include "nel/misc/vector.h" +#include "nel/misc/vectord.h" +#include "nel/pacs/u_move_primitive.h" +#include "nel/pacs/u_global_position.h" + +// External classes + +namespace NLNET +{ +class CPacsClient; +}; + +namespace NLPACS +{ +class UMoveContainer; +class UMovePrimitive; +class UGlobalPosition; +}; + +namespace NL3D +{ +class UScene; +class UInstance; +}; + +/** + * object for the test + * + * \author Cyril 'Hulud' Corvazier + * \author Nevrax France + * \date 2001 + */ +class CObjectDyn +{ +public: + + /// Box constructor + CObjectDyn (double width, double depth, double height, double orientation, const NLMISC::CVectorD& pos, + const NLMISC::CVectorD& speed, bool obstacle, NLPACS::UMoveContainer &container, NL3D::UScene &scene, + NLPACS::UMovePrimitive::TReaction reaction, uint8 worldImage, uint8 nbImage, uint8 insertWorldImage); + + /// Cylinder constructor + CObjectDyn (double radius, double height, const NLMISC::CVectorD& pos, const NLMISC::CVectorD& speed, + bool obstacle, NLPACS::UMoveContainer &container, NL3D::UScene &scene, + NLPACS::UMovePrimitive::TReaction reaction, uint8 worldImage, uint8 nbImage, uint8 insertWorldImage); + + /// Set position + void setPos (const NLMISC::CVectorD& pos); + void setGlobalPos (NLPACS::UGlobalPosition& gpos, NLMISC::CVectorD& pos, uint8 worldimage); + + /// Set position + void setSpeed (const NLMISC::CVectorD& speed); + + /// Set position + const NLMISC::CVectorD& getPos () const + { + return _Position; + } + + /// Set position + const NLMISC::CVectorD& getSpeed () const + { + return _Speed; + } + + /// Simulate + void tryMove (double deltaTime, NLPACS::UMoveContainer &container, uint8 worldImage); + void doMove (double deltaTime, uint8 worldImage); + + /// Remove object from container + void remove (NLPACS::UMoveContainer &container, NL3D::UScene &scene); + +private: + + bool _TryMove; + NLMISC::CVectorD _Position; + NLMISC::CVectorD _TryPosition; + NLMISC::CVectorD _Speed; + NLPACS::UMovePrimitive *_MovePrimitive; + NL3D::UInstance *_Instance; +}; + + +#endif // NL_OBJECT_H + +/* End of object.h */ +</PRE>
\ No newline at end of file diff --git a/cvs/cvsweb.cgi/code/nel/samples/pacs/readme.txt?sortby=date b/cvs/cvsweb.cgi/code/nel/samples/pacs/readme.txt?sortby=date new file mode 100644 index 00000000..d9d89f56 --- /dev/null +++ b/cvs/cvsweb.cgi/code/nel/samples/pacs/readme.txt?sortby=date @@ -0,0 +1,146 @@ +<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> +<HTML> +<HEAD> + <TITLE>nevrax.org : cvs</TITLE> + <META name="keywords" content="freesoftware,nel,newt,snowballs,richard stallman,GNU,Multi-User Online World"> + + <LINK REL=stylesheet TYPE="text/css" HREF="http://www.nevrax.org/inc/css/nevrax.css"> +</HEAD> +<BODY MARGINHEIGHT="0" MARGINWIDTH="0"> + +<!-- uplinks --> +<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0> + <TR> + <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD> + <TD WIDTH=140 BGCOLOR=#dddddd><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="16" BORDER=0 ALT=""></TD> + <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD> + <TD><IMG width=6 height=14 SRC="http://www.nevrax.org/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle> <A CLASS=uplinks HREF=http://www.nevrax.org><b>Home</B></FONT></A> </TD> + <TD><IMG width=6 height=14 SRC="http://www.nevrax.org/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle> <A CLASS=uplinks HREF=http://www.nevrax.com><b>nevrax.com</B></FONT></A> </TD> + </TR> +</TABLE> + +<!-- banner Nevrax --> +<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH=100%> + <TR><TD BGCOLOR="#000000" BACKGROUND="http://www.nevrax.org/inc/img/black_banner.jpg"><A HREF="http://www.nevrax.org"><IMG SRC="http://www.nevrax.org/inc/img/nevrax.gif" WIDTH="170" HEIGHT="45" BORDER=0 ALT="Nevrax" ></A></TD></TR> +</TABLE> + +<!-- main table --> +<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 height=100%> + <TR> + <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="10" BORDER=0 ALT=""></TD> + <TD WIDTH=140 BGCOLOR=#dddddd VALIGN=TOP ALIGN=middle><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT=""> + + <!------ Begin Box ------> + <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 BGCOLOR=black><TR><TD><TABLE border=0 cellspacing=2 cellpadding=0 width=120><tr><TD ALIGN=middle bgcolor=black> + <FONT COLOR=white FACE="sans-serif"><B>Nevrax.org</B></FONT></TD></TR><tr><td colspan=2 bgcolor=#FFFFFF> + <TABLE cellspacing=0 cellpadding=1 border=0> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/news/" TITLE="Rubrique news"><img width=13 height=15 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-news.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/news/" TITLE="News">News</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/mail/" TITLE="Rubrique mail"><img width=15 height=11 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-mail.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/mail/" TITLE="Mailing list archive">Mailing-list</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/docs/" TITLE="Rubrique docs"><img width=14 height=16 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-docs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/docs/" TITLE="Documentation">Documentation</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/cvs/" TITLE="Rubrique cvs"><img width=13 height=17 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-cvs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/cvs/" TITLE="CVS Web">CVS</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/bugs/" TITLE="Rubrique bugs"><img width=20 height=16 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-bugs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/bugs/" TITLE="Bugtracking">Bugs</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/free/" TITLE="Rubrique license"><img width=18 height=12 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-free.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/free/" TITLE="Free Software">Free software</a></td></tr> + </TABLE> + </TD></TR></TABLE></TD></TR></TABLE> + <!------ End Box ------> + + </TD> + <TD WIDTH=15><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD> + <TD ALIGN=left valign=top><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT=""> + +<!-- title --> +<TABLE background="http://www.nevrax.org/inc/img/redline.gif" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td> +<A HREF="http://www.nevrax.org/cvs/"><img src="http://www.nevrax.org/inc/img/t_cvs.gif" ALT="cvs" HEIGHT=20 BORDER=0></A> +</td><td><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="1" HEIGHT="1" BORDER=0 ALT=""> +</td></tr></table> + +<!-- title --> +<table width=100%><tr><td align=left><b> <a href="/cvs/cvsweb.cgi/?sortby=date">Nevrax</a> / <a href="/cvs/cvsweb.cgi/code/?sortby=date">code</a> / <a href="/cvs/cvsweb.cgi/code/nel/?sortby=date">nel</a> / <a href="/cvs/cvsweb.cgi/code/nel/samples/?sortby=date">samples</a> / <a href="/cvs/cvsweb.cgi/code/nel/samples/pacs/?sortby=date">pacs</a> / readme.txt</b></td><td align=right><b></b></td></TR></TABLE> + +<!-- block --> +<TABLE bgcolor="#dddddd" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td width=1% valign=middle><img width=6 height=14 hspace=2 vspace=2 src="http://www.nevrax.org/inc/img/reddots.gif"></TD> + <TD><B>readme.txt</B></TD> + <TD ALIGN=RIGHT> </td> +</tr></table> +<P> +<p>Default branch: MAIN<BR> +<HR size=1 NOSHADE><P><a NAME="rev1.1"></a><a NAME="nel_0_4"></a><a NAME="georges_v2"></a><a NAME="demo_0_1"></a><a NAME="HEAD"></a><a NAME="MAIN"></a> + Revision <A HREF="readme.txt?rev=1.1&content-type=text/x-cvsweb-markup&sortby=date"><b>1.1</b></A> / (<A HREF="/cvs/cvsweb.cgi/~checkout~/code/nel/samples/pacs/readme.txt?rev=1.1&content-type=text/plain&sortby=date" target="cvs_checkout" onClick="window.open('/cvs/cvsweb.cgi/~checkout~/code/nel/samples/pacs/readme.txt?rev=1.1&content-type=text/plain','cvs_checkout','resizeable,scrollbars');"><b>download</b></A>) - <a href="/cvs/cvsweb.cgi/code/nel/samples/pacs/readme.txt?annotate=1.1&sortby=date">annotate</a> - <A HREF="/cvs/cvsweb.cgi/code/nel/samples/pacs/readme.txt?r1=1.1&sortby=date">[select for diffs]</A> +, <i>Thu Jul 19 11:59:02 2001 UTC</i> (12 months, 1 week ago) by <i>corvazier</i> +<BR>Branch: <b><A HREF="readme.txt?sortby=date&only_with_tag=MAIN">MAIN</A> +</b> +<BR>CVS Tags: <b><A HREF="readme.txt?sortby=date&only_with_tag=nel_0_4">nel_0_4</A>, +<A HREF="readme.txt?sortby=date&only_with_tag=georges_v2">georges_v2</A>, +<A HREF="readme.txt?sortby=date&only_with_tag=demo_0_1">demo_0_1</A>, +<A HREF="readme.txt?sortby=date&only_with_tag=HEAD">HEAD</A> +</b><BR>Diff<PRE> +ADDED: sample to show how to use PACS +</PRE> + +<!-- block --> +<TABLE bgcolor="#dddddd" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td width=1% valign=middle><img width=6 height=14 hspace=2 vspace=2 src="http://www.nevrax.org/inc/img/reddots.gif"></TD> + <TD><B>Request Diffs</B></TD> + <TD ALIGN=RIGHT> </td> +</tr></table> +<P> +<P> +<FORM METHOD="GET" ACTION="/cvs/cvsweb.cgi/code/nel/samples/pacs/readme.txt.diff" NAME="diff_select"> +<INPUT TYPE=HIDDEN NAME="sortby" VALUE="date"> +Diffs between +<SELECT NAME="r1"> +<OPTION VALUE="text" SELECTED>Use Text Field +<OPTION VALUE="1.1:nel_0_4">nel_0_4 +<OPTION VALUE="1.1:georges_v2">georges_v2 +<OPTION VALUE="1.1:demo_0_1">demo_0_1 +<OPTION VALUE="1:MAIN">MAIN +<OPTION VALUE="1.1:HEAD">HEAD +</SELECT> +<INPUT TYPE="TEXT" SIZE="12" NAME="tr1" VALUE="1.1" onChange='document.diff_select.r1.selectedIndex=0'> + and +<SELECT NAME="r2"> +<OPTION VALUE="text" SELECTED>Use Text Field +<OPTION VALUE="1.1:nel_0_4">nel_0_4 +<OPTION VALUE="1.1:georges_v2">georges_v2 +<OPTION VALUE="1.1:demo_0_1">demo_0_1 +<OPTION VALUE="1:MAIN">MAIN +<OPTION VALUE="1.1:HEAD">HEAD +</SELECT> +<INPUT TYPE="TEXT" SIZE="12" NAME="tr2" VALUE="1.1" onChange='docuement.diff_select.r2.selectedIndex=0'> +<BR>Type of Diff should be a <SELECT NAME="f"> +<OPTION VALUE=h SELECTED>Colored Diff<OPTION VALUE=H>Long Colored Diff<OPTION VALUE=u>Unidiff<OPTION VALUE=c>Context Diff<OPTION VALUE=s>Side by Side</SELECT><INPUT TYPE=SUBMIT VALUE=" Get Diffs "> +</FORM> + +<!-- block --> +<TABLE bgcolor="#dddddd" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td width=1% valign=middle><img width=6 height=14 hspace=2 vspace=2 src="http://www.nevrax.org/inc/img/reddots.gif"></TD> + <TD><B>Select branch</B></TD> + <TD ALIGN=RIGHT> </td> +</tr></table> +<P> +<P> +<A name=branch></A> +<FORM METHOD="GET" ACTION="/cvs/cvsweb.cgi/code/nel/samples/pacs/readme.txt"> +<INPUT TYPE=HIDDEN NAME="sortby" VALUE="date"> +View only Branch: +<SELECT NAME="only_with_tag" onchange="submit()"> +<OPTION VALUE="">Show all branches +<OPTION>MAIN +</SELECT> +<INPUT TYPE=SUBMIT VALUE=" View Branch "> +</FORM> +<A name=logsort></A> +<FORM METHOD="GET" ACTION="/cvs/cvsweb.cgi/code/nel/samples/pacs/readme.txt"> +<INPUT TYPE=HIDDEN NAME="sortby" VALUE="date"> +Sort log by: +<SELECT NAME="logsort" onchange="submit()"> +<OPTION VALUE=cvs>Not sorted<OPTION VALUE=date SELECTED>Commit date<OPTION VALUE=rev>Revision</SELECT> +<INPUT TYPE=SUBMIT VALUE=" Sort "> +</FORM> + +<!-- footer --> +<BR><FONT Size=+5> </FONT> +</TD> +<TD WIDTH=15><IMG SRC=http://www.nevrax.org/inc/img/pixel.gif WIDTH=15 HEIGHT=15 BORDER=0 ALT=""></TD> +</TR> +</TABLE> +</BODY> +</HTML></BODY></HTML> |