Пример #1
0
IK_IMPL_SOLVER(grabPilaIK, info, result) {
	GET_COMP(mole_t, info.handle, TCompTransform);
	GET_COMP(skc, info.handle, SkelControllerMole);
	GET_COMP(pila_t, skc->getGrabbedPila(), TCompTransform);
	VEC3 right = -mole_t->getLeft();
	right.Normalize();
	result.new_pos = pila_t->getPosition() + right * 0.3f;

	//result.bone_normal = skc->getGrabNormalLeft();
}
Пример #2
0
int zoom_y(struct pixmap *source, struct pixmap *dest)
{
	int				 result = 0,
					 dest_row,
					 column,
					 component,
					 src_index;
	float			 ratio,
					 src_ptr,
					 delta;
	unsigned char	 src_component;

	if (source && dest) {
		/*
		 *	We could think of resizing a pixmap and changing the number of
		 *	components at the same time. Maybe this will be implemented later.
		 */
		if (source->width == dest->width && source->components == dest->components) {
			if (source->height < dest->height) {
				ratio = ((float) source->height / (float) dest->height);

				for (src_ptr = 0, dest_row = 0; dest_row < dest->height; src_ptr += ratio, dest_row++) {
					/*
					 *	dest[dest_row] = source[(int)src_ptr] +
					 *	  (source[((int)src_ptr) + 1] - source[(int)src_ptr])
					 *	  * (src_ptr - (int)src_ptr);
					 */
					src_index = (int)src_ptr;
					delta = src_ptr - src_index;

					for (column = 0; column < source->width; column++) {
						for (component = 0; component < source->components; component++) {
							src_component = GET_COMP(source, column, src_index, component);

							GET_COMP(dest, column, dest_row, component) =
								src_component +
								( GET_COMP(source, column, src_index + 1,
											component) -
								  src_component
								) * delta;
						}
					}
				}
			} else {
				if (!quiet) fprintf(stderr, "%s: zoom_y: error: can only zoom out\n", __progname);
				result = -1;
			}
		} else {
			if (!quiet) fprintf(stderr, "%s: zoom_y: error: incompatible pixmaps\n", __progname);
			result = -1;
		}
	}

	return result;
}
Пример #3
0
IK_IMPL_SOLVER(grabLeftIK, info, result) {
	GET_COMP(skc, info.handle, SkelControllerMole);
	GET_COMP(tmx, skc->getGrabbed(), TCompTransform);
	GET_COMP(tmx_mole, info.handle, TCompTransform);
	result.new_pos = skc->getGrabLeft();
	//result.bone_normal = VEC3(0, 1, 0);
	//result.bone_normal = result.new_pos - tmx->getPosition();
	//result.bone_normal = tmx_mole->getLeft();
	result.bone_normal = skc->getGrabNormalRight();
	result.bone_normal.Normalize();
	Debug->DrawLine(VEC3(0, 100, 0), result.new_pos);
}
Пример #4
0
void TCompGuiDrag::AddDragItem()
{
	drag_item = createPrefab(DRAG_ITEM_PREFAB);
	GET_COMP(tmx, drag_item, TCompTransform);
	GET_COMP(gui, drag_item, TCompGui);
	if (tmx && gui) {
		tmx->setPosition(myTransform->getPosition() + VEC3_FRONT * 0.01f);
		float height = myGui->GetHeight();
		tmx->setScaleBase(VEC3(height, height, height) * DRAG_ITEM_SCALE_FACTOR);
		gui->SetHeight(height);
		gui->SetWidth(height); // No es un error, la flecha es cuadrada con la altura del selector
		gui->SetParent(MY_OWNER);
	}
}
Пример #5
0
void SkelControllerMole::grabPila(CHandle h)
{
	grabbedPila = h;
	enableIK(SK_RHAND, grabPilaIK, SK_MOLE_TIME_TO_GRAB * 0.9f);
	GET_COMP(pila, grabbedPila, TCompPila);
	if (pila) pila->Grab();
}
Пример #6
0
IK_IMPL_SOLVER(ungrabbedPila, info, result) {
	GET_COMP(skc, info.handle, SkelControllerMole);
	TMsgAttach msg;
	msg.handle = CHandle();
	skc->getGrabbedPila().sendMsg(msg);
	skc->removePila();
}
Пример #7
0
int save_pixmap_pxm(struct pixmap *p, FILE *fp)
{
	int	 result = 0;
#ifndef CANONICAL_WAY
	int	 row,
		 column,
		 component;
#endif /* CANONICAL_WAY */

	if (p) {
		fprintf(fp, "P%c\n%d %d\n255\n", (p->components == 1) ? '5' : '6', p->width, p->height);
#ifdef CANONICAL_WAY
		fwrite(p->planes, p->height*p->width*p->components, 1, fp);
#else
		for (row = 0; row < p->height; row++) {
			for (column = 0; column < p->width; column++) {
				for (component = 0; component < p->components; component++) {
					putc(GET_COMP(p, column, row, component), fp);
				}
			}
		}
#endif /* CANONICAL_WAY */
	}

	return result;
}
Пример #8
0
void SkelControllerMole::unpushObject()
{
	GET_COMP(box, pushed, TCompBox);
	box->UnGrab();
	disableIK(SK_LHAND, SK_MOLE_TIME_TO_UNGRAB, ungrabbed);
	disableIK(SK_RHAND, SK_MOLE_TIME_TO_UNGRAB, ungrabbed);
}
Пример #9
0
int save_pixmap_png(struct pixmap *p, FILE *fp)
{
	int			 result = 0,
				 y;
	png_structp	 png_ptr;
	png_infop	 info_ptr;

	if (p) {
		if ((png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL)) != NULL) {
			if ((info_ptr = png_create_info_struct(png_ptr)) != NULL) {
				if (setjmp(png_ptr->jmpbuf) == 0) {
					png_init_io(png_ptr, fp);
					png_set_IHDR(png_ptr, info_ptr, p->width, p->height, 8, (p->components == 1) ? PNG_COLOR_TYPE_GRAY : PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
					png_write_info(png_ptr, info_ptr);
					for (y = 0; y < p->height; y++) {
						png_write_row(png_ptr, (png_bytep)&GET_COMP(p, 0, y, 0));
					}
					png_write_end(png_ptr, info_ptr);
					png_destroy_write_struct(&png_ptr, (png_infopp)NULL);
				} else
					result = -1;
			} else
				result = -1;

			png_destroy_write_struct(&png_ptr,  (png_infopp)NULL);
		} else
			result = -1;
	}

	return result;
}
Пример #10
0
void SkelControllerMole::pushObject(CHandle h) {
	pushed = h;
	GET_COMP(box, h, TCompBox);
	GET_COMP(tMe, owner, TCompTransform);
	VEC3 pos_grab_dummy;
	box->getPushPoints(
		tMe
		, left_h_target
		, right_h_target
		, front_h_dir
		, pos_grab_dummy
		, left_h_normal
		, right_h_normal
	);
	enableIK(SK_LHAND, grabLeftIK, SK_MOLE_TIME_TO_GRAB * 0.9f);
	enableIK(SK_RHAND, grabRightIK, SK_MOLE_TIME_TO_GRAB * 0.9f);
}
Пример #11
0
float CRenderTechnique::getPriority(CHandle owner) const
{
	float res = priority;
	if (category == UI_OBJS) {
		GET_COMP(trans, owner, TCompTransform);
		res = trans ? trans->getPosition().z : priority;
	}
	return res;
}
Пример #12
0
struct pixmap *rotate_left(struct pixmap *p)
{
	struct pixmap	*result = NULL;
	int				 x,
					 y,
					 c;

