本文整理汇总了C++中RenderMaterial类的典型用法代码示例。如果您正苦于以下问题:C++ RenderMaterial类的具体用法?C++ RenderMaterial怎么用?C++ RenderMaterial使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了RenderMaterial类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ARXDRAW_DrawEyeBall
void ARXDRAW_DrawEyeBall() {
if(eyeball.exist == 0 || !eyeballobj)
return;
float d;
if(eyeball.exist < 0) {
d = (float)(-eyeball.exist)*( 1.0f / 100 );
eyeball.exist++;
} else if(eyeball.exist > 2) {
d = (float)(eyeball.exist)*( 1.0f / 100 );
}
else
return;
Anglef angle = eyeball.angle;
angle.setPitch(MAKEANGLE(180.f - angle.getPitch()));
Vec3f pos = eyeball.pos;
pos.y += eyeball.floating;
Vec3f scale = Vec3f(d);
Color3f rgb = Color3f::gray(d);
RenderMaterial mat;
mat.setDepthTest(true);
mat.setBlendType(RenderMaterial::Additive);
Draw3DObject(eyeballobj, angle, pos, scale, rgb, mat);
}
示例2: Render
void CCurse::Render() {
RenderMaterial mat;
mat.setCulling(Renderer::CullCW);
mat.setDepthTest(true);
mat.setBlendType(RenderMaterial::Opaque);
Anglef stiteangle = Anglef(0, fRot, 0);
Vec3f stitepos = eTarget;
Vec3f stitescale = Vec3f_ONE;
Color3f stitecolor = Color3f::white;
Draw3DObject(svoodoo, stiteangle, stitepos, stitescale, stitecolor, mat);
for(int i = 0; i < 4; i++) {
PARTICLE_DEF * pd = createParticle();
if(!pd) {
break;
}
pd->ov = eTarget;
pd->move = Vec3f(2.f * frand2(), rnd() * -10.f - 10.f, 2.f * frand2());
pd->siz = 0.015f;
pd->tolive = Random::get(1000, 1600);
pd->tc = tex_p1;
pd->special = ROTATING | MODULATE_ROTATION | DISSIPATING | SUBSTRACT | GRAVITY;
pd->fparam = 0.0000001f;
}
}
示例3: ParticleSparkUpdate
void ParticleSparkUpdate() {
ARX_PROFILE_FUNC();
if(g_sparkParticlesCount == 0) {
return;
}
const GameInstant now = g_gameTime.now();
RenderMaterial sparkMaterial;
sparkMaterial.setBlendType(RenderMaterial::Additive);
for(size_t i = 0; i < g_sparkParticlesMax; i++) {
SparkParticle & spark = g_sparkParticles[i];
if(spark.m_duration == 0) {
continue;
}
long framediff = spark.timcreation + spark.m_duration - toMsi(now);
long framediff2 = toMsi(now) - spark.timcreation;
if(framediff2 < 0) {
continue;
}
if(framediff <= 0) {
spark.m_duration = 0;
g_sparkParticlesCount--;
continue;
}
float val = (spark.m_duration - framediff) * 0.01f;
Vec3f in = spark.m_pos + spark.move * val;
Vec3f tailDirection = glm::normalize(-spark.move);
TexturedVertex tv[3];
tv[0].color = spark.rgb;
tv[1].color = Color::gray(0.4f).toRGBA();
tv[2].color = Color::black.toRGBA();
worldToClipSpace(in, tv[0]);
if(tv[0].w < 0 || tv[0].p.z > g_camera->cdepth * fZFogEnd * tv[0].w) {
continue;
}
Vec3f temp1 = in + Vec3f(Random::getf(0.f, 0.5f), 0.8f, Random::getf(0.f, 0.5f));
Vec3f temp2 = in + tailDirection * spark.m_tailLength;
worldToClipSpace(temp1, tv[1]);
worldToClipSpace(temp2, tv[2]);
g_renderBatcher.add(sparkMaterial, tv);
}
}
示例4: Render
void CRepelUndead::Render() {
if(ulCurrentTime >= ulDuration)
return;
RenderMaterial mat;
mat.setDepthTest(true);
mat.setBlendType(RenderMaterial::Additive);
Anglef eObjAngle;
eObjAngle.setPitch(m_yaw);
eObjAngle.setYaw(0);
eObjAngle.setRoll(0);
float vv = 1.f + (std::sin(arxtime.get_updated() * ( 1.0f / 1000 )));
vv *= ( 1.0f / 2 );
vv += 1.1f;
Draw3DObject(ssol, eObjAngle, eSrc + Vec3f(0.f, -5.f, 0.f), Vec3f(vv), Color3f(0.6f, 0.6f, 0.8f), mat);
vv *= 100.f;
for(int n = 0; n < 4; n++) {
PARTICLE_DEF * pd = createParticle();
if(!pd) {
break;
}
float dx = -std::sin(frand2() * 360.f) * vv;
float dz = std::cos(frand2() * 360.f) * vv;
pd->ov = eSrc + Vec3f(dx, 0.f, dz);
pd->move = Vec3f(0.8f * frand2(), -4.f * rnd(), 0.8f * frand2());
pd->scale = Vec3f(-0.1f);
pd->tolive = Random::get(2600, 3200);
pd->tc = tex_p2;
pd->siz = 0.3f;
pd->rgb = Color3f(.4f, .4f, .6f);
}
if(!lightHandleIsValid(lLightId)) {
lLightId = GetFreeDynLight();
}
if(lightHandleIsValid(lLightId)) {
EERIE_LIGHT * light = lightHandleGet(lLightId);
light->intensity = 2.3f;
light->fallend = 350.f;
light->fallstart = 150.f;
light->rgb = Color3f(0.8f, 0.8f, 1.f);
light->pos = eSrc + Vec3f(0.f, -50.f, 0.f);
light->duration = 200;
light->time_creation = (unsigned long)(arxtime);
}
}
示例5: LaunchAntiMagicField
void NegateMagicSpell::Update() {
LaunchAntiMagicField();
if(m_target == EntityHandle_Player) {
m_pos = player.basePosition();
} else {
Entity * target = entities.get(m_target);
if(target) {
m_pos = target->pos;
}
}
Vec3f stitepos = m_pos - Vec3f(0.f, 10.f, 0.f);
RenderMaterial mat;
mat.setLayer(RenderMaterial::Decal);
mat.setDepthTest(true);
mat.setTexture(tex_sol);
mat.setBlendType(RenderMaterial::Additive);
for(int i = 0; i < 360; i++) {
float t = Random::getf();
if(t < 0.04f) {
PARTICLE_DEF * pd = createParticle();
if(!pd) {
break;
}
pd->ov = stitepos + arx::randomOffsetXZ(150.f);
pd->move = Vec3f(0.f, Random::getf(-3.f, 0.f), 0.f);
pd->siz = 0.3f;
pd->tolive = Random::getu(2000, 4000);
pd->tc = tex_p2;
pd->m_flags = FADE_IN_AND_OUT | ROTATING | DISSIPATING | SUBSTRACT;
pd->m_rotation = 0.0000001f;
}
}
float rot = timeWaveSaw(g_gameTime.now(), GameDurationMs(18000)) * 360.f;
Anglef stiteangle(0.f, -rot, 0.f);
float scalediff = timeWaveSin(g_gameTime.now(), GameDurationMsf(1570.79632f));
{
Color3f stitecolor = Color3f::gray(.4f);
Vec3f stitescale = Vec3f(3.f + 0.5f * scalediff);
Draw3DObject(ssol, stiteangle, stitepos, stitescale, stitecolor, mat);
}
{
Color3f stitecolor = Color3f(.5f, 0.f, .5f);
Vec3f stitescale = Vec3f(3.1f + 0.2f * scalediff);
Draw3DObject(ssol, stiteangle, stitepos, stitescale, stitecolor, mat);
}
}
示例6: LaunchAntiMagicField
void NegateMagicSpell::Update() {
LaunchAntiMagicField();
if(m_target == PlayerEntityHandle) {
m_pos = player.basePosition();
} else {
m_pos = entities[m_target]->pos;
}
Vec3f stitepos = m_pos - Vec3f(0.f, 10.f, 0.f);
RenderMaterial mat;
mat.setLayer(RenderMaterial::Decal);
mat.setDepthTest(true);
mat.setTexture(tex_sol);
mat.setBlendType(RenderMaterial::Additive);
for(int i = 0; i < 360; i++) {
float t = Random::getf();
if(t < 0.04f) {
PARTICLE_DEF * pd = createParticle();
if(!pd) {
break;
}
pd->ov = stitepos + Vec3f(Random::getf(-150.f, 150.f), 0.f, Random::getf(-150.f, 150.f));
pd->move = Vec3f(0.f, Random::getf(-3.f, 0.f), 0.f);
pd->siz = 0.3f;
pd->tolive = Random::getu(2000, 4000);
pd->tc = tex_p2;
pd->special = FADE_IN_AND_OUT | ROTATING | MODULATE_ROTATION | DISSIPATING
| SUBSTRACT;
pd->fparam = 0.0000001f;
}
}
float now = arxtime.now_f();
Anglef stiteangle(0.f, -now * 0.02f, 0.f);
float scalediff = std::sin(now * 0.004f);
{
Color3f stitecolor = Color3f::gray(.4f);
Vec3f stitescale = Vec3f(3.f + 0.5f * scalediff);
Draw3DObject(ssol, stiteangle, stitepos, stitescale, stitecolor, mat);
}
{
Color3f stitecolor = Color3f(.5f, 0.f, .5f);
Vec3f stitescale = Vec3f(3.1f + 0.2f * scalediff);
Draw3DObject(ssol, stiteangle, stitepos, stitescale, stitecolor, mat);
}
}
示例7: DrawStone
void CLevitate::DrawStone()
{
RenderMaterial mat;
mat.setDepthTest(true);
mat.setBlendType(RenderMaterial::Screen);
int nb = 256;
while(nb--) {
T_STONE & s = tstone[nb];
if(s.actif) {
float a = (float)s.currtime / (float)s.time;
if(a > 1.f) {
a = 1.f;
s.actif = 0;
}
Color4f col = Color4f(Color3f::white, 1.f - a);
EERIE_3DOBJ * obj = (s.numstone == 0) ? stone0 : stone1;
Draw3DObject(obj, s.ang, s.pos, s.scale, Color4f(col), mat);
PARTICLE_DEF * pd = createParticle();
if(pd) {
pd->ov = s.pos;
pd->move = Vec3f(0.f, 3.f * rnd(), 0.f);
pd->siz = 3.f + 3.f * rnd();
pd->tolive = 1000;
pd->timcreation = -(long(arxtime) + 1000l); // TODO WTF?
pd->special = FIRE_TO_SMOKE | FADE_IN_AND_OUT | ROTATING | MODULATE_ROTATION
| DISSIPATING;
pd->fparam = 0.0000001f;
}
//update mvt
if(!arxtime.is_paused()) {
a = (((float)this->currframetime) * 100.f) / (float)s.time;
s.pos.y += s.yvel * a;
s.ang += s.angvel * a;
s.yvel *= 1.f - (1.f / 100.f);
s.currtime += this->currframetime;
}
}
}
}
示例8: Vec3f
void CRuneOfGuarding::Render()
{
Vec3f pos = eSrc + Vec3f(0.f, -20.f, 0.f);
RenderMaterial mat;
mat.setDepthTest(true);
mat.setBlendType(RenderMaterial::Additive);
Anglef stiteangle;
Color3f stitecolor;
float stiteangleb = float(ulCurrentTime) * 0.01f;
stiteangle.setYaw(0);
stiteangle.setRoll(0);
stiteangle.setPitch(stiteangleb * 0.1f);
stitecolor = Color3f(0.4f, 0.4f, 0.6f);
float scale = std::sin(ulCurrentTime * 0.015f);
Vec3f stitescale = Vec3f(1.f, -0.1f, 1.f);
Draw3DObject(slight, stiteangle, pos, stitescale, stitecolor, mat);
stiteangle.setPitch(stiteangleb);
stitecolor = Color3f(0.6f, 0.f, 0.f);
stitescale = Vec3f(2.f) * (1.f + 0.01f * scale);
Draw3DObject(ssol, stiteangle, pos, stitescale, stitecolor, mat);
stitecolor = Color3f(0.6f, 0.3f, 0.45f);
stitescale = Vec3f(1.8f) * (1.f + 0.02f * scale);
Draw3DObject(srune, stiteangle, pos, stitescale, stitecolor, mat);
for(int n = 0; n < 4; n++) {
PARTICLE_DEF * pd = createParticle();
if(!pd) {
break;
}
pd->ov = pos + (Vec3f(40.f, 0.f, 40.f) * Vec3f(frand2(), 0.f, frand2()));
pd->move = Vec3f(0.8f, -4.f, 0.8f) * Vec3f(frand2(), rnd(), frand2());
pd->scale = Vec3f(-0.1f);
pd->tolive = Random::get(2600, 3200);
pd->tc = tex_p2;
pd->siz = 0.3f;
pd->rgb = Color3f(.4f, .4f, .6f);
}
}
示例9: Vec3f
void CNegateMagic::Render() {
int i = 0;
Vec3f stitepos = eSrc - Vec3f(0.f, 10.f, 0.f);
if(ulCurrentTime >= ulDuration)
return;
RenderMaterial mat;
mat.setLayer(RenderMaterial::Decal);
mat.setDepthTest(true);
mat.setTexture(tex_sol);
mat.setBlendType(RenderMaterial::Additive);
for(i = 0; i < 360; i++) {
float t = rnd();
if(t < 0.04f) {
PARTICLE_DEF * pd = createParticle();
if(!pd) {
break;
}
pd->ov = stitepos + Vec3f(frand2() * 150.f, 0.f, frand2() * 150.f);
pd->move = Vec3f(0.f, -3.0f * rnd(), 0.f);
pd->siz = 0.3f;
pd->tolive = Random::get(2000, 4000);
pd->tc = tex_p2;
pd->special = FADE_IN_AND_OUT | ROTATING | MODULATE_ROTATION | DISSIPATING
| SUBSTRACT;
pd->fparam = 0.0000001f;
}
}
Anglef stiteangle(0.f, -(float) ulCurrentTime * 0.02f, 0.f);
Color3f stitecolor = Color3f::gray(.4f);
float scalediff = std::sin(ulCurrentTime * 0.004f);
Vec3f stitescale = Vec3f(3.f + 0.5f * scalediff);
Draw3DObject(ssol, stiteangle, stitepos, stitescale, stitecolor, mat);
stitecolor = Color3f(.5f, 0.f, .5f);
stitescale = Vec3f(3.1f + 0.2f * scalediff);
Draw3DObject(ssol, stiteangle, stitepos, stitescale, stitecolor, mat);
}
示例10: DrawStone
void CRiseDead::DrawStone()
{
int nb = 256;
RenderMaterial mat;
mat.setDepthTest(true);
mat.setBlendType(RenderMaterial::Screen);
while(nb--) {
if(this->tstone[nb].actif) {
float a = (float)this->tstone[nb].currtime / (float)this->tstone[nb].time;
if(a > 1.f) {
a = 1.f;
this->tstone[nb].actif = 0;
}
Color4f col = Color4f(Color3f::white, 1.f - a);
Draw3DObject(stone[tstone[nb].numstone], tstone[nb].ang, tstone[nb].pos, tstone[nb].scale, col, mat);
PARTICLE_DEF * pd = createParticle();
if(pd) {
pd->ov = tstone[nb].pos;
pd->move = Vec3f(0.f, 3.f * rnd(), 0.f);
pd->siz = 3.f + 3.f * rnd();
pd->tolive = 1000;
pd->timcreation = -(long(arxtime) + 1000l); // TODO WTF
pd->special = FIRE_TO_SMOKE | FADE_IN_AND_OUT | ROTATING | MODULATE_ROTATION
| DISSIPATING;
pd->fparam = 0.0000001f;
}
//update mvt
if(!arxtime.is_paused()) {
a = (((float)this->currframetime) * 100.f) / (float)this->tstone[nb].time;
tstone[nb].pos.y += tstone[nb].yvel * a;
tstone[nb].ang += tstone[nb].angvel * a;
this->tstone[nb].yvel *= 1.f - (1.f / 100.f);
this->tstone[nb].currtime += this->currframetime;
}
}
}
}
示例11:
RenderMaterialInterfacePtr RenderMaterialManager::getMaterial2( const ConstString & _materialName
, const RenderMaterialStage * _stage
, EPrimitiveType _primitiveType
, uint32_t _textureCount
, const RenderTextureInterfacePtr * _textures )
{
uint32_t material_hash = this->makeMaterialHash( _materialName, _textureCount, _textures );
uint32_t material_table_index = material_hash % MENGE_RENDER_MATERIAL_HASH_TABLE_SIZE;
TVectorRenderMaterial & materials = m_materials[material_table_index];
for( TVectorRenderMaterial::iterator
it = materials.begin(),
it_end = materials.end();
it != it_end;
++it )
{
RenderMaterial * material = *it;
if( material->getHash() != material_hash )
{
continue;
}
if( s_equalMaterial( material, _primitiveType, _textureCount, _textures, _stage ) == false )
{
continue;
}
return material;
}
RenderMaterial * material = m_factoryMaterial.createObject();
uint32_t id = this->makeMaterialIndex_();
material->initialize( _materialName, id, material_hash, _primitiveType, _textureCount, _textures, _stage );
materials.push_back( material );
return material;
}
示例12: GameDurationMs
void CurseSpell::Update() {
fRot += g_gameTime.lastFrameDuration() / GameDurationMs(4);
Vec3f target = Vec3f_ZERO;
Entity * targetIo = entities.get(m_target);
if(targetIo) {
target = targetIo->pos;
if(m_target == EntityHandle_Player)
target.y -= 200.f;
else
target.y += targetIo->physics.cyl.height - 30.f;
}
m_pos = target;
RenderMaterial mat;
mat.setCulling(CullCW);
mat.setDepthTest(true);
mat.setBlendType(RenderMaterial::Opaque);
Draw3DObject(svoodoo, Anglef(0, fRot, 0), m_pos, Vec3f_ONE, Color3f::white, mat);
for(int i = 0; i < 4; i++) {
PARTICLE_DEF * pd = createParticle();
if(!pd) {
break;
}
pd->ov = m_pos;
pd->move = arx::linearRand(Vec3f(-2.f, -20.f, -2.f), Vec3f(2.f, -10.f, 2.f));
pd->siz = 0.015f;
pd->tolive = Random::getu(1000, 1600);
pd->tc = tex_p1;
pd->m_flags = ROTATING | DISSIPATING | SUBSTRACT | GRAVITY;
pd->m_rotation = 0.0000001f;
}
}
示例13: drawDebugFogs
static void drawDebugFogs() {
RenderMaterial mat;
mat.setBlendType(RenderMaterial::Opaque);
mat.setDepthTest(true);
for(size_t i = 0; i < MAX_FOG; i++) {
const FOG_DEF & fog = fogs[i];
if(!fog.exist) {
continue;
}
Draw3DObject(g_fogObject, Anglef(0.f, 0.f, 0.f), fog.pos, Vec3f(1.f), Color3f::white, mat);
if(fog.special & FOG_DIRECTIONAL) {
drawLine(fog.pos, fog.pos + fog.move * 50.f, Color::white);
}
drawLineSphere(Sphere(fog.pos, fog.size), Color(Color3<u8>::blue, 200));
}
}
示例14: RENDERER_PERFZONE
void Render::renderMeshes(Array<RenderElement*> & meshes, RenderMaterial::Pass pass)
{
RENDERER_PERFZONE(Render_renderMeshes);
RenderMaterial *lastMaterial = 0;
RenderMaterialInstance *lastMaterialInstance = 0;
const RenderBase *lastMesh = 0;
const uint32 numMeshes = (uint32)meshes.Size();
for(uint32 i=0; i<numMeshes; i++)
{
RenderElement &context = *meshes[i];
bindMeshContext(context);
bool instanced = context.m_mesh->getInstanceBuffer()?true:false;
if(context.m_materialInstance && context.m_materialInstance != lastMaterialInstance)
{
if(lastMaterial) lastMaterial->unbind();
lastMaterialInstance = context.m_materialInstance;
lastMaterial = &context.m_materialInstance->getMaterial();
lastMaterial->bind(pass, lastMaterialInstance, instanced);
}
else if(context.getMaterial() != lastMaterial)
{
if(lastMaterial) lastMaterial->unbind();
lastMaterialInstance = 0;
lastMaterial = context.getMaterial();
lastMaterial->bind(pass, lastMaterialInstance, instanced);
}
if(lastMaterial)
{
lastMaterial->bindMeshState(instanced);
}
if(context.m_mesh != lastMesh)
{
if(lastMesh) lastMesh->unbind();
lastMesh = context.m_mesh;
if(lastMesh) lastMesh->bind();
}
if(lastMesh)
{
context.m_mesh->render(context.getMaterial());
}
}
if(lastMesh)
{
lastMesh->unbind();
}
if(lastMaterial)
{
lastMaterial->unbind();
}
}
示例15: Update
void CurseSpell::Update(float timeDelta) {
fRot += timeDelta * 0.25f;
Vec3f target = Vec3f_ZERO;
if(ValidIONum(m_target)) {
target = entities[m_target]->pos;
if(m_target == PlayerEntityHandle)
target.y -= 200.f;
else
target.y += entities[m_target]->physics.cyl.height - 30.f;
}
m_pos = target;
RenderMaterial mat;
mat.setCulling(Renderer::CullCW);
mat.setDepthTest(true);
mat.setBlendType(RenderMaterial::Opaque);
Draw3DObject(svoodoo, Anglef(0, fRot, 0), m_pos, Vec3f_ONE, Color3f::white, mat);
for(int i = 0; i < 4; i++) {
PARTICLE_DEF * pd = createParticle();
if(!pd) {
break;
}
pd->ov = m_pos;
pd->move = Vec3f(2.f * frand2(), rnd() * -10.f - 10.f, 2.f * frand2());
pd->siz = 0.015f;
pd->tolive = Random::get(1000, 1600);
pd->tc = tex_p1;
pd->special = ROTATING | MODULATE_ROTATION | DISSIPATING | SUBSTRACT | GRAVITY;
pd->fparam = 0.0000001f;
}
}