• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ Water类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中Water的典型用法代码示例。如果您正苦于以下问题:C++ Water类的具体用法?C++ Water怎么用?C++ Water使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Water类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: new

Water *Water::create(const std::string& fileName, const std::string& waveFileOne, const std::string& waveFileTwo, const cocos2d::Size& size, float hSpeed, float vSpeed, float saturation)
{
	Water *water = new (std::nothrow) Water();
	if (water && water->initWithFile(fileName, cocos2d::Rect(0, 0, size.width, size.height)))
	{
		water->autorelease();

		auto TexCache = cocos2d::Director::getInstance()->getTextureCache();
		auto wave2 = TexCache->addImage(waveFileOne);
		auto wave1 = TexCache->addImage(waveFileTwo);

		cocos2d::Texture2D::TexParams wave1TexParams = { GL_LINEAR, GL_LINEAR, GL_REPEAT, GL_REPEAT };
		cocos2d::Texture2D::TexParams wave2TexParams = { GL_LINEAR, GL_LINEAR, GL_REPEAT, GL_REPEAT };
		wave1->setTexParameters(wave1TexParams);
		wave2->setTexParameters(wave2TexParams);
		auto glprogram = cocos2d::GLProgram::createWithFilenames("shader3D/water.vsh", "shader3D/water.fsh");
		auto glprogramstate = cocos2d::GLProgramState::getOrCreateWithGLProgram(glprogram);
		water->setGLProgramState(glprogramstate);

		glprogramstate->setUniformTexture("u_wave1", wave1);
		glprogramstate->setUniformTexture("u_wave2", wave2);
		glprogramstate->setUniformFloat("saturateValue", saturation);
		glprogramstate->setUniformFloat("verticalSpeed", vSpeed);
		glprogramstate->setUniformFloat("horizontalSpeed", hSpeed);


		return water;
	}
	CC_SAFE_DELETE(water);
	return nullptr;
}
开发者ID:huangshucheng,项目名称:MyUtil,代码行数:31,代码来源:Water.cpp


示例2: Water

// --- Methods inherited from ReferenceTarget ---
// This method is called to have the plug-in clone itself.
RefTargetHandle Water::Clone(RemapDir &remap) {
	// Create a new instance of the plug-in class
	Water *newWater = new Water();

	// Copy superclass stuff
	*((MtlBase *)newWater) = *((MtlBase *)this);

	// Clone the items we reference
	newWater->ReplaceReference(0, remap.CloneRef(xyzGen));
	newWater->ReplaceReference(1, remap.CloneRef(pblock));
	newWater->col[0] = col[0];
	newWater->col[1] = col[1];
	newWater->count = count;
	newWater->size = size;
	newWater->minperiod = minperiod;
	newWater->maxperiod = maxperiod;
	newWater->amp = amp;
	newWater->phase = phase;
	newWater->type = type;
	newWater->randSeed = randSeed;
	newWater->texValidity.SetEmpty();	
	for (int i = 0; i < NUM_SUB_TEXMAPS; i++) {
		newWater->subTex[i] = NULL;
		newWater->mapOn[i] = mapOn[i];
		if (subTex[i])
			newWater->ReplaceReference(i+2, remap.CloneRef(subTex[i]));
	}
	BaseClone(this, newWater, remap);
	// Return the new cloned texture
	return (RefTargetHandle)newWater;
}
开发者ID:artemeliy,项目名称:inf4715,代码行数:33,代码来源:water.cpp


示例3: loadWater

