HALF-LIFE PORTAL
Your Gate To Valve's Games www.hl-forum.de
PORTAL
FORUM
LOGIN
User oder E-mail:


Passwort:


oder
Registrieren
Passwort vergessen?
OpenID-Login
MISC
PARTNER

TF2 Crafting

Special Artworks by
Hayungs

Link us:
HL PORTAL

Support us:


HLPortal
auf Facebook

›› Willkommen!   ›› 95.376.592 Visits   ›› 18.316 registrierte User   ›› 36 Besucher online (0 auf dieser Seite)
23.789 Themen, 325.181 Beiträge  
    FORUM 

Thema-Ansicht


Forum > Editing > Coding > HL1 Bump Mapping in Half-Life
Status: Offen
13 Beiträge
Letzter Beitrag Seiten (1):  [1]


Autor Beitrag
# 1
Godkiller_NT  (36)
Nachricht offline
Headcrab
0 Punkte
Dabei seit: 28.11.2005
123 Beiträge
HL1 Bump Mapping in Half-Life
Hallo!
Ich habe versucht in Spirit Bump Mapping in Half-Life einzubbauen collective.valve-erc.com
Hat alles gut fuktoiniert aber leider bekamm ich 9 fehler die ich bis auf 1 alle lösen konnte.

Der fehler lautet:

C:\Spirit\cl_dll\bumpmap.cpp(680) : error C2440: '=' : 'int' kann nicht in 'struct glpoly_s *' konvertiert werden
Die Konvertierung eines ganzzahligen Typs in einen Zeigertyp erfordert ein reinterpret_cast-Operator oder eine Typumwandlung im C- oder Funktionsformat

:confused: :confused: :confused: :confused: :confused:

Ich werde einfach daraus nicht schlau, vieleicht kann mir jemand helfen?
Danke im voraus...

Sollten mehr Infos nötig sein bitte schreibt es.
____________________________________
14.06.2006, 19:05 Uhr Anzeigen
# 2
e-freak  (114)
HLP - Ehrenmember
Nachricht offline Moderator
Ichthyosaur
11.284 Punkte
Dabei seit: 19.11.2004
2.378 Beiträge
scheint ein problem beim umwandeln eines integers zu einem glpoly_s zu sein - d.h. du musst nochmal vorher den wert umwandeln lassen - wie man eben zB einen String zu einem Integer machen kann - hab ich jetzt mal so von Delphi-Kentnissen abgeleitet
____________________________________
iGude
14.06.2006, 19:21 Uhr Anzeigen
# 3
Godkiller_NT  (36)
Nachricht offline
Thread-Starter
Headcrab
0 Punkte
Dabei seit: 28.11.2005
123 Beiträge
Das umwandeln sollte in der com_model.h ambesten erfolgen.. oder?

#ifndef HARDWARE_MODE
// 06/23/2002 MAH
// This structure is different between hardware and software mode
//
// software mode - QW 'model.h'
#define VERTEXSIZE 7

typedef struct glpoly_s
{
struct glpoly_s *next;
struct glpoly_s *chain;
int numverts;
int flags; // for SURF_UNDERWATER

float verts[4][VERTEXSIZE]; // variable sized (xyz s1t1 s2t2)
} glpoly_t;

und in diesse funktion "typedef struct glpoly_s"
und wie?
hat jemand eine zeile für mich? :)
____________________________________
14.06.2006, 19:51 Uhr Anzeigen
# 4
Godkiller_NT  (36)
Nachricht offline
Thread-Starter
Headcrab
0 Punkte
Dabei seit: 28.11.2005
123 Beiträge
Ich habe den fehler eingekreist:

Nur da brauche ich wirklich Hilfe! :eek:

