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

C++ VertexShader类代码示例

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

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



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

示例1: GetMeshMaterialGOC

void GameObjectMaterialComponentsWidget::on_m_VSPropsButton_clicked()
{
	if(!m_IsReady)
	{
		return;
	}

	MeshMaterialGOC* meshMat = GetMeshMaterialGOC();

	if(meshMat == nullptr)
	{
		return;
	}

	VertexShader* vs = meshMat->GetVertexShaderResource();
	if(vs == nullptr)
	{
		return;
	}

	ShaderProperties* vsProps = meshMat->GetVertexShaderProperties();

	GameObjectShaderPropsDialog shaderPropsDiag(meshMat->GetName(), vs->GetName(), m_GameApp->GetGameAssetManager(), vsProps);

	shaderPropsDiag.exec();
}
开发者ID:dtbinh,项目名称:Arenal-Engine,代码行数:26,代码来源:GameObjectMaterialComponentsWidget.cpp


示例2: make_prog

	static Program make_prog(void)
	{
		Program prog;

		VertexShader vs;
		vs.Source(
			"#version 330\n"
			"uniform mat4 ProjectionMatrix, CameraMatrix, ModelMatrix;"
			"mat4 Matrix = ProjectionMatrix*CameraMatrix*ModelMatrix;"
			"in vec4 Position;"

			"void main(void)"
			"{"
			"	gl_Position = Matrix*Position;"
			"}"
		);

		FragmentShader fs;
		fs.Source(
			"#version 330\n"
			"void main(void){ }"
		);

		prog.AttachShader(vs).AttachShader(fs);
		prog.Link().Validate().Use();

		return std::move(prog);
	}
开发者ID:Extrunder,项目名称:oglplus,代码行数:28,代码来源:030_pin_display.cpp


示例3: make

	static Program make(void)
	{
		Program prog;

		VertexShader vs;
		vs.Source(
			"#version 330\n"
			"uniform vec2 ScreenSize;"
			"in vec4 Position;"
			"in vec2 TexCoord;"
			"out vec2 vertTexCoord;"
			"void main(void)"
			"{"
			"	gl_Position = Position;"
			"	vertTexCoord = TexCoord*ScreenSize;"
			"}"
		).Compile();

		FragmentShader fs;
		fs.Source(
			"#version 330\n"
			"uniform sampler1D Palette;"
			"uniform sampler2DRect Tex;"
			"in vec2 vertTexCoord;"
			"out vec4 fragColor;"
			"void main(void)"
			"{"
			"	float Overdraw = texture(Tex, vertTexCoord).r;"
			"	fragColor = texture(Palette, Overdraw);"
			"}"
		).Compile();

		prog.AttachShader(vs).AttachShader(fs).Link().Use();
		return std::move(prog);
	}
开发者ID:,项目名称:,代码行数:35,代码来源:


示例4: make_vs

	// Makes the common shared vertex shader
	static VertexShader make_vs(void)
	{
		VertexShader shader;

		shader.Source(
			"#version 140\n"
			"uniform mat4 ProjectionMatrix, CameraMatrix, ModelMatrix;"
			"in vec4 Position;"
			"in vec3 Normal;"
			"in vec2 TexCoord;"
			"out vec2 vertTexCoord;"
			"out vec3 vertNormal;"
			"out vec3 vertLight;"
			"uniform vec3 LightPos;"
			"void main(void)"
			"{"
			"	vertTexCoord = TexCoord;"
			"	gl_Position = ModelMatrix * Position;"
			"	vertNormal = mat3(ModelMatrix)*Normal;"
			"	vertLight = LightPos - gl_Position.xyz;"
			"	gl_Position = ProjectionMatrix * CameraMatrix * gl_Position;"
			"}"
		);

		shader.Compile();
		return shader;
	}
开发者ID:AdamSimpson,项目名称:oglplus,代码行数:28,代码来源:020_shaded_objects.cpp