void World::loadWater(int x, int y) {
	cout << "loading water" << endl;
	
	//copy the objects_0 array into a new array
	vector<Water> water = waterObjects;
	//clear the original object array
	waterObjects.clear();

	//loop through the new object array and then check if these objects are still in the new region
	for (int i = 0; i < water.size(); i++) {
		//if the objects are in the same region, put them back in the objects_0 array
		if (sameRegion(water.at(i).position_x / 32, water.at(i).position_y / 32, x, y)) {
			waterObjects.push_back(water.at(i));
		} else {
			//else remove the node from the game (deleting the model from memory)
			water.at(i).remove();
		}
	}

	//loop through the object index array
	for (int i = 0; i < water_index.size(); i++) {
		//if the object is in the same region then load the model
		if (sameRegion(water_index.at(i).x / 32, water_index.at(i).y / 32, x, y)) {
			//extract the object data
			WaterData data = water_index.at(i);

			bool model_exists = false;

			//DON'T LOAD OBJECTS IF THEY ARE ALREADY LOADED
			for (auto &j : waterObjects) {
				if ((j.position_x == data.x) && (j.position_y == data.y)) {
					model_exists = true;
					break;
				}
			}

			//if the model is not already in the array, load it!
			if (!model_exists) {
				Water object;
					//loading the object model
					if (data.id == 0)
						object.addWater(data.x, data.y, data.h, data.w, data.l);
					else if (data.id == 1)
						object.addLava(data.x, data.y, data.h, data.w, data.l);
					//add it to the objects_0 array
					waterObjects.push_back(object);
			}
		}
	}

	Client::sceneManager->getMeshCache()->clearUnusedMeshes();

}
开发者ID:jake2008,项目名称:TBR_CLIENT,代码行数:53,代码来源:CWorld.cpp


示例4: onLostDevice

void WaterDemo::onLostDevice()
{
    mGfxStats->onLostDevice();
    mSky->onLostDevice();
    mWater->onLostDevice();
    HR(mFX->OnLostDevice());
}
开发者ID:erickterri,项目名称:3dlearn,代码行数:7,代码来源:WaterDemo.cpp


示例5: Water

Water* Water::create()
{
    //Create is virtual function from CCSprite
    Water *pSprite = new Water();
    if (pSprite && pSprite->initWithFile("water_tile.png"))
    {
        // Set to autorelease
        pSprite->autorelease();
        
        //assign your attributes here!!
        
        return pSprite;
    }
    CC_SAFE_DELETE(pSprite);
    return NULL;
}
开发者ID:OneGameAMonth,项目名称:Cocos2d-x,代码行数:16,代码来源:Water.cpp


示例6: updateScene

void PropsDemo::updateScene(float dt)
{
	mTime += dt;

	mGfxStats->update(dt);

	gDInput->poll();

	// Fix camera to ground or free flying camera?
	if( gDInput->keyDown(DIK_N) )
		mFreeCamera = false;
	if( gDInput->keyDown(DIK_M) )
		mFreeCamera = true;

	if( mFreeCamera )
	{
		gCamera->update(dt, 0, 0);
	}
	else
	{
		gCamera->update(dt, mTerrain, 2.5f);
	}


	mWater->update(dt);
}
开发者ID:chenbk85,项目名称:3dlearn,代码行数:26,代码来源:PropsDemo.cpp


示例7: onLostDevice

void PropsDemo::onLostDevice()
{
	mGfxStats->onLostDevice();
	mTerrain->onLostDevice();
	mWater->onLostDevice();
	HR(mFX->OnLostDevice());
	HR(mGrassFX->OnLostDevice());
}
开发者ID:chenbk85,项目名称:3dlearn,代码行数:8,代码来源:PropsDemo.cpp


示例8: updateScene

void WaterDemo::updateScene(float dt)
{
    mGfxStats->update(dt);

    gDInput->poll();

    gCamera->update(dt, 0, 0);

    mWater->update(dt);
}
开发者ID:erickterri,项目名称:3dlearn,代码行数:10,代码来源:WaterDemo.cpp


示例9: scheduleUpdate

void Level::init() {
    scheduleUpdate();
    leftDelta = new float[8];
    rightDelta = new float[8];

    waterBlock = CCArray::create();
    waterBlock->retain();

    for(int i = 0; i < 8; i++) {
        Water *w = Water::create();
        w->setPosition(ccp(100+i*50, 150));
        addChild(w);
        waterBlock->addObject(w);
    }

    Water *w = (Water *)waterBlock->objectAtIndex(0);
    //w->setPosition(ccp(100, 100));
    w->velocity = {0, 100*M_PI};

}
开发者ID:liyonghelpme,项目名称:cannonAndMator,代码行数:20,代码来源:Level.cpp