void CBumpmapMgr::RenderLight(int light)
{
// get a ptr to the light in question
bumplight_t* pLight = &m_aBumpedScenes[light];

if (!pLight->enabled)
return;

// calculate the movewith
if (pLight->moveWithEnt)
{
// first, adjust the light's position by any change that the movewith entity has undergone
pLight->pos = pLight->origPos + (pLight->moveWithEnt->origin - pLight->entOrigPos);

// rotate the light around the movewith entity by any change in its angles
Vector anglesChange = pLight->moveWithEnt->angles - pLight->entOrigAngles;
Vector newPos = pLight->pos - pLight->moveWithEnt->origin;
newPos = RotateZ(newPos, -anglesChange.y);
newPos = RotateY(newPos, -anglesChange.x);
newPos = RotateX(newPos, -anglesChange.z);
newPos = newPos + pLight->moveWithEnt->origin;

pLight->pos = newPos;
}

float styleStrength = (float)(g_LightStyles[pLight->style][(int)(gpGlobals->time * 10) % strlen(g_LightStyles[pLight->style])] - 'a') / ('z' - 'a');

if (styleStrength == 0)
return;

// bind the right fragment program and set the parameters
cgGLBindProgram(m_fp_Bump);

cgGLSetParameter1f(m_parm_BumpLightStrength, pLight->strength * styleStrength);
cgGLSetParameter3fv(m_parm_BumpLightColour, pLight->colour);

// bind the normalisation cube map to tex unit 1
glActiveTextureARB(GL_TEXTURE1_ARB);
glDisable(GL_TEXTURE_RECTANGLE_NV);
glDisable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, m_uiNormCubeMap);

// bind the attenuation map to tex unit 2
glActiveTextureARB(GL_TEXTURE2_ARB);
glEnable(GL_TEXTURE_3D_EXT);
glBindTexture(GL_TEXTURE_3D_EXT, m_uiAttenuationMap);

// normal maps will be bound to tex unit 0
glActiveTextureARB(GL_TEXTURE0_ARB);
glDisable(GL_TEXTURE_RECTANGLE_NV);
glEnable(GL_TEXTURE_2D);

// create a bunch of variables
model_t* pWorld = gEngfuncs.GetEntityByIndex(0)->model; // worldspawn model
msurface_t** pSurf = pWorld->marksurfaces; // ptr to array of surfaces
glpoly_t* pPoly;
Vector N, T, B, L, L2, V, V1, V2, V3, E1, E2, AttenCoords;
TexNormalMaps_It texID;

glShadeModel(GL_SMOOTH);