示例5:

   void ShaderManager<RS>::init()
      {
      //construct safe default shader
      VertexShader<RS>* dv = 0;
      FragmentShader<RS>* df = 0;

      dv = new VertexShader<RS>();
      df = new FragmentShader<RS>();

      Vertex def;
      def.addVector3("POSITION");
      def.finalize();

      dv->associateVertex(def);

      if(RS == RS_DX11)
         {
         dv->initFromDef(Defaults::shaderDefDX, Defaults::vertexFunc);
         df->initFromDef(Defaults::shaderDefDX, Defaults::fragmentFunc);
         }
      else
         {
         dv->initFromDef(Defaults::shaderDefGL, Defaults::vertexFunc);
         df->initFromDef(Defaults::shaderDefGL, Defaults::fragmentFunc);
         }

      vShaders[Defaults::mapName][Defaults::mapName] = dv;
      fShaders[Defaults::mapName][Defaults::mapName] = df;
      }
开发者ID:radneyalquiza,项目名称:GAM531_Emperor,代码行数:29,代码来源:ShaderManager.cpp


示例6: initalize

	bool MicroManagerTest::initalize(float width, float height)
	{
		VertexShader vertexShader;
	
		vertexShader.set(  mData->sManager.loadVertexFromFile(&md3d, L"EngineVSPosNormalUV") );
		mData->ps = mData->sManager.loadPixelFromFile(&md3d, L"PSPosNormalUV");

	
		VertexShaderHandle modelShader = VertexShaderManager::newVertexShader( vertexShader );

		md3d.getDeviceContext()->PSSetShader(mData->ps,NULL,NULL);

		Procedural::MeshBuilderType mbt;
		Procedural::BoxGenerator	bg;
		bg.addToMeshBuilder( mbt );

		auto mesh = mbt.toMeshVertexCPU();

		mData->model = ModelBuilder::makeStaticGeometryModel( md3d, VertexTypeManager::getVertexType(VertexTypeManager::Pos_Normal_UV), D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST, mesh->toMeshCPU() );
		ModelManager::fromHandle(mData->model).mVSShader = modelShader;

		mbt.clear();

		Procedural::SphereGenerator sg(1,128,128);

		sg.addToMeshBuilder( mbt );
		auto meshSphere = mbt.toMeshVertexCPU();
		mData->sphere = ModelBuilder::makeStaticGeometryModel( md3d, VertexTypeManager::getVertexType(VertexTypeManager::Pos_Normal_UV), D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST, meshSphere->toMeshCPU() );
		ModelManager::fromHandle(mData->sphere).mVSShader = modelShader;

		mData->cam.setPerspectiveFOV( DirectX::XMConvertToRadians(45),width / height, 0.1, 500 );
		mData->cam.lookAt( .0f,.0f,.0f );
		mData->cam.setPosition( .0f, .0f, -30.0f );
		mData->cam.setRotationEuler( .0f,.0f,.0f);


		int count = 0;
		MaterialHandle fakeMaterial;
		// Generate the box Array and positions
		for( float xPos = -10.0f; xPos < 10.0f; xPos += 2.0f )
		{
			for( float yPos = -10.0f; yPos < 10.0f; yPos += 2.0f )
			{
				count++;
				BoxDemo2 bx = {xPos, yPos, 0.0f, 0.0f, 0.0f, 0.0f, mData->mang->newRi( count % 2 == 0 ? mData->model : mData->sphere, fakeMaterial )};
				mData->boxes.push_back( bx );
			}
		}

		mIsOk = true;

		matrix proj;
		mData->cam.getProjData( &proj );
		mData->mang->displayUpdate( proj );


		return mIsOk;

	}
开发者ID:fearless40,项目名称:gravwell3,代码行数:59,代码来源:MicroManagerTest.cpp


示例7: runtime_error