	if ((result = alloc_pixmap(p->height, p->width, p->components)) != NULL) {
		for (x = 0; x < p->width; x++) {
			for (y = 0; y < p->height; y++) {
				for (c = 0; c < p->components; c++) {
					GET_COMP(result, y, p->width - x - 1, c) = GET_COMP(p, x, y, c);
				}
			}
		}
	}

	return result;
}
Пример #13
0
void SkelControllerMole::ungrabPila()
{
	GET_COMP(pila, grabbedPila, TCompPila);
	TMsgAttach msg;
	msg.handle = CHandle();
	grabbedPila.sendMsg(msg);
	pila->setFalling();
	grabbedPila = CHandle();
	//disableIK(SK_RHAND, SK_MOLE_TIME_TO_UNGRAB, ungrabbed);
	//(SK_RHAND, SK_MOLE_TIME_TO_UNGRAB, );
}
void CPlayerBase::onGoAndLook(const TMsgGoAndLook& msg) {
	if (msg.target.isValid()) {
		CEntity* e = msg.target;
		//TCompTransform * transform = e->get<TCompTransform>();
		GET_COMP(transform, msg.target, TCompTransform);
		if (transform) {
			float pitch;
			transform->getAngles(&cinematicTargetYaw, &pitch);
			cinematicTargetPos = transform->getPosition();
			cinematicEndCode = msg.code_arrived;
			onCinematic = true;
		}
	}
}
Пример #15
0
void TCompCulling::updateNext()
{
	if (cull_camera) {
		if (!camera_main.isValid()) camera_main = tags_manager.getFirstHavingTag("camera_main");
		if (camera_main.isValid()) {
			GET_COMP(cul_cam, camera_main, TCompCulling);
			if (cul_cam) cul_cam->update();
		}
	}
	else {
		TCompCulling* cullings = getHandleManager<TCompCulling>()->getFirstObject();
		(cullings + next_to_update++)->update();
		if (next_to_update > getHandleManager<TCompCulling>()->size()) TCompCulling::next_to_update = 0;
	}
	cull_camera = !cull_camera;
}
Пример #16
0
int save_pixmap_tiff(struct pixmap *p, int c, int q, int pr, char *name)
{
	TIFF	*out;
	int		 result = 0,
			 row_stride,
			 y;

	if (p) {
		if ((out = TIFFOpen(name, "w")) != NULL) {
			TIFFSetField(out, TIFFTAG_IMAGEWIDTH, p->width);
			TIFFSetField(out, TIFFTAG_IMAGELENGTH, p->height);
			TIFFSetField(out, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);
			TIFFSetField(out, TIFFTAG_SAMPLESPERPIXEL, p->components);
			TIFFSetField(out, TIFFTAG_BITSPERSAMPLE, 8);
			TIFFSetField(out, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
			TIFFSetField(out, TIFFTAG_PHOTOMETRIC, (p->components == 1) ? PHOTOMETRIC_MINISBLACK : PHOTOMETRIC_RGB);
			TIFFSetField(out, TIFFTAG_COMPRESSION, c);
			switch (c) {
				case COMPRESSION_JPEG:
					TIFFSetField(out, TIFFTAG_JPEGQUALITY, q);
					TIFFSetField(out, TIFFTAG_JPEGCOLORMODE, JPEGCOLORMODE_RAW);
					break;
				case COMPRESSION_LZW:
				case COMPRESSION_DEFLATE:
					if (pr != 0)
						TIFFSetField(out, TIFFTAG_PREDICTOR, pr);
				default:
					break;
			}
			row_stride = p->width * p->components;
			TIFFSetField(out, TIFFTAG_ROWSPERSTRIP, TIFFDefaultStripSize(out, -1));
			for (y = 0; y < p->height; y++) {
				if (TIFFWriteScanline(out, &GET_COMP(p, 0, y, 0), y, 0) < 0) {
					if (!quiet) fprintf(stderr, "%s: save_pixmap_tiff: error: TIFFWriteScanline\n", __progname);
					result = -1;
					break;
				}
			}
			TIFFClose(out);
		} else
			result = -1;
	}

	return result;
}
Пример #17
0
void SkelControllerMole::updatePushPoints()
{
	if (!pushed.isValid()) return;
	if (isMovingBox()) {
		GET_COMP(box, pushed, TCompBox);
		GET_MY(tMe, TCompTransform);
		VEC3 pos_grab_dummy;
		box->getPushPoints(tMe
			, left_h_target
			, right_h_target
			, front_h_dir
			, pos_grab_dummy
			, left_h_normal
			, right_h_normal
			, 0.5f
			, false);
	}
}
Пример #18
0
int set_pixel(struct pixmap *p, int x, int y, unsigned char v)
{
	int	 result = 0,
		 component;

	if (p) {
		if (x >= 0 && x < p->width) {
			if (y >= 0 && y < p->height) {
				for (component = 0; component < p->components; component++)
					GET_COMP(p, x, y, component) = v;
			} else {
				if (!quiet) fprintf(stderr, "%s: set_pixel: error: y out of range\n", __progname);
				result = -1;
			}
		} else {
			if (!quiet) fprintf(stderr, "%s: set_pixel: error: x out of range\n", __progname);
			result = -1;
		}
	}

	return result;
}
void TCompLightDirShadowsDynamic::update(float dt) {
	PROFILE_FUNCTION("shadows: update");

	if (io->keys['0'].becomesPressed()) {
		offset++;
	}

	if (io->keys['9'].becomesPressed()) {
		offset--;
	}

	if (!h_main_camera.isValid()) {
		if(!setCameraHandle())
			return;
	}

	CHandle owner = CHandle(this).getOwner();
	GET_COMP(t_camera, h_main_camera, TCompCameraMain);
	
	//check if component same room as player
	CEntity *e = owner;
	if (!e) return;
	TCompRoom* cam_room = e->get<TCompRoom>();

	is_inRoom = ROOM_IS_IN(cam_room, SBB::readSala());

	if (!is_inRoom) return;

	if (t_camera) {
		VEC3 target = t_camera->getPosition();
		target += t_camera->getFront()*offset;
		if (last_position_target != target) {		//check if there are changes between frames
			updateFromEntityTransform(owner);
			this->lookAt(getPosition(), target);
			last_position_target = target;
		}
	}
	//updateFromEntityTransform(owner);
}
void TCompBoneTracker::update(float dt) {
    CEntity* e = h_entity;
    CEntity* my_e = CHandle(this).getOwner();
    if (!e || !my_e)
        return;
    TCompSkeleton* skel = e->get<TCompSkeleton>();
    if (!skel || bone_id == -1)
        return;
    auto bone = skel->model->getSkeleton()->getBone(bone_id);
    auto rot = Cal2Engine(bone->getRotationAbsolute());
    auto trans = Cal2Engine(bone->getTranslationAbsolute());

    TCompTransform* tmx = my_e->get<TCompTransform>();
    assert(tmx);

    //if (local_tmx_saved) {
    MAT44 bone_world = MAT44::CreateFromQuaternion(rot);
    bone_world.Translation(trans);
    MAT44 new_tmx = local_tmx * bone_world;
    VEC3 scale;
    new_tmx.Decompose(scale, rot, trans);
    //}

    tmx->setPosition(trans);
    tmx->setRotation(rot);

    GET_COMP(physics, CHandle(this).getOwner(), TCompPhysics);
    if (physics) {
        physics->setPosition(trans, rot);
    }
    //PxRigidDynamic *rd;
    //if (rd = physics->getActor()->isRigidDynamic()) {
    //	rd->setGlobalPose(PhysxConversion::ToPxTransform(trans, rot));
    //}

    ////If I follow a bone and other bone is following me IK needs an extra update!
    //GET_COMP(comp_ik, h_entity, TCompSkeletonIK);
    //if (comp_ik) comp_ik->update(dt);
}
Пример #21
0
void CImGuiModule::update(float dt) {
	ImGui_ImplDX11_NewFrame();

	ImGuiWindowFlags window_flags = 0;
	window_flags |= ImGuiWindowFlags_MenuBar;
	bool menu = true;
#ifndef FINAL_BUILD
	if (controller->IsToogleDebugUIPressed()) show_imgui = !show_imgui;
	if (!show_imgui) return;
	ImGui::Begin("Debug UI", &menu, ImVec2(800, 512), -1.0f, window_flags);
	ImGui::PushItemWidth(-140);                                 // Right align, keep 140 pixels for labels

	m_pLights_editor->update(dt);
	m_pMessages_editor->update(dt);

	//Engine Apps
	//---------------------------------------
	if (ImGui::BeginMenuBar())
	{
		if (ImGui::BeginMenu("Apps"))
		{
			ImGui::MenuItem("Log (L)", NULL, Debug->getStatus());
			ImGui::MenuItem("Commands (O)", NULL, Debug->GetCommandsConsoleState());

			ImGui::MenuItem("Particle editor (F8)", NULL, g_particlesManager->GetParticleEditorState());
			ImGui::MenuItem("Lights editor (F9)", NULL, m_pLights_editor->GetLightsEditorState());
			ImGui::MenuItem("Messages editor (F10)", NULL, m_pMessages_editor->GetEditorState());

			//Debug->OpenConsole();
			ImGui::EndMenu();
		}
		ImGui::EndMenuBar();
	}
	//---------------------------------------
	//Current Level
	IMGUI_SHOW_INT(CApp::get().GetLevelNumber());

	//Language
	IMGUI_SHOW_STRING(lang_manager->GetLanguage());

	//Difficulty
	IMGUI_SHOW_INT(GameController->GetDifficulty());

	//Extra wait end frame
	if (ImGui::TreeNode("Physx Timing")) {
		float tmax_update = g_PhysxManager->GetTMaxUpdate();
		ImGui::PushItemWidth(100);
		if (ImGui::DragFloat("tmax_update", &tmax_update, 0.01f)) {
			g_PhysxManager->SetTMaxUpdate(tmax_update);
		}
		ImGui::DragFloat("Wait end frame", CApp::get().GetWaitEnd());
		if (ImGui::Checkbox("Multi simulate", g_PhysxManager->GetMultiSimulatePointer())) {
			dbg("Changed Multisimulate\n");
		}
		ImGui::PopItemWidth();
		ImGui::TreePop();
	}

	//Last Input
	ImGui::Checkbox("Gamepad Mode", io->IsGamePadModePointer());

	//Buttons game
	//---------------------------------------
	if (GameController->GetGameState() == CGameController::RUNNING) {
		IMGUI_SHOW_INT(CGameController::RUNNING);
		if (ImGui::Button("PAUSE BUTTON"))
			GameController->SetGameState(CGameController::STOPPED);

		ImGui::SameLine();
		ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 1, 0, 1));
		if (ImGui::Button("RESUME BUTTON"))
			GameController->SetGameState(CGameController::RUNNING);

		ImGui::PopStyleColor();
	}
	else if (GameController->GetGameState() == CGameController::STOPPED) {
		IMGUI_SHOW_INT(CGameController::STOPPED);
		ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 1, 0, 1));
		if (ImGui::Button("PAUSE BUTTON"))
			GameController->SetGameState(CGameController::STOPPED);

		ImGui::PopStyleColor();

		ImGui::SameLine();

		if (ImGui::Button("RESUME BUTTON"))
			GameController->SetGameState(CGameController::RUNNING);
	}
	ImGui::SameLine();
	if (ImGui::Button("SKIP Cine.")) {
		logic_manager->throwUserEvent("cam:skip_cinematic();");
	}
	//Select Level
	{
		ImGui::PushItemWidth(80);
		static int level_selected = 1;
		if (ImGui::InputInt("", &level_selected)) {
			if (level_selected > 4) level_selected = 0;
			if (level_selected < 0) level_selected = 4;
		}
		ImGui::SameLine();
		auto name_scenes = CApp::get().GetNameScenes();
		char logic_level[] = "level_X";
		logic_level[6] = '0' + (unsigned char)(level_selected);
		ImGui::SameLine();
		ImGui::Text("%s", name_scenes[logic_level].c_str());
		ImGui::SameLine();
		if (ImGui::Button("Load Level")) {
			char lua_code[256];
			sprintf(lua_code, "p:stop_music(); p:setup_game(); LoadLevel(\"level_%d\")", level_selected);
			logic_manager->throwUserEvent(lua_code);
		}
		ImGui::PopItemWidth();
	}

	if (ImGui::Button("SAVE GAME")) CApp::get().saveLevel();
	if (ImGui::Button("LOAD GAME")) CApp::get().restartLevelNotify();

	ImGui::Checkbox("Free camera (K)", GameController->GetFreeCameraPointer());
	ImGui::Checkbox("Ui control", Gui->IsUiControlPointer());
	//ImGui::Checkbox("Continous Collision Detection", &(g_PhysxManager->ccdActive));

	if (ImGui::TreeNode("LUA Test")) {
		static char test_lua_txt[256] = "OnTest();";
		ImGui::InputTextMultiline("Test Lua", test_lua_txt, 256);
		if (ImGui::Button("Execute")) {
			logic_manager->throwUserEvent(test_lua_txt);
		}
		ImGui::TreePop();
	}

	if (ImGui::TreeNode("Gui create elements")) {
		static VEC3 pos_new_ui = VEC3(0.5f, 0.5f, 0.9f);
		static char gui_prebab_name[64] = "Fading_Letter";
		static char gui_prebab_entity_name[64] = "TEST";

		ImGui::DragFloat3("Pos", &pos_new_ui.x, 0.1f, -1.f, 2.f);
		ImGui::InputText("Prefab name", gui_prebab_name, 64);
		ImGui::InputText("Entity name", gui_prebab_entity_name, 64);
		if (ImGui::Button("Create")) {
			CHandle gui_elem = Gui->addGuiElement(std::string("ui/") + std::string(gui_prebab_name), pos_new_ui);
			GET_COMP(name, gui_elem, TCompName);
			name->setName(gui_prebab_entity_name);
		}

		ImGui::TreePop();
	}
	if (ImGui::TreeNode("TestMessages")) {
		static char test_msg_txt[256] = "*MOUSE* *LMOUSE* *RMOUSE*\n*LB* *RB* *BACK* *START* *LSTICK* *RSTICK* *APAD* *BPAD* *XPAD* *YPAD*\n*SHIFT* *ENTER* *SPACE* *ESC* *WKEY* *AKEY* *SKEY* *DKEY*";
		ImGui::InputTextMultiline("Test Message", test_msg_txt, 256);
		if (ImGui::Button("Create Message")) {
			std::string text = test_msg_txt;
			getHandleManager<TCompFadingMessage>()->each([text](TCompFadingMessage * mess) {
				TCompFadingMessage::ReloadInfo atts;
				atts.text = text;
				mess->reload(atts);
			}
			);
		}
		ImGui::TreePop();
	}

	if (ImGui::TreeNode("Free camera instructions")) {
		ImGui::Text("w/a/s/d - normal move\nq/e - up/down\nmouse wheel - speed up/down\n");

		ImGui::TreePop();
	}

	ImGui::Separator();
	//---------------------------------------