// go through each surface
for (int i = 0; i < pWorld->nummarksurfaces; i++)
{
// This is a semi-hack to use the pre-calculated visibilty info. We don't have access
// to what the current visframe is, but we can assume that the surfaces with the highest
// visframe are those which are currently being rendered. If the visframe changes, then
// there might be more overdraw for one frame, but this isn't noticeable.
//
// To stop surfaces being rendered twice (which is disastrous, since we are using additive
// blending) we set the visframe to the negative value of itself once we've rendered the surface.
// If we then find a surface that has a negative visframe, we know that we've already
// rendered that one.

if (pSurf[i]->visframe > 0 && pSurf[i]->visframe >= m_iLargestVisFrame)
{
m_iLargestVisFrame = pSurf[i]->visframe;

pPoly = pSurf[i]->polys;
float* vert = pPoly->verts[0];

// find the normal map corresponding to this surface's texture (use the flat map if there isn't one)
texID = m_aNormalMaps.find(pSurf[i]->texinfo->texture->gl_texturenum);
if (CVAR_GET_FLOAT("bm_allflat") == 1 || texID == m_aNormalMaps.end())
glBindTexture(GL_TEXTURE_2D, m_uiFlatSurfaceNorm);
else
glBindTexture(GL_TEXTURE_2D, texID->second);

// tangent and binormal simply come from the UV vectors
T = pSurf[i]->texinfo->vecs[0];
B = pSurf[i]->texinfo->vecs[1];
T = T.Normalize();
B = B.Normalize();

// We must now calculate the normal of the surface. We can't cross-product the tangent and binormal,
// as we can't guarantee which way the normal will be facing (textures can be mirrored both ways).
// So, we must calculate it by doing the cross product of two edge vectors. However, we can't just
// choose any old edge vectors, since some turn out to be colinear, which gives bogus normals.
// The solution is to go through each vertex until we find two edge vectors that aren't colinear.

V1 = Vector(vert[0], vert[1], vert[2]);
V2 = Vector(vert[VERTEXSIZE], vert[VERTEXSIZE+1], vert[VERTEXSIZE+2]);

E1 = (V1 - V2).Normalize();

bool bFound = false;

for (int j = 2; j < pPoly->numverts; j++)
{
V3 = Vector(vert[VERTEXSIZE*j], vert[VERTEXSIZE*j + 1], vert[VERTEXSIZE*j + 2]);

E2 = (V1 - V3).Normalize();

if (fabs(fabs(DotProduct(E1, E2))-1) > 0.01f) // vectors aren't colinear (dp 1 = equal, dp -1 = opposite) - check for > epsilon to account for FP error
{
N = -1 * CrossProduct(E1, E2).Normalize(); // we can use these edge vectors to calculate the normal
bFound = true;
break;
}
}

if (!bFound)
N = -1 * CrossProduct(E1, (V1 - Vector(vert + VERTEXSIZE*2)).Normalize()).Normalize();

// render this surface

glBegin(GL_POLYGON);

for (int v = 0; v < pPoly->numverts; v++, vert+=VERTEXSIZE)
{
// Since we can't use a vertex program, we have to calculate the light vector here. We first
// calculate the light vector in world space, and then transform it into tangent space
// by doing the equivalent of multiplying it by the TBN matrix, and finally scale it into the range [0,1].
V = Vector(vert);
L = pLight->pos - V;
L2.x = DotProduct(T, L)*0.5 + 0.5;
L2.y = -DotProduct(B, L)*0.5 + 0.5; // for some reason, the y component of the light vector must be flipped - probably a by-product of the normal maps being flipped on loading
L2.z = DotProduct(N, L)*0.5 + 0.5;

// We also have to calculate the coordinates in the attenuation texture
AttenCoords = (L / (pLight->radius * 2)) + Vector(0.5,0.5,0.5);

// send the data to OGL
glTexCoord2f(vert[3], 1 - vert[4]); // the normal maps get flipped on loading, for some reason - reverse that here
glMultiTexCoord3fvARB(GL_TEXTURE1_ARB, L2);
glMultiTexCoord3fvARB(GL_TEXTURE2_ARB, AttenCoords);
glVertex3fv(vert);
}

glEnd();
}

// set the negative visframe to say we've rendered this surface
if (pSurf[i]->visframe > 0)
pSurf[i]->visframe = -pSurf[i]->visframe;
}

// go back and make all visframes positive again, so that HL can render the map properly
for (i = 0; i < pWorld->nummarksurfaces; i++)
{
if (pSurf[i]->visframe < 0)
pSurf[i]->visframe = -pSurf[i]->visframe;
}

glActiveTextureARB(GL_TEXTURE2_ARB);
glDisable(GL_TEXTURE_3D_EXT);

glActiveTextureARB(GL_TEXTURE0_ARB);
}

als ich disses stück entfert hatte war der fehler weg. waren nur 39 "Nichtaufgeloestes externes Symbol" ist aber klar da es gefehlt hat.
kann mir bitte jemand sagen was ich noch ändern muss... :)
____________________________________
15.06.2006, 00:14 Uhr Anzeigen
# 5
Koraktor  (39)
HLP - Redakteur
Nachricht offline Moderator
Voltigore
21.228 Punkte
Dabei seit: 10.08.2004
5.393 Beiträge
Kannst du vielleicht genau angeben an welcher Stelle der Fehler auftritt.
Ich tippe jetzt mal ganz grob auf:

pPoly = pSurf[i]->polys;

Das heißt, dass der Typ von pSurf[i]->poly Integer ist und den kann man nicht einfach in ein struct "umschreiben". Am besten schaust du dir auch die Definition von msurface_t noch genauer an.
____________________________________
15.06.2006, 02:18 Uhr Anzeigen
# 6
Godkiller_NT  (36)
Nachricht offline
Thread-Starter
Headcrab
0 Punkte
Dabei seit: 28.11.2005
123 Beiträge
Ich glabe da ist etwas schief gegangen! sehe bild im anhang!
Der hat alles ohne probleme compilet :confused:
Anhang: mp10000.jpg (169 KB, 18x heruntergeladen)
____________________________________
15.06.2006, 13:11 Uhr Anzeigen
# 7
e-freak  (114)
HLP - Ehrenmember
Nachricht offline Moderator
Ichthyosaur
11.284 Punkte
Dabei seit: 19.11.2004
2.378 Beiträge
Du hast ausversehen HDR programmiert :P