ShaderProgram::ShaderProgram(
	const string &filename,
	const VertexShader &vertexShader,
	const FragmentShader &fragmentShader) : _name(filename), _handle(0), _linked(0)
{
	try
	{
		if (vertexShader.fail()) throw std::runtime_error("Invalid vertex shader");
		if (fragmentShader.fail()) throw std::runtime_error("Invalid fragment shader");

		if (GLEW_VERSION_2_0)
		{
			// Create program and attach vertex and fragment shaders
			_handle = glCreateProgram();
			glAttachShader(_handle, vertexShader.handle());
			glAttachShader(_handle, fragmentShader.handle());

			// Perform link stage
			glLinkProgram(_handle);
			glGetProgramiv(_handle, GL_LINK_STATUS, &_linked);

			// Validate program
			glValidateProgram(_handle);
			printInfoLog();

			// Check for success
			if (GL_FALSE == _linked)
				throw std::runtime_error("Link stage failed");
		}
		else if (GLEW_VERSION_1_5)
		{
			// Create program and attach vertex and fragment shaders
			_handle = glCreateProgramObjectARB();
			glAttachObjectARB(_handle, vertexShader.handle());
			glAttachObjectARB(_handle, fragmentShader.handle());

			// Perform link stage
			glLinkProgramARB(_handle);
			glGetObjectParameterivARB(_handle, GL_OBJECT_LINK_STATUS_ARB, &_linked);

			// Validate program
			glValidateProgramARB(_handle);
			printInfoLog();

			// Check for success
			if (GL_FALSE == _linked)
				throw std::runtime_error("Link stage failed");
		}

		cout << "* Shader \"" << _name << "\" successfully linked" << endl;
	}
	catch (std::runtime_error &err)
	{
		cerr << "Error: Faild to create shader " << _name << endl;
		cerr << "Reason: " << err.what() << endl;
	}
}
开发者ID:odalet,项目名称:qshaderedit,代码行数:57,代码来源:Shader.cpp


示例8: make_prog

	static Program make_prog(void)
	{
		VertexShader vs;
		vs.Source(
			"#version 130\n"
			"uniform mat4 ProjectionMatrix, ModelMatrix, CameraMatrix;"
			"uniform vec4 ClipPlane;"
			"attribute vec4 Position;"
			"attribute vec2 TexCoord;"
			"varying vec2 vertTexCoord;"
			"void main(void)"
			"{"
			"	vertTexCoord = TexCoord;"
			"	gl_Position = "
			"		ModelMatrix *"
			"		Position;"
			"	gl_ClipDistance[0] = dot(ClipPlane, gl_Position);"
			"	gl_Position = "
			"		ProjectionMatrix *"
			"		CameraMatrix *"
			"		gl_Position;"
			"}"
		);
		vs.Compile();

		FragmentShader fs;
		fs.Source(
			"#version 130\n"
			"varying vec2 vertTexCoord;"
			"void main(void)"
			"{"
			"	float i = ("
			"		int(vertTexCoord.x*36) % 2+"
			"		int(vertTexCoord.y*24) % 2"
			"	) % 2;"
			"	if(gl_FrontFacing)"
			"	{"
			"		gl_FragColor = vec4(1-i/2, 1-i/2, 1-i/2, 1.0);"
			"	}"
			"	else"
			"	{"
			"		gl_FragColor = vec4(0+i/2, 0+i/2, 0+i/2, 1.0);"
			"	}"
			"}"
		);
		fs.Compile();

		Program prog;
		prog.AttachShader(vs);
		prog.AttachShader(fs);
		prog.Link();
		prog.Use();

		return prog;
	}
开发者ID:AdamSimpson,项目名称:oglplus,代码行数:55,代码来源:017_clipped_torus.cpp


示例9: PostLink

//----------------------------------------------------------------------------
void LightAmbEffect::PostLink ()
{
	VisualEffect::PostLink();

	VisualPass* pass = mTechniques[0]->GetPass(0);
	VertexShader* vshader = pass->GetVertexShader();
	PixelShader* pshader = pass->GetPixelShader();
	vshader->SetBaseRegisters(msVRegisters);
	vshader->SetPrograms(msVPrograms);
	pshader->SetPrograms(msPPrograms);
}
开发者ID:bazhenovc,项目名称:WildMagic,代码行数:12,代码来源:Wm5LightAmbEffect.cpp