示例10:

bool Ned3DObjectManager::interactPlaneWater(PlaneObject &plane, WaterObject &water)
{
  Water *pWater = water.getWater();
  if(pWater == NULL) return false;
  
  // Test for plane collision with water
  
  Vector3 planePos = plane.getPosition();
  EulerAngles planeOrient = plane.getOrientation();
  Vector3 disp = planePos - disp;
  RotationMatrix planeMatrix;
  planeMatrix.setup(plane.getOrientation()); // get plane's orientation
  float planeBottom = plane.getBoundingBox().min.y;
  float waterHeight = pWater->getWaterHeight();
  
  if(plane.isPlaneAlive() && planeBottom < waterHeight)
  { //collision
    Vector3 viewVector = planeMatrix.objectToInertial(Vector3(0,0,1));
    plane.killPlane();
    plane.setSpeed(0.0f);
    planePos += 2.0f * viewVector;
    planeOrient.pitch = kPi / 4.0f;
    planeOrient.bank = kPi / 4.0f;
    plane.setOrientation(planeOrient);
    plane.setPPosition(planePos);
    
    int partHndl = gParticle.createSystem("planeexplosion");
    gParticle.setSystemPos(partHndl, plane.getPosition());
    int boomHndl = gSoundManager.requestSoundHandle("Boom.wav");
    int boomInst = gSoundManager.requestInstance(boomHndl);
    if(boomInst != SoundManager::NOINSTANCE)
    {
      gSoundManager.setPosition(boomHndl,boomInst,plane.getPosition());
      gSoundManager.play(boomHndl,boomInst);
      gSoundManager.releaseInstance(boomHndl,boomInst);
    }
    return true;
  }
  return false;
}
开发者ID:kmh0237,项目名称:GameProgramming2Project,代码行数:40,代码来源:Ned3DObjectManager.cpp


示例11: onResetDevice

void WaterDemo::onResetDevice()
{
    mGfxStats->onResetDevice();
    mSky->onResetDevice();
    mWater->onResetDevice();
    HR(mFX->OnResetDevice());

    // The aspect ratio depends on the backbuffer dimensions, which can
    // possibly change after a reset.  So rebuild the projection matrix.
    float w = (float)md3dPP.BackBufferWidth;
    float h = (float)md3dPP.BackBufferHeight;
    gCamera->setLens(D3DX_PI * 0.25f, w/h, 1.0f, 5000.0f);
}
开发者ID:erickterri,项目名称:3dlearn,代码行数:13,代码来源:WaterDemo.cpp


示例12: HR

void WaterDemo::drawScene()
{
    HR(gd3dDevice->BeginScene());

    mSky->draw();

    HR(mFX->SetValue(mhLight, &mLight, sizeof(DirLight)));
    HR(mFX->SetMatrix(mhWVP, &(mSceneWorld*gCamera->viewProj())));
    HR(mFX->SetValue(mhEyePosW, &gCamera->pos(), sizeof(D3DXVECTOR3)));

    UINT numPasses = 0;
    HR(mFX->Begin(&numPasses, 0));
    HR(mFX->BeginPass(0));

    for(UINT j = 0; j < mSceneMtrls.size(); ++j)
    {
        HR(mFX->SetValue(mhMtrl, &mSceneMtrls[j], sizeof(Mtrl)));

        // If there is a texture, then use.
        if(mSceneTextures[j] != 0)
        {
            HR(mFX->SetTexture(mhTex, mSceneTextures[j]));
        }

        // But if not, then set a pure white texture.  When the texture color
        // is multiplied by the color from lighting, it is like multiplying by
        // 1 and won't change the color from lighting.
        else
        {
            HR(mFX->SetTexture(mhTex, mWhiteTex));
        }

        HR(mFX->SetTexture(mhNormalMap, mSceneNormalMaps[j]));

        HR(mFX->CommitChanges());
        HR(mSceneMesh->DrawSubset(j));
    }
    HR(mFX->EndPass());
    HR(mFX->End());

    // Draw alpha blended object last.
    mWater->draw();

    mGfxStats->display();

    HR(gd3dDevice->EndScene());

    // Present the backbuffer.
    HR(gd3dDevice->Present(0, 0, 0, 0));
}
开发者ID:erickterri,项目名称:3dlearn,代码行数:50,代码来源:WaterDemo.cpp