im ernst: das sieht nach einer falschen berechnung aus, aber vll liegts auch an der map
____________________________________
iGude
15.06.2006, 13:22 Uhr Anzeigen
# 8
Godkiller_NT  (36)
Nachricht offline
Thread-Starter
Headcrab
0 Punkte
Dabei seit: 28.11.2005
123 Beiträge
Hmm.. die map ist inordnung auserdem sind alle licht effekte weg.
Muss an der Progamierung liegen in HDR progammiert! lol! :eek: war mir garnicht bewust...
____________________________________
15.06.2006, 13:26 Uhr Anzeigen
# 9
Godkiller_NT  (36)
Nachricht offline
Thread-Starter
Headcrab
0 Punkte
Dabei seit: 28.11.2005
123 Beiträge
OK! das HDR hatte sich mit der hw.dll reingeschmugelt aber trotzdem ist alle hinne "bild"
Ach und das HL Bitmapping funktoniert auch nicht richtig aber die funken wenn man auf denn boden schiest sind toll! wie bekomme ich das jezt hinn?
Anhang: b0000.jpg (184 KB, 20x heruntergeladen)
____________________________________
15.06.2006, 13:42 Uhr Anzeigen
# 10
e-freak  (114)
HLP - Ehrenmember
Nachricht offline Moderator
Ichthyosaur
11.284 Punkte
Dabei seit: 19.11.2004
2.378 Beiträge
öhm das mit hdr war nen scherz - also wenn du das reingemacht hast - vll sind die inkompatibel aber hast du denn explizit hdr rein gemacht?
____________________________________
iGude
15.06.2006, 14:03 Uhr Anzeigen
# 11
Godkiller_NT  (36)
Nachricht offline
Thread-Starter
Headcrab
0 Punkte
Dabei seit: 28.11.2005
123 Beiträge
explizit hdr?

Ich habe das auch mit dem 2.3 SDK ausprobiert wo für das gemacht ist aber ich versuche es auf Spirit of HL zu übertragen..
____________________________________
[Beitrag wurde 2x editiert, zuletzt von Godkiller_NT am 15.06.2006, 14:28]
15.06.2006, 14:22 Uhr Anzeigen
# 12
e-freak  (114)
HLP - Ehrenmember
Nachricht offline Moderator
Ichthyosaur
11.284 Punkte
Dabei seit: 19.11.2004
2.378 Beiträge
alsooo

das bild wos geklappt hat war so sau hell, gell? ich hab also (aus scherz) gefragt ob du hdr hast

dadrunter stand dann ja auch:

im ernst: das sieht nach einer falschen berechnung aus, aber vll liegts auch an der map
____________________________________
iGude
15.06.2006, 14:38 Uhr Anzeigen
# 13
Godkiller_NT  (36)
Nachricht offline
Thread-Starter
Headcrab
0 Punkte
Dabei seit: 28.11.2005
123 Beiträge
achso! trotzem sind alle lichter weg! die vorher da waren!
____________________________________
15.06.2006, 15:29 Uhr Anzeigen
nach oben
13 Beiträge

Seiten (1):  [1]


Gehe zu:  feed_mini Beiträge: RSS, RSS2, ATOM

Sections:  HLP  Board  Mods  Steam      Games:  HL  Op4  HLBS  HL2  HL2:Ep1  HL2:Ep2  Prtl  TF2  TFC  CS  DoD  L4D  Gunman
    USER ONLINE 
Insgesamt sind 36 Benutzer online. Davon sind 0 registriert:
    SITE OPTIONS 
- Zu Favoriten hinzufügen
- Als Startseite festlegen (IE only)
- Fehler auf dieser Seite?