示例10:

//----------------------------------------------------------------------------
void Texture2ColorBlendEffect::PostLink ()
{
    VisualEffect::PostLink();

    VisualPass* pass = mTechniques[0]->GetPass(0);
    VertexShader* vshader = pass->GetVertexShader();
    PixelShader* pshader = pass->GetPixelShader();
    vshader->SetBaseRegisters(msVRegisters);
    vshader->SetPrograms(msVPrograms);
    pshader->SetTextureUnits(msPTextureUnits);
    pshader->SetPrograms(msPPrograms);
}
开发者ID:fishxz,项目名称:omni-bot,代码行数:13,代码来源:Wm5Texture2ColorBlendEffect.cpp


示例11: kIStr

//----------------------------------------------------------------------------
VertexShader* VertexShader::Load (const char* acFilename)
{
    // open stream, load
    ifstream kIStr(acFilename,ios::in|ios::binary);
    if ( !kIStr )
        return NULL;

    VertexShader* pkShader = new VertexShader;
    pkShader->Read(kIStr);
    kIStr.close();
    return pkShader;
}
开发者ID:Hengplank,项目名称:kucgbowling,代码行数:13,代码来源:WmlVertexShader.cpp


示例12: PostLink

//----------------------------------------------------------------------------
void JunglerMaterial::PostLink ()
{
	Material::PostLink();

	MaterialPass* pass = mTechniques[0]->GetPass(0);
	VertexShader* vshader = pass->GetVertexShader();
	PixelShader* pshader = pass->GetPixelShader();
	vshader->SetBaseRegisters(msVRegisters);
	vshader->SetPrograms(msVPrograms);
	pshader->SetTextureUnits(msPTextureUnits);
	pshader->SetPrograms(msPPrograms);
}
开发者ID:manyxu,项目名称:Phoenix3D_2.0,代码行数:13,代码来源:PX2JunglerMaterial.cpp


示例13: CreateVertexShader

/**
*  @brief
*    Creates a vertex shader and sets the shader source code
*/
VertexShader *ShaderLanguage::CreateVertexShader(const String &sSourceCode, const String &sProfile, const String &sArguments, const String &sEntry)
{
	// Create the vertex shader instance
	VertexShader *pVertexShader = CreateVertexShader();

	// Set the vertex shader source code
	if (pVertexShader)
		pVertexShader->SetSourceCode(sSourceCode, sProfile, sArguments, sEntry);

	// Return the created vertex shader instance
	return pVertexShader;
}
开发者ID:ByeDream,项目名称:pixellight,代码行数:16,代码来源:ShaderLanguage.cpp


示例14: VertexShader