#ifdef CALIBRATE_GAME
	if (ImGui::TreeNode("CALIBRATE")) {
		if (ImGui::TreeNode("Bomb sci")) {
			ImGui::Checkbox("Calibrate", &CThrowBomb::calibrate);
			IMGUI_DRAG_FLOAT(CThrowBomb::lmax_st, 0.01f, 0.1f, 10.f);
			IMGUI_DRAG_FLOAT(CThrowBomb::hmax_st, 0.01f, 0.1f, 10.f);
			IMGUI_DRAG_FLOAT(CThrowBomb::speed_st, 0.01f, 0.1f, 10.f);
			IMGUI_DRAG_FLOAT(CThrowBomb::radius_st, 0.01f, 0.1f, 10.f);
			ImGui::DragFloat3("offset start throw", &CThrowBomb::offset_init_throw.x, 0.01f, -1.f, 1.f);
			ImGui::TreePop();
}
		ImGui::TreePop();
}
#endif
	//Profiling
	//---------------------------------------
#ifdef PROFILING_ENABLED
  //header for filtering instructions
	if (ImGui::TreeNode("PROFILING"))
	{
		static int nframes = 5;
		static float time_threshold = 5;
		ImGui::InputInt("NFrames", &nframes, 1, 5);
		ImGui::Separator();
		if (ImGui::Button("Start Capture Profiling"))
			profiler->setNFramesToCapture(nframes);
#ifndef PROFILING_JOHN
		ImGui::Separator();
		ImGui::InputFloat("Time Threshold", &time_threshold, 1, 5);
		if (profiler->isAutoCapture()) {
			ImGui::Text("Waiting auto capture...");
		}
		else {
			if (ImGui::Button("Auto Capture Profiling"))
				profiler->setAutoCapture(nframes, time_threshold);
		}
#endif
		ImGui::TreePop();
	}