示例13: openRankine

int openRankine(int np, void* p) {

    double etap = 0.6;     // pump isentropic efficiency
    double etat = 0.8;     // turbine isentropic efficiency
    double phigh = 8.0e5;  // high pressure

    Water w;

    // begin with water at 300 K, 1 atm
    w.setState_TP(300.0, OneAtm);
    saveState(w,"1");

    // pump water to 0.8 MPa
    w.setState_SP(s["1"], phigh);
    saveState(w,"2s");
    double h2 = (h["2s"] - h["1"])/etap + h["1"];
    w.setState_HP(h2, phigh);
    saveState(w,"2");

    // heat to saturated vapor
    w.setState_Psat(phigh, 1.0);
    saveState(w,"3");

    // expand to 1 atm
    w.setState_SP(s["3"], OneAtm);
    saveState(w,"4s");
    double work_s = h["3"] - h["4s"];
    double work = etat*work_s;
    w.setState_HP(h["3"] - work, OneAtm);
    saveState(w,"4");

    printStates();

    double heat_in = h["3"] - h["2"];
    double efficiency = work/heat_in;

    cout << "efficiency = " << efficiency << endl;
#ifdef WIN32
#ifndef CXX_DEMO
    cout << "press any key to end" << endl;
    char ch;
    cin >> ch;
#endif
#endif
    return 0;
}
开发者ID:anujg1991,项目名称:cantera,代码行数:46,代码来源:rankine.cpp


示例14: switch