//----------------------------------------------------------------------------
VertexColor4TextureEffect::VertexColor4TextureEffect (
    Shader::SamplerFilter filter, Shader::SamplerCoordinate coordinate0,
    Shader::SamplerCoordinate coordinate1)
{
    VertexShader* vshader = new0 VertexShader("Wm5.VertexColorTexture",
        3, 3, 1, 0, false);
    vshader->SetInput(0, "modelPosition", Shader::VT_FLOAT3,
        Shader::VS_POSITION);
    vshader->SetInput(1, "modelTCoord", Shader::VT_FLOAT2,
        Shader::VS_TEXCOORD0);
    vshader->SetInput(2, "modelColor", Shader::VT_FLOAT4,
        Shader::VS_COLOR0);
    vshader->SetOutput(0, "clipPosition", Shader::VT_FLOAT4,
        Shader::VS_POSITION);
    vshader->SetOutput(1, "vertexTCoord", Shader::VT_FLOAT2,
        Shader::VS_TEXCOORD0);
    vshader->SetOutput(2, "vertexColor", Shader::VT_FLOAT4,
        Shader::VS_COLOR0);
    vshader->SetConstant(0, "PVWMatrix", 4);
    vshader->SetBaseRegisters(msVRegisters);
    vshader->SetPrograms(msVPrograms);

    PixelShader* pshader = new0 PixelShader("Wm5.VertexColorTexture",
        2, 1, 0, 1, false);
    pshader->SetInput(0, "vertexColor", Shader::VT_FLOAT4,
        Shader::VS_COLOR0);
    pshader->SetInput(1, "vertexTCoord", Shader::VT_FLOAT2,
        Shader::VS_TEXCOORD0);
    pshader->SetOutput(0, "pixelColor", Shader::VT_FLOAT4,
        Shader::VS_COLOR0);
    pshader->SetSampler(0, "BaseSampler", Shader::ST_2D);
    pshader->SetFilter(0, filter);
    pshader->SetCoordinate(0, 0, coordinate0);
    pshader->SetCoordinate(0, 1, coordinate1);
    pshader->SetTextureUnits(msPTextureUnits);
    pshader->SetPrograms(msPPrograms);

    VisualPass* pass = new0 VisualPass();
    pass->SetVertexShader(vshader);
    pass->SetPixelShader(pshader);
    pass->SetAlphaState(new0 AlphaState());
    pass->SetCullState(new0 CullState());
    pass->SetDepthState(new0 DepthState());
    pass->SetOffsetState(new0 OffsetState());
    pass->SetStencilState(new0 StencilState());
    pass->SetWireState(new0 WireState());

    VisualTechnique* technique = new0 VisualTechnique();
    technique->InsertPass(pass);
    InsertTechnique(technique);
}
开发者ID:Kiichi77,项目名称:WildMagic,代码行数:52,代码来源:Wm5VertexColor4TextureEffect.cpp


示例15: VertexShader

//----------------------------------------------------------------------------
LightSptPerPixEffect::LightSptPerPixEffect ()
{
    VertexShader* vshader = new0 VertexShader("Wm5.LightSptPerPix",
        2, 3, 1, 0, false);
    vshader->SetInput(0, "modelPosition", Shader::VT_FLOAT3,
        Shader::VS_POSITION);
    vshader->SetInput(1, "modelNormal", Shader::VT_FLOAT3,
        Shader::VS_TEXCOORD1);
    vshader->SetOutput(0, "clipPosition", Shader::VT_FLOAT4,
        Shader::VS_POSITION);
    vshader->SetOutput(1, "vertexPosition", Shader::VT_FLOAT3,
        Shader::VS_TEXCOORD0);
    vshader->SetOutput(2, "vertexNormal", Shader::VT_FLOAT3,
        Shader::VS_TEXCOORD1);
    vshader->SetConstant(0, "PVWMatrix", 4);
    vshader->SetBaseRegisters(msVRegisters);
    vshader->SetPrograms(msVPrograms);

    PixelShader* pshader = new0 PixelShader("Wm5.LightSptPerPix",
        2, 1, 13, 0, false);
    pshader->SetInput(0, "vertexPosition", Shader::VT_FLOAT3,
        Shader::VS_TEXCOORD0);
    pshader->SetInput(1, "vertexNormal", Shader::VT_FLOAT3,
        Shader::VS_TEXCOORD1);
    pshader->SetOutput(0, "pixelColor", Shader::VT_FLOAT4,
        Shader::VS_COLOR0);
    pshader->SetConstant(0, "WMatrix", 4);
    pshader->SetConstant(1, "CameraModelPosition", 1);
    pshader->SetConstant(2, "MaterialEmissive", 1);
    pshader->SetConstant(3, "MaterialAmbient", 1);
    pshader->SetConstant(4, "MaterialDiffuse", 1);
    pshader->SetConstant(5, "MaterialSpecular", 1);
    pshader->SetConstant(6, "LightModelPosition", 1);
    pshader->SetConstant(7, "LightModelDirection", 1);
    pshader->SetConstant(8, "LightAmbient", 1);
    pshader->SetConstant(9, "LightDiffuse", 1);
    pshader->SetConstant(10, "LightSpecular", 1);
    pshader->SetConstant(11, "LightSpotCutoff", 1);
    pshader->SetConstant(12, "LightAttenuation", 1);
    pshader->SetBaseRegisters(msPRegisters);
    pshader->SetPrograms(msPPrograms);

    VisualPass* pass = new0 VisualPass();
    pass->SetVertexShader(vshader);
    pass->SetPixelShader(pshader);
    pass->SetAlphaState(new0 AlphaState());
    pass->SetCullState(new0 CullState());
    pass->SetDepthState(new0 DepthState());
    pass->SetOffsetState(new0 OffsetState());
    pass->SetStencilState(new0 StencilState());
    pass->SetWireState(new0 WireState());

    VisualTechnique* technique = new0 VisualTechnique();
    technique->InsertPass(pass);
    InsertTechnique(technique);
}
开发者ID:2asoft,项目名称:GeometricTools,代码行数:57,代码来源:Wm5LightSptPerPixEffect.cpp


