Waitrud Weber’s blog

things and reminders for memories

3d: WindowsAPI: Windows-make: we can not free memories

20200214 i: 1319 p: 037F3158 i: 1320 p: 037F3170 i: 1321 p: 037F3188 i: 1322 p: 037F3398 i: 1323 p: 037F3398 i: 1324 p: 037F33C8 i: 1325 p: 037F33C8 i: 1326 p: 037F31A0 i: 1327 p: 037F31A0 i: 1328 p: 037F33E0 i: 1329 p: 037F3230 i: 1330 p: 037F3230 i: 1331 p: 037F31B8 i: 1332 p: 037F31B8 i: 1333 p: 037F30F8 i: 1334 p: 037F31E8 i: 1335 p: 037F33B0 i: 1336 p: 037F33B0 i: 1337 p: 037F3320 i: 1338 p: 037F3320 i: 1339 p: 037F3200 i: 1340 p: 037F3200 i: 1341 p: 037F32C0 i: 1342 p: 037F31D0 i: 1343 p: 037F31D0 i: 1344 p: 037F3218 i: 1345 p: 037F3218 i: 1346 p: 037F3338 i: 1347 p: 037F3110 i: 1348 p: 037F3248 i: 1349 p: 037F3248 i: 1350 p: 037F3278 i: 1351 p: 037F3278 i: 1352 p: 037F32A8 i: 1353 p: 037F32A8 i: 1354 p: 037F3128 i: 1355 p: 037F32D8 i: 1356 p: 037F32D8 i: 1357 p: 037F3380 i: 1358 p: 037F3380 i: 1359 p: 037F3368 call_once_display_threeD_initialize= 1

// it doesn't work and throuh here: 20191112
//
//
void wButtonController::initialize( int m ) {

	printf("wButtonController::initialize %d\r\n", this->CursolNumber);
	//exit(-2); // it does work: 20191112 at 8.

	switch( this->CursolNumber ) {
	case 0:
		// list_directory ();
		break;
	case 2:
		//something_word_initialize ();
		display_threeD_screen_initialize_002 ();
		//printf( "display_threeD_screen_initialize_002 ():" );
		//exit(-1);
		break;
	case 3:
		printf( "display_threeD_screen_initialize_003 ():" );
		exit(-1);
		break;
	case 8:
		switch( mode_rails ) {
		case 0:
			display_threeD_screen_initialize ();
			break;
		case 1:
			display_threeD_screen_initialize_OnRails ();
			break;
		}
		break;
	default:
		break;
	}

	printf("wButtonController::initialize %d ends.\r\n", this->CursolNumber);
	//exit(-2); // it does work: 20191112 at 8.
}
// All qualified at 20190627:
//
//
//
//
int display_threeD_screen_initialize_002 () {
	printf("display_threeD_screen_initialize_002 starts\r\n");

	vPoint* eye = nullptr;

	if ( call_once_display_threeD_initialize == 0 ) {
		call_once_display_threeD_initialize = 1;
	} else {
		vCalculation* calc = new vCalculation ();
		calc->Print_Point_Memories ();
		printf("call_once_display_threeD_initialize= %d\r\n", call_once_display_threeD_initialize);
		exit(-1);
	}

	eye = new vPoint();
	eye->setPoint( 500.0f, 500.0f, -500.0f);
	screen = new vScreen ();
	vPoint* U= new vPoint ( 160.0f, 0.0f, 0.0f );
	vPoint* V= new vPoint ( 0, 90.0f, 0 );
	screen->put_U ( *U );
	screen->put_V ( *V );

	screen->put_Up ( *( new vPoint(0.0f, 1.0f, 0.0f) ) );
	screen->put_C ( *( new vPoint( 0.0f, 0.0f, -50.0f) ));
	screen->setWidth ( 640 );
	screen->setHeight ( 480 );
	screen->setEye ( *eye );
	screen->LookAt ( *(new vPoint( 0.0f, 0.0f, 0.0f )) );
	screen->HowFarFromEye = 320.0f;

	screen->calculation_up_UV();
	screen->OntheScreen( &g_x, &g_y );

	if ( memorized_CurveLines == 0 )
		curve_initialization();

	memorized_CurveLines = 1;
	printf("display_threeD_screen_initialize:memorized_CurveLines=%d\r\n", memorized_CurveLines );
}
void free_point ( vPoint* p ) {
	printf("point |%p|\r\n", p);
	delete( p );
	printf("delete |%p|\r\n", p);
	// debug 20200213
	//if ( p == nullptr ) exit(-1);
	//exit(-1);
	vPoint *pp = new vPoint();
	printf("point |%p|\r\n", pp);
	delete(pp);
	printf("point |%p|\r\n", pp);
	// exit(-1);

	if ( once_memorized ) delete(dummy_pp);

	if ( dummy_pp == nullptr && once_memorized ) {
		printf("dummy_pp=%p\r\n", dummy_pp);
		exit(-1);
	}

	dummy_pp = new vPoint();
	once_memorized = 1;
}

