Ejemplo n.º 1
0
//////////////////////////////////////////////////////////////////////////////////
// Initializes all member variables
// is called from all constructors!
//////////////////////////////////////////////////////////////////////////////////
void CRMEngine::InitCRMEngine()
{
	HRESULT   rval;
	LPDIRECT3DRM lpD3DRMInterface;

	CDXLOG("START: CRMEngine::InitCRMEngine");
	CDXLOG("Initialize member vars");

	// initialize member variables
	m_Direct3D = NULL;
	m_IMDevice = NULL;
	m_RMDevice = NULL;

	m_Direct3DRM = NULL;
	m_lpDDClipper = NULL;

	m_Screen = NULL;

	CDXLOG("Create the Direct3D Retained Mode Interface");

	// create the main d3drm object
	rval = Direct3DRMCreate(&lpD3DRMInterface);
	if(rval != D3DRM_OK) {
		D3DError(rval, m_Screen->GetWindowHandle(), __FILE__, __LINE__);
	}

	CDXLOG("QueryInterface for a IDirect3DRM3 Interface");

    /* Get the interface IDirect3DRM3 */
    rval = lpD3DRMInterface->QueryInterface (IID_IDirect3DRM3,
                                                (LPVOID *) &m_Direct3DRM);

	CDXLOG("Release the old IDirect3DRM interface");

	/* Release the Old IDirect3DRM */
	RELEASE(lpD3DRMInterface);

	if(rval != D3DRM_OK) {
		D3DError(rval, m_Screen->GetWindowHandle(), __FILE__, __LINE__);
	}

	CDXLOG("END: CRMEngine::InitCRMEngine");
}
Ejemplo n.º 2
0
// Constructor for Window class.
BoidsWin::BoidsWin( )
{
	// Create the D3DRM interface.
	Direct3DRMCreate( &d3drm );

	// Initialise the D3D interface pointers as being initially unused.
	device = NULL;  
	scene = NULL;
	clipper = NULL;
	frontSurface = NULL;  // Used for full screen mode.
	zBuffer = NULL;
	directDraw = NULL;

	numFlyers = INITIAL_NUM_FLYERS;  // Various initialisations.
	requiredFlyers = numFlyers;
	renderStyle = DEFAULT_RENDER_STYLE;
	flyerMesh = DEFAULT_FLYER_MESH;
	flyerColour = RGB_WHITE;

	frameCount = 0;  // Reset the frame counter to start at zero.
	overloaded = false;  // The simulation is not overloaded to start with.

	flockFormingActive = true;  // Activate the behaviour flags.
	velocityMatchingActive = true;
	collisionAvoidanceActive = true;

	cameraView = CAM_ABOVE;  // Initialise the camera view.
	cameraOnBoid = false;


	threadEnabled = false;  // Initialise the multitasking flags.
	threadFinished = true;
	appIdle = false;
	needShutdown = false;
	needToggleControls = false;
	needFullScreen = false;


	fullScreenMode = FULLSCREEN_STARTUP;  // Windowed & Full Screen modes.
	showControlPanel = CONTROL_PANEL_ON_STARTUP;
	windowedModePos.length = 0;  // Used to indicate as being uninitialised.
	resolutionFS.widthPixels = FULLSCREEN_WIDTH;  // Set default FS mode.
	resolutionFS.heightPixels = FULLSCREEN_HEIGHT;
	resolutionFS.colourDepthBits = FULLSCREEN_COLOUR_DEPTH;

	stopped = false;
	runTime = 0;
	stopTime = 0;
	frameStartTime = clock( );


	// Flyer attributes dialog settings.
	accelerationRate = ACCELERATION_RATE;
	angleOfVision = ANGLE_OF_VISION;
	collisionDistance = COLLISION_DISTANCE;
	flockFormingDistance = FLOCK_FORMING_DISTANCE;
	flockingRadius = FLOCKING_RADIUS;
	maximumSpeed = MAXIMUM_SPEED;
	minimumSpeed = MINIMUM_SPEED;
	rangeOfFlockHeadings = RANGE_OF_FLOCK_HEADINGS;
	wingStrokesPerSecond = WING_STROKES_PER_SECOND;
}