示例16: setVertexShader

void PipelineStateCache::setVertexShader(const VertexShader& vertexShader)
{
  // FIXME: cache this
  ID3D11Buffer* const* constantBuffers;
  uint32 numConstantBuffers = vertexShader.queryBuffersArray(constantBuffers);
  m_deviceContext->VSSetConstantBuffers(0, numConstantBuffers, constantBuffers);

  ID3D11VertexShader* shaderResourcePtr = vertexShader.getResourcePtr();
  if (shaderResourcePtr != m_currentVertexShader)
  {
    m_currentVertexShader = shaderResourcePtr;
    m_deviceContext->VSSetShader(shaderResourcePtr, NULL, 0);
  }
}
开发者ID:D13David,项目名称:Framework,代码行数:14,代码来源:RenderSystem.cpp


示例17: VertexShader

//----------------------------------------------------------------------------
UIMaterial::UIMaterial ()
{
    VertexShader* vshader = new0 VertexShader("PX2.UI",
                            3, 3, 1, 0, false);
    vshader->SetInput(0, "modelPosition", Shader::VT_FLOAT3,
                      Shader::VS_POSITION);
    vshader->SetInput(1, "modelColor0", Shader::VT_FLOAT4,
                      Shader::VS_COLOR0);
    vshader->SetInput(2, "modelTCoord0", Shader::VT_FLOAT2,
                      Shader::VS_TEXCOORD0);
    vshader->SetOutput(0, "clipPosition", Shader::VT_FLOAT4,
                       Shader::VS_POSITION);
    vshader->SetOutput(1, "vertexColor0", Shader::VT_FLOAT4,
                       Shader::VS_COLOR0);
    vshader->SetOutput(2, "vertexTCoord0", Shader::VT_FLOAT2,
                       Shader::VS_TEXCOORD0);
    vshader->SetConstant(0, "gPVWMatrix", 4);
    vshader->SetBaseRegisters(msVRegisters);
    vshader->SetPrograms(msVPrograms);

    PixelShader* pshader = new0 PixelShader("PX2.UI",
                                            2, 1, 0, 1, false);
    pshader->SetInput(0, "vertexColor0", Shader::VT_FLOAT4,
                      Shader::VS_COLOR0);
    pshader->SetInput(1, "vertexTCoord0", Shader::VT_FLOAT2,
                      Shader::VS_TEXCOORD0);
    pshader->SetOutput(0, "pixelColor", Shader::VT_FLOAT4,
                       Shader::VS_COLOR0);
    pshader->SetSampler(0, "gDiffuseSampler", Shader::ST_2D);
    pshader->SetFilter(0, Shader::SF_NEAREST);
    pshader->SetCoordinate(0, 0, Shader::SC_CLAMP_EDGE);
    pshader->SetCoordinate(0, 1, Shader::SC_CLAMP_EDGE);
    pshader->SetTextureUnits(msPTextureUnits);
    pshader->SetPrograms(msPPrograms);

    MaterialPass* pass = new0 MaterialPass();
    pass->SetVertexShader(vshader);
    pass->SetPixelShader(pshader);
    pass->SetAlphaProperty(new0 AlphaProperty());
    pass->SetCullProperty(new0 CullProperty());
    pass->SetDepthProperty(new0 DepthProperty());
    pass->SetOffsetProperty(new0 OffsetProperty());
    pass->SetStencilProperty(new0 StencilProperty());
    pass->SetWireProperty(new0 WireProperty());
    pass->GetAlphaProperty()->BlendEnabled = true;

    MaterialTechnique* technique = new0 MaterialTechnique();
    technique->InsertPass(pass);
    InsertTechnique(technique);
}
开发者ID:whztt07,项目名称:Phoenix3D_2.0,代码行数:51,代码来源:PX2UIMaterial.cpp