INT_PTR WaterDlgProc::DlgProc(
		TimeValue t,IParamMap2 *map,HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
	{
	switch (msg) {
		case WM_COMMAND:
			switch (LOWORD(wParam)) 
				{
				case IDC_SWAP:
					{
					water = (Water*)map->GetParamBlock()->GetOwner(); 

					water->SwapInputs();
					}
				break;
				}
			break;
		}
	return FALSE;
	}
开发者ID:artemeliy,项目名称:inf4715,代码行数:19,代码来源:water.cpp


示例15: setup

static void setup (void)
{
	glClearColor( 0.8,0.8,0.8,1.0 );

	// Load textures
	init_texture("Textures\\cylinderWall.bmp",	CYLINDER_WALL, textures);
	init_texture("Textures\\cylinderCap.bmp",	CYLINDER_CAP, textures);
	init_texture("Textures\\Front.bmp",			BUILD_FRONT, textures);
	init_texture("Textures\\BuildRight.bmp",	BUILD_RIGHT, textures);
	init_texture("Textures\\Concrete.bmp",		CONCRETE, textures);
	init_texture("Textures\\Skybox.bmp",		SKYBOX, textures);

	// Cylinder building
	cylinder.initialize(CYLINDER_WALL, CYLINDER_CAP);
	step1.initialize(CONCRETE, CYLINDER_CAP);
	step2.initialize(CONCRETE, CYLINDER_CAP);

	// Rectangle buildings
	build_front.initialize(BUILD_FRONT, BUILD_FRONT);
	build_right.initialize(BUILD_RIGHT, CONCRETE);
	foundation.initialize(CONCRETE, CONCRETE);

	// Water
	water.build();

	// Sky
	sky.initialize(SKYBOX);

	// Directional light
	sun.init();

	// Spot light
	spLight.init();

	glEnable(GL_DEPTH_TEST);
	glDepthFunc(GL_LEQUAL);
	glEnable(GL_CULL_FACE);
	glFrontFace(GL_CCW);

	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
}
开发者ID:ddoodm,项目名称:Computer-Graphics-Major-Assignment,代码行数:42,代码来源:Part2.cpp


示例16: clock


//.........这里部分代码省略.........
		}
		printf("World tiles fill: %d ms. \n", clock() - start);
		start = clock();

		/*for (int i = 0; i < 0; i++)
			CelluarAuto(Height, i);*/

		printf("Celluar Auto: %d ms. \n", clock() - start);
		start = clock();

		int k = 0;
		while (k < 100)
		{
			int i = rand() % Width;
			int j = rand() % height;
			if (GetBlock(i, j) == 0)
				continue;
			k += GenerateVein(i, j, Block::Stone->Id, 5);
		}

		printf("Veins generation: %d ms. \n", (clock() - start));
	}
	else
	{
		for (int i = 0; i < Width; i++) {
			for (int j = 0; j < Height; j++) {
				blocks[i][j].Id = mapData[i + j * width];
			}
		}
	}


	start = clock();
	
	for (int i = 0; i < Width; i++) {
		for (int j = 0; j < Height; j++) {
			if (blocks[i][j].Id != 0)
				blocks[i][j].connectionIndex = GetConnectionIndex(i, j);
		}
	}
	for (int i = 0; i < Width; i++) {
		for (int j = 0; j < Height; j++) {
			if (walls[i][j].Id != 0)
				walls[i][j].connectionIndex = GetConnectionIndex(i, j, true);
		}
	}
	printf("Tiles connections: %d ms. \n", clock() - start);
	start = clock();

	for (int i = 0; i < Width; i++) {
		for (int j = 0; j < Height; j++) {
			if (blocks[i][j].Id == 0 && walls[i][j].Id == 0)
			{
				blocks[i][j].lightSource = MAX_LIGHT;
				if (NearLive(i, j, 1) == 0)
					blocks[i][j].lightValue = MAX_LIGHT;
			}
		}
	}

	minX = 0;
	minY = 0;
	maxX = width;
	maxY = height;
	CalculateLights(true);

	printf("Lights calculations: %d ms. \n", clock() - start);
	start = clock();

	player = new Player();
	Respawn();
	entities.push_back(player);

	int water_count = 3;
	int water_x = (int)player->GetPosition().x;
	int water_y = GetTop(water_x);
	for (int i = water_x - 2; i < water_x + 2; i++)
	{
		for (int j = water_y; j < water_y + 2; j++)
		{
			SetBlock(i, j, 0);
			SetWall(i, j, 0);
			for (int k = 0; k < water_count; k++)
			{
				for (int l = 0; l < water_count; l++)
				{
					Water* water = new Water();
					water->SetPosition(glm::vec2(i + k * (1 / (float)water_count), j + l * (1 / (float)water_count)));
					waters.push_back(water);
					entities.push_back(water);
				}
			}
		}
	}
	



	skyManager = new SkyManager(this->Width);
}
开发者ID:SharkDX,项目名称:PenguinBasket,代码行数:101,代码来源:Map.cpp


示例17: HR

void PropsDemo::drawScene()
{
	// Clear the backbuffer and depth buffer.
	HR(gd3dDevice->Clear(0, 0, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xff888888, 1.0f, 0));

	HR(gd3dDevice->BeginScene());

	HR(mFX->SetValue(mhEyePosW, &gCamera->pos(), sizeof(D3DXVECTOR3)));
	HR(mFX->SetTechnique(mhTech));
	UINT numPasses = 0;
	HR(mFX->Begin(&numPasses, 0));
	HR(mFX->BeginPass(0));

	drawObject(mCastle, mCastleWorld);

	// Use alpha test to block non leaf pixels from being rendered in the
	// trees (i.e., use alpha mask).
	HR(gd3dDevice->SetRenderState(D3DRS_ALPHATESTENABLE, true));
	HR(gd3dDevice->SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_GREATEREQUAL));
	HR(gd3dDevice->SetRenderState(D3DRS_ALPHAREF, 200));

	// Draw the trees: NUM_TREES/4 of each of the four types.
	for(int i = 0; i < NUM_TREES; ++i)
	{
		if( i < NUM_TREES/4 )
			drawObject(mTrees[0], mTreeWorlds[i]);
		else if( i < 2*NUM_TREES/4 )
			drawObject(mTrees[1], mTreeWorlds[i]);
		else if( i < 3*NUM_TREES/4 )
			drawObject(mTrees[2], mTreeWorlds[i]);
		else
			drawObject(mTrees[3], mTreeWorlds[i]);
	}

	HR(gd3dDevice->SetRenderState(D3DRS_ALPHATESTENABLE, false));

	HR(mFX->EndPass());
	HR(mFX->End());


	HR(mGrassFX->SetValue(mhGrassEyePosW, &gCamera->pos(), sizeof(D3DXVECTOR3)));
	HR(mGrassFX->SetMatrix(mhGrassViewProj, &(gCamera->viewProj())));
	HR(mGrassFX->SetFloat(mhGrassTime, mTime));
	HR(mGrassFX->Begin(&numPasses, 0));
	HR(mGrassFX->BeginPass(0));

	// Draw to depth buffer only.
	HR(mGrassMesh->DrawSubset(0));

	HR(mGrassFX->EndPass());
	HR(mGrassFX->End());

	mTerrain->draw();

	mWater->draw(); // draw alpha blended objects last.

	mGfxStats->display();

	HR(gd3dDevice->EndScene());

	// Present the backbuffer.
	HR(gd3dDevice->Present(0, 0, 0, 0));
}
开发者ID:chenbk85,项目名称:3dlearn,代码行数:63,代码来源:PropsDemo.cpp