#endif
	//---------------------------------------

	//Filter options
	//---------------------------------------
	ImGui::Text("Filtering");

	//header for filtering instructions
	if (ImGui::TreeNode("instructions filtering"))
	{
		ImGui::Text("Filter usage:\n"
			"  \"\"         display all lines\n"
			"  \"xxx\"      display lines containing \"xxx\"\n"
			"  \"xxx,yyy\"  display lines containing \"xxx\" or \"yyy\"\n"
			"  \"-xxx\"     hide lines containing \"xxx\"");
		ImGui::TreePop();
	}
	//end header instructions

	//static ImGuiTextFilter filter;
	filter.Draw(); //filter text draw
	//---------------------------------------

	if (ImGui::CollapsingHeader("General Info")) {
		ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
	}
	if (ImGui::CollapsingHeader("Resources")) {
		Resources.renderUIDebug(&filter);
	}

	if (ImGui::CollapsingHeader("Entities")) {
		getHandleManager<CEntity>()->onAll(&CEntity::renderInMenu);
	}

	if (ImGui::CollapsingHeader("PostProcess")) {
		render_fx->renderInMenu();
	}

	if (ImGui::CollapsingHeader("SELECTED ENTITY")) {
		ImGui::Text("Application SELECTED ENTITY - TODO");
	}if (ImGui::CollapsingHeader("Entity by Tag")) {
		ImGui::Text("Application ENTITY TAG - TODO");
		tags_manager.renderInMenu();
	}
	if (ImGui::CollapsingHeader("Game Options")) {
		ImGui::Checkbox("god mode", GameController->GetCheatGodmodePointer());
	}if (ImGui::CollapsingHeader("Graficos")) {
		if (ImGui::TreeNode("polarize")) {
			//ImGui::SliderFloat("Polarize strength", &shader_ctes_globals.strenght_polarize, 0.0f, 2.0f);

			ImGui::TreePop();
		}

		if (ImGui::TreeNode("Dream shader options")) {
			if (ImGui::DragFloat4("color influence", &shader_ctes_dream.color_influence.x, 0.01f)) {
				shader_ctes_dream.uploadToGPU();
			}
			if (ImGui::DragFloat("waves size", &shader_ctes_dream.dream_waves_size, 0.01f)) {
				shader_ctes_dream.uploadToGPU();
			}
			if (ImGui::DragFloat("waves speed", &shader_ctes_dream.dream_speed, 0.01f)) {
				shader_ctes_dream.uploadToGPU();
			}
			if (ImGui::DragFloat("waves intensity", &shader_ctes_dream.dream_wave_amplitude, 0.01f)) {
				shader_ctes_dream.uploadToGPU();
			}
			if (ImGui::DragFloat("distorsion strenght", &shader_ctes_dream.dream_distorsion_strenght, 0.01f)) {
				shader_ctes_dream.uploadToGPU();
			}
			if (ImGui::DragFloat("distorsion expansion", &shader_ctes_dream.dream_distorsion_expansion, 0.01f)) {
				shader_ctes_dream.uploadToGPU();
			}

			if (ImGui::SmallButton("Load defaults")) {
				shader_ctes_dream.color_influence = VEC4(0.5, 0.5, 0.8, 1);
				shader_ctes_dream.dream_speed = 1;
				shader_ctes_dream.dream_waves_size = 0.5;
				shader_ctes_dream.dream_wave_amplitude = 8;

				shader_ctes_dream.dream_distorsion_expansion = 0.85;
				shader_ctes_dream.dream_distorsion_strenght = 55;
			}

			ImGui::TreePop();
		}

		if (ImGui::TreeNode("Shadow options")) {
			if (ImGui::DragFloat("Environment diffuse factor", &shader_ctes_globals.env_factor, 0.01f)) {
				shader_ctes_globals.uploadToGPU();
			}

			if (ImGui::DragFloat("Shadow intensity", &shader_ctes_globals.shadow_intensity, 0.01f)) {
				shader_ctes_globals.uploadToGPU();
			}

			if (ImGui::TreeNode("ssao")) {
				if (ImGui::DragFloat("ssao intensity", &shader_ctes_blur.ssao_intensity)) {
					shader_ctes_blur.uploadToGPU();
				}

				if (ImGui::DragFloat("ssao iterations", &shader_ctes_blur.ssao_iterations)) {
					shader_ctes_blur.uploadToGPU();
				}

				ImGui::Separator();

				if (ImGui::DragFloat("ssao intensity test", &shader_ctes_blur.ssao_test_intensity, 0.01f)) {
					shader_ctes_blur.uploadToGPU();
				}

				if (ImGui::DragFloat("ssao bias test", &shader_ctes_blur.ssao_bias, 0.01f)) {
					shader_ctes_blur.uploadToGPU();
				}

				if (ImGui::DragFloat("ssao scale test", &shader_ctes_blur.ssao_scale, 0.01f)) {
					shader_ctes_blur.uploadToGPU();
				}

				if (ImGui::DragFloat("ssao rad test", &shader_ctes_blur.ssao_sample_rad, 0.01f)) {
					shader_ctes_blur.uploadToGPU();
				}

				ImGui::TreePop();
			}

			ImGui::TreePop();
		}

		if (ImGui::TreeNode("Grafic options")) {
			ImGui::Checkbox("polarize effects(disabled)", GameController->GetFxPolarizePointer());

			ImGui::Checkbox("glow effect(disabled)", GameController->GetFxGlowPointer());

			if (ImGui::DragFloat("Specular force", &shader_ctes_hatching.specular_force)) {
				shader_ctes_hatching.uploadToGPU();
			}

			static bool use_ramp = shader_ctes_globals.use_ramp;
			if (ImGui::Checkbox("use ramp", &use_ramp)) {
				shader_ctes_globals.use_ramp = use_ramp;
			}

			static bool use_ramp_color = shader_ctes_globals.use_ramp_color;
			if (ImGui::Checkbox("use ramp color", &use_ramp_color)) {
				shader_ctes_globals.use_ramp_color = use_ramp_color;
			}

			ImGui::TreePop();
		}

		if (ImGui::TreeNode("Hatching test")) {
			ImGui::Text("Limit lines hatching (DISABLED, not working)");
			if (ImGui::DragFloat("Rim strength", &shader_ctes_hatching.rim_strenght, 0.1f)) {
				shader_ctes_hatching.uploadToGPU();
			}
			if (ImGui::DragFloat("Specular strength", &shader_ctes_hatching.specular_strenght, 0.1f)) {
				shader_ctes_hatching.uploadToGPU();
			}
			if (ImGui::DragFloat("Diffuse strength", &shader_ctes_hatching.diffuse_strenght, 0.1f)) {
				shader_ctes_hatching.uploadToGPU();
			}

			ImGui::Separator();
			ImGui::Text("Lines hatching options");
			if (ImGui::DragFloat("Size hatching lines", &shader_ctes_hatching.frequency_texture, 0.1f)) {
				shader_ctes_hatching.uploadToGPU();
			}
			if (ImGui::DragFloat("Intensity transparency lines", &shader_ctes_hatching.intensity_sketch, 0.1f)) {
				shader_ctes_hatching.uploadToGPU();
			}
			if (ImGui::DragFloat("Frequency change offset", &shader_ctes_hatching.frequency_offset, 0.1f)) {
				shader_ctes_hatching.uploadToGPU();
			}

			ImGui::Separator();
			ImGui::Text("Outline options");
			ImGui::Text("Quantity lines: more low to more lines. Will do strange things");
			if (ImGui::DragFloat("Quantity lines found", &shader_ctes_hatching.edge_lines_detection, 0.0001f, 0.0000000001f)) {
				shader_ctes_hatching.uploadToGPU();
			}

			ImGui::TreePop();
		}

		if (ImGui::TreeNode("Ramp shading options")) {
			ImGui::Text("Color influence from ramp, will work better with white lights, will mix lights");

			bool color_ramp = false;

			if (shader_ctes_hatching.color_ramp == 0.0f)
				color_ramp = false;
			else
				color_ramp = true;

			if (ImGui::Checkbox("color from ramp", &color_ramp)) {
				if (color_ramp) {
					shader_ctes_hatching.color_ramp = 1.0f;
					shader_ctes_hatching.uploadToGPU();
				}
				else {
					shader_ctes_hatching.color_ramp = 0.0f;
					shader_ctes_hatching.uploadToGPU();
				}
			}

			ImGui::TreePop();
		}
	}if (ImGui::CollapsingHeader("Culling")) {
		RenderManager.renderUICulling(SBB::readSala());
		TCompSkeleton::renderUICulling();
		ImGui::Checkbox("show culling collider", GameController->GetCullingRenderPointer());
	}

	if (ImGui::CollapsingHeader("Particles")) {
		g_particlesManager->renderInMenu();
	}

	ImGui::End();
#endif
	//TESTS DEBUG:
	//TestGameLog();
	//testLines();
	//bool open = true;
	//ShowExampleAppConsole(&open);		//test console commands

	//Debug->update();		//update log
	m_pLights_editor->RenderInMenu();
	m_pMessages_editor->RenderInMenu();
}
Пример #22
0
IK_IMPL_SOLVER(grabRightIK, info, result) {
	GET_COMP(skc, info.handle, SkelControllerMole);
	result.new_pos = skc->getGrabRight();
	result.bone_normal = skc->getGrabNormalLeft();
}