示例18: catch

 VertexShader<RS>* ShaderManager<RS>::getVertexShader(const String& file, const String&
    function, const Vertex* p)
    {
    VertexShader<RS>* out = 0;
    auto f = vShaders.find(file);
    if(f != vShaders.end())
       {
       auto fn = (*f).second.find(function);
       if(fn != (*f).second.end())
          {
          out  = (*fn).second;
          }
       else
          {
          out = new VertexShader<RS>();
          if(p)
             out->associateVertex(*p);
          try
             {
             out->Shader::init(file, function);
             vShaders[file][function] = out;
             }
          catch(DeviceFailureException e)
             {
             LOG(e.what());
             out->destroy();
             out = vShaders[Defaults::mapName][Defaults::mapName];
             }
          }
       }
    else
       {
       vShaders[file] = HashMap<String,VertexShader<RS>*>();
       out = new VertexShader<RS>();
       if(p)
          out->associateVertex(*p);
       try
          {
          out->Shader::init(file, function);
          vShaders[file][function] = out;
          }
       catch(DeviceFailureException e)
          {
          LOG(e.what());
          out->destroy();
          out = vShaders[Defaults::mapName][Defaults::mapName];
          }
       }
    return out;
    }
开发者ID:radneyalquiza,项目名称:GAM531_Emperor,代码行数:50,代码来源:ShaderManager.cpp


示例19: PostLink

//----------------------------------------------------------------------------
void StandardESMaterial_AlphaTest::PostLink ()
{
	Material::PostLink();

	MaterialPass* pass = mTechniques[0]->GetPass(0);
	VertexShader* vshader = pass->GetVertexShader();
	PixelShader* pshader = pass->GetPixelShader();
	vshader->SetBaseRegisters(msVRegisters);
	vshader->SetPrograms(msVPrograms);
	pshader->SetTextureUnits(msPTextureUnits);
	pshader->SetPrograms(msPPrograms);

	vshader->SetShaderKey(SKT_STANNDES_ALPHATEST);
	pshader->SetShaderKey(SKT_STANNDES_ALPHATEST);
}
开发者ID:SylviaTanenbaum,项目名称:3d-simulation-and-game,代码行数:16,代码来源:PX2StandardESMaterial_AlphaTest.cpp


示例20: hashString

const unsigned int ShaderCache::getVertexShader(const tinyxml2::XMLElement* element, const DeviceManager& deviceManager)
{
    VertexShader shader;
    shader.deserialise(element);
    unsigned int resourceName = hashString(getResourceNameFromFileName(shader.getFileName()));
    if (getVertexShader(resourceName) == nullptr)
    {
        if (shader.createShader(deviceManager))
        {
            m_vertexShaders.emplace(VertexShaderHandle(resourceName, shader));
        }
    }
    
    return resourceName;
}
开发者ID:,项目名称:,代码行数:15,代码来源:



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ VertexVector类代码示例发布时间:2022-05-31
下一篇:
C++ VertexSE3类代码示例发布时间: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