示例18: UpdateShader

bool DirectxEngine::UpdateShader(const Water& water, 
                                 const IScene& scene, 
                                 float timer)
{
    if (UpdateShader(water, scene, true, timer))
    {
        auto& shader = m_data->shaders[water.ShaderID()];
        shader->UpdateConstantFloat("speed", &water.Speed(), 1);
        shader->UpdateConstantFloat("bumpIntensity", &water.Bump(), 1);
        shader->UpdateConstantFloat("bumpScale", &water.BumpScale().x, 2);
        shader->UpdateConstantFloat("uvScale", &water.UVScale().x, 2);
        shader->UpdateConstantFloat("deepColor", &water.Deep().r, 4);
        shader->UpdateConstantFloat("shallowColor", &water.Shallow().r, 4);
        shader->UpdateConstantFloat("reflectionTint", &water.ReflectionTint().r, 3);
        shader->UpdateConstantFloat("reflectionIntensity", &water.ReflectionIntensity(), 1);
        shader->UpdateConstantFloat("fresnal", &water.Fresnal().x, 3);

        const auto& waves = water.Waves();
        for (unsigned int i = 0; i < waves.size(); ++i)
        {
            const int offset = i*4; // Arrays pack in buffer of float4
            shader->UpdateConstantFloat("waveFrequency", &waves[i].amplitude, 1, offset);
            shader->UpdateConstantFloat("waveAmplitude", &waves[i].frequency, 1, offset);
            shader->UpdateConstantFloat("wavePhase", &waves[i].phase, 1, offset);
            shader->UpdateConstantFloat("waveDirectionX", &waves[i].directionX, 1, offset);
            shader->UpdateConstantFloat("waveDirectionZ", &waves[i].directionZ, 1, offset);
        }
        return true;
    }
    return false;
}
开发者ID:,项目名称:,代码行数:31,代码来源:


示例19: scale