20200224: Maybe, free memorization:vPoint, so, we cannnot add:

//
//
//
//
//
void vScreen::calculation_up_UV () {
	vCalculation calc_this;

	log_msg_003("this->eye= ");
	this->eye.print();
	log_msg_003("lookat= ");
	this->lookat.print();

	vPoint howfar = calc_this.subtract ( this->lookat, this->eye );
	vPoint n_howfar = calc_this.normal( howfar );
	log_msg_003("n_howfar= ");
	n_howfar.print();

	howfar = calc_this.scale( n_howfar, this->HowFarFromEye );

	log_msg_003("howfar= ");
	howfar.print();

	this->C = calc_this.add( this->eye, howfar );

	this->up = normal ( this->up ) ;
	log_msg_003("up= ");
	up.print();

	u = cross( n_howfar, up );		//right , -left
	u = normal ( u ) ;				
	up = cross( u, n_howfar );		//up
	v = cross( up, u );				// depth

	U = calc_this.scale( u, this->width );
	V = calc_this.scale( this->up, this->height ); // V means UP, v means depth direction

	log_msg_003("u= ");
	u.print();
	log_msg_003("U= ");
	U.print();
	log_msg_003("V= ");
	V.print();

	vPoint harfU = calc_this.scale( u, -this->width/2.0f );
	vPoint harfV = calc_this.scale( this->up, -this->height/2.0f );

	this->C = calc_this.add( this->C, harfU );
	this->C = calc_this.add( this->C, harfV );

	log_msg_003("this->C= ");
	this->C.print();

	//20191228
	screen_tri.p1 = this->C;
	screen_tri.p2 = calc_this.add( this->C, this->U );
	screen_tri.p3 = calc_this.add( this->C, this->V );

	log_msg_003("calculation_up_UV: starts\r\n");
}
----
WM_MESSG 004: 20 *(p_evt->uMsg):20 uMsg:20 p_evt->uMsg: 2685472 &uMsg: 2685472
WM_PAINT 002: 15 *(p_evt->uMsg):0 uMsg: 15
WM_MESSG 003: 15 *(p_evt->uMsg):0
wButtonController::Process: 0 / 15<-WM_PAINT wParam 1040255369 lParam 0 this->event->uMsg:2685472 *(this->event->uMsg)=0

wButtonController::WM_PAINT:
this->event->main_mode = 2
default:
void wButtonController::drawButtons ( HDC hdc ): Starts
AryButton 0 = 0
AryButton 1 = 0
AryButton 2 = 1
AryButton 3 = 0
AryButton 4 = 0
AryButton 5 = 0
AryButton 6 = 0
AryButton 7 = 0
AryButton 8 = 0
void wButtonController::drawButtons ( HDC hdc ): Ends
wmpaint_display_threeD_proc_002:
memorized_CurveLines=0
memorized_CurveLines=0
WM_MESSG 004: 15 *(p_evt->uMsg):1970510888 uMsg:15 p_evt->uMsg: 2685472 &uMsg: 2686020
WM_PAINT 005: 15 *(p_evt->uMsg):1970510888 uMsg: 15
WM_PAINT 006: 15 *(p_evt->uMsg):1970510888 uMsg: 15
WM_MESSG 000: hWnd 132142: uMsg 257: wParam 13: lParam -1071906815: canvas 4370832: btc 4370848: *(p_evt->uMsg) 257:
WM_MESSG 003: 257 *(p_evt->uMsg):257
wButtonController::Process: 257 / 15<-WM_PAINT wParam 13 lParam -1071906815 this->event->uMsg:2686208 *(this->event->uMs
g)=257
wButtonController::ProcessWmKeyup: Starts:wButtonController::initialize 2
display_threeD_screen_initialize_002 starts
this->eye= p( 500.000000, 500.000000, -500.000000)
lookat= p( 0.000000, 0.000000, 0.000000)
n_howfar= p( -0.577350, -0.577350, 0.577350)
howfar= p( -184.752075, -184.752075, 184.752075)
up= p( 0.000000, 1.000000, 0.000000)
u= p( 0.707107, -0.000000, 0.707107)
U= p( 452.548340, -0.000000, 452.548340)
V= p( -195.959167, 391.918335, 195.959167)
this->C= p( 186.953339, 119.288757, -639.501709)
calculation_up_UV: starts
aReuse: 7/16
----