void ScaleRecipeTool::scale(Equipment* equip, double newEff)
{
    if( recObs == 0 || equip == 0 )
        return;

    int i, size;

    // Calculate volume ratio
    double currentBatchSize_l = recObs->batchSize_l();
    double newBatchSize_l = equip->batchSize_l();
    double volRatio = newBatchSize_l / currentBatchSize_l;

    // Calculate efficiency ratio
    double oldEfficiency = recObs->efficiency_pct();
    double effRatio = oldEfficiency / newEff;

    Database::instance().addToRecipe(recObs, equip);
    recObs->setBatchSize_l(newBatchSize_l);
    recObs->setBoilSize_l(equip->boilSize_l());
    recObs->setEfficiency_pct(newEff);
    recObs->setBoilTime_min(equip->boilTime_min());

    QList<Fermentable*> ferms = recObs->fermentables();
    size = ferms.size();
    for( i = 0; i < size; ++i )
    {
        Fermentable* ferm = ferms[i];
        // NOTE: why the hell do we need this?
        if( ferm == 0 )
            continue;

        if( !ferm->isSugar() && !ferm->isExtract() ) {
            ferm->setAmount_kg(ferm->amount_kg() * effRatio * volRatio);
        } else {
            ferm->setAmount_kg(ferm->amount_kg() * volRatio);
        }
    }

    QList<Hop*> hops = recObs->hops();
    size = hops.size();
    for( i = 0; i < size; ++i )
    {
        Hop* hop = hops[i];
        // NOTE: why the hell do we need this?
        if( hop == 0 )
            continue;

        hop->setAmount_kg(hop->amount_kg() * volRatio);
    }

    QList<Misc*> miscs = recObs->miscs();
    size = miscs.size();
    for( i = 0; i < size; ++i )
    {
        Misc* misc = miscs[i];
        // NOTE: why the hell do we need this?
        if( misc == 0 )
            continue;

        misc->setAmount( misc->amount() * volRatio );
    }

    QList<Water*> waters = recObs->waters();
    size = waters.size();
    for( i = 0; i < size; ++i )
    {
        Water* water = waters[i];
        // NOTE: why the hell do we need this?
        if( water == 0 )
            continue;

        water->setAmount_l(water->amount_l() * volRatio);
    }

    Mash* mash = recObs->mash();
    if( mash == 0 )
        return;

    QList<MashStep*> mashSteps = mash->mashSteps();
    size = mashSteps.size();
    for( i = 0; i < size; ++i )
    {
        MashStep* step = mashSteps[i];
        // NOTE: why the hell do we need this?
        if( step == 0 )
            continue;

        // Reset all these to zero so that the user
        // will know to re-run the mash wizard.
        step->setDecoctionAmount_l(0);
        step->setInfuseAmount_l(0);
    }

    // I don't think I should scale the yeasts.

    // Let the user know what happened.
    QMessageBox::information(this, tr("Recipe Scaled"),
                             tr("The equipment and mash have been reset due to the fact that mash temperatures do not scale easily. Please re-run the mash wizard.") );
}
开发者ID:EvansMike,项目名称:brewtarget,代码行数:99,代码来源:ScaleRecipeTool.cpp


示例20: glClear

static void draw		(void)
{
	glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
	glMatrixMode(GL_MODELVIEW);
	glPushMatrix();

	if(bRendered)	glEnable(GL_TEXTURE_2D);
	else			glDisable(GL_TEXTURE_2D);

	if(bWireframe)
	{
		glLineWidth( 2.0 );
		glPolygonMode(GL_FRONT, GL_LINE);
	}
	else
		glPolygonMode(GL_FRONT, GL_FILL);

	glRotatef(5, 1,0,0);
	camera.transform(sky);
	sun.transform();

	if(bDrawGrid) draw_axis();
	
	glColor3f(0.9,0.9,0.9);

	// Cylinder building
	glPushMatrix();
	glTranslatef(0, 0, -100);
	glRotatef(40, 0, 1, 0);
	spLight.transform();	// Update spot light
	cylinder.draw();
	step1.draw();
	step2.draw();
	glPopMatrix();

	// Right cuboid building
	glPushMatrix();
	glTranslatef(100, 25, 25);
	build_right.draw();
	glTranslatef(-75, 0, 150);
	glRotatef( 90, 0, 1, 0 );
	build_right.draw();
	glPopMatrix();

	// Front timber building
	glPushMatrix();
	glTranslatef(20, 15, 0);
	build_front.draw();
	glPopMatrix();

	// Foundations
	glPushMatrix();
	glTranslatef(0, -15, 0);
	foundation.draw();
	glTranslatef(-325, 0, 0);
	foundation.draw();
	glPopMatrix();

	// Water
	glPushMatrix();
	glTranslatef(-160,-10,0);
	water.draw();
	glPopMatrix();

	glPopMatrix();
	glutSwapBuffers();
	Sleep(1);	// Frame limiter
}
开发者ID:ddoodm,项目名称:Computer-Graphics-Major-Assignment,代码行数:68,代码来源:Part2.cpp



注:本文中的Water类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ Wav类代码示例发布时间:2022-05-31
下一篇:
C++ WatchpointMap类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap